diff --git "a/server.js" "b/server.js" --- "a/server.js" +++ "b/server.js" @@ -1,3 +1,4 @@ +"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -25,9 +26,9 @@ var __export = (target, all) => { }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { - for (let key2 of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key2) && key2 !== except) - __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); + 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; }; @@ -67,8 +68,8 @@ var require_depd = __commonJS({ } return false; } - function convertDataDescriptorToAccessor(obj, prop2, message) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop2); + function convertDataDescriptorToAccessor(obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); var value = descriptor.value; descriptor.get = function getter() { return value; @@ -80,7 +81,7 @@ var require_depd = __commonJS({ } delete descriptor.value; delete descriptor.writable; - Object.defineProperty(obj, prop2, descriptor); + Object.defineProperty(obj, prop, descriptor); return descriptor; } function createArgumentsString(arity) { @@ -171,11 +172,11 @@ var require_depd = __commonJS({ break; } } - var key2 = caller ? depSite.join(":") + "__" + caller.join(":") : void 0; - if (key2 !== void 0 && key2 in this._warned) { + var key = caller ? depSite.join(":") + "__" + caller.join(":") : void 0; + if (key !== void 0 && key in this._warned) { return; } - this._warned[key2] = true; + this._warned[key] = true; var msg = message; if (!msg) { msg = callSite === depSite || !callSite.name ? defaultMessage(depSite) : defaultMessage(callSite); @@ -280,11 +281,11 @@ var require_depd = __commonJS({ )(fn, log, this, message, site); return deprecatedfn; } - function wrapproperty(obj, prop2, message) { + function wrapproperty(obj, prop, message) { if (!obj || typeof obj !== "object" && typeof obj !== "function") { throw new TypeError("argument obj must be object"); } - var descriptor = Object.getOwnPropertyDescriptor(obj, prop2); + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); if (!descriptor) { throw new TypeError("must call property on owner object"); } @@ -294,9 +295,9 @@ var require_depd = __commonJS({ var deprecate = this; var stack = getStack(); var site = callSiteLocation(stack[1]); - site.name = prop2; + site.name = prop; if ("value" in descriptor) { - descriptor = convertDataDescriptorToAccessor(obj, prop2, message); + descriptor = convertDataDescriptorToAccessor(obj, prop, message); } var get = descriptor.get; var set = descriptor.set; @@ -312,7 +313,7 @@ var require_depd = __commonJS({ return set.apply(this, arguments); }; } - Object.defineProperty(obj, prop2, descriptor); + Object.defineProperty(obj, prop, descriptor); } function DeprecationError(namespace, message, stack) { var error = new Error(); @@ -363,7 +364,7 @@ var require_bytes = __commonJS({ init_define_import_meta_env(); module2.exports = bytes; module2.exports.format = format; - module2.exports.parse = parse5; + module2.exports.parse = parse3; var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; var map = { @@ -377,7 +378,7 @@ var require_bytes = __commonJS({ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; function bytes(value, options) { if (typeof value === "string") { - return parse5(value); + return parse3(value); } if (typeof value === "number") { return format(value, options); @@ -421,7 +422,7 @@ var require_bytes = __commonJS({ } return str + unitSeparator + unit; } - function parse5(val) { + function parse3(val) { if (typeof val === "number" && !isNaN(val)) { return val; } @@ -458,7 +459,7 @@ var require_content_type = __commonJS({ var QUOTE_REGEXP = /([\\"])/g; var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; exports2.format = format; - exports2.parse = parse5; + exports2.parse = parse3; function format(obj) { if (!obj || typeof obj !== "object") { throw new TypeError("argument obj is required"); @@ -482,7 +483,7 @@ var require_content_type = __commonJS({ } return string; } - function parse5(string) { + function parse3(string) { if (!string) { throw new TypeError("argument string is required"); } @@ -497,7 +498,7 @@ var require_content_type = __commonJS({ } var obj = new ContentType(type.toLowerCase()); if (index2 !== -1) { - var key2; + var key; var match; var value; PARAM_REGEXP.lastIndex = index2; @@ -506,7 +507,7 @@ var require_content_type = __commonJS({ throw new TypeError("invalid parameter format"); } index2 += match[0].length; - key2 = match[1].toLowerCase(); + key = match[1].toLowerCase(); value = match[2]; if (value.charCodeAt(0) === 34) { value = value.slice(1, -1); @@ -514,7 +515,7 @@ var require_content_type = __commonJS({ value = value.replace(QESC_REGEXP, "$1"); } } - obj.parameters[key2] = value; + obj.parameters[key] = value; } if (index2 !== header.length) { throw new TypeError("invalid parameter format"); @@ -562,9 +563,9 @@ var require_setprototypeof = __commonJS({ return obj; } function mixinProperties(obj, proto) { - for (var prop2 in proto) { - if (!Object.prototype.hasOwnProperty.call(obj, prop2)) { - obj[prop2] = proto[prop2]; + for (var prop in proto) { + if (!Object.prototype.hasOwnProperty.call(obj, prop)) { + obj[prop] = proto[prop]; } } return obj; @@ -783,7 +784,7 @@ var require_http_errors = __commonJS({ "use strict"; init_define_import_meta_env(); var deprecate = require_depd()("http-errors"); - var setPrototypeOf2 = require_setprototypeof(); + var setPrototypeOf = require_setprototypeof(); var statuses = require_statuses(); var inherits = require_inherits(); var toIdentifier = require_toidentifier(); @@ -830,9 +831,9 @@ var require_http_errors = __commonJS({ err.expose = status < 500; err.status = err.statusCode = status; } - for (var key2 in props) { - if (key2 !== "status" && key2 !== "statusCode") { - err[key2] = props[key2]; + for (var key in props) { + if (key !== "status" && key !== "statusCode") { + err[key] = props[key]; } } return err; @@ -850,7 +851,7 @@ var require_http_errors = __commonJS({ var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ClientError); - setPrototypeOf2(err, ClientError.prototype); + setPrototypeOf(err, ClientError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, @@ -889,7 +890,7 @@ var require_http_errors = __commonJS({ var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ServerError); - setPrototypeOf2(err, ServerError.prototype); + setPrototypeOf(err, ServerError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, @@ -955,7 +956,7 @@ var require_ms = __commonJS({ options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { - return parse5(val); + return parse3(val); } else if (type === "number" && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } @@ -963,7 +964,7 @@ var require_ms = __commonJS({ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) ); }; - function parse5(str) { + function parse3(str) { str = String(str); if (str.length > 100) { return; @@ -1158,8 +1159,8 @@ var require_browser = __commonJS({ exports2 = module2.exports = require_debug(); exports2.log = log; exports2.formatArgs = formatArgs; - exports2.save = save; - exports2.load = load; + exports2.save = save2; + exports2.load = load2; exports2.useColors = useColors; exports2.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage(); exports2.colors = [ @@ -1207,7 +1208,7 @@ var require_browser = __commonJS({ function log() { return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } - function save(namespaces) { + function save2(namespaces) { try { if (null == namespaces) { exports2.storage.removeItem("debug"); @@ -1217,7 +1218,7 @@ var require_browser = __commonJS({ } catch (e) { } } - function load() { + function load2() { var r; try { r = exports2.storage.debug; @@ -1228,7 +1229,7 @@ var require_browser = __commonJS({ } return r; } - exports2.enable(load()); + exports2.enable(load2()); function localstorage() { try { return window.localStorage; @@ -1248,22 +1249,22 @@ var require_node = __commonJS({ exports2.init = init; exports2.log = log; exports2.formatArgs = formatArgs; - exports2.save = save; - exports2.load = load; + exports2.save = save2; + exports2.load = load2; exports2.useColors = useColors; exports2.colors = [6, 2, 3, 4, 5, 1]; - exports2.inspectOpts = Object.keys(process.env).filter(function(key2) { - return /^debug_/i.test(key2); - }).reduce(function(obj, key2) { - var prop2 = key2.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { + exports2.inspectOpts = Object.keys(process.env).filter(function(key) { + return /^debug_/i.test(key); + }).reduce(function(obj, key) { + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { return k.toUpperCase(); }); - var val = process.env[key2]; + var val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) val = true; else if (/^(no|off|false|disabled)$/i.test(val)) val = false; else if (val === "null") val = null; else val = Number(val); - obj[prop2] = val; + obj[prop] = val; return obj; }, {}); var fd = parseInt(process.env.DEBUG_FD, 10) || 2; @@ -1300,14 +1301,14 @@ var require_node = __commonJS({ function log() { return stream.write(util.format.apply(util, arguments) + "\n"); } - function save(namespaces) { + function save2(namespaces) { if (null == namespaces) { delete process.env.DEBUG; } else { process.env.DEBUG = namespaces; } } - function load() { + function load2() { return process.env.DEBUG; } function createWritableStdioStream(fd2) { @@ -1350,12 +1351,12 @@ var require_node = __commonJS({ } function init(debug) { debug.inspectOpts = {}; - var keys2 = Object.keys(exports2.inspectOpts); - for (var i = 0; i < keys2.length; i++) { - debug.inspectOpts[keys2[i]] = exports2.inspectOpts[keys2[i]]; + var keys = Object.keys(exports2.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; } } - exports2.enable(load()); + exports2.enable(load2()); } }); @@ -1403,10 +1404,10 @@ var require_destroy = __commonJS({ } function closeZlibStream(stream) { if (stream._hadError === true) { - var prop2 = stream._binding === null ? "_binding" : "_handle"; - stream[prop2] = { + var prop = stream._binding === null ? "_binding" : "_handle"; + stream[prop] = { close: function() { - this[prop2] = null; + this[prop] = null; } }; } @@ -1467,17 +1468,17 @@ var require_safer = __commonJS({ var buffer = require("buffer"); var Buffer2 = buffer.Buffer; var safer = {}; - var key2; - for (key2 in buffer) { - if (!buffer.hasOwnProperty(key2)) continue; - if (key2 === "SlowBuffer" || key2 === "Buffer") continue; - safer[key2] = buffer[key2]; + var key; + for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue; + if (key === "SlowBuffer" || key === "Buffer") continue; + safer[key] = buffer[key]; } var Safer = safer.Buffer = {}; - for (key2 in Buffer2) { - if (!Buffer2.hasOwnProperty(key2)) continue; - if (key2 === "allocUnsafe" || key2 === "allocUnsafeSlow") continue; - Safer[key2] = Buffer2[key2]; + for (key in Buffer2) { + if (!Buffer2.hasOwnProperty(key)) continue; + if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue; + Safer[key] = Buffer2[key]; } safer.Buffer.prototype = Buffer2.prototype; if (!Safer.from || Safer.from === Uint8Array.from) { @@ -4854,8 +4855,8 @@ var require_lib = __commonJS({ enc = codecDef; break; case "object": - for (var key2 in codecDef) - codecOptions[key2] = codecDef[key2]; + for (var key in codecDef) + codecOptions[key] = codecDef[key]; if (!codecOptions.encodingName) codecOptions.encodingName = enc; enc = codecDef.type; @@ -4880,7 +4881,7 @@ var require_lib = __commonJS({ encoder2 = new bomHandling.PrependBOM(encoder2, options); return encoder2; }; - iconv.getDecoder = function getDecoder2(encoding, options) { + iconv.getDecoder = function getDecoder(encoding, options) { var codec = iconv.getCodec(encoding), decoder = new codec.decoder(options, codec); if (codec.bomAware && !(options && options.stripBOM === false)) decoder = new bomHandling.StripBOM(decoder, options); @@ -4952,7 +4953,7 @@ var require_raw_body = __commonJS({ var unpipe = require_unpipe(); module2.exports = getRawBody; var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /; - function getDecoder2(encoding) { + function getDecoder(encoding) { if (!encoding) return null; try { return iconv.getDecoder(encoding); @@ -5017,8 +5018,8 @@ var require_raw_body = __commonJS({ type: "entity.too.large" })); } - var state = stream._readableState; - if (stream._decoder || state && (state.encoding || state.decoder)) { + var state2 = stream._readableState; + if (stream._decoder || state2 && (state2.encoding || state2.decoder)) { return done(createError2(500, "stream encoding should not be set", { type: "stream.encoding.set" })); @@ -5031,7 +5032,7 @@ var require_raw_body = __commonJS({ var received = 0; var decoder; try { - decoder = getDecoder2(encoding); + decoder = getDecoder(encoding); } catch (err) { return done(err); } @@ -8456,8 +8457,8 @@ var require_lib2 = __commonJS({ enc = codecDef; break; case "object": - for (var key2 in codecDef) - codecOptions[key2] = codecDef[key2]; + for (var key in codecDef) + codecOptions[key] = codecDef[key]; if (!codecOptions.encodingName) codecOptions.encodingName = enc; enc = codecDef.type; @@ -8482,7 +8483,7 @@ var require_lib2 = __commonJS({ encoder2 = new bomHandling.PrependBOM(encoder2, options); return encoder2; }; - iconv.getDecoder = function getDecoder2(encoding, options) { + iconv.getDecoder = function getDecoder(encoding, options) { var codec = iconv.getCodec(encoding), decoder = new codec.decoder(options, codec); if (codec.bomAware && !(options && options.stripBOM === false)) decoder = new bomHandling.StripBOM(decoder, options); @@ -8678,7 +8679,7 @@ var require_read = __commonJS({ var unpipe = require_unpipe(); var zlib = require("zlib"); module2.exports = read; - function read(req, res, next, parse5, debug, options) { + function read(req, res, next, parse3, debug, options) { var length; var opts = options; var stream; @@ -8716,7 +8717,7 @@ var require_read = __commonJS({ unpipe(req); destroy(stream, true); } - dump2(req, function onfinished() { + dump(req, function onfinished() { next(createError2(400, _error)); }); return; @@ -8737,7 +8738,7 @@ var require_read = __commonJS({ try { debug("parse body"); str = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body; - req.body = parse5(str); + req.body = parse3(str); } catch (err) { next(createError2(400, err, { body: str, @@ -8782,7 +8783,7 @@ var require_read = __commonJS({ } return stream; } - function dump2(req, callback) { + function dump(req, callback) { if (onFinished.isFinished(req)) { callback(null); } else { @@ -8806,7 +8807,7 @@ var require_media_typer = __commonJS({ var typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/; var typeRegExp = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/; exports2.format = format; - exports2.parse = parse5; + exports2.parse = parse3; function format(obj) { if (!obj || typeof obj !== "object") { throw new TypeError("argument obj is required"); @@ -8841,7 +8842,7 @@ var require_media_typer = __commonJS({ } return string; } - function parse5(string) { + function parse3(string) { if (!string) { throw new TypeError("argument string is required"); } @@ -8853,7 +8854,7 @@ var require_media_typer = __commonJS({ } var index2 = string.indexOf(";"); var type = index2 !== -1 ? string.substr(0, index2) : string; - var key2; + var key; var match; var obj = splitType(type); var params = {}; @@ -8864,12 +8865,12 @@ var require_media_typer = __commonJS({ throw new TypeError("invalid parameter format"); } index2 += match[0].length; - key2 = match[1].toLowerCase(); + key = match[1].toLowerCase(); value = match[2]; if (value[0] === '"') { value = value.substr(1, value.length - 2).replace(qescRegExp, "$1"); } - params[key2] = value; + params[key] = value; } if (index2 !== -1 && index2 !== string.length) { throw new TypeError("invalid parameter format"); @@ -17678,7 +17679,7 @@ var require_json = __commonJS({ throw new TypeError("option verify must be function"); } var shouldParse = typeof type !== "function" ? typeChecker(type) : type; - function parse5(body) { + function parse3(body) { if (body.length === 0) { return {}; } @@ -17726,7 +17727,7 @@ var require_json = __commonJS({ })); return; } - read(req, res, next, parse5, debug, { + read(req, res, next, parse3, debug, { encoding: charset, inflate, limit, @@ -17764,11 +17765,11 @@ var require_json = __commonJS({ } } function normalizeJsonSyntaxError(error, obj) { - var keys2 = Object.getOwnPropertyNames(error); - for (var i = 0; i < keys2.length; i++) { - var key2 = keys2[i]; - if (key2 !== "stack" && key2 !== "message") { - delete error[key2]; + var keys = Object.getOwnPropertyNames(error); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key !== "stack" && key !== "message") { + delete error[key]; } } error.stack = obj.stack.replace(error.message, obj.message); @@ -17806,7 +17807,7 @@ var require_raw = __commonJS({ throw new TypeError("option verify must be function"); } var shouldParse = typeof type !== "function" ? typeChecker(type) : type; - function parse5(buf) { + function parse3(buf) { return buf; } return function rawParser(req, res, next) { @@ -17827,7 +17828,7 @@ var require_raw = __commonJS({ next(); return; } - read(req, res, next, parse5, debug, { + read(req, res, next, parse3, debug, { encoding: null, inflate, limit, @@ -17868,7 +17869,7 @@ var require_text = __commonJS({ throw new TypeError("option verify must be function"); } var shouldParse = typeof type !== "function" ? typeChecker(type) : type; - function parse5(buf) { + function parse3(buf) { return buf; } return function textParser(req, res, next) { @@ -17890,7 +17891,7 @@ var require_text = __commonJS({ return; } var charset = getCharset(req) || defaultCharset; - read(req, res, next, parse5, debug, { + read(req, res, next, parse3, debug, { encoding: charset, inflate, limit, @@ -18045,7 +18046,7 @@ var require_object_inspect = __commonJS({ depth = 0; } if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") { - return isArray2(obj) ? "[Array]" : "[Object]"; + return isArray(obj) ? "[Array]" : "[Object]"; } var indent = getIndent(opts, depth); if (typeof seen === "undefined") { @@ -18071,8 +18072,8 @@ var require_object_inspect = __commonJS({ } if (typeof obj === "function" && !isRegExp(obj)) { var name = nameOf(obj); - var keys2 = arrObjKeys(obj, inspect); - return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys2.length > 0 ? " { " + $join.call(keys2, ", ") + " }" : ""); + var keys = arrObjKeys(obj, inspect); + return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : ""); } if (isSymbol(obj)) { var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj); @@ -18091,7 +18092,7 @@ var require_object_inspect = __commonJS({ s += ""; return s; } - if (isArray2(obj)) { + if (isArray(obj)) { if (obj.length === 0) { return "[]"; } @@ -18121,8 +18122,8 @@ var require_object_inspect = __commonJS({ if (isMap(obj)) { var mapParts = []; if (mapForEach) { - mapForEach.call(obj, function(value, key2) { - mapParts.push(inspect(key2, obj, true) + " => " + inspect(value, obj)); + mapForEach.call(obj, function(value, key) { + mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj)); }); } return collectionOf("Map", mapSize.call(obj), mapParts, indent); @@ -18145,7 +18146,7 @@ var require_object_inspect = __commonJS({ if (isWeakRef(obj)) { return weakCollectionOf("WeakRef"); } - if (isNumber3(obj)) { + if (isNumber(obj)) { return markBoxed(inspect(Number(obj))); } if (isBigInt(obj)) { @@ -18191,7 +18192,7 @@ var require_object_inspect = __commonJS({ function canTrustToString(obj) { return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined")); } - function isArray2(obj) { + function isArray(obj) { return toStr(obj) === "[object Array]" && canTrustToString(obj); } function isDate(obj) { @@ -18206,7 +18207,7 @@ var require_object_inspect = __commonJS({ function isString(obj) { return toStr(obj) === "[object String]" && canTrustToString(obj); } - function isNumber3(obj) { + function isNumber(obj) { return toStr(obj) === "[object Number]" && canTrustToString(obj); } function isBoolean(obj) { @@ -18240,11 +18241,11 @@ var require_object_inspect = __commonJS({ } return false; } - var hasOwn = Object.prototype.hasOwnProperty || function(key2) { - return key2 in this; + var hasOwn = Object.prototype.hasOwnProperty || function(key) { + return key in this; }; - function has(obj, key2) { - return hasOwn.call(obj, key2); + function has(obj, key) { + return hasOwn.call(obj, key); } function toStr(obj) { return objectToString.call(obj); @@ -18385,8 +18386,8 @@ var require_object_inspect = __commonJS({ function weakCollectionOf(type) { return type + " { ? }"; } - function collectionOf(type, size, entries2, indent) { - var joinedEntries = indent ? indentedJoin(entries2, indent) : $join.call(entries2, ", "); + function collectionOf(type, size, entries, indent) { + var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ", "); return type + " (" + size + ") {" + joinedEntries + "}"; } function singleLineValues(xs) { @@ -18419,7 +18420,7 @@ var require_object_inspect = __commonJS({ return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent.prev; } function arrObjKeys(obj, inspect) { - var isArr = isArray2(obj); + var isArr = isArray(obj); var xs = []; if (isArr) { xs.length = obj.length; @@ -18435,19 +18436,19 @@ var require_object_inspect = __commonJS({ symMap["$" + syms[k]] = syms[k]; } } - for (var key2 in obj) { - if (!has(obj, key2)) { + for (var key in obj) { + if (!has(obj, key)) { continue; } - if (isArr && String(Number(key2)) === key2 && key2 < obj.length) { + if (isArr && String(Number(key)) === key && key < obj.length) { continue; } - if (hasShammedSymbols && symMap["$" + key2] instanceof Symbol) { + if (hasShammedSymbols && symMap["$" + key] instanceof Symbol) { continue; - } else if ($test.call(/[^\w$]/, key2)) { - xs.push(inspect(key2, obj) + ": " + inspect(obj[key2], obj)); + } else if ($test.call(/[^\w$]/, key)) { + xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj)); } else { - xs.push(key2 + ": " + inspect(obj[key2], obj)); + xs.push(key + ": " + inspect(obj[key], obj)); } } if (typeof gOPS === "function") { @@ -18469,11 +18470,11 @@ var require_side_channel_list = __commonJS({ init_define_import_meta_env(); var inspect = require_object_inspect(); var $TypeError = require_type(); - var listGetNode = function(list, key2, isDelete) { + var listGetNode = function(list, key, isDelete) { var prev = list; var curr; for (; (curr = prev.next) != null; prev = curr) { - if (curr.key === key2) { + if (curr.key === key) { prev.next = curr.next; if (!isDelete) { curr.next = /** @type {NonNullable} */ @@ -18484,60 +18485,60 @@ var require_side_channel_list = __commonJS({ } } }; - var listGet = function(objects, key2) { + var listGet = function(objects, key) { if (!objects) { return void 0; } - var node = listGetNode(objects, key2); + var node = listGetNode(objects, key); return node && node.value; }; - var listSet = function(objects, key2, value) { - var node = listGetNode(objects, key2); + var listSet = function(objects, key, value) { + var node = listGetNode(objects, key); if (node) { node.value = value; } else { objects.next = /** @type {import('./list.d.ts').ListNode} */ { // eslint-disable-line no-param-reassign, no-extra-parens - key: key2, + key, next: objects.next, value }; } }; - var listHas = function(objects, key2) { + var listHas = function(objects, key) { if (!objects) { return false; } - return !!listGetNode(objects, key2); + return !!listGetNode(objects, key); }; - var listDelete = function(objects, key2) { + var listDelete = function(objects, key) { if (objects) { - return listGetNode(objects, key2, true); + return listGetNode(objects, key, true); } }; module2.exports = function getSideChannelList() { var $o; var channel = { - assert: function(key2) { - if (!channel.has(key2)) { - throw new $TypeError("Side channel does not contain " + inspect(key2)); + assert: function(key) { + if (!channel.has(key)) { + throw new $TypeError("Side channel does not contain " + inspect(key)); } }, - "delete": function(key2) { - var deletedNode = listDelete($o, key2); + "delete": function(key) { + var deletedNode = listDelete($o, key); if (deletedNode && $o && !$o.next) { $o = void 0; } return !!deletedNode; }, - get: function(key2) { - return listGet($o, key2); + get: function(key) { + return listGet($o, key); }, - has: function(key2) { - return listHas($o, key2); + has: function(key) { + return listHas($o, key); }, - set: function(key2, value) { + set: function(key, value) { if (!$o) { $o = { next: void 0 @@ -18546,7 +18547,7 @@ var require_side_channel_list = __commonJS({ listSet( /** @type {NonNullable} */ $o, - key2, + key, value ); } @@ -19427,14 +19428,14 @@ var require_side_channel_map = __commonJS({ function getSideChannelMap() { var $m; var channel = { - assert: function(key2) { - if (!channel.has(key2)) { - throw new $TypeError("Side channel does not contain " + inspect(key2)); + assert: function(key) { + if (!channel.has(key)) { + throw new $TypeError("Side channel does not contain " + inspect(key)); } }, - "delete": function(key2) { + "delete": function(key) { if ($m) { - var result = $mapDelete($m, key2); + var result = $mapDelete($m, key); if ($mapSize($m) === 0) { $m = void 0; } @@ -19442,22 +19443,22 @@ var require_side_channel_map = __commonJS({ } return false; }, - get: function(key2) { + get: function(key) { if ($m) { - return $mapGet($m, key2); + return $mapGet($m, key); } }, - has: function(key2) { + has: function(key) { if ($m) { - return $mapHas($m, key2); + return $mapHas($m, key); } return false; }, - set: function(key2, value) { + set: function(key, value) { if (!$m) { $m = new $Map(); } - $mapSet($m, key2, value); + $mapSet($m, key, value); } }; return channel; @@ -19486,50 +19487,50 @@ var require_side_channel_weakmap = __commonJS({ var $wm; var $m; var channel = { - assert: function(key2) { - if (!channel.has(key2)) { - throw new $TypeError("Side channel does not contain " + inspect(key2)); + assert: function(key) { + if (!channel.has(key)) { + throw new $TypeError("Side channel does not contain " + inspect(key)); } }, - "delete": function(key2) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { + "delete": function(key) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { if ($wm) { - return $weakMapDelete($wm, key2); + return $weakMapDelete($wm, key); } } else if (getSideChannelMap) { if ($m) { - return $m["delete"](key2); + return $m["delete"](key); } } return false; }, - get: function(key2) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { + get: function(key) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { if ($wm) { - return $weakMapGet($wm, key2); + return $weakMapGet($wm, key); } } - return $m && $m.get(key2); + return $m && $m.get(key); }, - has: function(key2) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { + has: function(key) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { if ($wm) { - return $weakMapHas($wm, key2); + return $weakMapHas($wm, key); } } - return !!$m && $m.has(key2); + return !!$m && $m.has(key); }, - set: function(key2, value) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { + set: function(key, value) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { if (!$wm) { $wm = new $WeakMap(); } - $weakMapSet($wm, key2, value); + $weakMapSet($wm, key, value); } else if (getSideChannelMap) { if (!$m) { $m = getSideChannelMap(); } - $m.set(key2, value); + $m.set(key, value); } } }; @@ -19553,26 +19554,26 @@ var require_side_channel = __commonJS({ module2.exports = function getSideChannel() { var $channelData; var channel = { - assert: function(key2) { - if (!channel.has(key2)) { - var keyDesc = key2 && Object(key2) === key2 ? "the given object key" : inspect(key2); + assert: function(key) { + if (!channel.has(key)) { + var keyDesc = key && Object(key) === key ? "the given object key" : inspect(key); throw new $TypeError("Side channel does not contain " + keyDesc); } }, - "delete": function(key2) { - return !!$channelData && $channelData["delete"](key2); + "delete": function(key) { + return !!$channelData && $channelData["delete"](key); }, - get: function(key2) { - return $channelData && $channelData.get(key2); + get: function(key) { + return $channelData && $channelData.get(key); }, - has: function(key2) { - return !!$channelData && $channelData.has(key2); + has: function(key) { + return !!$channelData && $channelData.has(key); }, - set: function(key2, value) { + set: function(key, value) { if (!$channelData) { $channelData = makeChannel(); } - $channelData.set(key2, value); + $channelData.set(key, value); } }; return channel; @@ -19585,7 +19586,7 @@ var require_formats = __commonJS({ "../backend/node_modules/body-parser/node_modules/qs/lib/formats.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var replace2 = String.prototype.replace; + var replace = String.prototype.replace; var percentTwenties = /%20/g; var Format = { RFC1738: "RFC1738", @@ -19595,7 +19596,7 @@ var require_formats = __commonJS({ "default": Format.RFC3986, formatters: { RFC1738: function(value) { - return replace2.call(value, percentTwenties, "+"); + return replace.call(value, percentTwenties, "+"); }, RFC3986: function(value) { return String(value); @@ -19616,7 +19617,7 @@ var require_utils = __commonJS({ var getSideChannel = require_side_channel(); var defineProperty = require_es_define_property(); var has = Object.prototype.hasOwnProperty; - var isArray2 = Array.isArray; + var isArray = Array.isArray; var overflowChannel = getSideChannel(); var markOverflow = function markOverflow2(obj, maxIndex) { overflowChannel.set(obj, maxIndex); @@ -19642,7 +19643,7 @@ var require_utils = __commonJS({ while (queue.length > 1) { var item = queue.pop(); var obj = item.obj[item.prop]; - if (isArray2(obj)) { + if (isArray(obj)) { var compacted = []; for (var j = 0; j < obj.length; ++j) { if (typeof obj[j] !== "undefined") { @@ -19662,16 +19663,16 @@ var require_utils = __commonJS({ } return obj; }; - var setProperty = function setProperty2(obj, key2, value) { - if (key2 === "__proto__" && defineProperty) { - defineProperty(obj, key2, { + var setProperty = function setProperty2(obj, key, value) { + if (key === "__proto__" && defineProperty) { + defineProperty(obj, key, { configurable: true, enumerable: true, value, writable: true }); } else { - obj[key2] = value; + obj[key] = value; } }; var merge = function merge2(target, source, options) { @@ -19679,7 +19680,7 @@ var require_utils = __commonJS({ return target; } if (typeof source !== "object" && typeof source !== "function") { - if (isArray2(target)) { + if (isArray(target)) { var nextIndex = target.length; if (options && typeof options.arrayLimit === "number" && nextIndex >= options.arrayLimit) { if (options.throwOnLimitExceeded) { @@ -19723,10 +19724,10 @@ var require_utils = __commonJS({ return combined; } var mergeTarget = target; - if (isArray2(target) && !isArray2(source)) { + if (isArray(target) && !isArray(source)) { mergeTarget = arrayToObject(target, options); } - if (isArray2(target) && isArray2(source)) { + if (isArray(target) && isArray(source)) { source.forEach(function(item, i) { if (has.call(target, i)) { var targetItem = target[i]; @@ -19747,28 +19748,28 @@ var require_utils = __commonJS({ } return target; } - return Object.keys(source).reduce(function(acc, key2) { - var value = source[key2]; - if (has.call(acc, key2)) { - setProperty(acc, key2, merge2(acc[key2], value, options)); + return Object.keys(source).reduce(function(acc, key) { + var value = source[key]; + if (has.call(acc, key)) { + setProperty(acc, key, merge2(acc[key], value, options)); } else { - setProperty(acc, key2, value); + setProperty(acc, key, value); } if (isOverflow(source) && !isOverflow(acc)) { markOverflow(acc, getMaxIndex(source)); } if (isOverflow(acc)) { - var keyNum = parseInt(key2, 10); - if (String(keyNum) === key2 && keyNum >= 0 && keyNum > getMaxIndex(acc)) { + var keyNum = parseInt(key, 10); + if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) { setMaxIndex(acc, keyNum); } } return acc; }, mergeTarget); }; - var assign2 = function assignSingleSource(target, source) { - return Object.keys(source).reduce(function(acc, key2) { - setProperty(acc, key2, source[key2]); + var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function(acc, key) { + setProperty(acc, key, source[key]); return acc; }, target); }; @@ -19838,17 +19839,17 @@ var require_utils = __commonJS({ }; var compact = function compact2(value) { var queue = [{ obj: { o: value }, prop: "o" }]; - var refs3 = getSideChannel(); + var refs = getSideChannel(); for (var i = 0; i < queue.length; ++i) { var item = queue[i]; var obj = item.obj[item.prop]; - var keys2 = Object.keys(obj); - for (var j = 0; j < keys2.length; ++j) { - var key2 = keys2[j]; - var val = obj[key2]; - if (typeof val === "object" && val !== null && !refs3.has(val)) { - queue[queue.length] = { obj, prop: key2 }; - refs3.set(val, true); + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === "object" && val !== null && !refs.has(val)) { + queue[queue.length] = { obj, prop: key }; + refs.set(val, true); } } } @@ -19869,7 +19870,7 @@ var require_utils = __commonJS({ if (throwOnLimitExceeded) { throw new RangeError("Array limit exceeded. Only " + arrayLimit + " element" + (arrayLimit === 1 ? "" : "s") + " allowed in an array."); } - var bValues = isArray2(b) ? b : [b]; + var bValues = isArray(b) ? b : [b]; var newIndex = getMaxIndex(a); for (var i = 0; i < bValues.length; ++i) { newIndex += 1; @@ -19888,7 +19889,7 @@ var require_utils = __commonJS({ return result; }; var maybeMap = function maybeMap2(val, fn) { - if (isArray2(val)) { + if (isArray(val)) { var mapped = []; for (var i = 0; i < val.length; i += 1) { mapped[mapped.length] = fn(val[i]); @@ -19899,7 +19900,7 @@ var require_utils = __commonJS({ }; module2.exports = { arrayToObject, - assign: assign2, + assign, combine, compact, decode, @@ -19928,17 +19929,17 @@ var require_stringify = __commonJS({ return prefix + "[]"; }, comma: "comma", - indices: function indices(prefix, key2) { - return prefix + "[" + key2 + "]"; + indices: function indices(prefix, key) { + return prefix + "[" + key + "]"; }, repeat: function repeat(prefix) { return prefix; } }; - var isArray2 = Array.isArray; - var push2 = Array.prototype.push; + var isArray = Array.isArray; + var push = Array.prototype.push; var pushToArray = function(arr, valueOrArray) { - push2.apply(arr, isArray2(valueOrArray) ? valueOrArray : [valueOrArray]); + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); }; var toISO = Date.prototype.toISOString; var defaultFormat = formats["default"]; @@ -19971,7 +19972,7 @@ var require_stringify = __commonJS({ return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint"; }; var sentinel = {}; - var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter3, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel, depth, currentDepth) { + var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel, depth, currentDepth) { var obj = object; if (currentDepth > depth) { throw new RangeError("Input depth exceeded depth option of " + depth); @@ -19993,10 +19994,10 @@ var require_stringify = __commonJS({ step = 0; } } - obj = typeof filter3 === "function" ? filter3(prefix, obj) : obj; + obj = typeof filter2 === "function" ? filter2(prefix, obj) : obj; if (obj instanceof Date) { obj = serializeDate(obj); - } else if (generateArrayPrefix === "comma" && isArray2(obj)) { + } else if (generateArrayPrefix === "comma" && isArray(obj)) { obj = utils.maybeMap(obj, function(value2) { if (value2 instanceof Date) { return serializeDate(value2); @@ -20022,32 +20023,32 @@ var require_stringify = __commonJS({ return values; } var objKeys; - if (generateArrayPrefix === "comma" && isArray2(obj)) { + if (generateArrayPrefix === "comma" && isArray(obj)) { if (encodeValuesOnly && encoder2) { obj = utils.maybeMap(obj, function(v) { return v == null ? v : encoder2(v); }); } objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }]; - } else if (isArray2(filter3)) { - objKeys = filter3; + } else if (isArray(filter2)) { + objKeys = filter2; } else { - var keys2 = Object.keys(obj); - objKeys = sort ? keys2.sort(sort) : keys2; + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; } var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix); - var adjustedPrefix = commaRoundTrip && isArray2(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; - if (allowEmptyArrays && isArray2(obj) && obj.length === 0 && Object.keys(obj).length === 0) { + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; + if (allowEmptyArrays && isArray(obj) && obj.length === 0 && Object.keys(obj).length === 0) { return adjustedPrefix + "[]"; } for (var j = 0; j < objKeys.length; ++j) { - var key2 = objKeys[j]; - var value = typeof key2 === "object" && key2 && typeof key2.value !== "undefined" ? key2.value : obj[key2]; + var key = objKeys[j]; + var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key]; if (skipNulls && value === null) { continue; } - var encodedKey = allowDots && encodeDotInKeys ? String(key2).replace(/\./g, "%2E") : String(key2); - var keyPrefix = isArray2(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); + var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key); + var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); sideChannel.set(object, step); var valueSideChannel = getSideChannel(); valueSideChannel.set(sentinel, sideChannel); @@ -20060,8 +20061,8 @@ var require_stringify = __commonJS({ strictNullHandling, skipNulls, encodeDotInKeys, - generateArrayPrefix === "comma" && encodeValuesOnly && isArray2(obj) ? null : encoder2, - filter3, + generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder2, + filter2, sort, allowDots, serializeDate, @@ -20101,9 +20102,9 @@ var require_stringify = __commonJS({ format = opts.format; } var formatter = formats.formatters[format]; - var filter3 = defaults.filter; - if (typeof opts.filter === "function" || isArray2(opts.filter)) { - filter3 = opts.filter; + var filter2 = defaults.filter; + if (typeof opts.filter === "function" || isArray(opts.filter)) { + filter2 = opts.filter; } var arrayFormat; if (opts.arrayFormat in arrayPrefixGenerators) { @@ -20131,7 +20132,7 @@ var require_stringify = __commonJS({ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys, encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder, encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter: filter3, + filter: filter2, format, formatter, serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate, @@ -20144,15 +20145,15 @@ var require_stringify = __commonJS({ var obj = object; var options = normalizeStringifyOptions(opts); var objKeys; - var filter3; + var filter2; if (typeof options.filter === "function") { - filter3 = options.filter; - obj = filter3("", obj); - } else if (isArray2(options.filter)) { - filter3 = options.filter; - objKeys = filter3; + filter2 = options.filter; + obj = filter2("", obj); + } else if (isArray(options.filter)) { + filter2 = options.filter; + objKeys = filter2; } - var keys2 = []; + var keys = []; if (typeof obj !== "object" || obj === null) { return ""; } @@ -20166,16 +20167,16 @@ var require_stringify = __commonJS({ } var sideChannel = getSideChannel(); for (var i = 0; i < objKeys.length; ++i) { - var key2 = objKeys[i]; - if (typeof key2 === "undefined" || key2 === null) { + var key = objKeys[i]; + if (typeof key === "undefined" || key === null) { continue; } - var value = obj[key2]; + var value = obj[key]; if (options.skipNulls && value === null) { continue; } - var encodedKey = options.encodeDotInKeys ? String(key2).replace(/\./g, "%2E") : String(key2); - pushToArray(keys2, stringify( + var encodedKey = options.encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key); + pushToArray(keys, stringify( value, encodedKey, generateArrayPrefix, @@ -20198,7 +20199,7 @@ var require_stringify = __commonJS({ 0 )); } - var joined = keys2.join(options.delimiter); + var joined = keys.join(options.delimiter); var prefix = options.addQueryPrefix === true ? "?" : ""; if (options.charsetSentinel) { if (options.charset === "iso-8859-1") { @@ -20219,7 +20220,7 @@ var require_parse = __commonJS({ init_define_import_meta_env(); var utils = require_utils(); var has = Object.prototype.hasOwnProperty; - var isArray2 = Array.isArray; + var isArray = Array.isArray; var defaults = { allowDots: false, allowEmptyArrays: false, @@ -20306,19 +20307,19 @@ var require_parse = __commonJS({ var part = parts[i]; var bracketEqualsPos = part.indexOf("]="); var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1; - var key2; + var key; var val; if (pos === -1) { - key2 = options.decoder(part, defaults.decoder, charset, "key"); + key = options.decoder(part, defaults.decoder, charset, "key"); val = options.strictNullHandling ? null : ""; } else { - key2 = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); - if (key2 !== null) { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); + if (key !== null) { val = utils.maybeMap( parseArrayValue( part.slice(pos + 1), options, - isArray2(obj[key2]) ? obj[key2].length : 0 + isArray(obj[key]) ? obj[key].length : 0 ), function(encodedVal) { return options.decoder(encodedVal, defaults.decoder, charset, "value"); @@ -20330,23 +20331,23 @@ var require_parse = __commonJS({ val = interpretNumericEntities(String(val)); } if (part.indexOf("[]=") > -1) { - val = isArray2(val) ? [val] : val; + val = isArray(val) ? [val] : val; } - if (options.comma && isArray2(val) && val.length > options.arrayLimit) { + if (options.comma && isArray(val) && val.length > options.arrayLimit) { val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded); } - if (key2 !== null) { - var existing = has.call(obj, key2); + if (key !== null) { + var existing = has.call(obj, key); if (existing && (options.duplicates === "combine" || part.indexOf("[]=") > -1)) { - obj[key2] = utils.combine( - obj[key2], + obj[key] = utils.combine( + obj[key], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded ); } else if (!existing || options.duplicates === "last") { - obj[key2] = val; + obj[key] = val; } } } @@ -20399,18 +20400,18 @@ var require_parse = __commonJS({ return leaf; }; var splitKeyIntoSegments = function splitKeyIntoSegments2(originalKey, options) { - var key2 = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey; + var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey; if (options.depth <= 0) { - if (!options.plainObjects && has.call(Object.prototype, key2)) { + if (!options.plainObjects && has.call(Object.prototype, key)) { if (!options.allowPrototypes) { return; } } - return [key2]; + return [key]; } var segments = []; - var first = key2.indexOf("["); - var parent = first >= 0 ? key2.slice(0, first) : key2; + var first = key.indexOf("["); + var parent = first >= 0 ? key.slice(0, first) : key; if (parent) { if (!options.plainObjects && has.call(Object.prototype, parent)) { if (!options.allowPrototypes) { @@ -20419,7 +20420,7 @@ var require_parse = __commonJS({ } segments[segments.length] = parent; } - var n = key2.length; + var n = key.length; var open = first; var collected = 0; while (open >= 0 && collected < options.depth) { @@ -20427,7 +20428,7 @@ var require_parse = __commonJS({ var i = open + 1; var close = -1; while (i < n && close < 0) { - var cu = key2.charCodeAt(i); + var cu = key.charCodeAt(i); if (cu === 91) { level += 1; } else if (cu === 93) { @@ -20439,23 +20440,23 @@ var require_parse = __commonJS({ i += 1; } if (close < 0) { - segments[segments.length] = "[" + key2.slice(open) + "]"; + segments[segments.length] = "[" + key.slice(open) + "]"; return segments; } - var seg = key2.slice(open, close + 1); + var seg = key.slice(open, close + 1); var content = seg.slice(1, -1); if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) { return; } segments[segments.length] = seg; collected += 1; - open = key2.indexOf("[", close + 1); + open = key.indexOf("[", close + 1); } if (open >= 0) { if (options.strictDepth === true) { throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true"); } - segments[segments.length] = "[" + key2.slice(open) + "]"; + segments[segments.length] = "[" + key.slice(open) + "]"; } return segments; }; @@ -20463,11 +20464,11 @@ var require_parse = __commonJS({ if (!givenKey) { return; } - var keys2 = splitKeyIntoSegments(givenKey, options); - if (!keys2) { + var keys = splitKeyIntoSegments(givenKey, options); + if (!keys) { return; } - return parseObject(keys2, val, options, valuesParsed); + return parseObject(keys, val, options, valuesParsed); }; var normalizeParseOptions = function normalizeParseOptions2(opts) { if (!opts) { @@ -20527,10 +20528,10 @@ var require_parse = __commonJS({ } var tempObj = typeof str === "string" ? parseValues(str, options) : str; var obj = options.plainObjects ? { __proto__: null } : {}; - var keys2 = Object.keys(tempObj); - for (var i = 0; i < keys2.length; ++i) { - var key2 = keys2[i]; - var newObj = parseKeys(key2, tempObj[key2], options, typeof str === "string"); + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === "string"); obj = utils.merge(obj, newObj, options); } if (options.allowSparse === true) { @@ -20547,11 +20548,11 @@ var require_lib3 = __commonJS({ "use strict"; init_define_import_meta_env(); var stringify = require_stringify(); - var parse5 = require_parse(); + var parse3 = require_parse(); var formats = require_formats(); module2.exports = { formats, - parse: parse5, + parse: parse3, stringify }; } @@ -20589,7 +20590,7 @@ var require_urlencoded = __commonJS({ } var queryparse = extended ? extendedparser(opts) : simpleparser(opts); var shouldParse = typeof type !== "function" ? typeChecker(type) : type; - function parse5(body) { + function parse3(body) { return body.length ? queryparse(body) : {}; } return function urlencodedParser(req, res, next) { @@ -20619,7 +20620,7 @@ var require_urlencoded = __commonJS({ })); return; } - read(req, res, next, parse5, debug, { + read(req, res, next, parse3, debug, { debug, encoding: charset, inflate, @@ -20631,7 +20632,7 @@ var require_urlencoded = __commonJS({ function extendedparser(options) { var parameterLimit = options.parameterLimit !== void 0 ? options.parameterLimit : 1e3; var depth = options.depth !== void 0 ? options.depth : 32; - var parse5 = parser("qs"); + var parse3 = parser("qs"); if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError("option parameterLimit must be a positive number"); } @@ -20652,7 +20653,7 @@ var require_urlencoded = __commonJS({ var arrayLimit = Math.max(100, paramCount); debug("parse extended urlencoding"); try { - return parse5(body, { + return parse3(body, { allowPrototypes: true, arrayLimit, depth, @@ -20707,7 +20708,7 @@ var require_urlencoded = __commonJS({ } function simpleparser(options) { var parameterLimit = options.parameterLimit !== void 0 ? options.parameterLimit : 1e3; - var parse5 = parser("querystring"); + var parse3 = parser("querystring"); if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError("option parameterLimit must be a positive number"); } @@ -20723,7 +20724,7 @@ var require_urlencoded = __commonJS({ }); } debug("parse urlencoding"); - return parse5(body, void 0, void 0, { maxKeys: parameterLimit }); + return parse3(body, void 0, void 0, { maxKeys: parameterLimit }); }; } function typeChecker(type) { @@ -20869,26 +20870,26 @@ var require_escape_html = __commonJS({ if (!match) { return str; } - var escape5; + var escape3; var html = ""; var index2 = 0; var lastIndex = 0; for (index2 = match.index; index2 < str.length; index2++) { switch (str.charCodeAt(index2)) { case 34: - escape5 = """; + escape3 = """; break; case 38: - escape5 = "&"; + escape3 = "&"; break; case 39: - escape5 = "'"; + escape3 = "'"; break; case 60: - escape5 = "<"; + escape3 = "<"; break; case 62: - escape5 = ">"; + escape3 = ">"; break; default: continue; @@ -20897,7 +20898,7 @@ var require_escape_html = __commonJS({ html += str.substring(lastIndex, index2); } lastIndex = index2 + 1; - html += escape5; + html += escape3; } return lastIndex !== index2 ? html + str.substring(lastIndex, index2) : html; } @@ -20910,7 +20911,7 @@ var require_parseurl = __commonJS({ "use strict"; init_define_import_meta_env(); var url = require("url"); - var parse5 = url.parse; + var parse3 = url.parse; var Url = url.Url; module2.exports = parseurl; module2.exports.original = originalurl; @@ -20942,17 +20943,17 @@ var require_parseurl = __commonJS({ } function fastparse(str) { if (typeof str !== "string" || str.charCodeAt(0) !== 47) { - return parse5(str); + return parse3(str); } var pathname = str; - var query2 = null; + var query = null; var search = null; for (var i = 1; i < str.length; i++) { switch (str.charCodeAt(i)) { case 63: if (search === null) { pathname = str.substring(0, i); - query2 = str.substring(i + 1); + query = str.substring(i + 1); search = str.substring(i); } break; @@ -20970,7 +20971,7 @@ var require_parseurl = __commonJS({ /* # */ case 160: case 65279: - return parse5(str); + return parse3(str); } } var url2 = Url !== void 0 ? new Url() : {}; @@ -20978,7 +20979,7 @@ var require_parseurl = __commonJS({ url2.href = str; url2.pathname = pathname; if (search !== null) { - url2.query = query2; + url2.query = query; url2.search = search; } return url2; @@ -21055,10 +21056,10 @@ var require_finalhandler = __commonJS({ return void 0; } var headers = /* @__PURE__ */ Object.create(null); - var keys2 = Object.keys(err.headers); - for (var i = 0; i < keys2.length; i++) { - var key2 = keys2[i]; - headers[key2] = err.headers[key2]; + var keys = Object.keys(err.headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + headers[key] = err.headers[key]; } return headers; } @@ -21131,10 +21132,10 @@ var require_finalhandler = __commonJS({ if (!headers) { return; } - var keys2 = Object.keys(headers); - for (var i = 0; i < keys2.length; i++) { - var key2 = keys2[i]; - res.setHeader(key2, headers[key2]); + var keys = Object.keys(headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + res.setHeader(key, headers[key]); } } } @@ -21183,15 +21184,15 @@ var require_path_to_regexp = __commonJS({ init_define_import_meta_env(); module2.exports = pathToRegexp; var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g; - function pathToRegexp(path2, keys2, options) { + function pathToRegexp(path2, keys, options) { options = options || {}; - keys2 = keys2 || []; + keys = keys || []; var strict = options.strict; var end = options.end !== false; var flags = options.sensitive ? "" : "i"; var lookahead = options.lookahead !== false; var extraOffset = 0; - var keysOffset = keys2.length; + var keysOffset = keys.length; var i = 0; var name = 0; var pos = 0; @@ -21200,7 +21201,7 @@ var require_path_to_regexp = __commonJS({ if (path2 instanceof RegExp) { while (m = MATCHING_GROUP_REGEXP.exec(path2.source)) { if (m[0][0] === "\\") continue; - keys2.push({ + keys.push({ name: m[1] || name++, optional: false, offset: m.index @@ -21210,7 +21211,7 @@ var require_path_to_regexp = __commonJS({ } if (Array.isArray(path2)) { path2 = path2.map(function(value) { - return pathToRegexp(value, keys2, options).source; + return pathToRegexp(value, keys, options).source; }); return new RegExp(path2.join("|"), flags); } @@ -21219,7 +21220,7 @@ var require_path_to_regexp = __commonJS({ } path2 = path2.replace( /\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g, - function(match, slash, format, key2, capture, star, optional, offset) { + function(match, slash, format, key, capture, star, optional, offset) { if (match[0] === "\\") { backtrack += match; pos += 2; @@ -21253,8 +21254,8 @@ var require_path_to_regexp = __commonJS({ capture = capture ? capture.replace(/\\.|\*/, function(m2) { return m2 === "*" ? "(.*)" : m2; }) : backtrack ? "((?:(?!/|" + backtrack + ").)+?)" : "([^/" + format + "]+?)"; - keys2.push({ - name: key2, + keys.push({ + name: key, optional: !!optional, offset: offset + extraOffset }); @@ -21266,8 +21267,8 @@ var require_path_to_regexp = __commonJS({ ); while (m = MATCHING_GROUP_REGEXP.exec(path2)) { if (m[0][0] === "\\") continue; - if (keysOffset + i === keys2.length || keys2[keysOffset + i].offset > m.index) { - keys2.splice(keysOffset + i, 0, { + if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) { + keys.splice(keysOffset + i, 0, { name: name++, // Unnamed matching groups must be consistently linear. optional: false, @@ -21354,14 +21355,14 @@ var require_layer = __commonJS({ } this.params = {}; this.path = match2[0]; - var keys2 = this.keys; + var keys = this.keys; var params = this.params; for (var i = 1; i < match2.length; i++) { - var key2 = keys2[i - 1]; - var prop2 = key2.name; + var key = keys[i - 1]; + var prop = key.name; var val = decode_param(match2[i]); - if (val !== void 0 || !hasOwnProperty.call(params, prop2)) { - params[prop2] = val; + if (val !== void 0 || !hasOwnProperty.call(params, prop)) { + params[prop] = val; } } return true; @@ -21438,7 +21439,7 @@ var require_route = __commonJS({ var Layer = require_layer(); var methods = require_methods(); var slice = Array.prototype.slice; - var toString2 = Object.prototype.toString; + var toString = Object.prototype.toString; module2.exports = Route; function Route(path2) { this.path = path2; @@ -21466,7 +21467,7 @@ var require_route = __commonJS({ } return methods2; }; - Route.prototype.dispatch = function dispatch2(req, res, done) { + Route.prototype.dispatch = function dispatch(req, res, done) { var idx = 0; var stack = this.stack; var sync = 0; @@ -21508,7 +21509,7 @@ var require_route = __commonJS({ for (var i = 0; i < handles.length; i++) { var handle2 = handles[i]; if (typeof handle2 !== "function") { - var type = toString2.call(handle2); + var type = toString.call(handle2); var msg = "Route.all() requires a callback function but got a " + type; throw new TypeError(msg); } @@ -21525,7 +21526,7 @@ var require_route = __commonJS({ for (var i = 0; i < handles.length; i++) { var handle2 = handles[i]; if (typeof handle2 !== "function") { - var type = toString2.call(handle2); + var type = toString.call(handle2); var msg = "Route." + method + "() requires a callback function but got a " + type; throw new Error(msg); } @@ -21547,8 +21548,8 @@ var require_utils_merge = __commonJS({ init_define_import_meta_env(); exports2 = module2.exports = function(a, b) { if (a && b) { - for (var key2 in b) { - a[key2] = b[key2]; + for (var key in b) { + a[key] = b[key]; } } return a; @@ -21569,16 +21570,16 @@ var require_router = __commonJS({ var deprecate = require_depd()("express"); var flatten = require_array_flatten(); var parseUrl = require_parseurl(); - var setPrototypeOf2 = require_setprototypeof(); + var setPrototypeOf = require_setprototypeof(); var objectRegExp = /^\[object (\S+)\]$/; var slice = Array.prototype.slice; - var toString2 = Object.prototype.toString; + var toString = Object.prototype.toString; var proto = module2.exports = function(options) { var opts = options || {}; function router(req, res, next) { router.handle(req, res, next); } - setPrototypeOf2(router, proto); + setPrototypeOf(router, proto); router.params = {}; router._params = []; router.caseSensitive = opts.caseSensitive; @@ -21736,14 +21737,14 @@ var require_router = __commonJS({ }; proto.process_params = function process_params(layer, called, req, res, done) { var params = this.params; - var keys2 = layer.keys; - if (!keys2 || keys2.length === 0) { + var keys = layer.keys; + if (!keys || keys.length === 0) { return done(); } var i = 0; var name; var paramIndex = 0; - var key2; + var key; var paramVal; var paramCallbacks; var paramCalled; @@ -21751,12 +21752,12 @@ var require_router = __commonJS({ if (err) { return done(err); } - if (i >= keys2.length) { + if (i >= keys.length) { return done(); } paramIndex = 0; - key2 = keys2[i++]; - name = key2.name; + key = keys[i++]; + name = key.name; paramVal = req.params[name]; paramCallbacks = params[name]; paramCalled = called[name]; @@ -21776,7 +21777,7 @@ var require_router = __commonJS({ } function paramCallback(err) { var fn = paramCallbacks[paramIndex++]; - paramCalled.value = req.params[key2.name]; + paramCalled.value = req.params[key.name]; if (err) { paramCalled.error = err; param(err); @@ -21784,7 +21785,7 @@ var require_router = __commonJS({ } if (!fn) return param(); try { - fn(req, res, paramCallback, paramVal, key2.name); + fn(req, res, paramCallback, paramVal, key.name); } catch (e) { paramCallback(e); } @@ -21871,7 +21872,7 @@ var require_router = __commonJS({ if (type !== "object") { return type; } - return toString2.call(obj).replace(objectRegExp, "$1"); + return toString.call(obj).replace(objectRegExp, "$1"); } function matchLayer(layer, path2) { try { @@ -21945,15 +21946,15 @@ var require_init = __commonJS({ "../backend/node_modules/express/lib/middleware/init.js"(exports2) { "use strict"; init_define_import_meta_env(); - var setPrototypeOf2 = require_setprototypeof(); + var setPrototypeOf = require_setprototypeof(); exports2.init = function(app2) { return function expressInit(req, res, next) { if (app2.enabled("x-powered-by")) res.setHeader("X-Powered-By", "Express"); req.res = res; res.req = req; req.next = next; - setPrototypeOf2(req, app2.request); - setPrototypeOf2(res, app2.response); + setPrototypeOf(req, app2.request); + setPrototypeOf(res, app2.response); res.locals = res.locals || /* @__PURE__ */ Object.create(null); next(); }; @@ -21966,7 +21967,7 @@ var require_formats2 = __commonJS({ "../backend/node_modules/qs/lib/formats.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var replace2 = String.prototype.replace; + var replace = String.prototype.replace; var percentTwenties = /%20/g; var Format = { RFC1738: "RFC1738", @@ -21976,7 +21977,7 @@ var require_formats2 = __commonJS({ "default": Format.RFC3986, formatters: { RFC1738: function(value) { - return replace2.call(value, percentTwenties, "+"); + return replace.call(value, percentTwenties, "+"); }, RFC3986: function(value) { return String(value); @@ -21996,7 +21997,7 @@ var require_utils2 = __commonJS({ var formats = require_formats2(); var getSideChannel = require_side_channel(); var has = Object.prototype.hasOwnProperty; - var isArray2 = Array.isArray; + var isArray = Array.isArray; var overflowChannel = getSideChannel(); var markOverflow = function markOverflow2(obj, maxIndex) { overflowChannel.set(obj, maxIndex); @@ -22022,7 +22023,7 @@ var require_utils2 = __commonJS({ while (queue.length > 1) { var item = queue.pop(); var obj = item.obj[item.prop]; - if (isArray2(obj)) { + if (isArray(obj)) { var compacted = []; for (var j = 0; j < obj.length; ++j) { if (typeof obj[j] !== "undefined") { @@ -22047,7 +22048,7 @@ var require_utils2 = __commonJS({ return target; } if (typeof source !== "object" && typeof source !== "function") { - if (isArray2(target)) { + if (isArray(target)) { var nextIndex = target.length; if (options && typeof options.arrayLimit === "number" && nextIndex > options.arrayLimit) { return markOverflow(arrayToObject(target.concat(source), options), nextIndex); @@ -22083,10 +22084,10 @@ var require_utils2 = __commonJS({ return combined; } var mergeTarget = target; - if (isArray2(target) && !isArray2(source)) { + if (isArray(target) && !isArray(source)) { mergeTarget = arrayToObject(target, options); } - if (isArray2(target) && isArray2(source)) { + if (isArray(target) && isArray(source)) { source.forEach(function(item, i) { if (has.call(target, i)) { var targetItem = target[i]; @@ -22101,28 +22102,28 @@ var require_utils2 = __commonJS({ }); return target; } - return Object.keys(source).reduce(function(acc, key2) { - var value = source[key2]; - if (has.call(acc, key2)) { - acc[key2] = merge2(acc[key2], value, options); + return Object.keys(source).reduce(function(acc, key) { + var value = source[key]; + if (has.call(acc, key)) { + acc[key] = merge2(acc[key], value, options); } else { - acc[key2] = value; + acc[key] = value; } if (isOverflow(source) && !isOverflow(acc)) { markOverflow(acc, getMaxIndex(source)); } if (isOverflow(acc)) { - var keyNum = parseInt(key2, 10); - if (String(keyNum) === key2 && keyNum >= 0 && keyNum > getMaxIndex(acc)) { + var keyNum = parseInt(key, 10); + if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) { setMaxIndex(acc, keyNum); } } return acc; }, mergeTarget); }; - var assign2 = function assignSingleSource(target, source) { - return Object.keys(source).reduce(function(acc, key2) { - acc[key2] = source[key2]; + var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function(acc, key) { + acc[key] = source[key]; return acc; }, target); }; @@ -22185,17 +22186,17 @@ var require_utils2 = __commonJS({ }; var compact = function compact2(value) { var queue = [{ obj: { o: value }, prop: "o" }]; - var refs3 = []; + var refs = []; for (var i = 0; i < queue.length; ++i) { var item = queue[i]; var obj = item.obj[item.prop]; - var keys2 = Object.keys(obj); - for (var j = 0; j < keys2.length; ++j) { - var key2 = keys2[j]; - var val = obj[key2]; - if (typeof val === "object" && val !== null && refs3.indexOf(val) === -1) { - queue[queue.length] = { obj, prop: key2 }; - refs3[refs3.length] = val; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) { + queue[queue.length] = { obj, prop: key }; + refs[refs.length] = val; } } } @@ -22225,7 +22226,7 @@ var require_utils2 = __commonJS({ return result; }; var maybeMap = function maybeMap2(val, fn) { - if (isArray2(val)) { + if (isArray(val)) { var mapped = []; for (var i = 0; i < val.length; i += 1) { mapped[mapped.length] = fn(val[i]); @@ -22236,7 +22237,7 @@ var require_utils2 = __commonJS({ }; module2.exports = { arrayToObject, - assign: assign2, + assign, combine, compact, decode, @@ -22265,17 +22266,17 @@ var require_stringify2 = __commonJS({ return prefix + "[]"; }, comma: "comma", - indices: function indices(prefix, key2) { - return prefix + "[" + key2 + "]"; + indices: function indices(prefix, key) { + return prefix + "[" + key + "]"; }, repeat: function repeat(prefix) { return prefix; } }; - var isArray2 = Array.isArray; - var push2 = Array.prototype.push; + var isArray = Array.isArray; + var push = Array.prototype.push; var pushToArray = function(arr, valueOrArray) { - push2.apply(arr, isArray2(valueOrArray) ? valueOrArray : [valueOrArray]); + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); }; var toISO = Date.prototype.toISOString; var defaultFormat = formats["default"]; @@ -22307,7 +22308,7 @@ var require_stringify2 = __commonJS({ return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint"; }; var sentinel = {}; - var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter3, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { + var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { var obj = object; var tmpSc = sideChannel; var step = 0; @@ -22326,11 +22327,11 @@ var require_stringify2 = __commonJS({ step = 0; } } - if (typeof filter3 === "function") { - obj = filter3(prefix, obj); + if (typeof filter2 === "function") { + obj = filter2(prefix, obj); } else if (obj instanceof Date) { obj = serializeDate(obj); - } else if (generateArrayPrefix === "comma" && isArray2(obj)) { + } else if (generateArrayPrefix === "comma" && isArray(obj)) { obj = utils.maybeMap(obj, function(value2) { if (value2 instanceof Date) { return serializeDate(value2); @@ -22356,30 +22357,30 @@ var require_stringify2 = __commonJS({ return values; } var objKeys; - if (generateArrayPrefix === "comma" && isArray2(obj)) { + if (generateArrayPrefix === "comma" && isArray(obj)) { if (encodeValuesOnly && encoder2) { obj = utils.maybeMap(obj, encoder2); } objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }]; - } else if (isArray2(filter3)) { - objKeys = filter3; + } else if (isArray(filter2)) { + objKeys = filter2; } else { - var keys2 = Object.keys(obj); - objKeys = sort ? keys2.sort(sort) : keys2; + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; } var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix); - var adjustedPrefix = commaRoundTrip && isArray2(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; - if (allowEmptyArrays && isArray2(obj) && obj.length === 0) { + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; + if (allowEmptyArrays && isArray(obj) && obj.length === 0) { return adjustedPrefix + "[]"; } for (var j = 0; j < objKeys.length; ++j) { - var key2 = objKeys[j]; - var value = typeof key2 === "object" && key2 && typeof key2.value !== "undefined" ? key2.value : obj[key2]; + var key = objKeys[j]; + var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key]; if (skipNulls && value === null) { continue; } - var encodedKey = allowDots && encodeDotInKeys ? String(key2).replace(/\./g, "%2E") : String(key2); - var keyPrefix = isArray2(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); + var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key); + var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); sideChannel.set(object, step); var valueSideChannel = getSideChannel(); valueSideChannel.set(sentinel, sideChannel); @@ -22392,8 +22393,8 @@ var require_stringify2 = __commonJS({ strictNullHandling, skipNulls, encodeDotInKeys, - generateArrayPrefix === "comma" && encodeValuesOnly && isArray2(obj) ? null : encoder2, - filter3, + generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder2, + filter2, sort, allowDots, serializeDate, @@ -22431,9 +22432,9 @@ var require_stringify2 = __commonJS({ format = opts.format; } var formatter = formats.formatters[format]; - var filter3 = defaults.filter; - if (typeof opts.filter === "function" || isArray2(opts.filter)) { - filter3 = opts.filter; + var filter2 = defaults.filter; + if (typeof opts.filter === "function" || isArray(opts.filter)) { + filter2 = opts.filter; } var arrayFormat; if (opts.arrayFormat in arrayPrefixGenerators) { @@ -22460,7 +22461,7 @@ var require_stringify2 = __commonJS({ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys, encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder, encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter: filter3, + filter: filter2, format, formatter, serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate, @@ -22473,15 +22474,15 @@ var require_stringify2 = __commonJS({ var obj = object; var options = normalizeStringifyOptions(opts); var objKeys; - var filter3; + var filter2; if (typeof options.filter === "function") { - filter3 = options.filter; - obj = filter3("", obj); - } else if (isArray2(options.filter)) { - filter3 = options.filter; - objKeys = filter3; + filter2 = options.filter; + obj = filter2("", obj); + } else if (isArray(options.filter)) { + filter2 = options.filter; + objKeys = filter2; } - var keys2 = []; + var keys = []; if (typeof obj !== "object" || obj === null) { return ""; } @@ -22495,14 +22496,14 @@ var require_stringify2 = __commonJS({ } var sideChannel = getSideChannel(); for (var i = 0; i < objKeys.length; ++i) { - var key2 = objKeys[i]; - var value = obj[key2]; + var key = objKeys[i]; + var value = obj[key]; if (options.skipNulls && value === null) { continue; } - pushToArray(keys2, stringify( + pushToArray(keys, stringify( value, - key2, + key, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, @@ -22521,7 +22522,7 @@ var require_stringify2 = __commonJS({ sideChannel )); } - var joined = keys2.join(options.delimiter); + var joined = keys.join(options.delimiter); var prefix = options.addQueryPrefix === true ? "?" : ""; if (options.charsetSentinel) { if (options.charset === "iso-8859-1") { @@ -22542,7 +22543,7 @@ var require_parse2 = __commonJS({ init_define_import_meta_env(); var utils = require_utils2(); var has = Object.prototype.hasOwnProperty; - var isArray2 = Array.isArray; + var isArray = Array.isArray; var defaults = { allowDots: false, allowEmptyArrays: false, @@ -22617,19 +22618,19 @@ var require_parse2 = __commonJS({ var part = parts[i]; var bracketEqualsPos = part.indexOf("]="); var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1; - var key2; + var key; var val; if (pos === -1) { - key2 = options.decoder(part, defaults.decoder, charset, "key"); + key = options.decoder(part, defaults.decoder, charset, "key"); val = options.strictNullHandling ? null : ""; } else { - key2 = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); - if (key2 !== null) { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); + if (key !== null) { val = utils.maybeMap( parseArrayValue( part.slice(pos + 1), options, - isArray2(obj[key2]) ? obj[key2].length : 0 + isArray(obj[key]) ? obj[key].length : 0 ), function(encodedVal) { return options.decoder(encodedVal, defaults.decoder, charset, "value"); @@ -22641,25 +22642,25 @@ var require_parse2 = __commonJS({ val = interpretNumericEntities(String(val)); } if (part.indexOf("[]=") > -1) { - val = isArray2(val) ? [val] : val; + val = isArray(val) ? [val] : val; } - if (options.comma && isArray2(val) && val.length > options.arrayLimit) { + if (options.comma && isArray(val) && val.length > options.arrayLimit) { if (options.throwOnLimitExceeded) { throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array."); } val = utils.combine([], val, options.arrayLimit, options.plainObjects); } - if (key2 !== null) { - var existing = has.call(obj, key2); + if (key !== null) { + var existing = has.call(obj, key); if (existing && options.duplicates === "combine") { - obj[key2] = utils.combine( - obj[key2], + obj[key] = utils.combine( + obj[key], val, options.arrayLimit, options.plainObjects ); } else if (!existing || options.duplicates === "last") { - obj[key2] = val; + obj[key] = val; } } } @@ -22711,30 +22712,30 @@ var require_parse2 = __commonJS({ return leaf; }; var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) { - var key2 = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; if (options.depth <= 0) { - if (!options.plainObjects && has.call(Object.prototype, key2)) { + if (!options.plainObjects && has.call(Object.prototype, key)) { if (!options.allowPrototypes) { return; } } - return [key2]; + return [key]; } var brackets = /(\[[^[\]]*])/; var child = /(\[[^[\]]*])/g; - var segment = brackets.exec(key2); - var parent = segment ? key2.slice(0, segment.index) : key2; - var keys2 = []; + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + var keys = []; if (parent) { if (!options.plainObjects && has.call(Object.prototype, parent)) { if (!options.allowPrototypes) { return; } } - keys2[keys2.length] = parent; + keys[keys.length] = parent; } var i = 0; - while ((segment = child.exec(key2)) !== null && i < options.depth) { + while ((segment = child.exec(key)) !== null && i < options.depth) { i += 1; var segmentContent = segment[1].slice(1, -1); if (!options.plainObjects && has.call(Object.prototype, segmentContent)) { @@ -22742,25 +22743,25 @@ var require_parse2 = __commonJS({ return; } } - keys2[keys2.length] = segment[1]; + keys[keys.length] = segment[1]; } if (segment) { if (options.strictDepth === true) { throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true"); } - keys2[keys2.length] = "[" + key2.slice(segment.index) + "]"; + keys[keys.length] = "[" + key.slice(segment.index) + "]"; } - return keys2; + return keys; }; var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { if (!givenKey) { return; } - var keys2 = splitKeyIntoSegments(givenKey, options); - if (!keys2) { + var keys = splitKeyIntoSegments(givenKey, options); + if (!keys) { return; } - return parseObject(keys2, val, options, valuesParsed); + return parseObject(keys, val, options, valuesParsed); }; var normalizeParseOptions = function normalizeParseOptions2(opts) { if (!opts) { @@ -22819,10 +22820,10 @@ var require_parse2 = __commonJS({ } var tempObj = typeof str === "string" ? parseValues(str, options) : str; var obj = options.plainObjects ? { __proto__: null } : {}; - var keys2 = Object.keys(tempObj); - for (var i = 0; i < keys2.length; ++i) { - var key2 = keys2[i]; - var newObj = parseKeys(key2, tempObj[key2], options, typeof str === "string"); + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === "string"); obj = utils.merge(obj, newObj, options); } if (options.allowSparse === true) { @@ -22839,11 +22840,11 @@ var require_lib4 = __commonJS({ "use strict"; init_define_import_meta_env(); var stringify = require_stringify2(); - var parse5 = require_parse2(); + var parse3 = require_parse2(); var formats = require_formats2(); module2.exports = { formats, - parse: parse5, + parse: parse3, stringify }; } @@ -22857,7 +22858,7 @@ var require_query = __commonJS({ var merge = require_utils_merge(); var parseUrl = require_parseurl(); var qs = require_lib4(); - module2.exports = function query2(options) { + module2.exports = function query(options) { var opts = merge({}, options); var queryparse = qs.parse; if (typeof options === "function") { @@ -22867,7 +22868,7 @@ var require_query = __commonJS({ if (opts !== void 0 && opts.allowPrototypes === void 0) { opts.allowPrototypes = true; } - return function query3(req, res, next) { + return function query2(req, res, next) { if (!req.query) { var val = parseUrl(req).query; req.query = queryparse(val, opts); @@ -22931,7 +22932,7 @@ var require_view = __commonJS({ } return path3; }; - View.prototype.render = function render3(options, callback) { + View.prototype.render = function render2(options, callback) { debug('render "%s"', this.path); this.engine(this.path, options, callback); }; @@ -22966,8 +22967,8 @@ var require_safe_buffer = __commonJS({ var buffer = require("buffer"); var Buffer2 = buffer.Buffer; function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; + for (var key in src) { + dst[key] = src[key]; } } if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) { @@ -23024,7 +23025,7 @@ var require_content_disposition = __commonJS({ "use strict"; init_define_import_meta_env(); module2.exports = contentDisposition; - module2.exports.parse = parse5; + module2.exports.parse = parse3; var basename = require("path").basename; var Buffer2 = require_safe_buffer().Buffer; var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g; @@ -23115,7 +23116,7 @@ var require_content_disposition = __commonJS({ function getlatin1(val) { return String(val).replace(NON_LATIN1_REGEXP, "?"); } - function parse5(string) { + function parse3(string) { if (!string || typeof string !== "string") { throw new TypeError("argument string is required"); } @@ -23125,7 +23126,7 @@ var require_content_disposition = __commonJS({ } var index2 = match[0].length; var type = match[1].toLowerCase(); - var key2; + var key; var names = []; var params = {}; var value; @@ -23135,25 +23136,25 @@ var require_content_disposition = __commonJS({ throw new TypeError("invalid parameter format"); } index2 += match[0].length; - key2 = match[1].toLowerCase(); + key = match[1].toLowerCase(); value = match[2]; - if (names.indexOf(key2) !== -1) { + if (names.indexOf(key) !== -1) { throw new TypeError("invalid duplicate parameter"); } - names.push(key2); - if (key2.indexOf("*") + 1 === key2.length) { - key2 = key2.slice(0, -1); + names.push(key); + if (key.indexOf("*") + 1 === key.length) { + key = key.slice(0, -1); value = decodefield(value); - params[key2] = value; + params[key] = value; continue; } - if (typeof params[key2] === "string") { + if (typeof params[key] === "string") { continue; } if (value[0] === '"') { value = value.substr(1, value.length - 2).replace(QESC_REGEXP, "$1"); } - params[key2] = value; + params[key] = value; } if (index2 !== -1 && index2 !== string.length) { throw new TypeError("invalid parameter format"); @@ -23190,7 +23191,7 @@ var require_etag = __commonJS({ module2.exports = etag; var crypto4 = require("crypto"); var Stats = require("fs").Stats; - var toString2 = Object.prototype.toString; + var toString = Object.prototype.toString; function entitytag(entity) { if (entity.length === 0) { return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"'; @@ -23215,7 +23216,7 @@ var require_etag = __commonJS({ if (typeof Stats === "function" && obj instanceof Stats) { return true; } - return obj && typeof obj === "object" && "ctime" in obj && toString2.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString2.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number"; + return obj && typeof obj === "object" && "ctime" in obj && toString.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number"; } function stattag(stat) { var mtime = stat.mtime.getTime().toString(16); @@ -23248,9 +23249,9 @@ var require_fresh = __commonJS({ return false; } var etagStale = true; - var matches2 = parseTokenList(noneMatch); - for (var i = 0; i < matches2.length; i++) { - var match = matches2[i]; + var matches = parseTokenList(noneMatch); + for (var i = 0; i < matches.length; i++) { + var match = matches[i]; if (match === etag || match === "W/" + etag || "W/" + match === etag) { etagStale = false; break; @@ -23312,11 +23313,11 @@ var require_mime = __commonJS({ init_define_import_meta_env(); var path2 = require("path"); var fs = require("fs"); - function Mime2() { + function Mime() { this.types = /* @__PURE__ */ Object.create(null); this.extensions = /* @__PURE__ */ Object.create(null); } - Mime2.prototype.define = function(map) { + Mime.prototype.define = function(map) { for (var type in map) { var exts = map[type]; for (var i = 0; i < exts.length; i++) { @@ -23330,7 +23331,7 @@ var require_mime = __commonJS({ } } }; - Mime2.prototype.load = function(file) { + Mime.prototype.load = function(file) { this._loading = file; var map = {}, content = fs.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/); lines.forEach(function(line) { @@ -23340,18 +23341,18 @@ var require_mime = __commonJS({ this.define(map); this._loading = null; }; - Mime2.prototype.lookup = function(path3, fallback) { + Mime.prototype.lookup = function(path3, fallback) { var ext = path3.replace(/^.*[\.\/\\]/, "").toLowerCase(); return this.types[ext] || fallback || this.default_type; }; - Mime2.prototype.extension = function(mimeType) { + Mime.prototype.extension = function(mimeType) { var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); return this.extensions[type]; }; - var mime = new Mime2(); + var mime = new Mime(); mime.define(require_types()); mime.default_type = mime.lookup("bin"); - mime.Mime = Mime2; + mime.Mime = Mime; mime.charsets = { lookup: function(mimeType, fallback) { return /^text\/|^application\/(javascript|json)/.test(mimeType) ? "UTF-8" : fallback; @@ -23375,7 +23376,7 @@ var require_ms2 = __commonJS({ options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { - return parse5(val); + return parse3(val); } else if (type === "number" && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } @@ -23383,7 +23384,7 @@ var require_ms2 = __commonJS({ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) ); }; - function parse5(str) { + function parse3(str) { str = String(str); if (str.length > 100) { return; @@ -23890,8 +23891,8 @@ var require_send = __commonJS({ len = ranges[0].end - ranges[0].start + 1; } } - for (var prop2 in options) { - opts[prop2] = options[prop2]; + for (var prop in options) { + opts[prop] = options[prop]; } opts.start = offset; opts.end = Math.max(offset, offset + len - 1); @@ -24097,10 +24098,10 @@ var require_send = __commonJS({ return list; } function setHeaders(res, headers) { - var keys2 = Object.keys(headers); - for (var i = 0; i < keys2.length; i++) { - var key2 = keys2[i]; - res.setHeader(key2, headers[key2]); + var keys = Object.keys(headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + res.setHeader(key, headers[key]); } } } @@ -24116,7 +24117,7 @@ var require_forwarded = __commonJS({ if (!req) { throw new TypeError("argument req is required"); } - var proxyAddrs = parse5(req.headers["x-forwarded-for"] || ""); + var proxyAddrs = parse3(req.headers["x-forwarded-for"] || ""); var socketAddr = getSocketAddr(req); var addrs = [socketAddr].concat(proxyAddrs); return addrs; @@ -24124,7 +24125,7 @@ var require_forwarded = __commonJS({ function getSocketAddr(req) { return req.socket ? req.socket.remoteAddress : req.connection.remoteAddress; } - function parse5(header) { + function parse3(header) { var end = header.length; var list = []; var start = header.length; @@ -25100,7 +25101,7 @@ var require_application = __commonJS({ var Router = require_router(); var methods = require_methods(); var middleware = require_init(); - var query2 = require_query(); + var query = require_query(); var debug = require_src()("express:application"); var View = require_view(); var http = require("http"); @@ -25111,7 +25112,7 @@ var require_application = __commonJS({ var flatten = require_array_flatten(); var merge = require_utils_merge(); var resolve = require("path").resolve; - var setPrototypeOf2 = require_setprototypeof(); + var setPrototypeOf = require_setprototypeof(); var hasOwnProperty = Object.prototype.hasOwnProperty; var slice = Array.prototype.slice; var app2 = exports2 = module2.exports = {}; @@ -25140,10 +25141,10 @@ var require_application = __commonJS({ delete this.settings["trust proxy"]; delete this.settings["trust proxy fn"]; } - setPrototypeOf2(this.request, parent.request); - setPrototypeOf2(this.response, parent.response); - setPrototypeOf2(this.engines, parent.engines); - setPrototypeOf2(this.settings, parent.settings); + setPrototypeOf(this.request, parent.request); + setPrototypeOf(this.response, parent.response); + setPrototypeOf(this.engines, parent.engines); + setPrototypeOf(this.settings, parent.settings); }); this.locals = /* @__PURE__ */ Object.create(null); this.mountpath = "/"; @@ -25166,7 +25167,7 @@ var require_application = __commonJS({ caseSensitive: this.enabled("case sensitive routing"), strict: this.enabled("strict routing") }); - this._router.use(query2(this.get("query parser fn"))); + this._router.use(query(this.get("query parser fn"))); this._router.use(middleware.init(this)); } }; @@ -25212,8 +25213,8 @@ var require_application = __commonJS({ router.use(path2, function mounted_app(req, res, next) { var orig = req.app; fn2.handle(req, res, function(err) { - setPrototypeOf2(req, orig.request); - setPrototypeOf2(res, orig.response); + setPrototypeOf(req, orig.request); + setPrototypeOf(res, orig.response); next(err); }); }); @@ -25310,7 +25311,7 @@ var require_application = __commonJS({ return this; }; app2.del = deprecate.function(app2.delete, "app.del: Use app.delete instead"); - app2.render = function render3(name, options, callback) { + app2.render = function render2(name, options, callback) { var cache = this.cache; var done = callback; var engines = this.engines; @@ -25681,14 +25682,14 @@ var require_mediaType = __commonJS({ var kvps = splitParameters(match[3]).map(splitKeyValuePair); for (var j = 0; j < kvps.length; j++) { var pair = kvps[j]; - var key2 = pair[0].toLowerCase(); + var key = pair[0].toLowerCase(); var val = pair[1]; var value = val && val[0] === '"' && val[val.length - 1] === '"' ? val.substr(1, val.length - 2) : val; - if (key2 === "q") { + if (key === "q") { q = parseFloat(value); break; } - params[key2] = value; + params[key] = value; } } return { @@ -25725,9 +25726,9 @@ var require_mediaType = __commonJS({ } else if (spec.subtype != "*") { return null; } - var keys2 = Object.keys(spec.params); - if (keys2.length > 0) { - if (keys2.every(function(k) { + var keys = Object.keys(spec.params); + if (keys.length > 0) { + if (keys.every(function(k) { return spec.params[k] == "*" || (spec.params[k] || "").toLowerCase() == (p.params[k] || "").toLowerCase(); })) { s |= 1; @@ -25774,15 +25775,15 @@ var require_mediaType = __commonJS({ } function splitKeyValuePair(str) { var index2 = str.indexOf("="); - var key2; + var key; var val; if (index2 === -1) { - key2 = str; + key = str; } else { - key2 = str.substr(0, index2); + key = str.substr(0, index2); val = str.substr(index2 + 1); } - return [key2, val]; + return [key, val]; } function splitMediaTypes(accept) { var accepts = accept.split(","); @@ -25964,7 +25965,7 @@ var require_request = __commonJS({ var http = require("http"); var fresh = require_fresh(); var parseRange = require_range_parser(); - var parse5 = require_parseurl(); + var parse3 = require_parseurl(); var proxyaddr = require_proxy_addr(); var req = Object.create(http.IncomingMessage.prototype); module2.exports = req; @@ -26020,12 +26021,12 @@ var require_request = __commonJS({ req.param = function param(name, defaultValue) { var params = this.params || {}; var body = this.body || {}; - var query2 = this.query || {}; + var query = this.query || {}; var args = arguments.length === 1 ? "name" : "name, default"; deprecate("req.param(" + args + "): Use req.params, req.body, or req.query instead"); if (null != params[name] && params.hasOwnProperty(name)) return params[name]; if (null != body[name]) return body[name]; - if (null != query2[name]) return query2[name]; + if (null != query[name]) return query[name]; return defaultValue; }; req.is = function is3(types) { @@ -26069,7 +26070,7 @@ var require_request = __commonJS({ return subdomains2.slice(offset); }); defineGetter(req, "path", function path2() { - return parse5(this).pathname; + return parse3(this).pathname; }); defineGetter(req, "hostname", function hostname() { var trust = this.app.get("trust proxy fn"); @@ -26144,7 +26145,7 @@ var require_cookie = __commonJS({ "../backend/node_modules/cookie/index.js"(exports2) { "use strict"; init_define_import_meta_env(); - exports2.parse = parse5; + exports2.parse = parse3; exports2.serialize = serialize; var __toString = Object.prototype.toString; var __hasOwnProperty = Object.prototype.hasOwnProperty; @@ -26152,7 +26153,7 @@ var require_cookie = __commonJS({ var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/; var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i; var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/; - function parse5(str, opt) { + function parse3(str, opt) { if (typeof str !== "string") { throw new TypeError("argument str must be a string"); } @@ -26175,8 +26176,8 @@ var require_cookie = __commonJS({ } var keyStartIdx = startIndex(str, index2, eqIdx); var keyEndIdx = endIndex(str, eqIdx, keyStartIdx); - var key2 = str.slice(keyStartIdx, keyEndIdx); - if (!__hasOwnProperty.call(obj, key2)) { + var key = str.slice(keyStartIdx, keyEndIdx); + if (!__hasOwnProperty.call(obj, key)) { var valStartIdx = startIndex(str, eqIdx + 1, endIdx); var valEndIdx = endIndex(str, endIdx, valStartIdx); if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) { @@ -26184,7 +26185,7 @@ var require_cookie = __commonJS({ valEndIdx--; } var val = str.slice(valStartIdx, valEndIdx); - obj[key2] = tryDecode(val, dec); + obj[key] = tryDecode(val, dec); } index2 = endIdx + 1; } while (index2 < len); @@ -26312,16 +26313,16 @@ var require_vary = __commonJS({ "use strict"; init_define_import_meta_env(); module2.exports = vary; - module2.exports.append = append4; + module2.exports.append = append2; var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/; - function append4(header, field) { + function append2(header, field) { if (typeof header !== "string") { throw new TypeError("header argument is required"); } if (!field) { throw new TypeError("field argument is required"); } - var fields = !Array.isArray(field) ? parse5(String(field)) : field; + var fields = !Array.isArray(field) ? parse3(String(field)) : field; for (var j = 0; j < fields.length; j++) { if (!FIELD_NAME_REGEXP.test(fields[j])) { throw new TypeError("field argument contains an invalid header name"); @@ -26331,7 +26332,7 @@ var require_vary = __commonJS({ return header; } var val = header; - var vals = parse5(header.toLowerCase()); + var vals = parse3(header.toLowerCase()); if (fields.indexOf("*") !== -1 || vals.indexOf("*") !== -1) { return "*"; } @@ -26344,7 +26345,7 @@ var require_vary = __commonJS({ } return val; } - function parse5(header) { + function parse3(header) { var end = 0; var list = []; var start = 0; @@ -26373,7 +26374,7 @@ var require_vary = __commonJS({ } var val = res.getHeader("Vary") || ""; var header = Array.isArray(val) ? val.join(", ") : String(val); - if (val = append4(header, field)) { + if (val = append2(header, field)) { res.setHeader("Vary", val); } } @@ -26529,10 +26530,10 @@ var require_response = __commonJS({ } } var app2 = this.app; - var escape5 = app2.get("json escape"); + var escape3 = app2.get("json escape"); var replacer = app2.get("json replacer"); var spaces = app2.get("json spaces"); - var body = stringify(val, replacer, spaces, escape5); + var body = stringify(val, replacer, spaces, escape3); if (!this.get("Content-Type")) { this.set("Content-Type", "application/json"); } @@ -26551,10 +26552,10 @@ var require_response = __commonJS({ } } var app2 = this.app; - var escape5 = app2.get("json escape"); + var escape3 = app2.get("json escape"); var replacer = app2.get("json replacer"); var spaces = app2.get("json spaces"); - var body = stringify(val, replacer, spaces, escape5); + var body = stringify(val, replacer, spaces, escape3); var callback = this.req.query[app2.get("jsonp callback name")]; if (!this.get("Content-Type")) { this.set("X-Content-Type-Options", "nosniff"); @@ -26654,11 +26655,11 @@ var require_response = __commonJS({ "Content-Disposition": contentDisposition(name || path3) }; if (opts && opts.headers) { - var keys2 = Object.keys(opts.headers); - for (var i = 0; i < keys2.length; i++) { - var key2 = keys2[i]; - if (key2.toLowerCase() !== "content-disposition") { - headers[key2] = opts.headers[key2]; + var keys = Object.keys(opts.headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key.toLowerCase() !== "content-disposition") { + headers[key] = opts.headers[key]; } } } @@ -26674,19 +26675,19 @@ var require_response = __commonJS({ res.format = function(obj) { var req = this.req; var next = req.next; - var keys2 = Object.keys(obj).filter(function(v) { + var keys = Object.keys(obj).filter(function(v) { return v !== "default"; }); - var key2 = keys2.length > 0 ? req.accepts(keys2) : false; + var key = keys.length > 0 ? req.accepts(keys) : false; this.vary("Accept"); - if (key2) { - this.set("Content-Type", normalizeType(key2).value); - obj[key2](req, this, next); + if (key) { + this.set("Content-Type", normalizeType(key).value); + obj[key](req, this, next); } else if (obj.default) { obj.default(req, this, next); } else { next(createError2(406, { - types: normalizeTypes(keys2).map(function(o) { + types: normalizeTypes(keys).map(function(o) { return o.value; }) })); @@ -26700,7 +26701,7 @@ var require_response = __commonJS({ this.set("Content-Disposition", contentDisposition(filename)); return this; }; - res.append = function append4(field, val) { + res.append = function append2(field, val) { var prev = this.get(field); var value = val; if (prev) { @@ -26722,8 +26723,8 @@ var require_response = __commonJS({ } this.setHeader(field, value); } else { - for (var key2 in field) { - this.set(key2, field[key2]); + for (var key in field) { + this.set(key, field[key]); } } return this; @@ -26819,7 +26820,7 @@ var require_response = __commonJS({ vary(this, field); return this; }; - res.render = function render3(view, options, callback) { + res.render = function render2(view, options, callback) { var app2 = this.req.app; var done = callback; var opts = options || {}; @@ -26892,18 +26893,18 @@ var require_response = __commonJS({ if (options.headers) { file.on("headers", function headers(res3) { var obj = options.headers; - var keys2 = Object.keys(obj); - for (var i = 0; i < keys2.length; i++) { - var k = keys2[i]; + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; res3.setHeader(k, obj[k]); } }); } file.pipe(res2); } - function stringify(value, replacer, spaces, escape5) { + function stringify(value, replacer, spaces, escape3) { var json2 = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value); - if (escape5 && typeof json2 === "string") { + if (escape3 && typeof json2 === "string") { json2 = json2.replace(/[<>&]/g, function(c) { switch (c.charCodeAt(0)) { case 60: @@ -27108,34583 +27109,39860 @@ var require_express2 = __commonJS({ } }); -// node_modules/@acemir/cssom/lib/CSSOM.js -var require_CSSOM = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSOM.js"(exports2, module2) { +// node_modules/linkedom/cjs/shared/symbols.js +var require_symbols = __commonJS({ + "node_modules/linkedom/cjs/shared/symbols.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - /** - * Creates and configures a new CSSOM instance with the specified options. - * - * @param {Object} opts - Configuration options for the CSSOM instance - * @param {Object} [opts.globalObject] - Optional global object to be assigned to CSSOM objects prototype - * @returns {Object} A new CSSOM instance with the applied configuration - * @description - * This method creates a new instance of CSSOM and optionally - * configures CSSStyleSheet with a global object reference. When a globalObject is provided - * and CSSStyleSheet exists on the instance, it creates a new CSSStyleSheet constructor - * using a factory function and assigns the globalObject to its prototype's __globalObject property. - */ - setup: function(opts) { - var instance = Object.create(this); - if (opts.globalObject) { - if (instance.CSSStyleSheet) { - var factoryCSSStyleSheet = createFunctionFactory(instance.CSSStyleSheet); - var CSSStyleSheet = factoryCSSStyleSheet(); - CSSStyleSheet.prototype.__globalObject = opts.globalObject; - instance.CSSStyleSheet = CSSStyleSheet; - } - } - return instance; - } - }; - function createFunctionFactory(fn) { - return function() { - var newFn = function() { - return fn.apply(this, arguments); - }; - Object.setPrototypeOf(newFn, Object.getPrototypeOf(fn)); - for (var key2 in fn) { - if (Object.prototype.hasOwnProperty.call(fn, key2)) { - newFn[key2] = fn[key2]; - } - } - if (fn.prototype) { - newFn.prototype = Object.create(fn.prototype); - } - return newFn; - }; - } - module2.exports = CSSOM2; + var CHANGED = /* @__PURE__ */ Symbol("changed"); + exports2.CHANGED = CHANGED; + var CLASS_LIST = /* @__PURE__ */ Symbol("classList"); + exports2.CLASS_LIST = CLASS_LIST; + var CUSTOM_ELEMENTS = /* @__PURE__ */ Symbol("CustomElements"); + exports2.CUSTOM_ELEMENTS = CUSTOM_ELEMENTS; + var CONTENT = /* @__PURE__ */ Symbol("content"); + exports2.CONTENT = CONTENT; + var DATASET = /* @__PURE__ */ Symbol("dataset"); + exports2.DATASET = DATASET; + var DOCTYPE = /* @__PURE__ */ Symbol("doctype"); + exports2.DOCTYPE = DOCTYPE; + var DOM_PARSER = /* @__PURE__ */ Symbol("DOMParser"); + exports2.DOM_PARSER = DOM_PARSER; + var END = /* @__PURE__ */ Symbol("end"); + exports2.END = END; + var EVENT_TARGET = /* @__PURE__ */ Symbol("EventTarget"); + exports2.EVENT_TARGET = EVENT_TARGET; + var GLOBALS = /* @__PURE__ */ Symbol("globals"); + exports2.GLOBALS = GLOBALS; + var IMAGE = /* @__PURE__ */ Symbol("image"); + exports2.IMAGE = IMAGE; + var MIME = /* @__PURE__ */ Symbol("mime"); + exports2.MIME = MIME; + var MUTATION_OBSERVER = /* @__PURE__ */ Symbol("MutationObserver"); + exports2.MUTATION_OBSERVER = MUTATION_OBSERVER; + var NEXT = /* @__PURE__ */ Symbol("next"); + exports2.NEXT = NEXT; + var OWNER_ELEMENT = /* @__PURE__ */ Symbol("ownerElement"); + exports2.OWNER_ELEMENT = OWNER_ELEMENT; + var PREV = /* @__PURE__ */ Symbol("prev"); + exports2.PREV = PREV; + var PRIVATE = /* @__PURE__ */ Symbol("private"); + exports2.PRIVATE = PRIVATE; + var SHEET = /* @__PURE__ */ Symbol("sheet"); + exports2.SHEET = SHEET; + var START = /* @__PURE__ */ Symbol("start"); + exports2.START = START; + var STYLE = /* @__PURE__ */ Symbol("style"); + exports2.STYLE = STYLE; + var UPGRADE = /* @__PURE__ */ Symbol("upgrade"); + exports2.UPGRADE = UPGRADE; + var VALUE = /* @__PURE__ */ Symbol("value"); + exports2.VALUE = VALUE; } }); -// node_modules/@acemir/cssom/lib/errorUtils.js -var require_errorUtils = __commonJS({ - "node_modules/@acemir/cssom/lib/errorUtils.js"(exports, module) { +// node_modules/entities/dist/commonjs/decode-codepoint.js +var require_decode_codepoint = __commonJS({ + "node_modules/entities/dist/commonjs/decode-codepoint.js"(exports2) { + "use strict"; init_define_import_meta_env(); - function getErrorConstructor(context, errorType) { - if (context.parentStyleSheet && context.parentStyleSheet.__globalObject && context.parentStyleSheet.__globalObject[errorType]) { - return context.parentStyleSheet.__globalObject[errorType]; - } - if (context.__parentStyleSheet && context.__parentStyleSheet.__globalObject && context.__parentStyleSheet.__globalObject[errorType]) { - return context.__parentStyleSheet.__globalObject[errorType]; - } - if (context.__globalObject && context.__globalObject[errorType]) { - return context.__globalObject[errorType]; + var _a; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.fromCodePoint = void 0; + exports2.replaceCodePoint = replaceCodePoint; + exports2.decodeCodePoint = decodeCodePoint; + var decodeMap = /* @__PURE__ */ new Map([ + [0, 65533], + // C1 Unicode control character reference replacements + [128, 8364], + [130, 8218], + [131, 402], + [132, 8222], + [133, 8230], + [134, 8224], + [135, 8225], + [136, 710], + [137, 8240], + [138, 352], + [139, 8249], + [140, 338], + [142, 381], + [145, 8216], + [146, 8217], + [147, 8220], + [148, 8221], + [149, 8226], + [150, 8211], + [151, 8212], + [152, 732], + [153, 8482], + [154, 353], + [155, 8250], + [156, 339], + [158, 382], + [159, 376] + ]); + exports2.fromCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins + (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => { + let output = ""; + if (codePoint > 65535) { + codePoint -= 65536; + output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); + codePoint = 56320 | codePoint & 1023; + } + output += String.fromCharCode(codePoint); + return output; + }); + function replaceCodePoint(codePoint) { + var _a2; + if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { + return 65533; } - return typeof global !== "undefined" && global[errorType] || typeof window !== "undefined" && window[errorType] || eval(errorType); - } - function createError(context2, errorType2, message, name) { - var ErrorConstructor = getErrorConstructor(context2, errorType2); - return new ErrorConstructor(message, name); - } - function throwError(context2, errorType2, message, name) { - throw createError(context2, errorType2, message, name); + return (_a2 = decodeMap.get(codePoint)) !== null && _a2 !== void 0 ? _a2 : codePoint; } - function throwMissingArguments(context2, methodName, objectName, required, provided) { - required = required || 1; - provided = provided || 0; - var message = "Failed to execute '" + methodName + "' on '" + objectName + "': " + required + " argument" + (required > 1 ? "s" : "") + " required, but only " + provided + " present."; - throwError(context2, "TypeError", message); - } - function throwParseError(context2, methodName, objectName, rule, name) { - var message = "Failed to execute '" + methodName + "' on '" + objectName + "': Failed to parse the rule '" + rule + "'."; - throwError(context2, "DOMException", message, name || "SyntaxError"); + function decodeCodePoint(codePoint) { + return (0, exports2.fromCodePoint)(replaceCodePoint(codePoint)); } - function throwIndexError(context2, methodName, objectName, index2, maxIndex, name) { - var message = "Failed to execute '" + methodName + "' on '" + objectName + "': The index provided (" + index2 + ") is larger than the maximum index (" + maxIndex + ")."; - throwError(context2, "DOMException", message, name || "IndexSizeError"); + } +}); + +// node_modules/entities/dist/commonjs/internal/decode-shared.js +var require_decode_shared = __commonJS({ + "node_modules/entities/dist/commonjs/internal/decode-shared.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decodeBase64 = decodeBase64; + function decodeBase64(input) { + const binary = ( + // eslint-disable-next-line n/no-unsupported-features/node-builtins + typeof atob === "function" ? ( + // Browser (and Node >=16) + // eslint-disable-next-line n/no-unsupported-features/node-builtins + atob(input) + ) : ( + // Older Node versions (<16) + // eslint-disable-next-line n/no-unsupported-features/node-builtins + typeof Buffer.from === "function" ? ( + // eslint-disable-next-line n/no-unsupported-features/node-builtins + Buffer.from(input, "base64").toString("binary") + ) : ( + // eslint-disable-next-line unicorn/no-new-buffer, n/no-deprecated-api + new Buffer(input, "base64").toString("binary") + ) + ) + ); + const evenLength = binary.length & ~1; + const out = new Uint16Array(evenLength / 2); + for (let index2 = 0, outIndex = 0; index2 < evenLength; index2 += 2) { + const lo = binary.charCodeAt(index2); + const hi = binary.charCodeAt(index2 + 1); + out[outIndex++] = lo | hi << 8; + } + return out; } - var errorUtils = { - createError, - getErrorConstructor, - throwError, - throwMissingArguments, - throwParseError, - throwIndexError - }; - exports.errorUtils = errorUtils; } }); -// node_modules/@acemir/cssom/lib/regexPatterns.js -var require_regexPatterns = __commonJS({ - "node_modules/@acemir/cssom/lib/regexPatterns.js"(exports2) { +// node_modules/entities/dist/commonjs/generated/decode-data-html.js +var require_decode_data_html = __commonJS({ + "node_modules/entities/dist/commonjs/generated/decode-data-html.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; - var beforeRulePortionRegExp = /{(?!.*{)|}(?!.*})|;(?!.*;)|\*\/(?!.*\*\/)/g; - var beforeRuleValidationRegExp = /^[\s{};]*(\*\/\s*)?$/; - var forwardRuleValidationRegExp = /(?:\s|\/\*|\{|\()/; - var forwardImportRuleValidationRegExp = /(?:\s|\/\*|'|")/; - var forwardRuleClosingBraceRegExp = /{[^{}]*}|}/; - var forwardRuleSemicolonAndOpeningBraceRegExp = /^.*?({|;)/; - var cssCustomIdentifierRegExp = /^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/; - var startsWithCombinatorRegExp = /^\s*[>+~]/; - var atPageRuleSelectorRegExp = /^([^\s:]+)?((?::\w+)*)$/; - var layerRegExp = /layer\(([^)]*)\)/; - var layerRuleNameRegExp = /^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/; - var doubleOrMoreSpacesRegExp = /\s{2,}/g; - var startsWithHexEscapeRegExp = /^\\[0-9a-fA-F]/; - var identStartCharRegExp = /[a-zA-Z_\u00A0-\uFFFF]/; - var identCharRegExp = /^[a-zA-Z0-9_\-\u00A0-\uFFFF\\]/; - var specialCharsNeedEscapeRegExp = /[!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~\s]/; - var combinatorOrSeparatorRegExp = /[\s>+~,()]/; - var afterHexEscapeSeparatorRegExp = /[\s>+~,(){}\[\]]/; - var trailingSpaceSeparatorRegExp = /[\s>+~,(){}]/; - var endsWithHexEscapeRegExp = /\\[0-9a-fA-F]{1,6}\s+$/; - var basicStylePropertyValueValidationRegExp = /:(?![^(]*\))(?=(?:[^'"]|'[^']*'|"[^"]*")*$)/; - var attributeSelectorContentRegExp = /^([^\s=~|^$*]+)\s*(~=|\|=|\^=|\$=|\*=|=)\s*(.+)$/; - var pseudoElementRegExp = /::[a-zA-Z][\w-]*|:(before|after|first-line|first-letter)(?![a-zA-Z0-9_-])/; - var invalidCombinatorLtGtRegExp = /<>/; - var invalidCombinatorDoubleGtRegExp = />>/; - var consecutiveCombinatorsRegExp = /[>+~]\s*[>+~]/; - var invalidSlottedRegExp = /(?:^|[\s>+~,\[])slotted\s*\(/i; - var invalidPartRegExp = /(?:^|[\s>+~,\[])part\s*\(/i; - var invalidCueRegExp = /(?:^|[\s>+~,\[])cue\s*\(/i; - var invalidCueRegionRegExp = /(?:^|[\s>+~,\[])cue-region\s*\(/i; - var invalidNestingPattern = /&(?![.\#\[:>\+~\s])[a-zA-Z]/; - var emptyPseudoClassRegExp = /:(?:is|not|where|has)\(\s*\)/; - var whitespaceNormalizationRegExp = /(['"])(?:\\.|[^\\])*?\1|(\r\n|\r|\n)/g; - var newlineRemovalRegExp = /\n/g; - var whitespaceAndDotRegExp = /[\s.]/; - var declarationOrOpenBraceRegExp = /[{;}]/; - var ampersandRegExp = /&/; - var hexEscapeSequenceRegExp = /^([0-9a-fA-F]{1,6})[ \t\r\n\f]?/; - var attributeCaseFlagRegExp = /^(.+?)\s+([is])$/i; - var prependedAmpersandRegExp = /^&\s+[:\\.]/; - var openBraceGlobalRegExp = /{/g; - var closeBraceGlobalRegExp = /}/g; - var scopePreludeSplitRegExp = /\s*\)\s*to\s+\(/; - var leadingWhitespaceRegExp = /^\s+/; - var doubleQuoteRegExp = /"/g; - var backslashRegExp = /\\/g; - var invalidMediaOperatorWithoutSpaceRegExp = /\)(and|or)\(/i; - var invalidMediaNotAfterOperatorRegExp = /\b(and|or)\s+not\b/i; - var invalidMediaNotIdentifierRegExp = /\)\s+not\(/i; - var invalidMediaNotAfterFeatureRegExp = /\)\s+not\s+/i; - var invalidMediaOperatorBetweenParensRegExp = /\)\s+(?!and\b|or\b)[a-z]+\s+\(/i; - var invalidMediaNotWithMediaTypeRegExp = /\bnot\s+[a-z][a-z0-9_-]*\s+\(/i; - var mediaFeatureColonRegExp = /(\(\s*)([^():]+):(\s*)([^()]*\))/g; - var identifierBeforeParenRegExp = /[a-z0-9_-]/i; - var mediaAndOperatorRegExp = /\s*\band\b\s*/gi; - var mediaOrOperatorRegExp = /\s*\bor\b\s*/gi; - var mediaNotOperatorStartRegExp = /^\s*not\s+(?=\S)/i; - var mediaNotOperatorRegExp = /\s+\bnot\s+(?=\S)/gi; - var regexPatterns = { - // Parsing patterns - atKeyframesRegExp, - beforeRulePortionRegExp, - beforeRuleValidationRegExp, - forwardRuleValidationRegExp, - forwardImportRuleValidationRegExp, - forwardRuleClosingBraceRegExp, - forwardRuleSemicolonAndOpeningBraceRegExp, - // Selector validation patterns - cssCustomIdentifierRegExp, - startsWithCombinatorRegExp, - atPageRuleSelectorRegExp, - // Parsing patterns used in CSSImportRule - layerRegExp, - layerRuleNameRegExp, - doubleOrMoreSpacesRegExp, - // Escape sequence and identifier patterns - startsWithHexEscapeRegExp, - identStartCharRegExp, - identCharRegExp, - specialCharsNeedEscapeRegExp, - combinatorOrSeparatorRegExp, - afterHexEscapeSeparatorRegExp, - trailingSpaceSeparatorRegExp, - endsWithHexEscapeRegExp, - // Basic style property value validation - basicStylePropertyValueValidationRegExp, - // Attribute selector patterns - attributeSelectorContentRegExp, - // Selector validation patterns - pseudoElementRegExp, - invalidCombinatorLtGtRegExp, - invalidCombinatorDoubleGtRegExp, - consecutiveCombinatorsRegExp, - invalidSlottedRegExp, - invalidPartRegExp, - invalidCueRegExp, - invalidCueRegionRegExp, - invalidNestingPattern, - emptyPseudoClassRegExp, - whitespaceNormalizationRegExp, - newlineRemovalRegExp, - whitespaceAndDotRegExp, - declarationOrOpenBraceRegExp, - ampersandRegExp, - hexEscapeSequenceRegExp, - attributeCaseFlagRegExp, - prependedAmpersandRegExp, - openBraceGlobalRegExp, - closeBraceGlobalRegExp, - scopePreludeSplitRegExp, - leadingWhitespaceRegExp, - doubleQuoteRegExp, - backslashRegExp, - // Media query validation patterns - invalidMediaOperatorWithoutSpaceRegExp, - invalidMediaNotAfterOperatorRegExp, - invalidMediaNotIdentifierRegExp, - invalidMediaNotAfterFeatureRegExp, - invalidMediaOperatorBetweenParensRegExp, - invalidMediaNotWithMediaTypeRegExp, - // Media query normalization patterns - mediaFeatureColonRegExp, - identifierBeforeParenRegExp, - mediaAndOperatorRegExp, - mediaOrOperatorRegExp, - mediaNotOperatorStartRegExp, - mediaNotOperatorRegExp - }; - exports2.regexPatterns = regexPatterns; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.htmlDecodeTree = void 0; + var decode_shared_js_1 = require_decode_shared(); + exports2.htmlDecodeTree = (0, decode_shared_js_1.decodeBase64)("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg"); } }); -// node_modules/@acemir/cssom/lib/MediaList.js -var require_MediaList = __commonJS({ - "node_modules/@acemir/cssom/lib/MediaList.js"(exports2) { +// node_modules/entities/dist/commonjs/generated/decode-data-xml.js +var require_decode_data_xml = __commonJS({ + "node_modules/entities/dist/commonjs/generated/decode-data-xml.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = {}; - CSSOM2.MediaList = function MediaList() { - this.length = 0; - }; - CSSOM2.MediaList.prototype = { - constructor: CSSOM2.MediaList, + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.xmlDecodeTree = void 0; + var decode_shared_js_1 = require_decode_shared(); + exports2.xmlDecodeTree = (0, decode_shared_js_1.decodeBase64)("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg"); + } +}); + +// node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +var require_bin_trie_flags = __commonJS({ + "node_modules/entities/dist/commonjs/internal/bin-trie-flags.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BinTrieFlags = void 0; + var BinTrieFlags; + (function(BinTrieFlags2) { + BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH"; + BinTrieFlags2[BinTrieFlags2["FLAG13"] = 8192] = "FLAG13"; + BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH"; + BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE"; + })(BinTrieFlags || (exports2.BinTrieFlags = BinTrieFlags = {})); + } +}); + +// node_modules/entities/dist/commonjs/decode.js +var require_decode = __commonJS({ + "node_modules/entities/dist/commonjs/decode.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.xmlDecodeTree = exports2.htmlDecodeTree = exports2.replaceCodePoint = exports2.fromCodePoint = exports2.decodeCodePoint = exports2.EntityDecoder = exports2.DecodingMode = void 0; + exports2.determineBranch = determineBranch; + exports2.decodeHTML = decodeHTML; + exports2.decodeHTMLAttribute = decodeHTMLAttribute; + exports2.decodeHTMLStrict = decodeHTMLStrict; + exports2.decodeXML = decodeXML; + var decode_codepoint_js_1 = require_decode_codepoint(); + var decode_data_html_js_1 = require_decode_data_html(); + var decode_data_xml_js_1 = require_decode_data_xml(); + var bin_trie_flags_js_1 = require_bin_trie_flags(); + var CharCodes; + (function(CharCodes2) { + CharCodes2[CharCodes2["NUM"] = 35] = "NUM"; + CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI"; + CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS"; + CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO"; + CharCodes2[CharCodes2["NINE"] = 57] = "NINE"; + CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A"; + CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F"; + CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X"; + CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z"; + CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A"; + CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F"; + CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z"; + })(CharCodes || (CharCodes = {})); + var TO_LOWER_BIT = 32; + function isNumber(code) { + return code >= CharCodes.ZERO && code <= CharCodes.NINE; + } + function isHexadecimalCharacter(code) { + return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F; + } + function isAsciiAlphaNumeric(code) { + return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code); + } + function isEntityInAttributeInvalidEnd(code) { + return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code); + } + var EntityDecoderState; + (function(EntityDecoderState2) { + EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart"; + EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart"; + EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal"; + EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex"; + EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity"; + })(EntityDecoderState || (EntityDecoderState = {})); + var DecodingMode; + (function(DecodingMode2) { + DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy"; + DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict"; + DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute"; + })(DecodingMode || (exports2.DecodingMode = DecodingMode = {})); + var EntityDecoder = class { + constructor(decodeTree, emitCodePoint, errors) { + this.decodeTree = decodeTree; + this.emitCodePoint = emitCodePoint; + this.errors = errors; + this.state = EntityDecoderState.EntityStart; + this.consumed = 1; + this.result = 0; + this.treeIndex = 0; + this.excess = 1; + this.decodeMode = DecodingMode.Strict; + this.runConsumed = 0; + } + /** Resets the instance to make it reusable. */ + startEntity(decodeMode) { + this.decodeMode = decodeMode; + this.state = EntityDecoderState.EntityStart; + this.result = 0; + this.treeIndex = 0; + this.excess = 1; + this.consumed = 1; + this.runConsumed = 0; + } /** - * @return {string} + * Write an entity to the decoder. This can be called multiple times with partial entities. + * If the entity is incomplete, the decoder will return -1. + * + * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the + * entity is incomplete, and resume when the next string is written. + * + * @param input The string containing the entity (or a continuation of the entity). + * @param offset The offset at which the entity begins. Should be 0 if this is not the first call. + * @returns The number of characters that were consumed, or -1 if the entity is incomplete. */ - get mediaText() { - return Array.prototype.join.call(this, ", "); - }, + write(input, offset) { + switch (this.state) { + case EntityDecoderState.EntityStart: { + if (input.charCodeAt(offset) === CharCodes.NUM) { + this.state = EntityDecoderState.NumericStart; + this.consumed += 1; + return this.stateNumericStart(input, offset + 1); + } + this.state = EntityDecoderState.NamedEntity; + return this.stateNamedEntity(input, offset); + } + case EntityDecoderState.NumericStart: { + return this.stateNumericStart(input, offset); + } + case EntityDecoderState.NumericDecimal: { + return this.stateNumericDecimal(input, offset); + } + case EntityDecoderState.NumericHex: { + return this.stateNumericHex(input, offset); + } + case EntityDecoderState.NamedEntity: { + return this.stateNamedEntity(input, offset); + } + } + } /** - * @param {string} value + * Switches between the numeric decimal and hexadecimal states. + * + * Equivalent to the `Numeric character reference state` in the HTML spec. + * + * @param input The string containing the entity (or a continuation of the entity). + * @param offset The current offset. + * @returns The number of characters that were consumed, or -1 if the entity is incomplete. */ - set mediaText(value) { - if (typeof value === "string") { - var values = value.split(",").filter(function(text) { - return !!text; - }); - var length = this.length = values.length; - for (var i = 0; i < length; i++) { - this[i] = values[i].trim(); + stateNumericStart(input, offset) { + if (offset >= input.length) { + return -1; + } + if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) { + this.state = EntityDecoderState.NumericHex; + this.consumed += 1; + return this.stateNumericHex(input, offset + 1); + } + this.state = EntityDecoderState.NumericDecimal; + return this.stateNumericDecimal(input, offset); + } + /** + * Parses a hexadecimal numeric entity. + * + * Equivalent to the `Hexademical character reference state` in the HTML spec. + * + * @param input The string containing the entity (or a continuation of the entity). + * @param offset The current offset. + * @returns The number of characters that were consumed, or -1 if the entity is incomplete. + */ + stateNumericHex(input, offset) { + while (offset < input.length) { + const char = input.charCodeAt(offset); + if (isNumber(char) || isHexadecimalCharacter(char)) { + const digit = char <= CharCodes.NINE ? char - CharCodes.ZERO : (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10; + this.result = this.result * 16 + digit; + this.consumed++; + offset++; + } else { + return this.emitNumericEntity(char, 3); } - } else if (value === null) { - var length = this.length; - for (var i = 0; i < length; i++) { - delete this[i]; + } + return -1; + } + /** + * Parses a decimal numeric entity. + * + * Equivalent to the `Decimal character reference state` in the HTML spec. + * + * @param input The string containing the entity (or a continuation of the entity). + * @param offset The current offset. + * @returns The number of characters that were consumed, or -1 if the entity is incomplete. + */ + stateNumericDecimal(input, offset) { + while (offset < input.length) { + const char = input.charCodeAt(offset); + if (isNumber(char)) { + this.result = this.result * 10 + (char - CharCodes.ZERO); + this.consumed++; + offset++; + } else { + return this.emitNumericEntity(char, 2); } - this.length = 0; } - }, + return -1; + } /** - * @param {string} medium + * Validate and emit a numeric entity. + * + * Implements the logic from the `Hexademical character reference start + * state` and `Numeric character reference end state` in the HTML spec. + * + * @param lastCp The last code point of the entity. Used to see if the + * entity was terminated with a semicolon. + * @param expectedLength The minimum number of characters that should be + * consumed. Used to validate that at least one digit + * was consumed. + * @returns The number of characters that were consumed. */ - appendMedium: function(medium) { - if (Array.prototype.indexOf.call(this, medium) === -1) { - this[this.length] = medium; - this.length++; + emitNumericEntity(lastCp, expectedLength) { + var _a; + if (this.consumed <= expectedLength) { + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed); + return 0; } - }, + if (lastCp === CharCodes.SEMI) { + this.consumed += 1; + } else if (this.decodeMode === DecodingMode.Strict) { + return 0; + } + this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed); + if (this.errors) { + if (lastCp !== CharCodes.SEMI) { + this.errors.missingSemicolonAfterCharacterReference(); + } + this.errors.validateNumericCharacterReference(this.result); + } + return this.consumed; + } /** - * @param {string} medium + * Parses a named entity. + * + * Equivalent to the `Named character reference state` in the HTML spec. + * + * @param input The string containing the entity (or a continuation of the entity). + * @param offset The current offset. + * @returns The number of characters that were consumed, or -1 if the entity is incomplete. */ - deleteMedium: function(medium) { - var index2 = Array.prototype.indexOf.call(this, medium); - if (index2 !== -1) { - Array.prototype.splice.call(this, index2, 1); + stateNamedEntity(input, offset) { + const { decodeTree } = this; + let current = decodeTree[this.treeIndex]; + let valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14; + while (offset < input.length) { + if (valueLength === 0 && (current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) { + const runLength = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7; + if (this.runConsumed === 0) { + const firstChar = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE; + if (input.charCodeAt(offset) !== firstChar) { + return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity(); + } + offset++; + this.excess++; + this.runConsumed++; + } + while (this.runConsumed < runLength) { + if (offset >= input.length) { + return -1; + } + const charIndexInPacked = this.runConsumed - 1; + const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)]; + const expectedChar = charIndexInPacked % 2 === 0 ? packedWord & 255 : packedWord >> 8 & 255; + if (input.charCodeAt(offset) !== expectedChar) { + this.runConsumed = 0; + return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity(); + } + offset++; + this.excess++; + this.runConsumed++; + } + this.runConsumed = 0; + this.treeIndex += 1 + (runLength >> 1); + current = decodeTree[this.treeIndex]; + valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14; + } + if (offset >= input.length) + break; + const char = input.charCodeAt(offset); + if (char === CharCodes.SEMI && valueLength !== 0 && (current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) { + return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); + } + this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char); + if (this.treeIndex < 0) { + return this.result === 0 || // If we are parsing an attribute + this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity, + (valueLength === 0 || // And there should be no invalid characters. + isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity(); + } + current = decodeTree[this.treeIndex]; + valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14; + if (valueLength !== 0) { + if (char === CharCodes.SEMI) { + return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); + } + if (this.decodeMode !== DecodingMode.Strict && (current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) === 0) { + this.result = this.treeIndex; + this.consumed += this.excess; + this.excess = 0; + } + } + offset++; + this.excess++; } - }, - item: function(index2) { - return this[index2] || null; - }, - toString: function() { - return this.mediaText; + return -1; } - }; - exports2.MediaList = CSSOM2.MediaList; + /** + * Emit a named entity that was not terminated with a semicolon. + * + * @returns The number of characters consumed. + */ + emitNotTerminatedNamedEntity() { + var _a; + const { result, decodeTree } = this; + const valueLength = (decodeTree[result] & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14; + this.emitNamedEntityData(result, valueLength, this.consumed); + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference(); + return this.consumed; + } + /** + * Emit a named entity. + * + * @param result The index of the entity in the decode tree. + * @param valueLength The number of bytes in the entity. + * @param consumed The number of characters consumed. + * + * @returns The number of characters consumed. + */ + emitNamedEntityData(result, valueLength, consumed) { + const { decodeTree } = this; + this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~(bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH | bin_trie_flags_js_1.BinTrieFlags.FLAG13) : decodeTree[result + 1], consumed); + if (valueLength === 3) { + this.emitCodePoint(decodeTree[result + 2], consumed); + } + return consumed; + } + /** + * Signal to the parser that the end of the input was reached. + * + * Remaining data will be emitted and relevant errors will be produced. + * + * @returns The number of characters consumed. + */ + end() { + var _a; + switch (this.state) { + case EntityDecoderState.NamedEntity: { + return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0; + } + // Otherwise, emit a numeric entity if we have one. + case EntityDecoderState.NumericDecimal: { + return this.emitNumericEntity(0, 2); + } + case EntityDecoderState.NumericHex: { + return this.emitNumericEntity(0, 3); + } + case EntityDecoderState.NumericStart: { + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed); + return 0; + } + case EntityDecoderState.EntityStart: { + return 0; + } + } + } + }; + exports2.EntityDecoder = EntityDecoder; + function getDecoder(decodeTree) { + let returnValue = ""; + const decoder = new EntityDecoder(decodeTree, (data) => returnValue += (0, decode_codepoint_js_1.fromCodePoint)(data)); + return function decodeWithTrie(input, decodeMode) { + let lastIndex = 0; + let offset = 0; + while ((offset = input.indexOf("&", offset)) >= 0) { + returnValue += input.slice(lastIndex, offset); + decoder.startEntity(decodeMode); + const length = decoder.write( + input, + // Skip the "&" + offset + 1 + ); + if (length < 0) { + lastIndex = offset + decoder.end(); + break; + } + lastIndex = offset + length; + offset = length === 0 ? lastIndex + 1 : lastIndex; + } + const result = returnValue + input.slice(lastIndex); + returnValue = ""; + return result; + }; + } + function determineBranch(decodeTree, current, nodeIndex, char) { + const branchCount = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7; + const jumpOffset = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE; + if (branchCount === 0) { + return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1; + } + if (jumpOffset) { + const value = char - jumpOffset; + return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIndex + value] - 1; + } + const packedKeySlots = branchCount + 1 >> 1; + let lo = 0; + let hi = branchCount - 1; + while (lo <= hi) { + const mid = lo + hi >>> 1; + const slot = mid >> 1; + const packed = decodeTree[nodeIndex + slot]; + const midKey = packed >> (mid & 1) * 8 & 255; + if (midKey < char) { + lo = mid + 1; + } else if (midKey > char) { + hi = mid - 1; + } else { + return decodeTree[nodeIndex + packedKeySlots + mid]; + } + } + return -1; + } + var htmlDecoder = /* @__PURE__ */ getDecoder(decode_data_html_js_1.htmlDecodeTree); + var xmlDecoder = /* @__PURE__ */ getDecoder(decode_data_xml_js_1.xmlDecodeTree); + function decodeHTML(htmlString, mode = DecodingMode.Legacy) { + return htmlDecoder(htmlString, mode); + } + function decodeHTMLAttribute(htmlAttribute) { + return htmlDecoder(htmlAttribute, DecodingMode.Attribute); + } + function decodeHTMLStrict(htmlString) { + return htmlDecoder(htmlString, DecodingMode.Strict); + } + function decodeXML(xmlString) { + return xmlDecoder(xmlString, DecodingMode.Strict); + } + var decode_codepoint_js_2 = require_decode_codepoint(); + Object.defineProperty(exports2, "decodeCodePoint", { enumerable: true, get: function() { + return decode_codepoint_js_2.decodeCodePoint; + } }); + Object.defineProperty(exports2, "fromCodePoint", { enumerable: true, get: function() { + return decode_codepoint_js_2.fromCodePoint; + } }); + Object.defineProperty(exports2, "replaceCodePoint", { enumerable: true, get: function() { + return decode_codepoint_js_2.replaceCodePoint; + } }); + var decode_data_html_js_2 = require_decode_data_html(); + Object.defineProperty(exports2, "htmlDecodeTree", { enumerable: true, get: function() { + return decode_data_html_js_2.htmlDecodeTree; + } }); + var decode_data_xml_js_2 = require_decode_data_xml(); + Object.defineProperty(exports2, "xmlDecodeTree", { enumerable: true, get: function() { + return decode_data_xml_js_2.xmlDecodeTree; + } }); } }); -// node_modules/@acemir/cssom/lib/StyleSheet.js -var require_StyleSheet = __commonJS({ - "node_modules/@acemir/cssom/lib/StyleSheet.js"(exports2) { +// node_modules/htmlparser2/dist/commonjs/Tokenizer.js +var require_Tokenizer = __commonJS({ + "node_modules/htmlparser2/dist/commonjs/Tokenizer.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - MediaList: require_MediaList().MediaList - }; - CSSOM2.StyleSheet = function StyleSheet() { - this.__href = null; - this.__ownerNode = null; - this.__title = null; - this.__media = new CSSOM2.MediaList(); - this.__parentStyleSheet = null; - this.disabled = false; - }; - Object.defineProperties(CSSOM2.StyleSheet.prototype, { - type: { - get: function() { - return "text/css"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.QuoteType = void 0; + var decode_1 = require_decode(); + var CharCodes; + (function(CharCodes2) { + CharCodes2[CharCodes2["Tab"] = 9] = "Tab"; + CharCodes2[CharCodes2["NewLine"] = 10] = "NewLine"; + CharCodes2[CharCodes2["FormFeed"] = 12] = "FormFeed"; + CharCodes2[CharCodes2["CarriageReturn"] = 13] = "CarriageReturn"; + CharCodes2[CharCodes2["Space"] = 32] = "Space"; + CharCodes2[CharCodes2["ExclamationMark"] = 33] = "ExclamationMark"; + CharCodes2[CharCodes2["Number"] = 35] = "Number"; + CharCodes2[CharCodes2["Amp"] = 38] = "Amp"; + CharCodes2[CharCodes2["SingleQuote"] = 39] = "SingleQuote"; + CharCodes2[CharCodes2["DoubleQuote"] = 34] = "DoubleQuote"; + CharCodes2[CharCodes2["Dash"] = 45] = "Dash"; + CharCodes2[CharCodes2["Slash"] = 47] = "Slash"; + CharCodes2[CharCodes2["Zero"] = 48] = "Zero"; + CharCodes2[CharCodes2["Nine"] = 57] = "Nine"; + CharCodes2[CharCodes2["Semi"] = 59] = "Semi"; + CharCodes2[CharCodes2["Lt"] = 60] = "Lt"; + CharCodes2[CharCodes2["Eq"] = 61] = "Eq"; + CharCodes2[CharCodes2["Gt"] = 62] = "Gt"; + CharCodes2[CharCodes2["Questionmark"] = 63] = "Questionmark"; + CharCodes2[CharCodes2["UpperA"] = 65] = "UpperA"; + CharCodes2[CharCodes2["LowerA"] = 97] = "LowerA"; + CharCodes2[CharCodes2["UpperF"] = 70] = "UpperF"; + CharCodes2[CharCodes2["LowerF"] = 102] = "LowerF"; + CharCodes2[CharCodes2["UpperZ"] = 90] = "UpperZ"; + CharCodes2[CharCodes2["LowerZ"] = 122] = "LowerZ"; + CharCodes2[CharCodes2["LowerX"] = 120] = "LowerX"; + CharCodes2[CharCodes2["OpeningSquareBracket"] = 91] = "OpeningSquareBracket"; + })(CharCodes || (CharCodes = {})); + var State; + (function(State2) { + State2[State2["Text"] = 1] = "Text"; + State2[State2["BeforeTagName"] = 2] = "BeforeTagName"; + State2[State2["InTagName"] = 3] = "InTagName"; + State2[State2["InSelfClosingTag"] = 4] = "InSelfClosingTag"; + State2[State2["BeforeClosingTagName"] = 5] = "BeforeClosingTagName"; + State2[State2["InClosingTagName"] = 6] = "InClosingTagName"; + State2[State2["AfterClosingTagName"] = 7] = "AfterClosingTagName"; + State2[State2["BeforeAttributeName"] = 8] = "BeforeAttributeName"; + State2[State2["InAttributeName"] = 9] = "InAttributeName"; + State2[State2["AfterAttributeName"] = 10] = "AfterAttributeName"; + State2[State2["BeforeAttributeValue"] = 11] = "BeforeAttributeValue"; + State2[State2["InAttributeValueDq"] = 12] = "InAttributeValueDq"; + State2[State2["InAttributeValueSq"] = 13] = "InAttributeValueSq"; + State2[State2["InAttributeValueNq"] = 14] = "InAttributeValueNq"; + State2[State2["BeforeDeclaration"] = 15] = "BeforeDeclaration"; + State2[State2["InDeclaration"] = 16] = "InDeclaration"; + State2[State2["InProcessingInstruction"] = 17] = "InProcessingInstruction"; + State2[State2["BeforeComment"] = 18] = "BeforeComment"; + State2[State2["CDATASequence"] = 19] = "CDATASequence"; + State2[State2["InSpecialComment"] = 20] = "InSpecialComment"; + State2[State2["InCommentLike"] = 21] = "InCommentLike"; + State2[State2["BeforeSpecialS"] = 22] = "BeforeSpecialS"; + State2[State2["BeforeSpecialT"] = 23] = "BeforeSpecialT"; + State2[State2["SpecialStartSequence"] = 24] = "SpecialStartSequence"; + State2[State2["InSpecialTag"] = 25] = "InSpecialTag"; + State2[State2["InEntity"] = 26] = "InEntity"; + })(State || (State = {})); + function isWhitespace2(c) { + return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn; + } + function isEndOfTagSection(c) { + return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace2(c); + } + function isASCIIAlpha(c) { + return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ; + } + var QuoteType; + (function(QuoteType2) { + QuoteType2[QuoteType2["NoValue"] = 0] = "NoValue"; + QuoteType2[QuoteType2["Unquoted"] = 1] = "Unquoted"; + QuoteType2[QuoteType2["Single"] = 2] = "Single"; + QuoteType2[QuoteType2["Double"] = 3] = "Double"; + })(QuoteType || (exports2.QuoteType = QuoteType = {})); + var Sequences = { + Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), + // CDATA[ + CdataEnd: new Uint8Array([93, 93, 62]), + // ]]> + CommentEnd: new Uint8Array([45, 45, 62]), + // `-->` + ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), + // ` this.emitCodePoint(cp, consumed)); + } + reset() { + this.state = State.Text; + this.buffer = ""; + this.sectionStart = 0; + this.index = 0; + this.baseState = State.Text; + this.currentSequence = void 0; + this.running = true; + this.offset = 0; + } + write(chunk) { + this.offset += this.buffer.length; + this.buffer = chunk; + this.parse(); + } + end() { + if (this.running) + this.finish(); + } + pause() { + this.running = false; + } + resume() { + this.running = true; + if (this.index < this.buffer.length + this.offset) { + this.parse(); } - }, - href: { - get: function() { - return this.__href; + } + stateText(c) { + if (c === CharCodes.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes.Lt)) { + if (this.index > this.sectionStart) { + this.cbs.ontext(this.sectionStart, this.index); + } + this.state = State.BeforeTagName; + this.sectionStart = this.index; + } else if (this.decodeEntities && c === CharCodes.Amp) { + this.startEntity(); } - }, - ownerNode: { - get: function() { - return this.__ownerNode; + } + stateSpecialStartSequence(c) { + const isEnd = this.sequenceIndex === this.currentSequence.length; + const isMatch = isEnd ? ( + // If we are at the end of the sequence, make sure the tag name has ended + isEndOfTagSection(c) + ) : ( + // Otherwise, do a case-insensitive comparison + (c | 32) === this.currentSequence[this.sequenceIndex] + ); + if (!isMatch) { + this.isSpecial = false; + } else if (!isEnd) { + this.sequenceIndex++; + return; } - }, - title: { - get: function() { - return this.__title; + this.sequenceIndex = 0; + this.state = State.InTagName; + this.stateInTagName(c); + } + /** Look for an end tag. For tags, also decode entities. */ + stateInSpecialTag(c) { + if (this.sequenceIndex === this.currentSequence.length) { + if (c === CharCodes.Gt || isWhitespace2(c)) { + const endOfText = this.index - this.currentSequence.length; + if (this.sectionStart < endOfText) { + const actualIndex = this.index; + this.index = endOfText; + this.cbs.ontext(this.sectionStart, endOfText); + this.index = actualIndex; + } + this.isSpecial = false; + this.sectionStart = endOfText + 2; + this.stateInClosingTagName(c); + return; + } + this.sequenceIndex = 0; } - }, - media: { - get: function() { - return this.__media; - }, - set: function(value) { - if (typeof value === "string") { - this.__media.mediaText = value; - } else { - this.__media = value; + if ((c | 32) === this.currentSequence[this.sequenceIndex]) { + this.sequenceIndex += 1; + } else if (this.sequenceIndex === 0) { + if (this.currentSequence === Sequences.TitleEnd) { + if (this.decodeEntities && c === CharCodes.Amp) { + this.startEntity(); + } + } else if (this.fastForwardTo(CharCodes.Lt)) { + this.sequenceIndex = 1; } + } else { + this.sequenceIndex = Number(c === CharCodes.Lt); } - }, - parentStyleSheet: { - get: function() { - return this.__parentStyleSheet; + } + stateCDATASequence(c) { + if (c === Sequences.Cdata[this.sequenceIndex]) { + if (++this.sequenceIndex === Sequences.Cdata.length) { + this.state = State.InCommentLike; + this.currentSequence = Sequences.CdataEnd; + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + } + } else { + this.sequenceIndex = 0; + this.state = State.InDeclaration; + this.stateInDeclaration(c); } } - }); - exports2.StyleSheet = CSSOM2.StyleSheet; - } -}); - -// node_modules/@acemir/cssom/lib/CSSRuleList.js -var require_CSSRuleList = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSRuleList.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = {}; - CSSOM2.CSSRuleList = function CSSRuleList() { - var arr = new Array(); - Object.setPrototypeOf(arr, CSSOM2.CSSRuleList.prototype); - return arr; - }; - CSSOM2.CSSRuleList.prototype = Object.create(Array.prototype); - CSSOM2.CSSRuleList.prototype.constructor = CSSOM2.CSSRuleList; - CSSOM2.CSSRuleList.prototype.item = function(index2) { - return this[index2] || null; - }; - exports2.CSSRuleList = CSSOM2.CSSRuleList; - } -}); - -// node_modules/@acemir/cssom/lib/CSSRule.js -var require_CSSRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSRule.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = {}; - CSSOM2.CSSRule = function CSSRule() { - this.__parentRule = null; - this.__parentStyleSheet = null; - }; - CSSOM2.CSSRule.UNKNOWN_RULE = 0; - CSSOM2.CSSRule.STYLE_RULE = 1; - CSSOM2.CSSRule.CHARSET_RULE = 2; - CSSOM2.CSSRule.IMPORT_RULE = 3; - CSSOM2.CSSRule.MEDIA_RULE = 4; - CSSOM2.CSSRule.FONT_FACE_RULE = 5; - CSSOM2.CSSRule.PAGE_RULE = 6; - CSSOM2.CSSRule.KEYFRAMES_RULE = 7; - CSSOM2.CSSRule.KEYFRAME_RULE = 8; - CSSOM2.CSSRule.MARGIN_RULE = 9; - CSSOM2.CSSRule.NAMESPACE_RULE = 10; - CSSOM2.CSSRule.COUNTER_STYLE_RULE = 11; - CSSOM2.CSSRule.SUPPORTS_RULE = 12; - CSSOM2.CSSRule.DOCUMENT_RULE = 13; - CSSOM2.CSSRule.FONT_FEATURE_VALUES_RULE = 14; - CSSOM2.CSSRule.VIEWPORT_RULE = 15; - CSSOM2.CSSRule.REGION_STYLE_RULE = 16; - CSSOM2.CSSRule.CONTAINER_RULE = 17; - CSSOM2.CSSRule.LAYER_BLOCK_RULE = 18; - CSSOM2.CSSRule.STARTING_STYLE_RULE = 1002; - Object.defineProperties(CSSOM2.CSSRule.prototype, { - constructor: { value: CSSOM2.CSSRule }, - cssRule: { - value: "", - configurable: true, - enumerable: true - }, - cssText: { - get: function() { - return ""; - }, - set: function(cssText) { - return cssText; - } - }, - parentRule: { - get: function() { - return this.__parentRule; - } - }, - parentStyleSheet: { - get: function() { - return this.__parentStyleSheet; + /** + * When we wait for one specific character, we can speed things up + * by skipping through the buffer until we find it. + * + * @returns Whether the character was found. + */ + fastForwardTo(c) { + while (++this.index < this.buffer.length + this.offset) { + if (this.buffer.charCodeAt(this.index - this.offset) === c) { + return true; + } } - }, - UNKNOWN_RULE: { value: 0, enumerable: true }, - // obsolet - STYLE_RULE: { value: 1, enumerable: true }, - CHARSET_RULE: { value: 2, enumerable: true }, - // obsolet - IMPORT_RULE: { value: 3, enumerable: true }, - MEDIA_RULE: { value: 4, enumerable: true }, - FONT_FACE_RULE: { value: 5, enumerable: true }, - PAGE_RULE: { value: 6, enumerable: true }, - KEYFRAMES_RULE: { value: 7, enumerable: true }, - KEYFRAME_RULE: { value: 8, enumerable: true }, - MARGIN_RULE: { value: 9, enumerable: true }, - NAMESPACE_RULE: { value: 10, enumerable: true }, - COUNTER_STYLE_RULE: { value: 11, enumerable: true }, - SUPPORTS_RULE: { value: 12, enumerable: true }, - DOCUMENT_RULE: { value: 13, enumerable: true }, - FONT_FEATURE_VALUES_RULE: { value: 14, enumerable: true }, - VIEWPORT_RULE: { value: 15, enumerable: true }, - REGION_STYLE_RULE: { value: 16, enumerable: true }, - CONTAINER_RULE: { value: 17, enumerable: true }, - LAYER_BLOCK_RULE: { value: 18, enumerable: true }, - STARTING_STYLE_RULE: { value: 1002, enumerable: true } - }); - exports2.CSSRule = CSSOM2.CSSRule; - } -}); - -// node_modules/@acemir/cssom/lib/CSSGroupingRule.js -var require_CSSGroupingRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSGroupingRule.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - parse: require_parse3().parse - }; - var errorUtils2 = require_errorUtils().errorUtils; - CSSOM2.CSSGroupingRule = function CSSGroupingRule() { - CSSOM2.CSSRule.call(this); - this.__cssRules = new CSSOM2.CSSRuleList(); - }; - CSSOM2.CSSGroupingRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSGroupingRule.prototype.constructor = CSSOM2.CSSGroupingRule; - Object.setPrototypeOf(CSSOM2.CSSGroupingRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSGroupingRule.prototype, "cssRules", { - get: function() { - return this.__cssRules; - } - }); - CSSOM2.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index2) { - if (rule === void 0 && index2 === void 0) { - errorUtils2.throwMissingArguments(this, "insertRule", this.constructor.name); - } - if (index2 === void 0) { - index2 = 0; - } - index2 = Number(index2); - if (index2 < 0) { - index2 = 4294967296 + index2; - } - if (index2 > this.cssRules.length) { - errorUtils2.throwIndexError(this, "insertRule", this.constructor.name, index2, this.cssRules.length); + this.index = this.buffer.length + this.offset - 1; + return false; } - var ruleToParse = processedRuleToParse = String(rule); - ruleToParse = ruleToParse.trim().replace(/^\/\*[\s\S]*?\*\/\s*/, ""); - var isNestedSelector = this.constructor.name === "CSSStyleRule"; - if (isNestedSelector === false) { - var currentRule = this; - while (currentRule.parentRule) { - currentRule = currentRule.parentRule; - if (currentRule.constructor.name === "CSSStyleRule") { - isNestedSelector = true; - break; + /** + * Comments and CDATA end with `-->` and `]]>`. + * + * Their common qualities are: + * - Their end sequences have a distinct character they start with. + * - That character is then repeated, so we have to check multiple repeats. + * - All characters but the start character of the sequence can be skipped. + */ + stateInCommentLike(c) { + if (c === this.currentSequence[this.sequenceIndex]) { + if (++this.sequenceIndex === this.currentSequence.length) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, this.index, 2); + } else { + this.cbs.oncomment(this.sectionStart, this.index, 2); + } + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + this.state = State.Text; + } + } else if (this.sequenceIndex === 0) { + if (this.fastForwardTo(this.currentSequence[0])) { + this.sequenceIndex = 1; } + } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { + this.sequenceIndex = 0; } } - if (isNestedSelector) { - processedRuleToParse = "s { n { } " + ruleToParse + "}"; - } - var isScopeRule = this.constructor.name === "CSSScopeRule"; - if (isScopeRule) { - if (isNestedSelector) { - processedRuleToParse = "s { @scope {" + ruleToParse + "}}"; + /** + * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name. + * + * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar). + * We allow anything that wouldn't end the tag. + */ + isTagStartChar(c) { + return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c); + } + startSpecial(sequence, offset) { + this.isSpecial = true; + this.currentSequence = sequence; + this.sequenceIndex = offset; + this.state = State.SpecialStartSequence; + } + stateBeforeTagName(c) { + if (c === CharCodes.ExclamationMark) { + this.state = State.BeforeDeclaration; + this.sectionStart = this.index + 1; + } else if (c === CharCodes.Questionmark) { + this.state = State.InProcessingInstruction; + this.sectionStart = this.index + 1; + } else if (this.isTagStartChar(c)) { + const lower = c | 32; + this.sectionStart = this.index; + if (this.xmlMode) { + this.state = State.InTagName; + } else if (lower === Sequences.ScriptEnd[2]) { + this.state = State.BeforeSpecialS; + } else if (lower === Sequences.TitleEnd[2] || lower === Sequences.XmpEnd[2]) { + this.state = State.BeforeSpecialT; + } else { + this.state = State.InTagName; + } + } else if (c === CharCodes.Slash) { + this.state = State.BeforeClosingTagName; } else { - processedRuleToParse = "@scope {" + ruleToParse + "}"; + this.state = State.Text; + this.stateText(c); } } - var parsedRules = new CSSOM2.CSSRuleList(); - CSSOM2.parse(processedRuleToParse, { - styleSheet: this.parentStyleSheet, - cssRules: parsedRules - }); - if (isScopeRule) { - if (isNestedSelector) { - parsedRules = parsedRules[0].cssRules[0].cssRules; + stateInTagName(c) { + if (isEndOfTagSection(c)) { + this.cbs.onopentagname(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } + } + stateBeforeClosingTagName(c) { + if (isWhitespace2(c)) { + } else if (c === CharCodes.Gt) { + this.state = State.Text; } else { - parsedRules = parsedRules[0].cssRules; + this.state = this.isTagStartChar(c) ? State.InClosingTagName : State.InSpecialComment; + this.sectionStart = this.index; } } - if (isNestedSelector) { - parsedRules = parsedRules[0].cssRules.slice(1); + stateInClosingTagName(c) { + if (c === CharCodes.Gt || isWhitespace2(c)) { + this.cbs.onclosetag(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State.AfterClosingTagName; + this.stateAfterClosingTagName(c); + } } - if (parsedRules.length !== 1) { - if (isNestedSelector && parsedRules.length === 0 && ruleToParse.indexOf("@font-face") === 0) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Only conditional nested group rules, style rules, @scope rules, @apply rules, and nested declaration rules may be nested.", - "HierarchyRequestError" - ); - } else { - errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + stateAfterClosingTagName(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.state = State.Text; + this.sectionStart = this.index + 1; } } - var cssRule = parsedRules[0]; - if (cssRule.constructor.name === "CSSNestedDeclarations" && cssRule.style.length === 0) { - errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + stateBeforeAttributeName(c) { + if (c === CharCodes.Gt) { + this.cbs.onopentagend(this.index); + if (this.isSpecial) { + this.state = State.InSpecialTag; + this.sequenceIndex = 0; + } else { + this.state = State.Text; + } + this.sectionStart = this.index + 1; + } else if (c === CharCodes.Slash) { + this.state = State.InSelfClosingTag; + } else if (!isWhitespace2(c)) { + this.state = State.InAttributeName; + this.sectionStart = this.index; + } + } + stateInSelfClosingTag(c) { + if (c === CharCodes.Gt) { + this.cbs.onselfclosingtag(this.index); + this.state = State.Text; + this.sectionStart = this.index + 1; + this.isSpecial = false; + } else if (!isWhitespace2(c)) { + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } } - if (cssRule.constructor.name === "CSSImportRule" || cssRule.constructor.name === "CSSNamespaceRule") { - var ruleKeyword = cssRule.constructor.name === "CSSImportRule" ? "@import" : "@namespace"; - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': '" + ruleKeyword + "' rules cannot be inserted inside a group rule.", - "HierarchyRequestError" - ); + stateInAttributeName(c) { + if (c === CharCodes.Eq || isEndOfTagSection(c)) { + this.cbs.onattribname(this.sectionStart, this.index); + this.sectionStart = this.index; + this.state = State.AfterAttributeName; + this.stateAfterAttributeName(c); + } } - if (cssRule.constructor.name === "CSSLayerStatementRule") { - errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + stateAfterAttributeName(c) { + if (c === CharCodes.Eq) { + this.state = State.BeforeAttributeValue; + } else if (c === CharCodes.Slash || c === CharCodes.Gt) { + this.cbs.onattribend(QuoteType.NoValue, this.sectionStart); + this.sectionStart = -1; + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } else if (!isWhitespace2(c)) { + this.cbs.onattribend(QuoteType.NoValue, this.sectionStart); + this.state = State.InAttributeName; + this.sectionStart = this.index; + } + } + stateBeforeAttributeValue(c) { + if (c === CharCodes.DoubleQuote) { + this.state = State.InAttributeValueDq; + this.sectionStart = this.index + 1; + } else if (c === CharCodes.SingleQuote) { + this.state = State.InAttributeValueSq; + this.sectionStart = this.index + 1; + } else if (!isWhitespace2(c)) { + this.sectionStart = this.index; + this.state = State.InAttributeValueNq; + this.stateInAttributeValueNoQuotes(c); + } } - cssRule.__parentRule = this; - this.cssRules.splice(index2, 0, cssRule); - return index2; - }; - CSSOM2.CSSGroupingRule.prototype.deleteRule = function deleteRule(index2) { - if (index2 === void 0) { - errorUtils2.throwMissingArguments(this, "deleteRule", this.constructor.name); + handleInAttributeValue(c, quote) { + if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(quote === CharCodes.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1); + this.state = State.BeforeAttributeName; + } else if (this.decodeEntities && c === CharCodes.Amp) { + this.startEntity(); + } } - index2 = Number(index2); - if (index2 < 0) { - index2 = 4294967296 + index2; + stateInAttributeValueDoubleQuotes(c) { + this.handleInAttributeValue(c, CharCodes.DoubleQuote); } - if (index2 >= this.cssRules.length) { - errorUtils2.throwIndexError(this, "deleteRule", this.constructor.name, index2, this.cssRules.length); + stateInAttributeValueSingleQuotes(c) { + this.handleInAttributeValue(c, CharCodes.SingleQuote); } - this.cssRules[index2].__parentRule = null; - this.cssRules[index2].__parentStyleSheet = null; - this.cssRules.splice(index2, 1); - }; - exports2.CSSGroupingRule = CSSOM2.CSSGroupingRule; - } -}); - -// node_modules/@acemir/cssom/lib/CSSStyleRule.js -var require_CSSStyleRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSStyleRule.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = { - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - var regexPatterns = require_regexPatterns().regexPatterns; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { - } - CSSOM2.CSSStyleRule = function CSSStyleRule() { - CSSOM2.CSSGroupingRule.call(this); - this.__selectorText = ""; - this.__style = new CSSOM2.CSSStyleDeclaration(); - this.__style.parentRule = this; - }; - CSSOM2.CSSStyleRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSStyleRule.prototype.constructor = CSSOM2.CSSStyleRule; - Object.setPrototypeOf(CSSOM2.CSSStyleRule, CSSOM2.CSSGroupingRule); - Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "type", { - value: 1, - writable: false - }); - Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "selectorText", { - get: function() { - return this.__selectorText; - }, - set: function(value) { - if (typeof value === "string") { - var endsWithHexEscapeRegExp = regexPatterns.endsWithHexEscapeRegExp; - var endsWithEscape = endsWithHexEscapeRegExp.test(value); - var trimmedValue = endsWithEscape ? value.replace(/\s+$/, " ").trimStart() : value.trim(); - if (trimmedValue === "") { - return; - } - this.__selectorText = trimmedValue; - } - }, - configurable: true - }); - Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "style", { - get: function() { - return this.__style; - }, - set: function(value) { - if (typeof value === "string") { - this.__style.cssText = value; - } else { - this.__style = value; + stateInAttributeValueNoQuotes(c) { + if (isWhitespace2(c) || c === CharCodes.Gt) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(QuoteType.Unquoted, this.index); + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } else if (this.decodeEntities && c === CharCodes.Amp) { + this.startEntity(); } - }, - configurable: true - }); - Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "cssText", { - get: function() { - var text; - if (this.selectorText) { - var values = ""; - if (this.cssRules.length) { - var valuesArr = [" {"]; - this.style.cssText && valuesArr.push(this.style.cssText); - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); - values = valuesArr.join("\n ") + "\n}"; - } else { - values = " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; - } - text = this.selectorText + values; + } + stateBeforeDeclaration(c) { + if (c === CharCodes.OpeningSquareBracket) { + this.state = State.CDATASequence; + this.sequenceIndex = 0; } else { - text = ""; + this.state = c === CharCodes.Dash ? State.BeforeComment : State.InDeclaration; } - return text; } - }); - exports2.CSSStyleRule = CSSOM2.CSSStyleRule; - } -}); - -// node_modules/@acemir/cssom/lib/CSSStyleSheet.js -var require_CSSStyleSheet = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSStyleSheet.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = { - MediaList: require_MediaList().MediaList, - StyleSheet: require_StyleSheet().StyleSheet, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSStyleRule: require_CSSStyleRule().CSSStyleRule - }; - var errorUtils2 = require_errorUtils().errorUtils; - CSSOM2.CSSStyleSheet = function CSSStyleSheet(opts) { - CSSOM2.StyleSheet.call(this); - this.__constructed = true; - this.__cssRules = new CSSOM2.CSSRuleList(); - this.__ownerRule = null; - if (opts && typeof opts === "object") { - if (opts.baseURL && typeof opts.baseURL === "string") { - this.__baseURL = opts.baseURL; - } - if (opts.media && typeof opts.media === "string") { - this.media.mediaText = opts.media; - } - if (typeof opts.disabled === "boolean") { - this.disabled = opts.disabled; + stateInDeclaration(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.ondeclaration(this.sectionStart, this.index); + this.state = State.Text; + this.sectionStart = this.index + 1; } } - }; - CSSOM2.CSSStyleSheet.prototype = Object.create(CSSOM2.StyleSheet.prototype); - CSSOM2.CSSStyleSheet.prototype.constructor = CSSOM2.CSSStyleSheet; - Object.setPrototypeOf(CSSOM2.CSSStyleSheet, CSSOM2.StyleSheet); - Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "cssRules", { - get: function() { - return this.__cssRules; - } - }); - Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "rules", { - get: function() { - return this.__cssRules; - } - }); - Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "ownerRule", { - get: function() { - return this.__ownerRule; + stateInProcessingInstruction(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.onprocessinginstruction(this.sectionStart, this.index); + this.state = State.Text; + this.sectionStart = this.index + 1; + } } - }); - CSSOM2.CSSStyleSheet.prototype.insertRule = function(rule, index2) { - if (rule === void 0 && index2 === void 0) { - errorUtils2.throwMissingArguments(this, "insertRule", this.constructor.name); + stateBeforeComment(c) { + if (c === CharCodes.Dash) { + this.state = State.InCommentLike; + this.currentSequence = Sequences.CommentEnd; + this.sequenceIndex = 2; + this.sectionStart = this.index + 1; + } else { + this.state = State.InDeclaration; + } } - if (index2 === void 0) { - index2 = 0; + stateInSpecialComment(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.oncomment(this.sectionStart, this.index, 0); + this.state = State.Text; + this.sectionStart = this.index + 1; + } } - index2 = Number(index2); - if (index2 < 0) { - index2 = 4294967296 + index2; + stateBeforeSpecialS(c) { + const lower = c | 32; + if (lower === Sequences.ScriptEnd[3]) { + this.startSpecial(Sequences.ScriptEnd, 4); + } else if (lower === Sequences.StyleEnd[3]) { + this.startSpecial(Sequences.StyleEnd, 4); + } else { + this.state = State.InTagName; + this.stateInTagName(c); + } } - if (index2 > this.cssRules.length) { - errorUtils2.throwIndexError(this, "insertRule", this.constructor.name, index2, this.cssRules.length); + stateBeforeSpecialT(c) { + const lower = c | 32; + switch (lower) { + case Sequences.TitleEnd[3]: { + this.startSpecial(Sequences.TitleEnd, 4); + break; + } + case Sequences.TextareaEnd[3]: { + this.startSpecial(Sequences.TextareaEnd, 4); + break; + } + case Sequences.XmpEnd[3]: { + this.startSpecial(Sequences.XmpEnd, 4); + break; + } + default: { + this.state = State.InTagName; + this.stateInTagName(c); + } + } } - var ruleToParse = String(rule); - var parseErrors = []; - var parsedSheet = CSSOM2.parse(ruleToParse, void 0, function(err) { - parseErrors.push(err); - }); - if (parsedSheet.cssRules.length !== 1) { - errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + startEntity() { + this.baseState = this.state; + this.state = State.InEntity; + this.entityStart = this.index; + this.entityDecoder.startEntity(this.xmlMode ? decode_1.DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? decode_1.DecodingMode.Legacy : decode_1.DecodingMode.Attribute); } - var cssRule = parsedSheet.cssRules[0]; - function findLastIndexOfConstructor(rules, constructorName) { - for (var i2 = rules.length - 1; i2 >= 0; i2--) { - if (rules[i2].constructor.name === constructorName) { - return i2; + stateInEntity() { + const indexInBuffer = this.index - this.offset; + const length = this.entityDecoder.write(this.buffer, indexInBuffer); + if (length >= 0) { + this.state = this.baseState; + if (length === 0) { + this.index -= 1; } + } else { + if (indexInBuffer < this.buffer.length && this.buffer.charCodeAt(indexInBuffer) === CharCodes.Amp) { + this.state = this.baseState; + this.index -= 1; + return; + } + this.index = this.offset + this.buffer.length - 1; } - return -1; } - function findFirstNonConstructorIndex(rules, constructorNames) { - for (var i2 = 0; i2 < rules.length; i2++) { - if (constructorNames.indexOf(rules[i2].constructor.name) === -1) { - return i2; + /** + * Remove data that has already been consumed from the buffer. + */ + cleanup() { + if (this.running && this.sectionStart !== this.index) { + if (this.state === State.Text || this.state === State.InSpecialTag && this.sequenceIndex === 0) { + this.cbs.ontext(this.sectionStart, this.index); + this.sectionStart = this.index; + } else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = this.index; } } - return rules.length; } - if (cssRule.constructor.name === "CSSImportRule") { - if (this.__constructed === true) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Can't insert @import rules into a constructed stylesheet.", - "SyntaxError" - ); + shouldContinue() { + return this.index < this.buffer.length + this.offset && this.running; + } + /** + * Iterates through the buffer, calling the function corresponding to the current state. + * + * States that are more likely to be hit are higher up, as a performance improvement. + */ + parse() { + while (this.shouldContinue()) { + const c = this.buffer.charCodeAt(this.index - this.offset); + switch (this.state) { + case State.Text: { + this.stateText(c); + break; + } + case State.SpecialStartSequence: { + this.stateSpecialStartSequence(c); + break; + } + case State.InSpecialTag: { + this.stateInSpecialTag(c); + break; + } + case State.CDATASequence: { + this.stateCDATASequence(c); + break; + } + case State.InAttributeValueDq: { + this.stateInAttributeValueDoubleQuotes(c); + break; + } + case State.InAttributeName: { + this.stateInAttributeName(c); + break; + } + case State.InCommentLike: { + this.stateInCommentLike(c); + break; + } + case State.InSpecialComment: { + this.stateInSpecialComment(c); + break; + } + case State.BeforeAttributeName: { + this.stateBeforeAttributeName(c); + break; + } + case State.InTagName: { + this.stateInTagName(c); + break; + } + case State.InClosingTagName: { + this.stateInClosingTagName(c); + break; + } + case State.BeforeTagName: { + this.stateBeforeTagName(c); + break; + } + case State.AfterAttributeName: { + this.stateAfterAttributeName(c); + break; + } + case State.InAttributeValueSq: { + this.stateInAttributeValueSingleQuotes(c); + break; + } + case State.BeforeAttributeValue: { + this.stateBeforeAttributeValue(c); + break; + } + case State.BeforeClosingTagName: { + this.stateBeforeClosingTagName(c); + break; + } + case State.AfterClosingTagName: { + this.stateAfterClosingTagName(c); + break; + } + case State.BeforeSpecialS: { + this.stateBeforeSpecialS(c); + break; + } + case State.BeforeSpecialT: { + this.stateBeforeSpecialT(c); + break; + } + case State.InAttributeValueNq: { + this.stateInAttributeValueNoQuotes(c); + break; + } + case State.InSelfClosingTag: { + this.stateInSelfClosingTag(c); + break; + } + case State.InDeclaration: { + this.stateInDeclaration(c); + break; + } + case State.BeforeDeclaration: { + this.stateBeforeDeclaration(c); + break; + } + case State.BeforeComment: { + this.stateBeforeComment(c); + break; + } + case State.InProcessingInstruction: { + this.stateInProcessingInstruction(c); + break; + } + case State.InEntity: { + this.stateInEntity(); + break; + } + } + this.index++; } - var firstLayerIndex = findFirstNonConstructorIndex(this.cssRules, ["CSSImportRule"]); - if (firstLayerIndex < this.cssRules.length && this.cssRules[firstLayerIndex].constructor.name === "CSSLayerStatementRule" && index2 > firstLayerIndex) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "HierarchyRequestError" - ); + this.cleanup(); + } + finish() { + if (this.state === State.InEntity) { + this.entityDecoder.end(); + this.state = this.baseState; } - var firstNonImportIndex = findFirstNonConstructorIndex(this.cssRules, ["CSSImportRule"]); - if (index2 > firstNonImportIndex && firstNonImportIndex < this.cssRules.length && this.cssRules[firstNonImportIndex].constructor.name !== "CSSLayerStatementRule") { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "HierarchyRequestError" - ); + this.handleTrailingData(); + this.cbs.onend(); + } + /** Handle any trailing data. */ + handleTrailingData() { + const endIndex = this.buffer.length + this.offset; + if (this.sectionStart >= endIndex) { + return; } - } else if (cssRule.constructor.name === "CSSNamespaceRule") { - var firstImportIndex = -1; - for (var i = 0; i < this.cssRules.length; i++) { - if (this.cssRules[i].constructor.name === "CSSImportRule") { - firstImportIndex = i; - break; + if (this.state === State.InCommentLike) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, endIndex, 0); + } else { + this.cbs.oncomment(this.sectionStart, endIndex, 0); } + } else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) { + } else { + this.cbs.ontext(this.sectionStart, endIndex); } - var firstNonImportNamespaceIndex = findFirstNonConstructorIndex(this.cssRules, [ - "CSSLayerStatementRule", - "CSSImportRule", - "CSSNamespaceRule" - ]); - if (firstImportIndex !== -1 && index2 <= firstImportIndex) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "HierarchyRequestError" - ); + } + emitCodePoint(cp, consumed) { + if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) { + if (this.sectionStart < this.entityStart) { + this.cbs.onattribdata(this.sectionStart, this.entityStart); + } + this.sectionStart = this.entityStart + consumed; + this.index = this.sectionStart - 1; + this.cbs.onattribentity(cp); + } else { + if (this.sectionStart < this.entityStart) { + this.cbs.ontext(this.sectionStart, this.entityStart); + } + this.sectionStart = this.entityStart + consumed; + this.index = this.sectionStart - 1; + this.cbs.ontextentity(cp, this.sectionStart); } - if (firstNonImportNamespaceIndex < this.cssRules.length) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "InvalidStateError" - ); + } + }; + exports2.default = Tokenizer; + } +}); + +// node_modules/htmlparser2/dist/commonjs/Parser.js +var require_Parser = __commonJS({ + "node_modules/htmlparser2/dist/commonjs/Parser.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { + var ownKeys2 = function(o) { + ownKeys2 = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys2(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); } - if (index2 > firstNonImportNamespaceIndex) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "HierarchyRequestError" - ); + __setModuleDefault2(result, mod); + return result; + }; + })(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Parser = void 0; + var Tokenizer_js_1 = __importStar2(require_Tokenizer()); + var decode_1 = require_decode(); + var formTags = /* @__PURE__ */ new Set([ + "input", + "option", + "optgroup", + "select", + "button", + "datalist", + "textarea" + ]); + var pTag = /* @__PURE__ */ new Set(["p"]); + var tableSectionTags = /* @__PURE__ */ new Set(["thead", "tbody"]); + var ddtTags = /* @__PURE__ */ new Set(["dd", "dt"]); + var rtpTags = /* @__PURE__ */ new Set(["rt", "rp"]); + var openImpliesClose = /* @__PURE__ */ new Map([ + ["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])], + ["th", /* @__PURE__ */ new Set(["th"])], + ["td", /* @__PURE__ */ new Set(["thead", "th", "td"])], + ["body", /* @__PURE__ */ new Set(["head", "link", "script"])], + ["li", /* @__PURE__ */ new Set(["li"])], + ["p", pTag], + ["h1", pTag], + ["h2", pTag], + ["h3", pTag], + ["h4", pTag], + ["h5", pTag], + ["h6", pTag], + ["select", formTags], + ["input", formTags], + ["output", formTags], + ["button", formTags], + ["datalist", formTags], + ["textarea", formTags], + ["option", /* @__PURE__ */ new Set(["option"])], + ["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])], + ["dd", ddtTags], + ["dt", ddtTags], + ["address", pTag], + ["article", pTag], + ["aside", pTag], + ["blockquote", pTag], + ["details", pTag], + ["div", pTag], + ["dl", pTag], + ["fieldset", pTag], + ["figcaption", pTag], + ["figure", pTag], + ["footer", pTag], + ["form", pTag], + ["header", pTag], + ["hr", pTag], + ["main", pTag], + ["nav", pTag], + ["ol", pTag], + ["pre", pTag], + ["section", pTag], + ["table", pTag], + ["ul", pTag], + ["rt", rtpTags], + ["rp", rtpTags], + ["tbody", tableSectionTags], + ["tfoot", tableSectionTags] + ]); + var voidElements2 = /* @__PURE__ */ new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr" + ]); + var foreignContextElements = /* @__PURE__ */ new Set(["math", "svg"]); + var htmlIntegrationElements = /* @__PURE__ */ new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignobject", + "desc", + "title" + ]); + var reNameEnd = /\s|\//; + var Parser = class { + constructor(cbs, options = {}) { + var _a, _b, _c, _d, _e, _f; + this.options = options; + this.startIndex = 0; + this.endIndex = 0; + this.openTagStart = 0; + this.tagname = ""; + this.attribname = ""; + this.attribvalue = ""; + this.attribs = null; + this.stack = []; + this.buffers = []; + this.bufferOffset = 0; + this.writeIndex = 0; + this.ended = false; + this.cbs = cbs !== null && cbs !== void 0 ? cbs : {}; + this.htmlMode = !this.options.xmlMode; + this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : this.htmlMode; + this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : this.htmlMode; + this.recognizeSelfClosing = (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode; + this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer_js_1.default)(this.options, this); + this.foreignContext = [!this.htmlMode]; + (_f = (_e = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e, this); + } + // Tokenizer event handlers + /** @internal */ + ontext(start, endIndex) { + var _a, _b; + const data = this.getSlice(start, endIndex); + this.endIndex = endIndex - 1; + (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data); + this.startIndex = endIndex; + } + /** @internal */ + ontextentity(cp, endIndex) { + var _a, _b; + this.endIndex = endIndex - 1; + (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, (0, decode_1.fromCodePoint)(cp)); + this.startIndex = endIndex; + } + /** + * Checks if the current tag is a void element. Override this if you want + * to specify your own additional void elements. + */ + isVoidElement(name) { + return this.htmlMode && voidElements2.has(name); + } + /** @internal */ + onopentagname(start, endIndex) { + this.endIndex = endIndex; + let name = this.getSlice(start, endIndex); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + this.emitOpenTag(name); + } + emitOpenTag(name) { + var _a, _b, _c, _d; + this.openTagStart = this.startIndex; + this.tagname = name; + const impliesClose = this.htmlMode && openImpliesClose.get(name); + if (impliesClose) { + while (this.stack.length > 0 && impliesClose.has(this.stack[0])) { + const element = this.stack.shift(); + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, element, true); + } + } + if (!this.isVoidElement(name)) { + this.stack.unshift(name); + if (this.htmlMode) { + if (foreignContextElements.has(name)) { + this.foreignContext.unshift(true); + } else if (htmlIntegrationElements.has(name)) { + this.foreignContext.unshift(false); + } + } } - } else if (cssRule.constructor.name === "CSSLayerStatementRule") { - } else { - var firstNonSpecialRuleIndex = findFirstNonConstructorIndex(this.cssRules, [ - "CSSLayerStatementRule", - "CSSImportRule", - "CSSNamespaceRule" - ]); - if (index2 < firstNonSpecialRuleIndex) { - errorUtils2.throwError( - this, - "DOMException", - "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", - "HierarchyRequestError" - ); + (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name); + if (this.cbs.onopentag) + this.attribs = {}; + } + endOpenTag(isImplied) { + var _a, _b; + this.startIndex = this.openTagStart; + if (this.attribs) { + (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied); + this.attribs = null; } - if (parseErrors.filter(function(error) { - return !error.isNested; - }).length !== 0) { - errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) { + this.cbs.onclosetag(this.tagname, true); + } + this.tagname = ""; + } + /** @internal */ + onopentagend(endIndex) { + this.endIndex = endIndex; + this.endOpenTag(false); + this.startIndex = endIndex + 1; + } + /** @internal */ + onclosetag(start, endIndex) { + var _a, _b, _c, _d, _e, _f, _g, _h; + this.endIndex = endIndex; + let name = this.getSlice(start, endIndex); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + if (this.htmlMode && (foreignContextElements.has(name) || htmlIntegrationElements.has(name))) { + this.foreignContext.shift(); + } + if (!this.isVoidElement(name)) { + const pos = this.stack.indexOf(name); + if (pos !== -1) { + for (let index2 = 0; index2 <= pos; index2++) { + const element = this.stack.shift(); + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, element, index2 !== pos); + } + } else if (this.htmlMode && name === "p") { + this.emitOpenTag("p"); + this.closeCurrentTag(true); + } + } else if (this.htmlMode && name === "br") { + (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, "br"); + (_f = (_e = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", {}, true); + (_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, "br", false); + } + this.startIndex = endIndex + 1; + } + /** @internal */ + onselfclosingtag(endIndex) { + this.endIndex = endIndex; + if (this.recognizeSelfClosing || this.foreignContext[0]) { + this.closeCurrentTag(false); + this.startIndex = endIndex + 1; + } else { + this.onopentagend(endIndex); } } - cssRule.__parentStyleSheet = this; - this.cssRules.splice(index2, 0, cssRule); - return index2; - }; - CSSOM2.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2) { - if (index2 === void 0) { - index2 = this.cssRules.length; + closeCurrentTag(isOpenImplied) { + var _a, _b; + const name = this.tagname; + this.endOpenTag(isOpenImplied); + if (this.stack[0] === name) { + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied); + this.stack.shift(); + } } - this.insertRule(selector + "{" + styleBlock + "}", index2); - return -1; - }; - CSSOM2.CSSStyleSheet.prototype.deleteRule = function(index2) { - if (index2 === void 0) { - errorUtils2.throwMissingArguments(this, "deleteRule", this.constructor.name); + /** @internal */ + onattribname(start, endIndex) { + this.startIndex = start; + const name = this.getSlice(start, endIndex); + this.attribname = this.lowerCaseAttributeNames ? name.toLowerCase() : name; } - index2 = Number(index2); - if (index2 < 0) { - index2 = 4294967296 + index2; + /** @internal */ + onattribdata(start, endIndex) { + this.attribvalue += this.getSlice(start, endIndex); } - if (index2 >= this.cssRules.length) { - errorUtils2.throwIndexError(this, "deleteRule", this.constructor.name, index2, this.cssRules.length); + /** @internal */ + onattribentity(cp) { + this.attribvalue += (0, decode_1.fromCodePoint)(cp); } - if (this.cssRules[index2]) { - if (this.cssRules[index2].constructor.name == "CSSNamespaceRule") { - var shouldContinue = this.cssRules.every(function(rule) { - return ["CSSImportRule", "CSSLayerStatementRule", "CSSNamespaceRule"].indexOf(rule.constructor.name) !== -1; - }); - if (!shouldContinue) { - errorUtils2.throwError(this, "DOMException", "Failed to execute 'deleteRule' on '" + this.constructor.name + "': Failed to delete rule.", "InvalidStateError"); - } + /** @internal */ + onattribend(quote, endIndex) { + var _a, _b; + this.endIndex = endIndex; + (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === Tokenizer_js_1.QuoteType.Double ? '"' : quote === Tokenizer_js_1.QuoteType.Single ? "'" : quote === Tokenizer_js_1.QuoteType.NoValue ? void 0 : null); + if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) { + this.attribs[this.attribname] = this.attribvalue; } - if (this.cssRules[index2].constructor.name == "CSSImportRule") { - this.cssRules[index2].styleSheet.__parentStyleSheet = null; + this.attribvalue = ""; + } + getInstructionName(value) { + const index2 = value.search(reNameEnd); + let name = index2 < 0 ? value : value.substr(0, index2); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); } - this.cssRules[index2].__parentStyleSheet = null; + return name; } - this.cssRules.splice(index2, 1); - }; - CSSOM2.CSSStyleSheet.prototype.removeRule = function(index2) { - if (index2 === void 0) { - index2 = 0; + /** @internal */ + ondeclaration(start, endIndex) { + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex); + if (this.cbs.onprocessinginstruction) { + const name = this.getInstructionName(value); + this.cbs.onprocessinginstruction(`!${name}`, `!${value}`); + } + this.startIndex = endIndex + 1; + } + /** @internal */ + onprocessinginstruction(start, endIndex) { + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex); + if (this.cbs.onprocessinginstruction) { + const name = this.getInstructionName(value); + this.cbs.onprocessinginstruction(`?${name}`, `?${value}`); + } + this.startIndex = endIndex + 1; + } + /** @internal */ + oncomment(start, endIndex, offset) { + var _a, _b, _c, _d; + this.endIndex = endIndex; + (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset)); + (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c); + this.startIndex = endIndex + 1; + } + /** @internal */ + oncdata(start, endIndex, offset) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex - offset); + if (!this.htmlMode || this.options.recognizeCDATA) { + (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a); + (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value); + (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e); + } else { + (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`); + (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j); + } + this.startIndex = endIndex + 1; } - this.deleteRule(index2); - }; - CSSOM2.CSSStyleSheet.prototype.replace = function(text) { - var _Promise; - if (this.__globalObject && this.__globalObject["Promise"]) { - _Promise = this.__globalObject["Promise"]; - } else { - _Promise = Promise; + /** @internal */ + onend() { + var _a, _b; + if (this.cbs.onclosetag) { + this.endIndex = this.startIndex; + for (let index2 = 0; index2 < this.stack.length; index2++) { + this.cbs.onclosetag(this.stack[index2], true); + } + } + (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a); } - var _setTimeout; - if (this.__globalObject && this.__globalObject["setTimeout"]) { - _setTimeout = this.__globalObject["setTimeout"]; - } else { - _setTimeout = setTimeout; + /** + * Resets the parser to a blank state, ready to parse a new HTML document + */ + reset() { + var _a, _b, _c, _d; + (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a); + this.tokenizer.reset(); + this.tagname = ""; + this.attribname = ""; + this.attribs = null; + this.stack.length = 0; + this.startIndex = 0; + this.endIndex = 0; + (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this); + this.buffers.length = 0; + this.foreignContext.length = 0; + this.foreignContext.unshift(!this.htmlMode); + this.bufferOffset = 0; + this.writeIndex = 0; + this.ended = false; } - var sheet = this; - return new _Promise(function(resolve, reject) { - if (!sheet.__constructed || sheet.__disallowModification) { - reject(errorUtils2.createError( - sheet, - "DOMException", - "Failed to execute 'replaceSync' on '" + sheet.constructor.name + "': Not allowed.", - "NotAllowedError" - )); + /** + * Resets the parser, then parses a complete document and + * pushes it to the handler. + * + * @param data Document to parse. + */ + parseComplete(data) { + this.reset(); + this.end(data); + } + getSlice(start, end) { + while (start - this.bufferOffset >= this.buffers[0].length) { + this.shiftBuffer(); } - sheet.__disallowModification = true; - _setTimeout(function() { - var rules = new CSSOM2.CSSRuleList(); - CSSOM2.parse(text, { styleSheet: sheet, cssRules: rules }); - var i = 0; - while (i < rules.length) { - if (rules[i].constructor.name === "CSSImportRule") { - rules.splice(i, 1); - } else { - i++; - } - } - sheet.__cssRules.splice.apply(sheet.__cssRules, [0, sheet.__cssRules.length].concat(rules)); - delete sheet.__disallowModification; - resolve(sheet); - }); - }); - }; - CSSOM2.CSSStyleSheet.prototype.replaceSync = function(text) { - var sheet = this; - if (!sheet.__constructed || sheet.__disallowModification) { - errorUtils2.throwError( - sheet, - "DOMException", - "Failed to execute 'replaceSync' on '" + sheet.constructor.name + "': Not allowed.", - "NotAllowedError" - ); + let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset); + while (end - this.bufferOffset > this.buffers[0].length) { + this.shiftBuffer(); + slice += this.buffers[0].slice(0, end - this.bufferOffset); + } + return slice; } - var rules = new CSSOM2.CSSRuleList(); - CSSOM2.parse(text, { styleSheet: sheet, cssRules: rules }); - var i = 0; - while (i < rules.length) { - if (rules[i].constructor.name === "CSSImportRule") { - rules.splice(i, 1); - } else { - i++; + shiftBuffer() { + this.bufferOffset += this.buffers[0].length; + this.writeIndex--; + this.buffers.shift(); + } + /** + * Parses a chunk of data and calls the corresponding callbacks. + * + * @param chunk Chunk to parse. + */ + write(chunk) { + var _a, _b; + if (this.ended) { + (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(".write() after done!")); + return; + } + this.buffers.push(chunk); + if (this.tokenizer.running) { + this.tokenizer.write(chunk); + this.writeIndex++; } } - sheet.__cssRules.splice.apply(sheet.__cssRules, [0, sheet.__cssRules.length].concat(rules)); - }; - CSSOM2.CSSStyleSheet.prototype.toString = function() { - var result = ""; - var rules = this.cssRules; - for (var i = 0; i < rules.length; i++) { - result += rules[i].cssText + "\n"; + /** + * Parses the end of the buffer and clears the stack, calls onend. + * + * @param chunk Optional final chunk to parse. + */ + end(chunk) { + var _a, _b; + if (this.ended) { + (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(".end() after done!")); + return; + } + if (chunk) + this.write(chunk); + this.ended = true; + this.tokenizer.end(); + } + /** + * Pauses parsing. The parser won't emit events until `resume` is called. + */ + pause() { + this.tokenizer.pause(); + } + /** + * Resumes parsing after `pause` was called. + */ + resume() { + this.tokenizer.resume(); + while (this.tokenizer.running && this.writeIndex < this.buffers.length) { + this.tokenizer.write(this.buffers[this.writeIndex++]); + } + if (this.ended) + this.tokenizer.end(); + } + /** + * Alias of `write`, for backwards compatibility. + * + * @param chunk Chunk to parse. + * @deprecated + */ + parseChunk(chunk) { + this.write(chunk); + } + /** + * Alias of `end`, for backwards compatibility. + * + * @param chunk Optional final chunk to parse. + * @deprecated + */ + done(chunk) { + this.end(chunk); } - return result; }; - exports2.CSSStyleSheet = CSSOM2.CSSStyleSheet; - CSSOM2.parse = require_parse3().parse; + exports2.Parser = Parser; } }); -// node_modules/@acemir/cssom/lib/CSSNestedDeclarations.js -var require_CSSNestedDeclarations = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSNestedDeclarations.js"(exports2) { +// node_modules/domelementtype/lib/index.js +var require_lib5 = __commonJS({ + "node_modules/domelementtype/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration - }; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { - } - CSSOM2.CSSNestedDeclarations = function CSSNestedDeclarations() { - CSSOM2.CSSRule.call(this); - this.__style = new CSSOM2.CSSStyleDeclaration(); - this.__style.parentRule = this; - }; - CSSOM2.CSSNestedDeclarations.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSNestedDeclarations.prototype.constructor = CSSOM2.CSSNestedDeclarations; - Object.setPrototypeOf(CSSOM2.CSSNestedDeclarations, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "type", { - value: 0, - writable: false - }); - Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "style", { - get: function() { - return this.__style; - }, - set: function(value) { - if (typeof value === "string") { - this.__style.cssText = value; - } else { - this.__style = value; - } - } - }); - Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "cssText", { - get: function() { - return this.style.cssText; - } - }); - exports2.CSSNestedDeclarations = CSSOM2.CSSNestedDeclarations; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Doctype = exports2.CDATA = exports2.Tag = exports2.Style = exports2.Script = exports2.Comment = exports2.Directive = exports2.Text = exports2.Root = exports2.isTag = exports2.ElementType = void 0; + var ElementType4; + (function(ElementType5) { + ElementType5["Root"] = "root"; + ElementType5["Text"] = "text"; + ElementType5["Directive"] = "directive"; + ElementType5["Comment"] = "comment"; + ElementType5["Script"] = "script"; + ElementType5["Style"] = "style"; + ElementType5["Tag"] = "tag"; + ElementType5["CDATA"] = "cdata"; + ElementType5["Doctype"] = "doctype"; + })(ElementType4 = exports2.ElementType || (exports2.ElementType = {})); + function isTag3(elem) { + return elem.type === ElementType4.Tag || elem.type === ElementType4.Script || elem.type === ElementType4.Style; + } + exports2.isTag = isTag3; + exports2.Root = ElementType4.Root; + exports2.Text = ElementType4.Text; + exports2.Directive = ElementType4.Directive; + exports2.Comment = ElementType4.Comment; + exports2.Script = ElementType4.Script; + exports2.Style = ElementType4.Style; + exports2.Tag = ElementType4.Tag; + exports2.CDATA = ElementType4.CDATA; + exports2.Doctype = ElementType4.Doctype; } }); -// node_modules/@acemir/cssom/lib/CSSImportRule.js -var require_CSSImportRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSImportRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domhandler/lib/node.js +var require_node2 = __commonJS({ + "node_modules/htmlparser2/node_modules/domhandler/lib/node.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet, - MediaList: require_MediaList().MediaList - }; - var regexPatterns = require_regexPatterns().regexPatterns; - CSSOM2.CSSImportRule = function CSSImportRule() { - CSSOM2.CSSRule.call(this); - this.__href = ""; - this.__media = new CSSOM2.MediaList(); - this.__layerName = null; - this.__supportsText = null; - this.__styleSheet = new CSSOM2.CSSStyleSheet(); + var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ (function() { + var extendStatics2 = function(d, b) { + extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics2(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics2(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __assign2 = exports2 && exports2.__assign || function() { + __assign2 = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign2.apply(this, arguments); }; - CSSOM2.CSSImportRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSImportRule.prototype.constructor = CSSOM2.CSSImportRule; - Object.setPrototypeOf(CSSOM2.CSSImportRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "type", { - value: 3, - writable: false - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "cssText", { - get: function() { - var mediaText = this.media.mediaText; - return '@import url("' + this.href.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '")' + (this.layerName !== null ? " layer" + (this.layerName && "(" + this.layerName + ")") : "") + (this.supportsText ? " supports(" + this.supportsText + ")" : "") + (mediaText ? " " + mediaText : "") + ";"; - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "href", { - get: function() { - return this.__href; - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "media", { - get: function() { - return this.__media; - }, - set: function(value) { - if (typeof value === "string") { - this.__media.mediaText = value; - } else { - this.__media = value; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.cloneNode = exports2.hasChildren = exports2.isDocument = exports2.isDirective = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = exports2.Element = exports2.Document = exports2.CDATA = exports2.NodeWithChildren = exports2.ProcessingInstruction = exports2.Comment = exports2.Text = exports2.DataNode = exports2.Node = void 0; + var domelementtype_1 = require_lib5(); + var Node = ( + /** @class */ + (function() { + function Node2() { + this.parent = null; + this.prev = null; + this.next = null; + this.startIndex = null; + this.endIndex = null; } - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "layerName", { - get: function() { - return this.__layerName; - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "supportsText", { - get: function() { - return this.__supportsText; - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "styleSheet", { - get: function() { - return this.__styleSheet; - } - }); - Object.defineProperty(CSSOM2.CSSImportRule.prototype, "parse", { - value: function(cssText) { - var i = 0; - var state = ""; - var buffer = ""; - var index2; - var layerRegExp = regexPatterns.layerRegExp; - var layerRuleNameRegExp = regexPatterns.layerRuleNameRegExp; - var doubleOrMoreSpacesRegExp = regexPatterns.doubleOrMoreSpacesRegExp; - function extractSupportsContent(text) { - var supportsIndex = text.indexOf("supports("); - if (supportsIndex !== 0) { - return null; - } - var depth = 0; - var start = supportsIndex + "supports(".length; - var i2 = start; - for (; i2 < text.length; i2++) { - if (text[i2] === "(") { - depth++; - } else if (text[i2] === ")") { - if (depth === 0) { - return { - content: text.slice(start, i2), - endIndex: i2 - }; - } - depth--; - } + Object.defineProperty(Node2.prototype, "parentNode", { + // Read-write aliases for properties + /** + * Same as {@link parent}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.parent; + }, + set: function(parent) { + this.parent = parent; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Node2.prototype, "previousSibling", { + /** + * Same as {@link prev}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.prev; + }, + set: function(prev) { + this.prev = prev; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Node2.prototype, "nextSibling", { + /** + * Same as {@link next}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.next; + }, + set: function(next) { + this.next = next; + }, + enumerable: false, + configurable: true + }); + Node2.prototype.cloneNode = function(recursive) { + if (recursive === void 0) { + recursive = false; } - return null; + return cloneNode(this, recursive); + }; + return Node2; + })() + ); + exports2.Node = Node; + var DataNode = ( + /** @class */ + (function(_super) { + __extends2(DataNode2, _super); + function DataNode2(data) { + var _this = _super.call(this) || this; + _this.data = data; + return _this; } - for (var character; character = cssText.charAt(i); i++) { - switch (character) { - case " ": - case " ": - case "\r": - case "\n": - case "\f": - if (state === "after-import") { - state = "url"; - } else { - buffer += character; - } - break; - case "@": - if (!state && cssText.indexOf("@import", i) === i) { - state = "after-import"; - i += "import".length; - buffer = ""; - } - break; - case "u": - if (state === "media") { - buffer += character; - } - if (state === "url" && cssText.indexOf("url(", i) === i) { - index2 = cssText.indexOf(")", i + 1); - if (index2 === -1) { - throw i + ': ")" not found'; - } - i += "url(".length; - var url = cssText.slice(i, index2); - if (url[0] === url[url.length - 1]) { - if (url[0] === '"' || url[0] === "'") { - url = url.slice(1, -1); - } - } - this.__href = url; - i = index2; - state = "media"; - } - break; - case '"': - if (state === "after-import" || state === "url") { - index2 = cssText.indexOf('"', i + 1); - if (!index2) { - throw i + `: '"' not found`; - } - this.__href = cssText.slice(i + 1, index2); - i = index2; - state = "media"; - } - break; - case "'": - if (state === "after-import" || state === "url") { - index2 = cssText.indexOf("'", i + 1); - if (!index2) { - throw i + `: "'" not found`; - } - this.__href = cssText.slice(i + 1, index2); - i = index2; - state = "media"; - } - break; - case ";": - if (state === "media") { - if (buffer) { - var bufferTrimmed = buffer.trim(); - if (bufferTrimmed.indexOf("layer") === 0) { - var layerMatch = bufferTrimmed.match(layerRegExp); - if (layerMatch) { - var layerName = layerMatch[1].trim(); - if (layerName.match(layerRuleNameRegExp) !== null) { - this.__layerName = layerMatch[1].trim(); - bufferTrimmed = bufferTrimmed.replace(layerRegExp, "").replace(doubleOrMoreSpacesRegExp, " ").trim(); - } else { - if (bufferTrimmed) { - this.media.mediaText = bufferTrimmed; - return; - } - } - } else { - this.__layerName = ""; - bufferTrimmed = bufferTrimmed.substring("layer".length).trim(); - } - } - var supportsResult = extractSupportsContent(bufferTrimmed); - if (supportsResult) { - this.__supportsText = supportsResult.content.trim(); - bufferTrimmed = bufferTrimmed.slice(0, 0) + bufferTrimmed.slice(supportsResult.endIndex + 1); - bufferTrimmed = bufferTrimmed.replace(doubleOrMoreSpacesRegExp, " ").trim(); - } - if (bufferTrimmed) { - this.media.mediaText = bufferTrimmed; - } - } - } - break; - default: - if (state === "media") { - buffer += character; - } - break; + Object.defineProperty(DataNode2.prototype, "nodeValue", { + /** + * Same as {@link data}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.data; + }, + set: function(data) { + this.data = data; + }, + enumerable: false, + configurable: true + }); + return DataNode2; + })(Node) + ); + exports2.DataNode = DataNode; + var Text4 = ( + /** @class */ + (function(_super) { + __extends2(Text5, _super); + function Text5() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Text; + return _this; + } + Object.defineProperty(Text5.prototype, "nodeType", { + get: function() { + return 3; + }, + enumerable: false, + configurable: true + }); + return Text5; + })(DataNode) + ); + exports2.Text = Text4; + var Comment4 = ( + /** @class */ + (function(_super) { + __extends2(Comment5, _super); + function Comment5() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Comment; + return _this; + } + Object.defineProperty(Comment5.prototype, "nodeType", { + get: function() { + return 8; + }, + enumerable: false, + configurable: true + }); + return Comment5; + })(DataNode) + ); + exports2.Comment = Comment4; + var ProcessingInstruction = ( + /** @class */ + (function(_super) { + __extends2(ProcessingInstruction2, _super); + function ProcessingInstruction2(name, data) { + var _this = _super.call(this, data) || this; + _this.name = name; + _this.type = domelementtype_1.ElementType.Directive; + return _this; + } + Object.defineProperty(ProcessingInstruction2.prototype, "nodeType", { + get: function() { + return 1; + }, + enumerable: false, + configurable: true + }); + return ProcessingInstruction2; + })(DataNode) + ); + exports2.ProcessingInstruction = ProcessingInstruction; + var NodeWithChildren = ( + /** @class */ + (function(_super) { + __extends2(NodeWithChildren2, _super); + function NodeWithChildren2(children) { + var _this = _super.call(this) || this; + _this.children = children; + return _this; + } + Object.defineProperty(NodeWithChildren2.prototype, "firstChild", { + // Aliases + /** First child of the node. */ + get: function() { + var _a; + return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NodeWithChildren2.prototype, "lastChild", { + /** Last child of the node. */ + get: function() { + return this.children.length > 0 ? this.children[this.children.length - 1] : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NodeWithChildren2.prototype, "childNodes", { + /** + * Same as {@link children}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.children; + }, + set: function(children) { + this.children = children; + }, + enumerable: false, + configurable: true + }); + return NodeWithChildren2; + })(Node) + ); + exports2.NodeWithChildren = NodeWithChildren; + var CDATA4 = ( + /** @class */ + (function(_super) { + __extends2(CDATA5, _super); + function CDATA5() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.CDATA; + return _this; + } + Object.defineProperty(CDATA5.prototype, "nodeType", { + get: function() { + return 4; + }, + enumerable: false, + configurable: true + }); + return CDATA5; + })(NodeWithChildren) + ); + exports2.CDATA = CDATA4; + var Document = ( + /** @class */ + (function(_super) { + __extends2(Document2, _super); + function Document2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Root; + return _this; + } + Object.defineProperty(Document2.prototype, "nodeType", { + get: function() { + return 9; + }, + enumerable: false, + configurable: true + }); + return Document2; + })(NodeWithChildren) + ); + exports2.Document = Document; + var Element = ( + /** @class */ + (function(_super) { + __extends2(Element2, _super); + function Element2(name, attribs, children, type) { + if (children === void 0) { + children = []; + } + if (type === void 0) { + type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag; } + var _this = _super.call(this, children) || this; + _this.name = name; + _this.attribs = attribs; + _this.type = type; + return _this; } + Object.defineProperty(Element2.prototype, "nodeType", { + get: function() { + return 1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Element2.prototype, "tagName", { + // DOM Level 1 aliases + /** + * Same as {@link name}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.name; + }, + set: function(name) { + this.name = name; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Element2.prototype, "attributes", { + get: function() { + var _this = this; + return Object.keys(this.attribs).map(function(name) { + var _a, _b; + return { + name, + value: _this.attribs[name], + namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name], + prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name] + }; + }); + }, + enumerable: false, + configurable: true + }); + return Element2; + })(NodeWithChildren) + ); + exports2.Element = Element; + function isTag3(node) { + return (0, domelementtype_1.isTag)(node); + } + exports2.isTag = isTag3; + function isCDATA2(node) { + return node.type === domelementtype_1.ElementType.CDATA; + } + exports2.isCDATA = isCDATA2; + function isText2(node) { + return node.type === domelementtype_1.ElementType.Text; + } + exports2.isText = isText2; + function isComment2(node) { + return node.type === domelementtype_1.ElementType.Comment; + } + exports2.isComment = isComment2; + function isDirective(node) { + return node.type === domelementtype_1.ElementType.Directive; + } + exports2.isDirective = isDirective; + function isDocument(node) { + return node.type === domelementtype_1.ElementType.Root; + } + exports2.isDocument = isDocument; + function hasChildren2(node) { + return Object.prototype.hasOwnProperty.call(node, "children"); + } + exports2.hasChildren = hasChildren2; + function cloneNode(node, recursive) { + if (recursive === void 0) { + recursive = false; } - }); - exports2.CSSImportRule = CSSOM2.CSSImportRule; + var result; + if (isText2(node)) { + result = new Text4(node.data); + } else if (isComment2(node)) { + result = new Comment4(node.data); + } else if (isTag3(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_1 = new Element(node.name, __assign2({}, node.attribs), children); + children.forEach(function(child) { + return child.parent = clone_1; + }); + if (node.namespace != null) { + clone_1.namespace = node.namespace; + } + if (node["x-attribsNamespace"]) { + clone_1["x-attribsNamespace"] = __assign2({}, node["x-attribsNamespace"]); + } + if (node["x-attribsPrefix"]) { + clone_1["x-attribsPrefix"] = __assign2({}, node["x-attribsPrefix"]); + } + result = clone_1; + } else if (isCDATA2(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_2 = new CDATA4(children); + children.forEach(function(child) { + return child.parent = clone_2; + }); + result = clone_2; + } else if (isDocument(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_3 = new Document(children); + children.forEach(function(child) { + return child.parent = clone_3; + }); + if (node["x-mode"]) { + clone_3["x-mode"] = node["x-mode"]; + } + result = clone_3; + } else if (isDirective(node)) { + var instruction = new ProcessingInstruction(node.name, node.data); + if (node["x-name"] != null) { + instruction["x-name"] = node["x-name"]; + instruction["x-publicId"] = node["x-publicId"]; + instruction["x-systemId"] = node["x-systemId"]; + } + result = instruction; + } else { + throw new Error("Not implemented yet: ".concat(node.type)); + } + result.startIndex = node.startIndex; + result.endIndex = node.endIndex; + if (node.sourceCodeLocation != null) { + result.sourceCodeLocation = node.sourceCodeLocation; + } + return result; + } + exports2.cloneNode = cloneNode; + function cloneChildren(childs) { + var children = childs.map(function(child) { + return cloneNode(child, true); + }); + for (var i = 1; i < children.length; i++) { + children[i].prev = children[i - 1]; + children[i - 1].next = children[i]; + } + return children; + } } }); -// node_modules/@acemir/cssom/lib/CSSNamespaceRule.js -var require_CSSNamespaceRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSNamespaceRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domhandler/lib/index.js +var require_lib6 = __commonJS({ + "node_modules/htmlparser2/node_modules/domhandler/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; - CSSOM2.CSSNamespaceRule = function CSSNamespaceRule() { - CSSOM2.CSSRule.call(this); - this.__prefix = ""; - this.__namespaceURI = ""; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DomHandler = void 0; + var domelementtype_1 = require_lib5(); + var node_js_1 = require_node2(); + __exportStar2(require_node2(), exports2); + var defaultOpts = { + withStartIndices: false, + withEndIndices: false, + xmlMode: false }; - CSSOM2.CSSNamespaceRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSNamespaceRule.prototype.constructor = CSSOM2.CSSNamespaceRule; - Object.setPrototypeOf(CSSOM2.CSSNamespaceRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "type", { - value: 10, - writable: false - }); - Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "cssText", { - get: function() { - return "@namespace" + (this.prefix && " " + this.prefix) + ' url("' + this.namespaceURI + '");'; - } - }); - Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "prefix", { - get: function() { - return this.__prefix; - } - }); - Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "namespaceURI", { - get: function() { - return this.__namespaceURI; - } - }); - Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "parse", { - value: function(cssText) { - var newPrefix = ""; - var newNamespaceURI = ""; - var text = cssText.trim(); - if (text.indexOf("@namespace") === 0) { - text = text.slice("@namespace".length).trim(); - } - if (text.charAt(text.length - 1) === ";") { - text = text.slice(0, -1).trim(); - } - var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s*|([^)]*?))\s*\)|(['"])(.*?)\5)$/; - var match = text.match(re); - if (match) { - if (match[1]) { - newPrefix = match[1]; + var DomHandler = ( + /** @class */ + (function() { + function DomHandler2(callback, options, elementCB) { + this.dom = []; + this.root = new node_js_1.Document(this.dom); + this.done = false; + this.tagStack = [this.root]; + this.lastNode = null; + this.parser = null; + if (typeof options === "function") { + elementCB = options; + options = defaultOpts; } - if (typeof match[3] !== "undefined") { - newNamespaceURI = match[3]; - } else if (typeof match[4] !== "undefined") { - newNamespaceURI = match[4].trim(); - } else if (typeof match[6] !== "undefined") { - newNamespaceURI = match[6]; + if (typeof callback === "object") { + options = callback; + callback = void 0; } - this.__prefix = newPrefix; - this.__namespaceURI = newNamespaceURI; - } else { - throw new DOMException("Invalid @namespace rule", "InvalidStateError"); + this.callback = callback !== null && callback !== void 0 ? callback : null; + this.options = options !== null && options !== void 0 ? options : defaultOpts; + this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null; } - } - }); - exports2.CSSNamespaceRule = CSSOM2.CSSNamespaceRule; + DomHandler2.prototype.onparserinit = function(parser) { + this.parser = parser; + }; + DomHandler2.prototype.onreset = function() { + this.dom = []; + this.root = new node_js_1.Document(this.dom); + this.done = false; + this.tagStack = [this.root]; + this.lastNode = null; + this.parser = null; + }; + DomHandler2.prototype.onend = function() { + if (this.done) + return; + this.done = true; + this.parser = null; + this.handleCallback(null); + }; + DomHandler2.prototype.onerror = function(error) { + this.handleCallback(error); + }; + DomHandler2.prototype.onclosetag = function() { + this.lastNode = null; + var elem = this.tagStack.pop(); + if (this.options.withEndIndices) { + elem.endIndex = this.parser.endIndex; + } + if (this.elementCB) + this.elementCB(elem); + }; + DomHandler2.prototype.onopentag = function(name, attribs) { + var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0; + var element = new node_js_1.Element(name, attribs, void 0, type); + this.addNode(element); + this.tagStack.push(element); + }; + DomHandler2.prototype.ontext = function(data) { + var lastNode = this.lastNode; + if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) { + lastNode.data += data; + if (this.options.withEndIndices) { + lastNode.endIndex = this.parser.endIndex; + } + } else { + var node = new node_js_1.Text(data); + this.addNode(node); + this.lastNode = node; + } + }; + DomHandler2.prototype.oncomment = function(data) { + if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) { + this.lastNode.data += data; + return; + } + var node = new node_js_1.Comment(data); + this.addNode(node); + this.lastNode = node; + }; + DomHandler2.prototype.oncommentend = function() { + this.lastNode = null; + }; + DomHandler2.prototype.oncdatastart = function() { + var text = new node_js_1.Text(""); + var node = new node_js_1.CDATA([text]); + this.addNode(node); + text.parent = node; + this.lastNode = text; + }; + DomHandler2.prototype.oncdataend = function() { + this.lastNode = null; + }; + DomHandler2.prototype.onprocessinginstruction = function(name, data) { + var node = new node_js_1.ProcessingInstruction(name, data); + this.addNode(node); + }; + DomHandler2.prototype.handleCallback = function(error) { + if (typeof this.callback === "function") { + this.callback(error, this.dom); + } else if (error) { + throw error; + } + }; + DomHandler2.prototype.addNode = function(node) { + var parent = this.tagStack[this.tagStack.length - 1]; + var previousSibling = parent.children[parent.children.length - 1]; + if (this.options.withStartIndices) { + node.startIndex = this.parser.startIndex; + } + if (this.options.withEndIndices) { + node.endIndex = this.parser.endIndex; + } + parent.children.push(node); + if (previousSibling) { + node.prev = previousSibling; + previousSibling.next = node; + } + node.parent = parent; + this.lastNode = null; + }; + return DomHandler2; + })() + ); + exports2.DomHandler = DomHandler; + exports2.default = DomHandler; } }); -// node_modules/@acemir/cssom/lib/CSSConditionRule.js -var require_CSSConditionRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSConditionRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-html.js +var require_decode_data_html2 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-html.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - CSSOM2.CSSConditionRule = function CSSConditionRule() { - CSSOM2.CSSGroupingRule.call(this); - this.__conditionText = ""; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.default = new Uint16Array( + // prettier-ignore + '\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(function(c) { + return c.charCodeAt(0); + }) + ); + } +}); + +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-xml.js +var require_decode_data_xml2 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-xml.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.default = new Uint16Array( + // prettier-ignore + "\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(function(c) { + return c.charCodeAt(0); + }) + ); + } +}); + +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.js +var require_decode_codepoint2 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var _a; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.replaceCodePoint = exports2.fromCodePoint = void 0; + var decodeMap = /* @__PURE__ */ new Map([ + [0, 65533], + // C1 Unicode control character reference replacements + [128, 8364], + [130, 8218], + [131, 402], + [132, 8222], + [133, 8230], + [134, 8224], + [135, 8225], + [136, 710], + [137, 8240], + [138, 352], + [139, 8249], + [140, 338], + [142, 381], + [145, 8216], + [146, 8217], + [147, 8220], + [148, 8221], + [149, 8226], + [150, 8211], + [151, 8212], + [152, 732], + [153, 8482], + [154, 353], + [155, 8250], + [156, 339], + [158, 382], + [159, 376] + ]); + exports2.fromCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins + (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function(codePoint) { + var output = ""; + if (codePoint > 65535) { + codePoint -= 65536; + output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); + codePoint = 56320 | codePoint & 1023; + } + output += String.fromCharCode(codePoint); + return output; }; - CSSOM2.CSSConditionRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSConditionRule.prototype.constructor = CSSOM2.CSSConditionRule; - Object.setPrototypeOf(CSSOM2.CSSConditionRule, CSSOM2.CSSGroupingRule); - Object.defineProperty(CSSOM2.CSSConditionRule.prototype, "conditionText", { - get: function() { - return this.__conditionText; + function replaceCodePoint(codePoint) { + var _a2; + if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { + return 65533; } - }); - exports2.CSSConditionRule = CSSOM2.CSSConditionRule; + return (_a2 = decodeMap.get(codePoint)) !== null && _a2 !== void 0 ? _a2 : codePoint; + } + exports2.replaceCodePoint = replaceCodePoint; + function decodeCodePoint(codePoint) { + return (0, exports2.fromCodePoint)(replaceCodePoint(codePoint)); + } + exports2.default = decodeCodePoint; } }); -// node_modules/@acemir/cssom/lib/CSSMediaRule.js -var require_CSSMediaRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSMediaRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/decode.js +var require_decode2 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/decode.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, - CSSConditionRule: require_CSSConditionRule().CSSConditionRule, - MediaList: require_MediaList().MediaList - }; - CSSOM2.CSSMediaRule = function CSSMediaRule() { - CSSOM2.CSSConditionRule.call(this); - this.__media = new CSSOM2.MediaList(); - }; - CSSOM2.CSSMediaRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); - CSSOM2.CSSMediaRule.prototype.constructor = CSSOM2.CSSMediaRule; - Object.setPrototypeOf(CSSOM2.CSSMediaRule, CSSOM2.CSSConditionRule); - Object.defineProperty(CSSOM2.CSSMediaRule.prototype, "type", { - value: 4, - writable: false + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; }); - Object.defineProperties(CSSOM2.CSSMediaRule.prototype, { - "media": { - get: function() { - return this.__media; - }, - set: function(value) { - if (typeof value === "string") { - this.__media.mediaText = value; - } else { - this.__media = value; + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decodeXML = exports2.decodeHTMLStrict = exports2.decodeHTMLAttribute = exports2.decodeHTML = exports2.determineBranch = exports2.EntityDecoder = exports2.DecodingMode = exports2.BinTrieFlags = exports2.fromCodePoint = exports2.replaceCodePoint = exports2.decodeCodePoint = exports2.xmlDecodeTree = exports2.htmlDecodeTree = void 0; + var decode_data_html_js_1 = __importDefault2(require_decode_data_html2()); + exports2.htmlDecodeTree = decode_data_html_js_1.default; + var decode_data_xml_js_1 = __importDefault2(require_decode_data_xml2()); + exports2.xmlDecodeTree = decode_data_xml_js_1.default; + var decode_codepoint_js_1 = __importStar2(require_decode_codepoint2()); + exports2.decodeCodePoint = decode_codepoint_js_1.default; + var decode_codepoint_js_2 = require_decode_codepoint2(); + Object.defineProperty(exports2, "replaceCodePoint", { enumerable: true, get: function() { + return decode_codepoint_js_2.replaceCodePoint; + } }); + Object.defineProperty(exports2, "fromCodePoint", { enumerable: true, get: function() { + return decode_codepoint_js_2.fromCodePoint; + } }); + var CharCodes; + (function(CharCodes2) { + CharCodes2[CharCodes2["NUM"] = 35] = "NUM"; + CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI"; + CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS"; + CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO"; + CharCodes2[CharCodes2["NINE"] = 57] = "NINE"; + CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A"; + CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F"; + CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X"; + CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z"; + CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A"; + CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F"; + CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z"; + })(CharCodes || (CharCodes = {})); + var TO_LOWER_BIT = 32; + var BinTrieFlags; + (function(BinTrieFlags2) { + BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH"; + BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH"; + BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE"; + })(BinTrieFlags = exports2.BinTrieFlags || (exports2.BinTrieFlags = {})); + function isNumber(code) { + return code >= CharCodes.ZERO && code <= CharCodes.NINE; + } + function isHexadecimalCharacter(code) { + return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F; + } + function isAsciiAlphaNumeric(code) { + return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code); + } + function isEntityInAttributeInvalidEnd(code) { + return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code); + } + var EntityDecoderState; + (function(EntityDecoderState2) { + EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart"; + EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart"; + EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal"; + EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex"; + EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity"; + })(EntityDecoderState || (EntityDecoderState = {})); + var DecodingMode; + (function(DecodingMode2) { + DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy"; + DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict"; + DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute"; + })(DecodingMode = exports2.DecodingMode || (exports2.DecodingMode = {})); + var EntityDecoder = ( + /** @class */ + (function() { + function EntityDecoder2(decodeTree, emitCodePoint, errors) { + this.decodeTree = decodeTree; + this.emitCodePoint = emitCodePoint; + this.errors = errors; + this.state = EntityDecoderState.EntityStart; + this.consumed = 1; + this.result = 0; + this.treeIndex = 0; + this.excess = 1; + this.decodeMode = DecodingMode.Strict; + } + EntityDecoder2.prototype.startEntity = function(decodeMode) { + this.decodeMode = decodeMode; + this.state = EntityDecoderState.EntityStart; + this.result = 0; + this.treeIndex = 0; + this.excess = 1; + this.consumed = 1; + }; + EntityDecoder2.prototype.write = function(str, offset) { + switch (this.state) { + case EntityDecoderState.EntityStart: { + if (str.charCodeAt(offset) === CharCodes.NUM) { + this.state = EntityDecoderState.NumericStart; + this.consumed += 1; + return this.stateNumericStart(str, offset + 1); + } + this.state = EntityDecoderState.NamedEntity; + return this.stateNamedEntity(str, offset); + } + case EntityDecoderState.NumericStart: { + return this.stateNumericStart(str, offset); + } + case EntityDecoderState.NumericDecimal: { + return this.stateNumericDecimal(str, offset); + } + case EntityDecoderState.NumericHex: { + return this.stateNumericHex(str, offset); + } + case EntityDecoderState.NamedEntity: { + return this.stateNamedEntity(str, offset); + } } - }, - configurable: true, - enumerable: true - }, - "conditionText": { - get: function() { - return this.media.mediaText; - } - }, - "cssText": { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); + }; + EntityDecoder2.prototype.stateNumericStart = function(str, offset) { + if (offset >= str.length) { + return -1; + } + if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) { + this.state = EntityDecoderState.NumericHex; + this.consumed += 1; + return this.stateNumericHex(str, offset + 1); + } + this.state = EntityDecoderState.NumericDecimal; + return this.stateNumericDecimal(str, offset); + }; + EntityDecoder2.prototype.addToNumericResult = function(str, start, end, base) { + if (start !== end) { + var digitCount = end - start; + this.result = this.result * Math.pow(base, digitCount) + parseInt(str.substr(start, digitCount), base); + this.consumed += digitCount; + } + }; + EntityDecoder2.prototype.stateNumericHex = function(str, offset) { + var startIdx = offset; + while (offset < str.length) { + var char = str.charCodeAt(offset); + if (isNumber(char) || isHexadecimalCharacter(char)) { + offset += 1; + } else { + this.addToNumericResult(str, startIdx, offset, 16); + return this.emitNumericEntity(char, 3); + } + } + this.addToNumericResult(str, startIdx, offset, 16); + return -1; + }; + EntityDecoder2.prototype.stateNumericDecimal = function(str, offset) { + var startIdx = offset; + while (offset < str.length) { + var char = str.charCodeAt(offset); + if (isNumber(char)) { + offset += 1; + } else { + this.addToNumericResult(str, startIdx, offset, 10); + return this.emitNumericEntity(char, 2); + } + } + this.addToNumericResult(str, startIdx, offset, 10); + return -1; + }; + EntityDecoder2.prototype.emitNumericEntity = function(lastCp, expectedLength) { + var _a; + if (this.consumed <= expectedLength) { + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed); + return 0; + } + if (lastCp === CharCodes.SEMI) { + this.consumed += 1; + } else if (this.decodeMode === DecodingMode.Strict) { + return 0; + } + this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed); + if (this.errors) { + if (lastCp !== CharCodes.SEMI) { + this.errors.missingSemicolonAfterCharacterReference(); + } + this.errors.validateNumericCharacterReference(this.result); + } + return this.consumed; + }; + EntityDecoder2.prototype.stateNamedEntity = function(str, offset) { + var decodeTree = this.decodeTree; + var current = decodeTree[this.treeIndex]; + var valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14; + for (; offset < str.length; offset++, this.excess++) { + var char = str.charCodeAt(offset); + this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char); + if (this.treeIndex < 0) { + return this.result === 0 || // If we are parsing an attribute + this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity, + (valueLength === 0 || // And there should be no invalid characters. + isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity(); + } + current = decodeTree[this.treeIndex]; + valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14; + if (valueLength !== 0) { + if (char === CharCodes.SEMI) { + return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); } - return acc; - }, []).join("\n ")); + if (this.decodeMode !== DecodingMode.Strict) { + this.result = this.treeIndex; + this.consumed += this.excess; + this.excess = 0; + } + } } - values = valuesArr.join("\n ") + "\n}"; - return "@media " + this.media.mediaText + values; + return -1; + }; + EntityDecoder2.prototype.emitNotTerminatedNamedEntity = function() { + var _a; + var _b = this, result = _b.result, decodeTree = _b.decodeTree; + var valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14; + this.emitNamedEntityData(result, valueLength, this.consumed); + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference(); + return this.consumed; + }; + EntityDecoder2.prototype.emitNamedEntityData = function(result, valueLength, consumed) { + var decodeTree = this.decodeTree; + this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH : decodeTree[result + 1], consumed); + if (valueLength === 3) { + this.emitCodePoint(decodeTree[result + 2], consumed); + } + return consumed; + }; + EntityDecoder2.prototype.end = function() { + var _a; + switch (this.state) { + case EntityDecoderState.NamedEntity: { + return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0; + } + // Otherwise, emit a numeric entity if we have one. + case EntityDecoderState.NumericDecimal: { + return this.emitNumericEntity(0, 2); + } + case EntityDecoderState.NumericHex: { + return this.emitNumericEntity(0, 3); + } + case EntityDecoderState.NumericStart: { + (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed); + return 0; + } + case EntityDecoderState.EntityStart: { + return 0; + } + } + }; + return EntityDecoder2; + })() + ); + exports2.EntityDecoder = EntityDecoder; + function getDecoder(decodeTree) { + var ret = ""; + var decoder = new EntityDecoder(decodeTree, function(str) { + return ret += (0, decode_codepoint_js_1.fromCodePoint)(str); + }); + return function decodeWithTrie(str, decodeMode) { + var lastIndex = 0; + var offset = 0; + while ((offset = str.indexOf("&", offset)) >= 0) { + ret += str.slice(lastIndex, offset); + decoder.startEntity(decodeMode); + var len = decoder.write( + str, + // Skip the "&" + offset + 1 + ); + if (len < 0) { + lastIndex = offset + decoder.end(); + break; + } + lastIndex = offset + len; + offset = len === 0 ? lastIndex + 1 : lastIndex; + } + var result = ret + str.slice(lastIndex); + ret = ""; + return result; + }; + } + function determineBranch(decodeTree, current, nodeIdx, char) { + var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; + var jumpOffset = current & BinTrieFlags.JUMP_TABLE; + if (branchCount === 0) { + return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1; + } + if (jumpOffset) { + var value = char - jumpOffset; + return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIdx + value] - 1; + } + var lo = nodeIdx; + var hi = lo + branchCount - 1; + while (lo <= hi) { + var mid = lo + hi >>> 1; + var midVal = decodeTree[mid]; + if (midVal < char) { + lo = mid + 1; + } else if (midVal > char) { + hi = mid - 1; + } else { + return decodeTree[mid + branchCount]; } } - }); - exports2.CSSMediaRule = CSSOM2.CSSMediaRule; + return -1; + } + exports2.determineBranch = determineBranch; + var htmlDecoder = getDecoder(decode_data_html_js_1.default); + var xmlDecoder = getDecoder(decode_data_xml_js_1.default); + function decodeHTML(str, mode) { + if (mode === void 0) { + mode = DecodingMode.Legacy; + } + return htmlDecoder(str, mode); + } + exports2.decodeHTML = decodeHTML; + function decodeHTMLAttribute(str) { + return htmlDecoder(str, DecodingMode.Attribute); + } + exports2.decodeHTMLAttribute = decodeHTMLAttribute; + function decodeHTMLStrict(str) { + return htmlDecoder(str, DecodingMode.Strict); + } + exports2.decodeHTMLStrict = decodeHTMLStrict; + function decodeXML(str) { + return xmlDecoder(str, DecodingMode.Strict); + } + exports2.decodeXML = decodeXML; } }); -// node_modules/@acemir/cssom/lib/CSSCounterStyleRule.js -var require_CSSCounterStyleRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSCounterStyleRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/encode-html.js +var require_encode_html = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/generated/encode-html.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule - }; - CSSOM2.CSSCounterStyleRule = function CSSCounterStyleRule() { - CSSOM2.CSSRule.call(this); - this.name = ""; - this.__props = ""; - }; - CSSOM2.CSSCounterStyleRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSCounterStyleRule.prototype.constructor = CSSOM2.CSSCounterStyleRule; - Object.setPrototypeOf(CSSOM2.CSSCounterStyleRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "type", { - value: 11, - writable: false - }); - Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "cssText", { - get: function() { - return "@counter-style " + this.name + " { " + this.__props + " }"; - } - }); - Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "parse", { - value: function(cssText) { - var match = cssText.match(/@counter-style\s+([^\s{]+)\s*\{([^]*)\}/); - if (match) { - this.name = match[1]; - var propsText = match[2]; - this.__props = propsText.trim().replace(/\n/g, " ").replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g, function(match2, quote) { - return quote ? match2 : " "; - }); - } + Object.defineProperty(exports2, "__esModule", { value: true }); + function restoreDiff(arr) { + for (var i = 1; i < arr.length; i++) { + arr[i][0] += arr[i - 1][0] + 1; } - }); - exports2.CSSCounterStyleRule = CSSOM2.CSSCounterStyleRule; + return arr; + } + exports2.default = new Map(/* @__PURE__ */ restoreDiff([[9, " "], [0, " "], [22, "!"], [0, """], [0, "#"], [0, "$"], [0, "%"], [0, "&"], [0, "'"], [0, "("], [0, ")"], [0, "*"], [0, "+"], [0, ","], [1, "."], [0, "/"], [10, ":"], [0, ";"], [0, { v: "<", n: 8402, o: "<⃒" }], [0, { v: "=", n: 8421, o: "=⃥" }], [0, { v: ">", n: 8402, o: ">⃒" }], [0, "?"], [0, "@"], [26, "["], [0, "\"], [0, "]"], [0, "^"], [0, "_"], [0, "`"], [5, { n: 106, o: "fj" }], [20, "{"], [0, "|"], [0, "}"], [34, " "], [0, "¡"], [0, "¢"], [0, "£"], [0, "¤"], [0, "¥"], [0, "¦"], [0, "§"], [0, "¨"], [0, "©"], [0, "ª"], [0, "«"], [0, "¬"], [0, "­"], [0, "®"], [0, "¯"], [0, "°"], [0, "±"], [0, "²"], [0, "³"], [0, "´"], [0, "µ"], [0, "¶"], [0, "·"], [0, "¸"], [0, "¹"], [0, "º"], [0, "»"], [0, "¼"], [0, "½"], [0, "¾"], [0, "¿"], [0, "À"], [0, "Á"], [0, "Â"], [0, "Ã"], [0, "Ä"], [0, "Å"], [0, "Æ"], [0, "Ç"], [0, "È"], [0, "É"], [0, "Ê"], [0, "Ë"], [0, "Ì"], [0, "Í"], [0, "Î"], [0, "Ï"], [0, "Ð"], [0, "Ñ"], [0, "Ò"], [0, "Ó"], [0, "Ô"], [0, "Õ"], [0, "Ö"], [0, "×"], [0, "Ø"], [0, "Ù"], [0, "Ú"], [0, "Û"], [0, "Ü"], [0, "Ý"], [0, "Þ"], [0, "ß"], [0, "à"], [0, "á"], [0, "â"], [0, "ã"], [0, "ä"], [0, "å"], [0, "æ"], [0, "ç"], [0, "è"], [0, "é"], [0, "ê"], [0, "ë"], [0, "ì"], [0, "í"], [0, "î"], [0, "ï"], [0, "ð"], [0, "ñ"], [0, "ò"], [0, "ó"], [0, "ô"], [0, "õ"], [0, "ö"], [0, "÷"], [0, "ø"], [0, "ù"], [0, "ú"], [0, "û"], [0, "ü"], [0, "ý"], [0, "þ"], [0, "ÿ"], [0, "Ā"], [0, "ā"], [0, "Ă"], [0, "ă"], [0, "Ą"], [0, "ą"], [0, "Ć"], [0, "ć"], [0, "Ĉ"], [0, "ĉ"], [0, "Ċ"], [0, "ċ"], [0, "Č"], [0, "č"], [0, "Ď"], [0, "ď"], [0, "Đ"], [0, "đ"], [0, "Ē"], [0, "ē"], [2, "Ė"], [0, "ė"], [0, "Ę"], [0, "ę"], [0, "Ě"], [0, "ě"], [0, "Ĝ"], [0, "ĝ"], [0, "Ğ"], [0, "ğ"], [0, "Ġ"], [0, "ġ"], [0, "Ģ"], [1, "Ĥ"], [0, "ĥ"], [0, "Ħ"], [0, "ħ"], [0, "Ĩ"], [0, "ĩ"], [0, "Ī"], [0, "ī"], [2, "Į"], [0, "į"], [0, "İ"], [0, "ı"], [0, "IJ"], [0, "ij"], [0, "Ĵ"], [0, "ĵ"], [0, "Ķ"], [0, "ķ"], [0, "ĸ"], [0, "Ĺ"], [0, "ĺ"], [0, "Ļ"], [0, "ļ"], [0, "Ľ"], [0, "ľ"], [0, "Ŀ"], [0, "ŀ"], [0, "Ł"], [0, "ł"], [0, "Ń"], [0, "ń"], [0, "Ņ"], [0, "ņ"], [0, "Ň"], [0, "ň"], [0, "ʼn"], [0, "Ŋ"], [0, "ŋ"], [0, "Ō"], [0, "ō"], [2, "Ő"], [0, "ő"], [0, "Œ"], [0, "œ"], [0, "Ŕ"], [0, "ŕ"], [0, "Ŗ"], [0, "ŗ"], [0, "Ř"], [0, "ř"], [0, "Ś"], [0, "ś"], [0, "Ŝ"], [0, "ŝ"], [0, "Ş"], [0, "ş"], [0, "Š"], [0, "š"], [0, "Ţ"], [0, "ţ"], [0, "Ť"], [0, "ť"], [0, "Ŧ"], [0, "ŧ"], [0, "Ũ"], [0, "ũ"], [0, "Ū"], [0, "ū"], [0, "Ŭ"], [0, "ŭ"], [0, "Ů"], [0, "ů"], [0, "Ű"], [0, "ű"], [0, "Ų"], [0, "ų"], [0, "Ŵ"], [0, "ŵ"], [0, "Ŷ"], [0, "ŷ"], [0, "Ÿ"], [0, "Ź"], [0, "ź"], [0, "Ż"], [0, "ż"], [0, "Ž"], [0, "ž"], [19, "ƒ"], [34, "Ƶ"], [63, "ǵ"], [65, "ȷ"], [142, "ˆ"], [0, "ˇ"], [16, "˘"], [0, "˙"], [0, "˚"], [0, "˛"], [0, "˜"], [0, "˝"], [51, "̑"], [127, "Α"], [0, "Β"], [0, "Γ"], [0, "Δ"], [0, "Ε"], [0, "Ζ"], [0, "Η"], [0, "Θ"], [0, "Ι"], [0, "Κ"], [0, "Λ"], [0, "Μ"], [0, "Ν"], [0, "Ξ"], [0, "Ο"], [0, "Π"], [0, "Ρ"], [1, "Σ"], [0, "Τ"], [0, "Υ"], [0, "Φ"], [0, "Χ"], [0, "Ψ"], [0, "Ω"], [7, "α"], [0, "β"], [0, "γ"], [0, "δ"], [0, "ε"], [0, "ζ"], [0, "η"], [0, "θ"], [0, "ι"], [0, "κ"], [0, "λ"], [0, "μ"], [0, "ν"], [0, "ξ"], [0, "ο"], [0, "π"], [0, "ρ"], [0, "ς"], [0, "σ"], [0, "τ"], [0, "υ"], [0, "φ"], [0, "χ"], [0, "ψ"], [0, "ω"], [7, "ϑ"], [0, "ϒ"], [2, "ϕ"], [0, "ϖ"], [5, "Ϝ"], [0, "ϝ"], [18, "ϰ"], [0, "ϱ"], [3, "ϵ"], [0, "϶"], [10, "Ё"], [0, "Ђ"], [0, "Ѓ"], [0, "Є"], [0, "Ѕ"], [0, "І"], [0, "Ї"], [0, "Ј"], [0, "Љ"], [0, "Њ"], [0, "Ћ"], [0, "Ќ"], [1, "Ў"], [0, "Џ"], [0, "А"], [0, "Б"], [0, "В"], [0, "Г"], [0, "Д"], [0, "Е"], [0, "Ж"], [0, "З"], [0, "И"], [0, "Й"], [0, "К"], [0, "Л"], [0, "М"], [0, "Н"], [0, "О"], [0, "П"], [0, "Р"], [0, "С"], [0, "Т"], [0, "У"], [0, "Ф"], [0, "Х"], [0, "Ц"], [0, "Ч"], [0, "Ш"], [0, "Щ"], [0, "Ъ"], [0, "Ы"], [0, "Ь"], [0, "Э"], [0, "Ю"], [0, "Я"], [0, "а"], [0, "б"], [0, "в"], [0, "г"], [0, "д"], [0, "е"], [0, "ж"], [0, "з"], [0, "и"], [0, "й"], [0, "к"], [0, "л"], [0, "м"], [0, "н"], [0, "о"], [0, "п"], [0, "р"], [0, "с"], [0, "т"], [0, "у"], [0, "ф"], [0, "х"], [0, "ц"], [0, "ч"], [0, "ш"], [0, "щ"], [0, "ъ"], [0, "ы"], [0, "ь"], [0, "э"], [0, "ю"], [0, "я"], [1, "ё"], [0, "ђ"], [0, "ѓ"], [0, "є"], [0, "ѕ"], [0, "і"], [0, "ї"], [0, "ј"], [0, "љ"], [0, "њ"], [0, "ћ"], [0, "ќ"], [1, "ў"], [0, "џ"], [7074, " "], [0, " "], [0, " "], [0, " "], [1, " "], [0, " "], [0, " "], [0, " "], [0, "​"], [0, "‌"], [0, "‍"], [0, "‎"], [0, "‏"], [0, "‐"], [2, "–"], [0, "—"], [0, "―"], [0, "‖"], [1, "‘"], [0, "’"], [0, "‚"], [1, "“"], [0, "”"], [0, "„"], [1, "†"], [0, "‡"], [0, "•"], [2, "‥"], [0, "…"], [9, "‰"], [0, "‱"], [0, "′"], [0, "″"], [0, "‴"], [0, "‵"], [3, "‹"], [0, "›"], [3, "‾"], [2, "⁁"], [1, "⁃"], [0, "⁄"], [10, "⁏"], [7, "⁗"], [7, { v: " ", n: 8202, o: "  " }], [0, "⁠"], [0, "⁡"], [0, "⁢"], [0, "⁣"], [72, "€"], [46, "⃛"], [0, "⃜"], [37, "ℂ"], [2, "℅"], [4, "ℊ"], [0, "ℋ"], [0, "ℌ"], [0, "ℍ"], [0, "ℎ"], [0, "ℏ"], [0, "ℐ"], [0, "ℑ"], [0, "ℒ"], [0, "ℓ"], [1, "ℕ"], [0, "№"], [0, "℗"], [0, "℘"], [0, "ℙ"], [0, "ℚ"], [0, "ℛ"], [0, "ℜ"], [0, "ℝ"], [0, "℞"], [3, "™"], [1, "ℤ"], [2, "℧"], [0, "ℨ"], [0, "℩"], [2, "ℬ"], [0, "ℭ"], [1, "ℯ"], [0, "ℰ"], [0, "ℱ"], [1, "ℳ"], [0, "ℴ"], [0, "ℵ"], [0, "ℶ"], [0, "ℷ"], [0, "ℸ"], [12, "ⅅ"], [0, "ⅆ"], [0, "ⅇ"], [0, "ⅈ"], [10, "⅓"], [0, "⅔"], [0, "⅕"], [0, "⅖"], [0, "⅗"], [0, "⅘"], [0, "⅙"], [0, "⅚"], [0, "⅛"], [0, "⅜"], [0, "⅝"], [0, "⅞"], [49, "←"], [0, "↑"], [0, "→"], [0, "↓"], [0, "↔"], [0, "↕"], [0, "↖"], [0, "↗"], [0, "↘"], [0, "↙"], [0, "↚"], [0, "↛"], [1, { v: "↝", n: 824, o: "↝̸" }], [0, "↞"], [0, "↟"], [0, "↠"], [0, "↡"], [0, "↢"], [0, "↣"], [0, "↤"], [0, "↥"], [0, "↦"], [0, "↧"], [1, "↩"], [0, "↪"], [0, "↫"], [0, "↬"], [0, "↭"], [0, "↮"], [1, "↰"], [0, "↱"], [0, "↲"], [0, "↳"], [1, "↵"], [0, "↶"], [0, "↷"], [2, "↺"], [0, "↻"], [0, "↼"], [0, "↽"], [0, "↾"], [0, "↿"], [0, "⇀"], [0, "⇁"], [0, "⇂"], [0, "⇃"], [0, "⇄"], [0, "⇅"], [0, "⇆"], [0, "⇇"], [0, "⇈"], [0, "⇉"], [0, "⇊"], [0, "⇋"], [0, "⇌"], [0, "⇍"], [0, "⇎"], [0, "⇏"], [0, "⇐"], [0, "⇑"], [0, "⇒"], [0, "⇓"], [0, "⇔"], [0, "⇕"], [0, "⇖"], [0, "⇗"], [0, "⇘"], [0, "⇙"], [0, "⇚"], [0, "⇛"], [1, "⇝"], [6, "⇤"], [0, "⇥"], [15, "⇵"], [7, "⇽"], [0, "⇾"], [0, "⇿"], [0, "∀"], [0, "∁"], [0, { v: "∂", n: 824, o: "∂̸" }], [0, "∃"], [0, "∄"], [0, "∅"], [1, "∇"], [0, "∈"], [0, "∉"], [1, "∋"], [0, "∌"], [2, "∏"], [0, "∐"], [0, "∑"], [0, "−"], [0, "∓"], [0, "∔"], [1, "∖"], [0, "∗"], [0, "∘"], [1, "√"], [2, "∝"], [0, "∞"], [0, "∟"], [0, { v: "∠", n: 8402, o: "∠⃒" }], [0, "∡"], [0, "∢"], [0, "∣"], [0, "∤"], [0, "∥"], [0, "∦"], [0, "∧"], [0, "∨"], [0, { v: "∩", n: 65024, o: "∩︀" }], [0, { v: "∪", n: 65024, o: "∪︀" }], [0, "∫"], [0, "∬"], [0, "∭"], [0, "∮"], [0, "∯"], [0, "∰"], [0, "∱"], [0, "∲"], [0, "∳"], [0, "∴"], [0, "∵"], [0, "∶"], [0, "∷"], [0, "∸"], [1, "∺"], [0, "∻"], [0, { v: "∼", n: 8402, o: "∼⃒" }], [0, { v: "∽", n: 817, o: "∽̱" }], [0, { v: "∾", n: 819, o: "∾̳" }], [0, "∿"], [0, "≀"], [0, "≁"], [0, { v: "≂", n: 824, o: "≂̸" }], [0, "≃"], [0, "≄"], [0, "≅"], [0, "≆"], [0, "≇"], [0, "≈"], [0, "≉"], [0, "≊"], [0, { v: "≋", n: 824, o: "≋̸" }], [0, "≌"], [0, { v: "≍", n: 8402, o: "≍⃒" }], [0, { v: "≎", n: 824, o: "≎̸" }], [0, { v: "≏", n: 824, o: "≏̸" }], [0, { v: "≐", n: 824, o: "≐̸" }], [0, "≑"], [0, "≒"], [0, "≓"], [0, "≔"], [0, "≕"], [0, "≖"], [0, "≗"], [1, "≙"], [0, "≚"], [1, "≜"], [2, "≟"], [0, "≠"], [0, { v: "≡", n: 8421, o: "≡⃥" }], [0, "≢"], [1, { v: "≤", n: 8402, o: "≤⃒" }], [0, { v: "≥", n: 8402, o: "≥⃒" }], [0, { v: "≦", n: 824, o: "≦̸" }], [0, { v: "≧", n: 824, o: "≧̸" }], [0, { v: "≨", n: 65024, o: "≨︀" }], [0, { v: "≩", n: 65024, o: "≩︀" }], [0, { v: "≪", n: new Map(/* @__PURE__ */ restoreDiff([[824, "≪̸"], [7577, "≪⃒"]])) }], [0, { v: "≫", n: new Map(/* @__PURE__ */ restoreDiff([[824, "≫̸"], [7577, "≫⃒"]])) }], [0, "≬"], [0, "≭"], [0, "≮"], [0, "≯"], [0, "≰"], [0, "≱"], [0, "≲"], [0, "≳"], [0, "≴"], [0, "≵"], [0, "≶"], [0, "≷"], [0, "≸"], [0, "≹"], [0, "≺"], [0, "≻"], [0, "≼"], [0, "≽"], [0, "≾"], [0, { v: "≿", n: 824, o: "≿̸" }], [0, "⊀"], [0, "⊁"], [0, { v: "⊂", n: 8402, o: "⊂⃒" }], [0, { v: "⊃", n: 8402, o: "⊃⃒" }], [0, "⊄"], [0, "⊅"], [0, "⊆"], [0, "⊇"], [0, "⊈"], [0, "⊉"], [0, { v: "⊊", n: 65024, o: "⊊︀" }], [0, { v: "⊋", n: 65024, o: "⊋︀" }], [1, "⊍"], [0, "⊎"], [0, { v: "⊏", n: 824, o: "⊏̸" }], [0, { v: "⊐", n: 824, o: "⊐̸" }], [0, "⊑"], [0, "⊒"], [0, { v: "⊓", n: 65024, o: "⊓︀" }], [0, { v: "⊔", n: 65024, o: "⊔︀" }], [0, "⊕"], [0, "⊖"], [0, "⊗"], [0, "⊘"], [0, "⊙"], [0, "⊚"], [0, "⊛"], [1, "⊝"], [0, "⊞"], [0, "⊟"], [0, "⊠"], [0, "⊡"], [0, "⊢"], [0, "⊣"], [0, "⊤"], [0, "⊥"], [1, "⊧"], [0, "⊨"], [0, "⊩"], [0, "⊪"], [0, "⊫"], [0, "⊬"], [0, "⊭"], [0, "⊮"], [0, "⊯"], [0, "⊰"], [1, "⊲"], [0, "⊳"], [0, { v: "⊴", n: 8402, o: "⊴⃒" }], [0, { v: "⊵", n: 8402, o: "⊵⃒" }], [0, "⊶"], [0, "⊷"], [0, "⊸"], [0, "⊹"], [0, "⊺"], [0, "⊻"], [1, "⊽"], [0, "⊾"], [0, "⊿"], [0, "⋀"], [0, "⋁"], [0, "⋂"], [0, "⋃"], [0, "⋄"], [0, "⋅"], [0, "⋆"], [0, "⋇"], [0, "⋈"], [0, "⋉"], [0, "⋊"], [0, "⋋"], [0, "⋌"], [0, "⋍"], [0, "⋎"], [0, "⋏"], [0, "⋐"], [0, "⋑"], [0, "⋒"], [0, "⋓"], [0, "⋔"], [0, "⋕"], [0, "⋖"], [0, "⋗"], [0, { v: "⋘", n: 824, o: "⋘̸" }], [0, { v: "⋙", n: 824, o: "⋙̸" }], [0, { v: "⋚", n: 65024, o: "⋚︀" }], [0, { v: "⋛", n: 65024, o: "⋛︀" }], [2, "⋞"], [0, "⋟"], [0, "⋠"], [0, "⋡"], [0, "⋢"], [0, "⋣"], [2, "⋦"], [0, "⋧"], [0, "⋨"], [0, "⋩"], [0, "⋪"], [0, "⋫"], [0, "⋬"], [0, "⋭"], [0, "⋮"], [0, "⋯"], [0, "⋰"], [0, "⋱"], [0, "⋲"], [0, "⋳"], [0, "⋴"], [0, { v: "⋵", n: 824, o: "⋵̸" }], [0, "⋶"], [0, "⋷"], [1, { v: "⋹", n: 824, o: "⋹̸" }], [0, "⋺"], [0, "⋻"], [0, "⋼"], [0, "⋽"], [0, "⋾"], [6, "⌅"], [0, "⌆"], [1, "⌈"], [0, "⌉"], [0, "⌊"], [0, "⌋"], [0, "⌌"], [0, "⌍"], [0, "⌎"], [0, "⌏"], [0, "⌐"], [1, "⌒"], [0, "⌓"], [1, "⌕"], [0, "⌖"], [5, "⌜"], [0, "⌝"], [0, "⌞"], [0, "⌟"], [2, "⌢"], [0, "⌣"], [9, "⌭"], [0, "⌮"], [7, "⌶"], [6, "⌽"], [1, "⌿"], [60, "⍼"], [51, "⎰"], [0, "⎱"], [2, "⎴"], [0, "⎵"], [0, "⎶"], [37, "⏜"], [0, "⏝"], [0, "⏞"], [0, "⏟"], [2, "⏢"], [4, "⏧"], [59, "␣"], [164, "Ⓢ"], [55, "─"], [1, "│"], [9, "┌"], [3, "┐"], [3, "└"], [3, "┘"], [3, "├"], [7, "┤"], [7, "┬"], [7, "┴"], [7, "┼"], [19, "═"], [0, "║"], [0, "╒"], [0, "╓"], [0, "╔"], [0, "╕"], [0, "╖"], [0, "╗"], [0, "╘"], [0, "╙"], [0, "╚"], [0, "╛"], [0, "╜"], [0, "╝"], [0, "╞"], [0, "╟"], [0, "╠"], [0, "╡"], [0, "╢"], [0, "╣"], [0, "╤"], [0, "╥"], [0, "╦"], [0, "╧"], [0, "╨"], [0, "╩"], [0, "╪"], [0, "╫"], [0, "╬"], [19, "▀"], [3, "▄"], [3, "█"], [8, "░"], [0, "▒"], [0, "▓"], [13, "□"], [8, "▪"], [0, "▫"], [1, "▭"], [0, "▮"], [2, "▱"], [1, "△"], [0, "▴"], [0, "▵"], [2, "▸"], [0, "▹"], [3, "▽"], [0, "▾"], [0, "▿"], [2, "◂"], [0, "◃"], [6, "◊"], [0, "○"], [32, "◬"], [2, "◯"], [8, "◸"], [0, "◹"], [0, "◺"], [0, "◻"], [0, "◼"], [8, "★"], [0, "☆"], [7, "☎"], [49, "♀"], [1, "♂"], [29, "♠"], [2, "♣"], [1, "♥"], [0, "♦"], [3, "♪"], [2, "♭"], [0, "♮"], [0, "♯"], [163, "✓"], [3, "✗"], [8, "✠"], [21, "✶"], [33, "❘"], [25, "❲"], [0, "❳"], [84, "⟈"], [0, "⟉"], [28, "⟦"], [0, "⟧"], [0, "⟨"], [0, "⟩"], [0, "⟪"], [0, "⟫"], [0, "⟬"], [0, "⟭"], [7, "⟵"], [0, "⟶"], [0, "⟷"], [0, "⟸"], [0, "⟹"], [0, "⟺"], [1, "⟼"], [2, "⟿"], [258, "⤂"], [0, "⤃"], [0, "⤄"], [0, "⤅"], [6, "⤌"], [0, "⤍"], [0, "⤎"], [0, "⤏"], [0, "⤐"], [0, "⤑"], [0, "⤒"], [0, "⤓"], [2, "⤖"], [2, "⤙"], [0, "⤚"], [0, "⤛"], [0, "⤜"], [0, "⤝"], [0, "⤞"], [0, "⤟"], [0, "⤠"], [2, "⤣"], [0, "⤤"], [0, "⤥"], [0, "⤦"], [0, "⤧"], [0, "⤨"], [0, "⤩"], [0, "⤪"], [8, { v: "⤳", n: 824, o: "⤳̸" }], [1, "⤵"], [0, "⤶"], [0, "⤷"], [0, "⤸"], [0, "⤹"], [2, "⤼"], [0, "⤽"], [7, "⥅"], [2, "⥈"], [0, "⥉"], [0, "⥊"], [0, "⥋"], [2, "⥎"], [0, "⥏"], [0, "⥐"], [0, "⥑"], [0, "⥒"], [0, "⥓"], [0, "⥔"], [0, "⥕"], [0, "⥖"], [0, "⥗"], [0, "⥘"], [0, "⥙"], [0, "⥚"], [0, "⥛"], [0, "⥜"], [0, "⥝"], [0, "⥞"], [0, "⥟"], [0, "⥠"], [0, "⥡"], [0, "⥢"], [0, "⥣"], [0, "⥤"], [0, "⥥"], [0, "⥦"], [0, "⥧"], [0, "⥨"], [0, "⥩"], [0, "⥪"], [0, "⥫"], [0, "⥬"], [0, "⥭"], [0, "⥮"], [0, "⥯"], [0, "⥰"], [0, "⥱"], [0, "⥲"], [0, "⥳"], [0, "⥴"], [0, "⥵"], [0, "⥶"], [1, "⥸"], [0, "⥹"], [1, "⥻"], [0, "⥼"], [0, "⥽"], [0, "⥾"], [0, "⥿"], [5, "⦅"], [0, "⦆"], [4, "⦋"], [0, "⦌"], [0, "⦍"], [0, "⦎"], [0, "⦏"], [0, "⦐"], [0, "⦑"], [0, "⦒"], [0, "⦓"], [0, "⦔"], [0, "⦕"], [0, "⦖"], [3, "⦚"], [1, "⦜"], [0, "⦝"], [6, "⦤"], [0, "⦥"], [0, "⦦"], [0, "⦧"], [0, "⦨"], [0, "⦩"], [0, "⦪"], [0, "⦫"], [0, "⦬"], [0, "⦭"], [0, "⦮"], [0, "⦯"], [0, "⦰"], [0, "⦱"], [0, "⦲"], [0, "⦳"], [0, "⦴"], [0, "⦵"], [0, "⦶"], [0, "⦷"], [1, "⦹"], [1, "⦻"], [0, "⦼"], [1, "⦾"], [0, "⦿"], [0, "⧀"], [0, "⧁"], [0, "⧂"], [0, "⧃"], [0, "⧄"], [0, "⧅"], [3, "⧉"], [3, "⧍"], [0, "⧎"], [0, { v: "⧏", n: 824, o: "⧏̸" }], [0, { v: "⧐", n: 824, o: "⧐̸" }], [11, "⧜"], [0, "⧝"], [0, "⧞"], [4, "⧣"], [0, "⧤"], [0, "⧥"], [5, "⧫"], [8, "⧴"], [1, "⧶"], [9, "⨀"], [0, "⨁"], [0, "⨂"], [1, "⨄"], [1, "⨆"], [5, "⨌"], [0, "⨍"], [2, "⨐"], [0, "⨑"], [0, "⨒"], [0, "⨓"], [0, "⨔"], [0, "⨕"], [0, "⨖"], [0, "⨗"], [10, "⨢"], [0, "⨣"], [0, "⨤"], [0, "⨥"], [0, "⨦"], [0, "⨧"], [1, "⨩"], [0, "⨪"], [2, "⨭"], [0, "⨮"], [0, "⨯"], [0, "⨰"], [0, "⨱"], [1, "⨳"], [0, "⨴"], [0, "⨵"], [0, "⨶"], [0, "⨷"], [0, "⨸"], [0, "⨹"], [0, "⨺"], [0, "⨻"], [0, "⨼"], [2, "⨿"], [0, "⩀"], [1, "⩂"], [0, "⩃"], [0, "⩄"], [0, "⩅"], [0, "⩆"], [0, "⩇"], [0, "⩈"], [0, "⩉"], [0, "⩊"], [0, "⩋"], [0, "⩌"], [0, "⩍"], [2, "⩐"], [2, "⩓"], [0, "⩔"], [0, "⩕"], [0, "⩖"], [0, "⩗"], [0, "⩘"], [1, "⩚"], [0, "⩛"], [0, "⩜"], [0, "⩝"], [1, "⩟"], [6, "⩦"], [3, "⩪"], [2, { v: "⩭", n: 824, o: "⩭̸" }], [0, "⩮"], [0, "⩯"], [0, { v: "⩰", n: 824, o: "⩰̸" }], [0, "⩱"], [0, "⩲"], [0, "⩳"], [0, "⩴"], [0, "⩵"], [1, "⩷"], [0, "⩸"], [0, "⩹"], [0, "⩺"], [0, "⩻"], [0, "⩼"], [0, { v: "⩽", n: 824, o: "⩽̸" }], [0, { v: "⩾", n: 824, o: "⩾̸" }], [0, "⩿"], [0, "⪀"], [0, "⪁"], [0, "⪂"], [0, "⪃"], [0, "⪄"], [0, "⪅"], [0, "⪆"], [0, "⪇"], [0, "⪈"], [0, "⪉"], [0, "⪊"], [0, "⪋"], [0, "⪌"], [0, "⪍"], [0, "⪎"], [0, "⪏"], [0, "⪐"], [0, "⪑"], [0, "⪒"], [0, "⪓"], [0, "⪔"], [0, "⪕"], [0, "⪖"], [0, "⪗"], [0, "⪘"], [0, "⪙"], [0, "⪚"], [2, "⪝"], [0, "⪞"], [0, "⪟"], [0, "⪠"], [0, { v: "⪡", n: 824, o: "⪡̸" }], [0, { v: "⪢", n: 824, o: "⪢̸" }], [1, "⪤"], [0, "⪥"], [0, "⪦"], [0, "⪧"], [0, "⪨"], [0, "⪩"], [0, "⪪"], [0, "⪫"], [0, { v: "⪬", n: 65024, o: "⪬︀" }], [0, { v: "⪭", n: 65024, o: "⪭︀" }], [0, "⪮"], [0, { v: "⪯", n: 824, o: "⪯̸" }], [0, { v: "⪰", n: 824, o: "⪰̸" }], [2, "⪳"], [0, "⪴"], [0, "⪵"], [0, "⪶"], [0, "⪷"], [0, "⪸"], [0, "⪹"], [0, "⪺"], [0, "⪻"], [0, "⪼"], [0, "⪽"], [0, "⪾"], [0, "⪿"], [0, "⫀"], [0, "⫁"], [0, "⫂"], [0, "⫃"], [0, "⫄"], [0, { v: "⫅", n: 824, o: "⫅̸" }], [0, { v: "⫆", n: 824, o: "⫆̸" }], [0, "⫇"], [0, "⫈"], [2, { v: "⫋", n: 65024, o: "⫋︀" }], [0, { v: "⫌", n: 65024, o: "⫌︀" }], [2, "⫏"], [0, "⫐"], [0, "⫑"], [0, "⫒"], [0, "⫓"], [0, "⫔"], [0, "⫕"], [0, "⫖"], [0, "⫗"], [0, "⫘"], [0, "⫙"], [0, "⫚"], [0, "⫛"], [8, "⫤"], [1, "⫦"], [0, "⫧"], [0, "⫨"], [0, "⫩"], [1, "⫫"], [0, "⫬"], [0, "⫭"], [0, "⫮"], [0, "⫯"], [0, "⫰"], [0, "⫱"], [0, "⫲"], [0, "⫳"], [9, { v: "⫽", n: 8421, o: "⫽⃥" }], [44343, { n: new Map(/* @__PURE__ */ restoreDiff([[56476, "𝒜"], [1, "𝒞"], [0, "𝒟"], [2, "𝒢"], [2, "𝒥"], [0, "𝒦"], [2, "𝒩"], [0, "𝒪"], [0, "𝒫"], [0, "𝒬"], [1, "𝒮"], [0, "𝒯"], [0, "𝒰"], [0, "𝒱"], [0, "𝒲"], [0, "𝒳"], [0, "𝒴"], [0, "𝒵"], [0, "𝒶"], [0, "𝒷"], [0, "𝒸"], [0, "𝒹"], [1, "𝒻"], [1, "𝒽"], [0, "𝒾"], [0, "𝒿"], [0, "𝓀"], [0, "𝓁"], [0, "𝓂"], [0, "𝓃"], [1, "𝓅"], [0, "𝓆"], [0, "𝓇"], [0, "𝓈"], [0, "𝓉"], [0, "𝓊"], [0, "𝓋"], [0, "𝓌"], [0, "𝓍"], [0, "𝓎"], [0, "𝓏"], [52, "𝔄"], [0, "𝔅"], [1, "𝔇"], [0, "𝔈"], [0, "𝔉"], [0, "𝔊"], [2, "𝔍"], [0, "𝔎"], [0, "𝔏"], [0, "𝔐"], [0, "𝔑"], [0, "𝔒"], [0, "𝔓"], [0, "𝔔"], [1, "𝔖"], [0, "𝔗"], [0, "𝔘"], [0, "𝔙"], [0, "𝔚"], [0, "𝔛"], [0, "𝔜"], [1, "𝔞"], [0, "𝔟"], [0, "𝔠"], [0, "𝔡"], [0, "𝔢"], [0, "𝔣"], [0, "𝔤"], [0, "𝔥"], [0, "𝔦"], [0, "𝔧"], [0, "𝔨"], [0, "𝔩"], [0, "𝔪"], [0, "𝔫"], [0, "𝔬"], [0, "𝔭"], [0, "𝔮"], [0, "𝔯"], [0, "𝔰"], [0, "𝔱"], [0, "𝔲"], [0, "𝔳"], [0, "𝔴"], [0, "𝔵"], [0, "𝔶"], [0, "𝔷"], [0, "𝔸"], [0, "𝔹"], [1, "𝔻"], [0, "𝔼"], [0, "𝔽"], [0, "𝔾"], [1, "𝕀"], [0, "𝕁"], [0, "𝕂"], [0, "𝕃"], [0, "𝕄"], [1, "𝕆"], [3, "𝕊"], [0, "𝕋"], [0, "𝕌"], [0, "𝕍"], [0, "𝕎"], [0, "𝕏"], [0, "𝕐"], [1, "𝕒"], [0, "𝕓"], [0, "𝕔"], [0, "𝕕"], [0, "𝕖"], [0, "𝕗"], [0, "𝕘"], [0, "𝕙"], [0, "𝕚"], [0, "𝕛"], [0, "𝕜"], [0, "𝕝"], [0, "𝕞"], [0, "𝕟"], [0, "𝕠"], [0, "𝕡"], [0, "𝕢"], [0, "𝕣"], [0, "𝕤"], [0, "𝕥"], [0, "𝕦"], [0, "𝕧"], [0, "𝕨"], [0, "𝕩"], [0, "𝕪"], [0, "𝕫"]])) }], [8906, "ff"], [0, "fi"], [0, "fl"], [0, "ffi"], [0, "ffl"]])); } }); -// node_modules/@acemir/cssom/lib/CSSPropertyRule.js -var require_CSSPropertyRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSPropertyRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/escape.js +var require_escape = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/escape.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule - }; - CSSOM2.CSSPropertyRule = function CSSPropertyRule() { - CSSOM2.CSSRule.call(this); - this.__name = ""; - this.__syntax = ""; - this.__inherits = false; - this.__initialValue = null; - }; - CSSOM2.CSSPropertyRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSPropertyRule.prototype.constructor = CSSOM2.CSSPropertyRule; - Object.setPrototypeOf(CSSOM2.CSSPropertyRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "type", { - value: 0, - writable: false - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "cssText", { - get: function() { - var text = "@property " + this.name + " {"; - if (this.syntax !== "") { - text += ' syntax: "' + this.syntax.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '";'; - } - text += " inherits: " + (this.inherits ? "true" : "false") + ";"; - if (this.initialValue !== null) { - text += " initial-value: " + this.initialValue + ";"; - } - text += " }"; - return text; - } - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "name", { - get: function() { - return this.__name; - } - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "syntax", { - get: function() { - return this.__syntax; - } - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "inherits", { - get: function() { - return this.__inherits; - } - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "initialValue", { - get: function() { - return this.__initialValue; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.escapeText = exports2.escapeAttribute = exports2.escapeUTF8 = exports2.escape = exports2.encodeXML = exports2.getCodePoint = exports2.xmlReplacer = void 0; + exports2.xmlReplacer = /["&'<>$\x80-\uFFFF]/g; + var xmlCodeMap = /* @__PURE__ */ new Map([ + [34, """], + [38, "&"], + [39, "'"], + [60, "<"], + [62, ">"] + ]); + exports2.getCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + String.prototype.codePointAt != null ? function(str, index2) { + return str.codePointAt(index2); + } : ( + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function(c, index2) { + return (c.charCodeAt(index2) & 64512) === 55296 ? (c.charCodeAt(index2) - 55296) * 1024 + c.charCodeAt(index2 + 1) - 56320 + 65536 : c.charCodeAt(index2); } - }); - Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "parse", { - value: function(cssText) { - var match = cssText.match(/@property\s+(--[^\s{]+)\s*\{([^]*)\}/); - if (!match) { - return false; - } - this.__name = match[1]; - var bodyText = match[2]; - var syntaxMatch = bodyText.match(/syntax\s*:\s*(['"])([^]*?)\1\s*;/); - if (!syntaxMatch) { - return false; - } - this.__syntax = syntaxMatch[2]; - if (this.__syntax === "") { - return false; - } - var inheritsMatch = bodyText.match(/inherits\s*:\s*(true|false)\s*;/); - if (!inheritsMatch) { - return false; - } - this.__inherits = inheritsMatch[1] === "true"; - var initialValueMatch = bodyText.match(/initial-value\s*:\s*([^;]+);/); - if (initialValueMatch) { - this.__initialValue = initialValueMatch[1].trim(); + ); + function encodeXML2(str) { + var ret = ""; + var lastIdx = 0; + var match; + while ((match = exports2.xmlReplacer.exec(str)) !== null) { + var i = match.index; + var char = str.charCodeAt(i); + var next = xmlCodeMap.get(char); + if (next !== void 0) { + ret += str.substring(lastIdx, i) + next; + lastIdx = i + 1; } else { - if (this.__syntax !== "*") { - return false; - } + ret += "".concat(str.substring(lastIdx, i), "&#x").concat((0, exports2.getCodePoint)(str, i).toString(16), ";"); + lastIdx = exports2.xmlReplacer.lastIndex += Number((char & 64512) === 55296); } - return true; } - }); - exports2.CSSPropertyRule = CSSOM2.CSSPropertyRule; - } -}); - -// node_modules/@acemir/cssom/lib/CSSContainerRule.js -var require_CSSContainerRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSContainerRule.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, - CSSConditionRule: require_CSSConditionRule().CSSConditionRule - }; - CSSOM2.CSSContainerRule = function CSSContainerRule() { - CSSOM2.CSSConditionRule.call(this); - }; - CSSOM2.CSSContainerRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); - CSSOM2.CSSContainerRule.prototype.constructor = CSSOM2.CSSContainerRule; - Object.setPrototypeOf(CSSOM2.CSSContainerRule, CSSOM2.CSSConditionRule); - Object.defineProperty(CSSOM2.CSSContainerRule.prototype, "type", { - value: 17, - writable: false - }); - Object.defineProperties(CSSOM2.CSSContainerRule.prototype, { - "cssText": { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); - } - values = valuesArr.join("\n ") + "\n}"; - return "@container " + this.conditionText + values; - } - }, - "containerName": { - get: function() { - var parts = this.conditionText.trim().split(/\s+/); - if (parts.length > 1 && parts[0] !== "(" && !parts[0].startsWith("(")) { - return parts[0]; - } - return ""; - } - }, - "containerQuery": { - get: function() { - var parts = this.conditionText.trim().split(/\s+/); - if (parts.length > 1 && parts[0] !== "(" && !parts[0].startsWith("(")) { - return parts.slice(1).join(" "); + return ret + str.substr(lastIdx); + } + exports2.encodeXML = encodeXML2; + exports2.escape = encodeXML2; + function getEscaper(regex, map) { + return function escape3(data) { + var match; + var lastIdx = 0; + var result = ""; + while (match = regex.exec(data)) { + if (lastIdx !== match.index) { + result += data.substring(lastIdx, match.index); } - return this.conditionText; + result += map.get(match[0].charCodeAt(0)); + lastIdx = match.index + 1; } - } - }); - exports2.CSSContainerRule = CSSOM2.CSSContainerRule; + return result + data.substring(lastIdx); + }; + } + exports2.escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap); + exports2.escapeAttribute = getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([ + [34, """], + [38, "&"], + [160, " "] + ])); + exports2.escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([ + [38, "&"], + [60, "<"], + [62, ">"], + [160, " "] + ])); } }); -// node_modules/@acemir/cssom/lib/CSSSupportsRule.js -var require_CSSSupportsRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSSupportsRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/encode.js +var require_encode = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/encode.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, - CSSConditionRule: require_CSSConditionRule().CSSConditionRule - }; - CSSOM2.CSSSupportsRule = function CSSSupportsRule() { - CSSOM2.CSSConditionRule.call(this); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - CSSOM2.CSSSupportsRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); - CSSOM2.CSSSupportsRule.prototype.constructor = CSSOM2.CSSSupportsRule; - Object.setPrototypeOf(CSSOM2.CSSSupportsRule, CSSOM2.CSSConditionRule); - Object.defineProperty(CSSOM2.CSSSupportsRule.prototype, "type", { - value: 12, - writable: false - }); - Object.defineProperty(CSSOM2.CSSSupportsRule.prototype, "cssText", { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encodeNonAsciiHTML = exports2.encodeHTML = void 0; + var encode_html_js_1 = __importDefault2(require_encode_html()); + var escape_js_1 = require_escape(); + var htmlReplacer = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g; + function encodeHTML(data) { + return encodeHTMLTrieRe(htmlReplacer, data); + } + exports2.encodeHTML = encodeHTML; + function encodeNonAsciiHTML(data) { + return encodeHTMLTrieRe(escape_js_1.xmlReplacer, data); + } + exports2.encodeNonAsciiHTML = encodeNonAsciiHTML; + function encodeHTMLTrieRe(regExp, str) { + var ret = ""; + var lastIdx = 0; + var match; + while ((match = regExp.exec(str)) !== null) { + var i = match.index; + ret += str.substring(lastIdx, i); + var char = str.charCodeAt(i); + var next = encode_html_js_1.default.get(char); + if (typeof next === "object") { + if (i + 1 < str.length) { + var nextChar = str.charCodeAt(i + 1); + var value = typeof next.n === "number" ? next.n === nextChar ? next.o : void 0 : next.n.get(nextChar); + if (value !== void 0) { + ret += value; + lastIdx = regExp.lastIndex += 1; + continue; } - return acc; - }, []).join("\n ")); + } + next = next.v; + } + if (next !== void 0) { + ret += next; + lastIdx = i + 1; + } else { + var cp = (0, escape_js_1.getCodePoint)(str, i); + ret += "&#x".concat(cp.toString(16), ";"); + lastIdx = regExp.lastIndex += Number(cp !== char); } - values = valuesArr.join("\n ") + "\n}"; - return "@supports " + this.conditionText + values; } - }); - exports2.CSSSupportsRule = CSSOM2.CSSSupportsRule; + return ret + str.substr(lastIdx); + } } }); -// node_modules/@acemir/cssom/lib/CSSFontFaceRule.js -var require_CSSFontFaceRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSFontFaceRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/index.js +var require_lib7 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, - CSSRule: require_CSSRule().CSSRule - }; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decodeXMLStrict = exports2.decodeHTML5Strict = exports2.decodeHTML4Strict = exports2.decodeHTML5 = exports2.decodeHTML4 = exports2.decodeHTMLAttribute = exports2.decodeHTMLStrict = exports2.decodeHTML = exports2.decodeXML = exports2.DecodingMode = exports2.EntityDecoder = exports2.encodeHTML5 = exports2.encodeHTML4 = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.escapeText = exports2.escapeAttribute = exports2.escapeUTF8 = exports2.escape = exports2.encodeXML = exports2.encode = exports2.decodeStrict = exports2.decode = exports2.EncodingMode = exports2.EntityLevel = void 0; + var decode_js_1 = require_decode2(); + var encode_js_1 = require_encode(); + var escape_js_1 = require_escape(); + var EntityLevel2; + (function(EntityLevel3) { + EntityLevel3[EntityLevel3["XML"] = 0] = "XML"; + EntityLevel3[EntityLevel3["HTML"] = 1] = "HTML"; + })(EntityLevel2 = exports2.EntityLevel || (exports2.EntityLevel = {})); + var EncodingMode2; + (function(EncodingMode3) { + EncodingMode3[EncodingMode3["UTF8"] = 0] = "UTF8"; + EncodingMode3[EncodingMode3["ASCII"] = 1] = "ASCII"; + EncodingMode3[EncodingMode3["Extensive"] = 2] = "Extensive"; + EncodingMode3[EncodingMode3["Attribute"] = 3] = "Attribute"; + EncodingMode3[EncodingMode3["Text"] = 4] = "Text"; + })(EncodingMode2 = exports2.EncodingMode || (exports2.EncodingMode = {})); + function decode(data, options) { + if (options === void 0) { + options = EntityLevel2.XML; + } + var level = typeof options === "number" ? options : options.level; + if (level === EntityLevel2.HTML) { + var mode = typeof options === "object" ? options.mode : void 0; + return (0, decode_js_1.decodeHTML)(data, mode); + } + return (0, decode_js_1.decodeXML)(data); } - CSSOM2.CSSFontFaceRule = function CSSFontFaceRule() { - CSSOM2.CSSRule.call(this); - this.__style = new CSSOM2.CSSStyleDeclaration(); - this.__style.parentRule = this; - }; - CSSOM2.CSSFontFaceRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSFontFaceRule.prototype.constructor = CSSOM2.CSSFontFaceRule; - Object.setPrototypeOf(CSSOM2.CSSFontFaceRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "type", { - value: 5, - writable: false - }); - Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "style", { - get: function() { - return this.__style; - }, - set: function(value) { - if (typeof value === "string") { - this.__style.cssText = value; - } else { - this.__style = value; - } + exports2.decode = decode; + function decodeStrict(data, options) { + var _a; + if (options === void 0) { + options = EntityLevel2.XML; } - }); - Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "cssText", { - get: function() { - return "@font-face {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; + var opts = typeof options === "number" ? { level: options } : options; + (_a = opts.mode) !== null && _a !== void 0 ? _a : opts.mode = decode_js_1.DecodingMode.Strict; + return decode(data, opts); + } + exports2.decodeStrict = decodeStrict; + function encode(data, options) { + if (options === void 0) { + options = EntityLevel2.XML; } - }); - exports2.CSSFontFaceRule = CSSOM2.CSSFontFaceRule; + var opts = typeof options === "number" ? { level: options } : options; + if (opts.mode === EncodingMode2.UTF8) + return (0, escape_js_1.escapeUTF8)(data); + if (opts.mode === EncodingMode2.Attribute) + return (0, escape_js_1.escapeAttribute)(data); + if (opts.mode === EncodingMode2.Text) + return (0, escape_js_1.escapeText)(data); + if (opts.level === EntityLevel2.HTML) { + if (opts.mode === EncodingMode2.ASCII) { + return (0, encode_js_1.encodeNonAsciiHTML)(data); + } + return (0, encode_js_1.encodeHTML)(data); + } + return (0, escape_js_1.encodeXML)(data); + } + exports2.encode = encode; + var escape_js_2 = require_escape(); + Object.defineProperty(exports2, "encodeXML", { enumerable: true, get: function() { + return escape_js_2.encodeXML; + } }); + Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { + return escape_js_2.escape; + } }); + Object.defineProperty(exports2, "escapeUTF8", { enumerable: true, get: function() { + return escape_js_2.escapeUTF8; + } }); + Object.defineProperty(exports2, "escapeAttribute", { enumerable: true, get: function() { + return escape_js_2.escapeAttribute; + } }); + Object.defineProperty(exports2, "escapeText", { enumerable: true, get: function() { + return escape_js_2.escapeText; + } }); + var encode_js_2 = require_encode(); + Object.defineProperty(exports2, "encodeHTML", { enumerable: true, get: function() { + return encode_js_2.encodeHTML; + } }); + Object.defineProperty(exports2, "encodeNonAsciiHTML", { enumerable: true, get: function() { + return encode_js_2.encodeNonAsciiHTML; + } }); + Object.defineProperty(exports2, "encodeHTML4", { enumerable: true, get: function() { + return encode_js_2.encodeHTML; + } }); + Object.defineProperty(exports2, "encodeHTML5", { enumerable: true, get: function() { + return encode_js_2.encodeHTML; + } }); + var decode_js_2 = require_decode2(); + Object.defineProperty(exports2, "EntityDecoder", { enumerable: true, get: function() { + return decode_js_2.EntityDecoder; + } }); + Object.defineProperty(exports2, "DecodingMode", { enumerable: true, get: function() { + return decode_js_2.DecodingMode; + } }); + Object.defineProperty(exports2, "decodeXML", { enumerable: true, get: function() { + return decode_js_2.decodeXML; + } }); + Object.defineProperty(exports2, "decodeHTML", { enumerable: true, get: function() { + return decode_js_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTMLStrict", { enumerable: true, get: function() { + return decode_js_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeHTMLAttribute", { enumerable: true, get: function() { + return decode_js_2.decodeHTMLAttribute; + } }); + Object.defineProperty(exports2, "decodeHTML4", { enumerable: true, get: function() { + return decode_js_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTML5", { enumerable: true, get: function() { + return decode_js_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTML4Strict", { enumerable: true, get: function() { + return decode_js_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeHTML5Strict", { enumerable: true, get: function() { + return decode_js_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeXMLStrict", { enumerable: true, get: function() { + return decode_js_2.decodeXML; + } }); } }); -// node_modules/@acemir/cssom/lib/CSSHostRule.js -var require_CSSHostRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSHostRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js +var require_foreignNames = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList - }; - CSSOM2.CSSHostRule = function CSSHostRule() { - CSSOM2.CSSRule.call(this); - this.cssRules = new CSSOM2.CSSRuleList(); - }; - CSSOM2.CSSHostRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSHostRule.prototype.constructor = CSSOM2.CSSHostRule; - Object.setPrototypeOf(CSSOM2.CSSHostRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSHostRule.prototype, "type", { - value: 1001, - writable: false - }); - Object.defineProperty(CSSOM2.CSSHostRule.prototype, "cssText", { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); - } - values = valuesArr.join("\n ") + "\n}"; - return "@host" + values; - } - }); - exports2.CSSHostRule = CSSOM2.CSSHostRule; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.attributeNames = exports2.elementNames = void 0; + exports2.elementNames = new Map([ + "altGlyph", + "altGlyphDef", + "altGlyphItem", + "animateColor", + "animateMotion", + "animateTransform", + "clipPath", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feDistantLight", + "feDropShadow", + "feFlood", + "feFuncA", + "feFuncB", + "feFuncG", + "feFuncR", + "feGaussianBlur", + "feImage", + "feMerge", + "feMergeNode", + "feMorphology", + "feOffset", + "fePointLight", + "feSpecularLighting", + "feSpotLight", + "feTile", + "feTurbulence", + "foreignObject", + "glyphRef", + "linearGradient", + "radialGradient", + "textPath" + ].map(function(val) { + return [val.toLowerCase(), val]; + })); + exports2.attributeNames = new Map([ + "definitionURL", + "attributeName", + "attributeType", + "baseFrequency", + "baseProfile", + "calcMode", + "clipPathUnits", + "diffuseConstant", + "edgeMode", + "filterUnits", + "glyphRef", + "gradientTransform", + "gradientUnits", + "kernelMatrix", + "kernelUnitLength", + "keyPoints", + "keySplines", + "keyTimes", + "lengthAdjust", + "limitingConeAngle", + "markerHeight", + "markerUnits", + "markerWidth", + "maskContentUnits", + "maskUnits", + "numOctaves", + "pathLength", + "patternContentUnits", + "patternTransform", + "patternUnits", + "pointsAtX", + "pointsAtY", + "pointsAtZ", + "preserveAlpha", + "preserveAspectRatio", + "primitiveUnits", + "refX", + "refY", + "repeatCount", + "repeatDur", + "requiredExtensions", + "requiredFeatures", + "specularConstant", + "specularExponent", + "spreadMethod", + "startOffset", + "stdDeviation", + "stitchTiles", + "surfaceScale", + "systemLanguage", + "tableValues", + "targetX", + "targetY", + "textLength", + "viewBox", + "viewTarget", + "xChannelSelector", + "yChannelSelector", + "zoomAndPan" + ].map(function(val) { + return [val.toLowerCase(), val]; + })); } }); -// node_modules/@acemir/cssom/lib/CSSStartingStyleRule.js -var require_CSSStartingStyleRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSStartingStyleRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js +var require_lib8 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - CSSOM2.CSSStartingStyleRule = function CSSStartingStyleRule() { - CSSOM2.CSSGroupingRule.call(this); + var __assign2 = exports2 && exports2.__assign || function() { + __assign2 = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign2.apply(this, arguments); }; - CSSOM2.CSSStartingStyleRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSStartingStyleRule.prototype.constructor = CSSOM2.CSSStartingStyleRule; - Object.setPrototypeOf(CSSOM2.CSSStartingStyleRule, CSSOM2.CSSGroupingRule); - Object.defineProperty(CSSOM2.CSSStartingStyleRule.prototype, "type", { - value: 1002, - writable: false + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; }); - Object.defineProperty(CSSOM2.CSSStartingStyleRule.prototype, "cssText", { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.render = void 0; + var ElementType4 = __importStar2(require_lib5()); + var entities_1 = require_lib7(); + var foreignNames_js_1 = require_foreignNames(); + var unencodedElements2 = /* @__PURE__ */ new Set([ + "style", + "script", + "xmp", + "iframe", + "noembed", + "noframes", + "plaintext", + "noscript" + ]); + function replaceQuotes2(value) { + return value.replace(/"/g, """); + } + function formatAttributes2(attributes, opts) { + var _a; + if (!attributes) + return; + var encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false ? replaceQuotes2 : opts.xmlMode || opts.encodeEntities !== "utf8" ? entities_1.encodeXML : entities_1.escapeAttribute; + return Object.keys(attributes).map(function(key) { + var _a2, _b; + var value = (_a2 = attributes[key]) !== null && _a2 !== void 0 ? _a2 : ""; + if (opts.xmlMode === "foreign") { + key = (_b = foreignNames_js_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key; } - values = valuesArr.join("\n ") + "\n}"; - return "@starting-style" + values; + if (!opts.emptyAttrs && !opts.xmlMode && value === "") { + return key; + } + return "".concat(key, '="').concat(encode(value), '"'); + }).join(" "); + } + var singleTag = /* @__PURE__ */ new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr" + ]); + function render2(node, options) { + if (options === void 0) { + options = {}; } - }); - exports2.CSSStartingStyleRule = CSSOM2.CSSStartingStyleRule; + var nodes = "length" in node ? node : [node]; + var output = ""; + for (var i = 0; i < nodes.length; i++) { + output += renderNode2(nodes[i], options); + } + return output; + } + exports2.render = render2; + exports2.default = render2; + function renderNode2(node, options) { + switch (node.type) { + case ElementType4.Root: + return render2(node.children, options); + // @ts-expect-error We don't use `Doctype` yet + case ElementType4.Doctype: + case ElementType4.Directive: + return renderDirective(node); + case ElementType4.Comment: + return renderComment(node); + case ElementType4.CDATA: + return renderCdata(node); + case ElementType4.Script: + case ElementType4.Style: + case ElementType4.Tag: + return renderTag2(node, options); + case ElementType4.Text: + return renderText(node, options); + } + } + var foreignModeIntegrationPoints2 = /* @__PURE__ */ new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignObject", + "desc", + "title" + ]); + var foreignElements2 = /* @__PURE__ */ new Set(["svg", "math"]); + function renderTag2(elem, opts) { + var _a; + if (opts.xmlMode === "foreign") { + elem.name = (_a = foreignNames_js_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name; + if (elem.parent && foreignModeIntegrationPoints2.has(elem.parent.name)) { + opts = __assign2(__assign2({}, opts), { xmlMode: false }); + } + } + if (!opts.xmlMode && foreignElements2.has(elem.name)) { + opts = __assign2(__assign2({}, opts), { xmlMode: "foreign" }); + } + var tag = "<".concat(elem.name); + var attribs = formatAttributes2(elem.attribs, opts); + if (attribs) { + tag += " ".concat(attribs); + } + if (elem.children.length === 0 && (opts.xmlMode ? ( + // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags + opts.selfClosingTags !== false + ) : ( + // User explicitly asked for self-closing tags, even in HTML mode + opts.selfClosingTags && singleTag.has(elem.name) + ))) { + if (!opts.xmlMode) + tag += " "; + tag += "/>"; + } else { + tag += ">"; + if (elem.children.length > 0) { + tag += render2(elem.children, opts); + } + if (opts.xmlMode || !singleTag.has(elem.name)) { + tag += "</".concat(elem.name, ">"); + } + } + return tag; + } + function renderDirective(elem) { + return "<".concat(elem.data, ">"); + } + function renderText(elem, opts) { + var _a; + var data = elem.data || ""; + if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false && !(!opts.xmlMode && elem.parent && unencodedElements2.has(elem.parent.name))) { + data = opts.xmlMode || opts.encodeEntities !== "utf8" ? (0, entities_1.encodeXML)(data) : (0, entities_1.escapeText)(data); + } + return data; + } + function renderCdata(elem) { + return "<![CDATA[".concat(elem.children[0].data, "]]>"); + } + function renderComment(elem) { + return "<!--".concat(elem.data, "-->"); + } } }); -// node_modules/@acemir/cssom/lib/CSSKeyframeRule.js -var require_CSSKeyframeRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSKeyframeRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +var require_stringify3 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/stringify.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getOuterHTML = getOuterHTML2; + exports2.getInnerHTML = getInnerHTML2; + exports2.getText = getText2; + exports2.textContent = textContent2; + exports2.innerText = innerText2; + var domhandler_1 = require_lib6(); + var dom_serializer_1 = __importDefault2(require_lib8()); + var domelementtype_1 = require_lib5(); + function getOuterHTML2(node, options) { + return (0, dom_serializer_1.default)(node, options); } - CSSOM2.CSSKeyframeRule = function CSSKeyframeRule() { - CSSOM2.CSSRule.call(this); - this.keyText = ""; - this.__style = new CSSOM2.CSSStyleDeclaration(); - this.__style.parentRule = this; - }; - CSSOM2.CSSKeyframeRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSKeyframeRule.prototype.constructor = CSSOM2.CSSKeyframeRule; - Object.setPrototypeOf(CSSOM2.CSSKeyframeRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "type", { - value: 8, - writable: false - }); - Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "style", { - get: function() { - return this.__style; - }, - set: function(value) { - if (typeof value === "string") { - this.__style.cssText = value; - } else { - this.__style = value; - } + function getInnerHTML2(node, options) { + return (0, domhandler_1.hasChildren)(node) ? node.children.map(function(node2) { + return getOuterHTML2(node2, options); + }).join("") : ""; + } + function getText2(node) { + if (Array.isArray(node)) + return node.map(getText2).join(""); + if ((0, domhandler_1.isTag)(node)) + return node.name === "br" ? "\n" : getText2(node.children); + if ((0, domhandler_1.isCDATA)(node)) + return getText2(node.children); + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } + function textContent2(node) { + if (Array.isArray(node)) + return node.map(textContent2).join(""); + if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) { + return textContent2(node.children); } - }); - Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "cssText", { - get: function() { - return this.keyText + " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } + function innerText2(node) { + if (Array.isArray(node)) + return node.map(innerText2).join(""); + if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) { + return innerText2(node.children); } - }); - exports2.CSSKeyframeRule = CSSOM2.CSSKeyframeRule; + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } } }); -// node_modules/@acemir/cssom/lib/CSSKeyframesRule.js -var require_CSSKeyframesRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSKeyframesRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +var require_traversal = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/traversal.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - parse: require_parse3().parse - }; - var errorUtils2 = require_errorUtils().errorUtils; - CSSOM2.CSSKeyframesRule = function CSSKeyframesRule() { - CSSOM2.CSSRule.call(this); - this.name = ""; - this.cssRules = new CSSOM2.CSSRuleList(); - this._setupIndexedAccess(); - var self2 = this; - var originalPush = this.cssRules.push; - var originalSplice = this.cssRules.splice; - Object.defineProperty(this.cssRules, "push", { - value: function() { - var result = originalPush.apply(this, arguments); - self2._setupIndexedAccess(); - return result; - }, - writable: true, - enumerable: false, - configurable: true - }); - Object.defineProperty(this.cssRules, "splice", { - value: function() { - var result = originalSplice.apply(this, arguments); - self2._setupIndexedAccess(); - return result; - }, - writable: true, - enumerable: false, - configurable: true - }); - }; - CSSOM2.CSSKeyframesRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSKeyframesRule.prototype.constructor = CSSOM2.CSSKeyframesRule; - Object.setPrototypeOf(CSSOM2.CSSKeyframesRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSKeyframesRule.prototype, "type", { - value: 7, - writable: false - }); - Object.defineProperty(CSSOM2.CSSKeyframesRule.prototype, "cssText", { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); - } - values = valuesArr.join("\n ") + "\n}"; - var cssWideKeywords = ["initial", "inherit", "revert", "revert-layer", "unset", "none"]; - var processedName = cssWideKeywords.includes(this.name) ? '"' + this.name + '"' : this.name; - return "@" + (this._vendorPrefix || "") + "keyframes " + processedName + values; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getChildren = getChildren2; + exports2.getParent = getParent2; + exports2.getSiblings = getSiblings2; + exports2.getAttributeValue = getAttributeValue2; + exports2.hasAttrib = hasAttrib2; + exports2.getName = getName2; + exports2.nextElementSibling = nextElementSibling2; + exports2.prevElementSibling = prevElementSibling2; + var domhandler_1 = require_lib6(); + function getChildren2(elem) { + return (0, domhandler_1.hasChildren)(elem) ? elem.children : []; + } + function getParent2(elem) { + return elem.parent || null; + } + function getSiblings2(elem) { + var _a, _b; + var parent = getParent2(elem); + if (parent != null) + return getChildren2(parent); + var siblings = [elem]; + var prev = elem.prev, next = elem.next; + while (prev != null) { + siblings.unshift(prev); + _a = prev, prev = _a.prev; } - }); - CSSOM2.CSSKeyframesRule.prototype.appendRule = function appendRule(rule) { - if (arguments.length === 0) { - errorUtils2.throwMissingArguments(this, "appendRule", "CSSKeyframesRule"); + while (next != null) { + siblings.push(next); + _b = next, next = _b.next; } - var parsedRule; - try { - var tempStyleSheet = CSSOM2.parse("@keyframes temp { " + rule + " }"); - if (tempStyleSheet.cssRules.length > 0 && tempStyleSheet.cssRules[0].cssRules.length > 0) { - parsedRule = tempStyleSheet.cssRules[0].cssRules[0]; - } else { - throw new Error("Failed to parse keyframe rule"); + return siblings; + } + function getAttributeValue2(elem, name) { + var _a; + return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name]; + } + function hasAttrib2(elem, name) { + return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null; + } + function getName2(elem) { + return elem.name; + } + function nextElementSibling2(elem) { + var _a; + var next = elem.next; + while (next !== null && !(0, domhandler_1.isTag)(next)) + _a = next, next = _a.next; + return next; + } + function prevElementSibling2(elem) { + var _a; + var prev = elem.prev; + while (prev !== null && !(0, domhandler_1.isTag)(prev)) + _a = prev, prev = _a.prev; + return prev; + } + } +}); + +// node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +var require_manipulation = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.removeElement = removeElement2; + exports2.replaceElement = replaceElement2; + exports2.appendChild = appendChild2; + exports2.append = append2; + exports2.prependChild = prependChild2; + exports2.prepend = prepend2; + function removeElement2(elem) { + if (elem.prev) + elem.prev.next = elem.next; + if (elem.next) + elem.next.prev = elem.prev; + if (elem.parent) { + var childs = elem.parent.children; + var childsIndex = childs.lastIndexOf(elem); + if (childsIndex >= 0) { + childs.splice(childsIndex, 1); } - } catch (e) { - errorUtils2.throwParseError(this, "appendRule", "CSSKeyframesRule", rule); } - parsedRule.__parentRule = this; - this.cssRules.push(parsedRule); - }; - CSSOM2.CSSKeyframesRule.prototype.deleteRule = function deleteRule(select) { - if (arguments.length === 0) { - errorUtils2.throwMissingArguments(this, "deleteRule", "CSSKeyframesRule"); + elem.next = null; + elem.prev = null; + elem.parent = null; + } + function replaceElement2(elem, replacement) { + var prev = replacement.prev = elem.prev; + if (prev) { + prev.next = replacement; } - var normalizedSelect = this._normalizeKeyText(select); - for (var i = 0; i < this.cssRules.length; i++) { - var rule = this.cssRules[i]; - if (this._normalizeKeyText(rule.keyText) === normalizedSelect) { - rule.__parentRule = null; - this.cssRules.splice(i, 1); - return; - } + var next = replacement.next = elem.next; + if (next) { + next.prev = replacement; } - }; - CSSOM2.CSSKeyframesRule.prototype.findRule = function findRule(select) { - if (arguments.length === 0) { - errorUtils2.throwMissingArguments(this, "findRule", "CSSKeyframesRule"); + var parent = replacement.parent = elem.parent; + if (parent) { + var childs = parent.children; + childs[childs.lastIndexOf(elem)] = replacement; + elem.parent = null; } - var normalizedSelect = this._normalizeKeyText(select); - for (var i = this.cssRules.length - 1; i >= 0; i--) { - var rule = this.cssRules[i]; - if (this._normalizeKeyText(rule.keyText) === normalizedSelect) { - return rule; + } + function appendChild2(parent, child) { + removeElement2(child); + child.next = null; + child.parent = parent; + if (parent.children.push(child) > 1) { + var sibling = parent.children[parent.children.length - 2]; + sibling.next = child; + child.prev = sibling; + } else { + child.prev = null; + } + } + function append2(elem, next) { + removeElement2(next); + var parent = elem.parent; + var currNext = elem.next; + next.next = currNext; + next.prev = elem; + elem.next = next; + next.parent = parent; + if (currNext) { + currNext.prev = next; + if (parent) { + var childs = parent.children; + childs.splice(childs.lastIndexOf(currNext), 0, next); } + } else if (parent) { + parent.children.push(next); } - return null; - }; - CSSOM2.CSSKeyframesRule.prototype._normalizeKeyText = function _normalizeKeyText(keyText) { - if (!keyText) return ""; - var normalized2 = keyText.toString().trim().toLowerCase(); - if (normalized2 === "from") { - return "0%"; - } else if (normalized2 === "to") { - return "100%"; + } + function prependChild2(parent, child) { + removeElement2(child); + child.parent = parent; + child.prev = null; + if (parent.children.unshift(child) !== 1) { + var sibling = parent.children[1]; + sibling.prev = child; + child.next = sibling; + } else { + child.next = null; } - return normalized2; - }; - if (typeof Symbol !== "undefined" && Symbol.iterator) { - CSSOM2.CSSKeyframesRule.prototype[Symbol.iterator] = function() { - var index2 = 0; - var cssRules = this.cssRules; - return { - next: function() { - if (index2 < cssRules.length) { - return { value: cssRules[index2++], done: false }; - } else { - return { done: true }; - } - } - }; - }; } - CSSOM2.CSSKeyframesRule.prototype._setupIndexedAccess = function() { - for (var i = 0; i < 1e3; i++) { - if (this.hasOwnProperty(i)) { - delete this[i]; - } else { - break; + function prepend2(elem, prev) { + removeElement2(prev); + var parent = elem.parent; + if (parent) { + var childs = parent.children; + childs.splice(childs.indexOf(elem), 0, prev); + } + if (elem.prev) { + elem.prev.next = prev; + } + prev.parent = parent; + prev.prev = elem.prev; + prev.next = elem; + elem.prev = prev; + } + } +}); + +// node_modules/htmlparser2/node_modules/domutils/lib/querying.js +var require_querying = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/querying.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.filter = filter2; + exports2.find = find2; + exports2.findOneChild = findOneChild; + exports2.findOne = findOne3; + exports2.existsOne = existsOne2; + exports2.findAll = findAll3; + var domhandler_1 = require_lib6(); + function filter2(test, node, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return find2(test, Array.isArray(node) ? node : [node], recurse, limit); + } + function find2(test, nodes, recurse, limit) { + var result = []; + var nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; + var indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (indexStack.length === 1) { + return result; + } + nodeStack.shift(); + indexStack.shift(); + continue; + } + var elem = nodeStack[0][indexStack[0]++]; + if (test(elem)) { + result.push(elem); + if (--limit <= 0) + return result; + } + if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) { + indexStack.unshift(0); + nodeStack.unshift(elem.children); } } - for (var i = 0; i < this.cssRules.length; i++) { - (function(index2) { - Object.defineProperty(this, index2, { - get: function() { - return this.cssRules[index2]; - }, - enumerable: false, - configurable: true - }); - }).call(this, i); + } + function findOneChild(test, nodes) { + return nodes.find(test); + } + function findOne3(test, nodes, recurse) { + if (recurse === void 0) { + recurse = true; } - Object.defineProperty(this, "length", { - get: function() { - return this.cssRules.length; - }, - enumerable: false, - configurable: true + var searchedNodes = Array.isArray(nodes) ? nodes : [nodes]; + for (var i = 0; i < searchedNodes.length; i++) { + var node = searchedNodes[i]; + if ((0, domhandler_1.isTag)(node) && test(node)) { + return node; + } + if (recurse && (0, domhandler_1.hasChildren)(node) && node.children.length > 0) { + var found = findOne3(test, node.children, true); + if (found) + return found; + } + } + return null; + } + function existsOne2(test, nodes) { + return (Array.isArray(nodes) ? nodes : [nodes]).some(function(node) { + return (0, domhandler_1.isTag)(node) && test(node) || (0, domhandler_1.hasChildren)(node) && existsOne2(test, node.children); }); - }; - exports2.CSSKeyframesRule = CSSOM2.CSSKeyframesRule; + } + function findAll3(test, nodes) { + var result = []; + var nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; + var indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (nodeStack.length === 1) { + return result; + } + nodeStack.shift(); + indexStack.shift(); + continue; + } + var elem = nodeStack[0][indexStack[0]++]; + if ((0, domhandler_1.isTag)(elem) && test(elem)) + result.push(elem); + if ((0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) { + indexStack.unshift(0); + nodeStack.unshift(elem.children); + } + } + } } }); -// node_modules/@acemir/cssom/lib/CSSValue.js -var require_CSSValue = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSValue.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +var require_legacy = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/legacy.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = {}; - CSSOM2.CSSValue = function CSSValue() { - }; - CSSOM2.CSSValue.prototype = { - constructor: CSSOM2.CSSValue, - // @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue - set cssText(text) { - var name = this._getConstructorName(); - throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!'); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.testElement = testElement2; + exports2.getElements = getElements2; + exports2.getElementById = getElementById2; + exports2.getElementsByTagName = getElementsByTagName2; + exports2.getElementsByClassName = getElementsByClassName2; + exports2.getElementsByTagType = getElementsByTagType2; + var domhandler_1 = require_lib6(); + var querying_js_1 = require_querying(); + var Checks2 = { + tag_name: function(name) { + if (typeof name === "function") { + return function(elem) { + return (0, domhandler_1.isTag)(elem) && name(elem.name); + }; + } else if (name === "*") { + return domhandler_1.isTag; + } + return function(elem) { + return (0, domhandler_1.isTag)(elem) && elem.name === name; + }; }, - get cssText() { - var name = this._getConstructorName(); - throw new Error('getter "cssText" of "' + name + '" is not implemented!'); + tag_type: function(type) { + if (typeof type === "function") { + return function(elem) { + return type(elem.type); + }; + } + return function(elem) { + return elem.type === type; + }; }, - _getConstructorName: function() { - var s = this.constructor.toString(), c = s.match(/function\s([^\(]+)/), name = c[1]; - return name; + tag_contains: function(data) { + if (typeof data === "function") { + return function(elem) { + return (0, domhandler_1.isText)(elem) && data(elem.data); + }; + } + return function(elem) { + return (0, domhandler_1.isText)(elem) && elem.data === data; + }; } }; - exports2.CSSValue = CSSOM2.CSSValue; + function getAttribCheck2(attrib, value) { + if (typeof value === "function") { + return function(elem) { + return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]); + }; + } + return function(elem) { + return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value; + }; + } + function combineFuncs2(a, b) { + return function(elem) { + return a(elem) || b(elem); + }; + } + function compileTest2(options) { + var funcs = Object.keys(options).map(function(key) { + var value = options[key]; + return Object.prototype.hasOwnProperty.call(Checks2, key) ? Checks2[key](value) : getAttribCheck2(key, value); + }); + return funcs.length === 0 ? null : funcs.reduce(combineFuncs2); + } + function testElement2(options, node) { + var test = compileTest2(options); + return test ? test(node) : true; + } + function getElements2(options, nodes, recurse, limit) { + if (limit === void 0) { + limit = Infinity; + } + var test = compileTest2(options); + return test ? (0, querying_js_1.filter)(test, nodes, recurse, limit) : []; + } + function getElementById2(id, nodes, recurse) { + if (recurse === void 0) { + recurse = true; + } + if (!Array.isArray(nodes)) + nodes = [nodes]; + return (0, querying_js_1.findOne)(getAttribCheck2("id", id), nodes, recurse); + } + function getElementsByTagName2(tagName, nodes, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return (0, querying_js_1.filter)(Checks2["tag_name"](tagName), nodes, recurse, limit); + } + function getElementsByClassName2(className, nodes, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return (0, querying_js_1.filter)(getAttribCheck2("class", className), nodes, recurse, limit); + } + function getElementsByTagType2(type, nodes, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return (0, querying_js_1.filter)(Checks2["tag_type"](type), nodes, recurse, limit); + } } }); -// node_modules/@acemir/cssom/lib/CSSValueExpression.js -var require_CSSValueExpression = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSValueExpression.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +var require_helpers = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/helpers.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSValue: require_CSSValue().CSSValue - }; - CSSOM2.CSSValueExpression = function CSSValueExpression(token, idx) { - this._token = token; - this._idx = idx; - }; - CSSOM2.CSSValueExpression.prototype = Object.create(CSSOM2.CSSValue.prototype); - CSSOM2.CSSValueExpression.prototype.constructor = CSSOM2.CSSValueExpression; - Object.setPrototypeOf(CSSOM2.CSSValueExpression, CSSOM2.CSSValue); - CSSOM2.CSSValueExpression.prototype.parse = function() { - var token = this._token, idx = this._idx; - var character = "", expression = "", error = "", info, paren = []; - for (; ; ++idx) { - character = token.charAt(idx); - if (character === "") { - error = "css expression error: unfinished expression!"; - break; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DocumentPosition = void 0; + exports2.removeSubsets = removeSubsets2; + exports2.compareDocumentPosition = compareDocumentPosition2; + exports2.uniqueSort = uniqueSort2; + var domhandler_1 = require_lib6(); + function removeSubsets2(nodes) { + var idx = nodes.length; + while (--idx >= 0) { + var node = nodes[idx]; + if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) { + nodes.splice(idx, 1); + continue; } - switch (character) { - case "(": - paren.push(character); - expression += character; - break; - case ")": - paren.pop(character); - expression += character; - break; - case "/": - if (info = this._parseJSComment(token, idx)) { - if (info.error) { - error = "css expression error: unfinished comment in expression!"; - } else { - idx = info.idx; - } - } else if (info = this._parseJSRexExp(token, idx)) { - idx = info.idx; - expression += info.text; - } else { - expression += character; - } - break; - case "'": - case '"': - info = this._parseJSString(token, idx, character); - if (info) { - idx = info.idx; - expression += info.text; - } else { - expression += character; - } - break; - default: - expression += character; + for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + if (nodes.includes(ancestor)) { + nodes.splice(idx, 1); break; - } - if (error) { - break; - } - if (paren.length === 0) { - break; + } } } - var ret; - if (error) { - ret = { - error - }; - } else { - ret = { - idx, - expression - }; + return nodes; + } + var DocumentPosition2; + (function(DocumentPosition3) { + DocumentPosition3[DocumentPosition3["DISCONNECTED"] = 1] = "DISCONNECTED"; + DocumentPosition3[DocumentPosition3["PRECEDING"] = 2] = "PRECEDING"; + DocumentPosition3[DocumentPosition3["FOLLOWING"] = 4] = "FOLLOWING"; + DocumentPosition3[DocumentPosition3["CONTAINS"] = 8] = "CONTAINS"; + DocumentPosition3[DocumentPosition3["CONTAINED_BY"] = 16] = "CONTAINED_BY"; + })(DocumentPosition2 || (exports2.DocumentPosition = DocumentPosition2 = {})); + function compareDocumentPosition2(nodeA, nodeB) { + var aParents = []; + var bParents = []; + if (nodeA === nodeB) { + return 0; } - return ret; - }; - CSSOM2.CSSValueExpression.prototype._parseJSComment = function(token, idx) { - var nextChar = token.charAt(idx + 1), text; - if (nextChar === "/" || nextChar === "*") { - var startIdx = idx, endIdx, commentEndChar; - if (nextChar === "/") { - commentEndChar = "\n"; - } else if (nextChar === "*") { - commentEndChar = "*/"; - } - endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1); - if (endIdx !== -1) { - endIdx = endIdx + commentEndChar.length - 1; - text = token.substring(idx, endIdx + 1); - return { - idx: endIdx, - text - }; - } else { - var error = "css expression error: unfinished comment in expression!"; - return { - error - }; - } - } else { - return false; + var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent; + while (current) { + aParents.unshift(current); + current = current.parent; } - }; - CSSOM2.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) { - var endIdx = this._findMatchedIdx(token, idx, sep), text; - if (endIdx === -1) { - return false; - } else { - text = token.substring(idx, endIdx + sep.length); - return { - idx: endIdx, - text - }; + current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent; + while (current) { + bParents.unshift(current); + current = current.parent; } - }; - CSSOM2.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) { - var before2 = token.substring(0, idx).replace(/\s+$/, ""), legalRegx = [ - /^$/, - /\($/, - /\[$/, - /\!$/, - /\+$/, - /\-$/, - /\*$/, - /\/\s+/, - /\%$/, - /\=$/, - /\>$/, - /<$/, - /\&$/, - /\|$/, - /\^$/, - /\~$/, - /\?$/, - /\,$/, - /delete$/, - /in$/, - /instanceof$/, - /new$/, - /typeof$/, - /void$/ - ]; - var isLegal = legalRegx.some(function(reg) { - return reg.test(before2); - }); - if (!isLegal) { - return false; - } else { - var sep = "/"; - return this._parseJSString(token, idx, sep); + var maxIdx = Math.min(aParents.length, bParents.length); + var idx = 0; + while (idx < maxIdx && aParents[idx] === bParents[idx]) { + idx++; } - }; - CSSOM2.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) { - var startIdx = idx, endIdx; - var NOT_FOUND = -1; - while (true) { - endIdx = token.indexOf(sep, startIdx + 1); - if (endIdx === -1) { - endIdx = NOT_FOUND; - break; - } else { - var text = token.substring(idx + 1, endIdx), matched = text.match(/\\+$/); - if (!matched || matched[0] % 2 === 0) { - break; - } else { - startIdx = endIdx; - } + if (idx === 0) { + return DocumentPosition2.DISCONNECTED; + } + var sharedParent = aParents[idx - 1]; + var siblings = sharedParent.children; + var aSibling = aParents[idx]; + var bSibling = bParents[idx]; + if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { + if (sharedParent === nodeB) { + return DocumentPosition2.FOLLOWING | DocumentPosition2.CONTAINED_BY; } + return DocumentPosition2.FOLLOWING; } - var nextNewLineIdx = token.indexOf("\n", idx + 1); - if (nextNewLineIdx < endIdx) { - endIdx = NOT_FOUND; + if (sharedParent === nodeA) { + return DocumentPosition2.PRECEDING | DocumentPosition2.CONTAINS; } - return endIdx; - }; - exports2.CSSValueExpression = CSSOM2.CSSValueExpression; + return DocumentPosition2.PRECEDING; + } + function uniqueSort2(nodes) { + nodes = nodes.filter(function(node, i, arr) { + return !arr.includes(node, i + 1); + }); + nodes.sort(function(a, b) { + var relative = compareDocumentPosition2(a, b); + if (relative & DocumentPosition2.PRECEDING) { + return -1; + } else if (relative & DocumentPosition2.FOLLOWING) { + return 1; + } + return 0; + }); + return nodes; + } } }); -// node_modules/@acemir/cssom/lib/MatcherList.js -var require_MatcherList = __commonJS({ - "node_modules/@acemir/cssom/lib/MatcherList.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/feeds.js +var require_feeds = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/feeds.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = {}; - CSSOM2.MatcherList = function MatcherList() { - this.length = 0; - }; - CSSOM2.MatcherList.prototype = { - constructor: CSSOM2.MatcherList, - /** - * @return {string} - */ - get matcherText() { - return Array.prototype.join.call(this, ", "); - }, - /** - * @param {string} value - */ - set matcherText(value) { - var values = value.split(","); - var length = this.length = values.length; - for (var i = 0; i < length; i++) { - this[i] = values[i].trim(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getFeed = getFeed2; + var stringify_js_1 = require_stringify3(); + var legacy_js_1 = require_legacy(); + function getFeed2(doc) { + var feedRoot = getOneElement2(isValidFeed2, doc); + return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed2(feedRoot) : getRssFeed2(feedRoot); + } + function getAtomFeed2(feedRoot) { + var _a; + var childs = feedRoot.children; + var feed = { + type: "atom", + items: (0, legacy_js_1.getElementsByTagName)("entry", childs).map(function(item) { + var _a2; + var children = item.children; + var entry = { media: getMediaElements2(children) }; + addConditionally2(entry, "id", "id", children); + addConditionally2(entry, "title", "title", children); + var href2 = (_a2 = getOneElement2("link", children)) === null || _a2 === void 0 ? void 0 : _a2.attribs["href"]; + if (href2) { + entry.link = href2; + } + var description = fetch3("summary", children) || fetch3("content", children); + if (description) { + entry.description = description; + } + var pubDate = fetch3("updated", children); + if (pubDate) { + entry.pubDate = new Date(pubDate); + } + return entry; + }) + }; + addConditionally2(feed, "id", "id", childs); + addConditionally2(feed, "title", "title", childs); + var href = (_a = getOneElement2("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"]; + if (href) { + feed.link = href; + } + addConditionally2(feed, "description", "subtitle", childs); + var updated = fetch3("updated", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally2(feed, "author", "email", childs, true); + return feed; + } + function getRssFeed2(feedRoot) { + var _a, _b; + var childs = (_b = (_a = getOneElement2("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; + var feed = { + type: feedRoot.name.substr(0, 3), + id: "", + items: (0, legacy_js_1.getElementsByTagName)("item", feedRoot.children).map(function(item) { + var children = item.children; + var entry = { media: getMediaElements2(children) }; + addConditionally2(entry, "id", "guid", children); + addConditionally2(entry, "title", "title", children); + addConditionally2(entry, "link", "link", children); + addConditionally2(entry, "description", "description", children); + var pubDate = fetch3("pubDate", children) || fetch3("dc:date", children); + if (pubDate) + entry.pubDate = new Date(pubDate); + return entry; + }) + }; + addConditionally2(feed, "title", "title", childs); + addConditionally2(feed, "link", "link", childs); + addConditionally2(feed, "description", "description", childs); + var updated = fetch3("lastBuildDate", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally2(feed, "author", "managingEditor", childs, true); + return feed; + } + var MEDIA_KEYS_STRING2 = ["url", "type", "lang"]; + var MEDIA_KEYS_INT2 = [ + "fileSize", + "bitrate", + "framerate", + "samplingrate", + "channels", + "duration", + "height", + "width" + ]; + function getMediaElements2(where) { + return (0, legacy_js_1.getElementsByTagName)("media:content", where).map(function(elem) { + var attribs = elem.attribs; + var media = { + medium: attribs["medium"], + isDefault: !!attribs["isDefault"] + }; + for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING2; _i < MEDIA_KEYS_STRING_1.length; _i++) { + var attrib = MEDIA_KEYS_STRING_1[_i]; + if (attribs[attrib]) { + media[attrib] = attribs[attrib]; + } } - }, - /** - * @param {string} matcher - */ - appendMatcher: function(matcher) { - if (Array.prototype.indexOf.call(this, matcher) === -1) { - this[this.length] = matcher; - this.length++; + for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT2; _a < MEDIA_KEYS_INT_1.length; _a++) { + var attrib = MEDIA_KEYS_INT_1[_a]; + if (attribs[attrib]) { + media[attrib] = parseInt(attribs[attrib], 10); + } } - }, - /** - * @param {string} matcher - */ - deleteMatcher: function(matcher) { - var index2 = Array.prototype.indexOf.call(this, matcher); - if (index2 !== -1) { - Array.prototype.splice.call(this, index2, 1); + if (attribs["expression"]) { + media.expression = attribs["expression"]; } + return media; + }); + } + function getOneElement2(tagName, node) { + return (0, legacy_js_1.getElementsByTagName)(tagName, node, true, 1)[0]; + } + function fetch3(tagName, where, recurse) { + if (recurse === void 0) { + recurse = false; } - }; - exports2.MatcherList = CSSOM2.MatcherList; + return (0, stringify_js_1.textContent)((0, legacy_js_1.getElementsByTagName)(tagName, where, recurse, 1)).trim(); + } + function addConditionally2(obj, prop, tagName, where, recurse) { + if (recurse === void 0) { + recurse = false; + } + var val = fetch3(tagName, where, recurse); + if (val) + obj[prop] = val; + } + function isValidFeed2(value) { + return value === "rss" || value === "feed" || value === "rdf:RDF"; + } } }); -// node_modules/@acemir/cssom/lib/CSSDocumentRule.js -var require_CSSDocumentRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSDocumentRule.js"(exports2) { +// node_modules/htmlparser2/node_modules/domutils/lib/index.js +var require_lib9 = __commonJS({ + "node_modules/htmlparser2/node_modules/domutils/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - MatcherList: require_MatcherList().MatcherList - }; - CSSOM2.CSSDocumentRule = function CSSDocumentRule() { - CSSOM2.CSSRule.call(this); - this.matcher = new CSSOM2.MatcherList(); - this.cssRules = new CSSOM2.CSSRuleList(); - }; - CSSOM2.CSSDocumentRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSDocumentRule.prototype.constructor = CSSOM2.CSSDocumentRule; - Object.setPrototypeOf(CSSOM2.CSSDocumentRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSDocumentRule.prototype, "type", { - value: 10, - writable: false - }); - Object.defineProperty(CSSOM2.CSSDocumentRule.prototype, "cssText", { - get: function() { - var cssTexts = []; - for (var i = 0, length = this.cssRules.length; i < length; i++) { - cssTexts.push(this.cssRules[i].cssText); - } - return "@-moz-document " + this.matcher.matcherText + " {" + (cssTexts.length ? "\n " + cssTexts.join("\n ") : "") + "\n}"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - }); - exports2.CSSDocumentRule = CSSOM2.CSSDocumentRule; + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.hasChildren = exports2.isDocument = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = void 0; + __exportStar2(require_stringify3(), exports2); + __exportStar2(require_traversal(), exports2); + __exportStar2(require_manipulation(), exports2); + __exportStar2(require_querying(), exports2); + __exportStar2(require_legacy(), exports2); + __exportStar2(require_helpers(), exports2); + __exportStar2(require_feeds(), exports2); + var domhandler_1 = require_lib6(); + Object.defineProperty(exports2, "isTag", { enumerable: true, get: function() { + return domhandler_1.isTag; + } }); + Object.defineProperty(exports2, "isCDATA", { enumerable: true, get: function() { + return domhandler_1.isCDATA; + } }); + Object.defineProperty(exports2, "isText", { enumerable: true, get: function() { + return domhandler_1.isText; + } }); + Object.defineProperty(exports2, "isComment", { enumerable: true, get: function() { + return domhandler_1.isComment; + } }); + Object.defineProperty(exports2, "isDocument", { enumerable: true, get: function() { + return domhandler_1.isDocument; + } }); + Object.defineProperty(exports2, "hasChildren", { enumerable: true, get: function() { + return domhandler_1.hasChildren; + } }); } }); -// node_modules/@acemir/cssom/lib/CSSScopeRule.js -var require_CSSScopeRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSScopeRule.js"(exports2) { +// node_modules/htmlparser2/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/htmlparser2/dist/commonjs/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - CSSOM2.CSSScopeRule = function CSSScopeRule() { - CSSOM2.CSSGroupingRule.call(this); - this.__start = null; - this.__end = null; - }; - CSSOM2.CSSScopeRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSScopeRule.prototype.constructor = CSSOM2.CSSScopeRule; - Object.setPrototypeOf(CSSOM2.CSSScopeRule, CSSOM2.CSSGroupingRule); - Object.defineProperties(CSSOM2.CSSScopeRule.prototype, { - type: { - value: 0, - writable: false - }, - cssText: { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() { + var ownKeys2 = function(o) { + ownKeys2 = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys2(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); + } + __setModuleDefault2(result, mod); + return result; + }; + })(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DomUtils = exports2.getFeed = exports2.ElementType = exports2.QuoteType = exports2.Tokenizer = exports2.DefaultHandler = exports2.DomHandler = exports2.Parser = void 0; + exports2.parseDocument = parseDocument; + exports2.parseDOM = parseDOM; + exports2.createDocumentStream = createDocumentStream; + exports2.createDomStream = createDomStream; + exports2.parseFeed = parseFeed; + var Parser_js_1 = require_Parser(); + var Parser_js_2 = require_Parser(); + Object.defineProperty(exports2, "Parser", { enumerable: true, get: function() { + return Parser_js_2.Parser; + } }); + var domhandler_1 = require_lib6(); + var domhandler_2 = require_lib6(); + Object.defineProperty(exports2, "DomHandler", { enumerable: true, get: function() { + return domhandler_2.DomHandler; + } }); + Object.defineProperty(exports2, "DefaultHandler", { enumerable: true, get: function() { + return domhandler_2.DomHandler; + } }); + function parseDocument(data, options) { + const handler = new domhandler_1.DomHandler(void 0, options); + new Parser_js_1.Parser(handler, options).end(data); + return handler.root; + } + function parseDOM(data, options) { + return parseDocument(data, options).children; + } + function createDocumentStream(callback, options, elementCallback) { + const handler = new domhandler_1.DomHandler((error) => callback(error, handler.root), options, elementCallback); + return new Parser_js_1.Parser(handler, options); + } + function createDomStream(callback, options, elementCallback) { + const handler = new domhandler_1.DomHandler(callback, options, elementCallback); + return new Parser_js_1.Parser(handler, options); + } + var Tokenizer_js_1 = require_Tokenizer(); + Object.defineProperty(exports2, "Tokenizer", { enumerable: true, get: function() { + return __importDefault2(Tokenizer_js_1).default; + } }); + Object.defineProperty(exports2, "QuoteType", { enumerable: true, get: function() { + return Tokenizer_js_1.QuoteType; + } }); + exports2.ElementType = __importStar2(require_lib5()); + var domutils_1 = require_lib9(); + var domutils_2 = require_lib9(); + Object.defineProperty(exports2, "getFeed", { enumerable: true, get: function() { + return domutils_2.getFeed; + } }); + var parseFeedDefaultOptions = { xmlMode: true }; + function parseFeed(feed, options = parseFeedDefaultOptions) { + return (0, domutils_1.getFeed)(parseDOM(feed, options)); + } + exports2.DomUtils = __importStar2(require_lib9()); + } +}); + +// node_modules/linkedom/cjs/shared/constants.js +var require_constants = __commonJS({ + "node_modules/linkedom/cjs/shared/constants.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var NODE_END = -1; + exports2.NODE_END = NODE_END; + var ELEMENT_NODE = 1; + exports2.ELEMENT_NODE = ELEMENT_NODE; + var ATTRIBUTE_NODE = 2; + exports2.ATTRIBUTE_NODE = ATTRIBUTE_NODE; + var TEXT_NODE = 3; + exports2.TEXT_NODE = TEXT_NODE; + var CDATA_SECTION_NODE = 4; + exports2.CDATA_SECTION_NODE = CDATA_SECTION_NODE; + var COMMENT_NODE = 8; + exports2.COMMENT_NODE = COMMENT_NODE; + var DOCUMENT_NODE = 9; + exports2.DOCUMENT_NODE = DOCUMENT_NODE; + var DOCUMENT_TYPE_NODE = 10; + exports2.DOCUMENT_TYPE_NODE = DOCUMENT_TYPE_NODE; + var DOCUMENT_FRAGMENT_NODE = 11; + exports2.DOCUMENT_FRAGMENT_NODE = DOCUMENT_FRAGMENT_NODE; + var BLOCK_ELEMENTS = /* @__PURE__ */ new Set(["ARTICLE", "ASIDE", "BLOCKQUOTE", "BODY", "BR", "BUTTON", "CANVAS", "CAPTION", "COL", "COLGROUP", "DD", "DIV", "DL", "DT", "EMBED", "FIELDSET", "FIGCAPTION", "FIGURE", "FOOTER", "FORM", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "UL", "OL", "P"]); + exports2.BLOCK_ELEMENTS = BLOCK_ELEMENTS; + var SHOW_ALL = -1; + exports2.SHOW_ALL = SHOW_ALL; + var SHOW_ELEMENT = 1; + exports2.SHOW_ELEMENT = SHOW_ELEMENT; + var SHOW_TEXT = 4; + exports2.SHOW_TEXT = SHOW_TEXT; + var SHOW_CDATA_SECTION = 8; + exports2.SHOW_CDATA_SECTION = SHOW_CDATA_SECTION; + var SHOW_COMMENT = 128; + exports2.SHOW_COMMENT = SHOW_COMMENT; + var DOCUMENT_POSITION_DISCONNECTED = 1; + exports2.DOCUMENT_POSITION_DISCONNECTED = DOCUMENT_POSITION_DISCONNECTED; + var DOCUMENT_POSITION_PRECEDING = 2; + exports2.DOCUMENT_POSITION_PRECEDING = DOCUMENT_POSITION_PRECEDING; + var DOCUMENT_POSITION_FOLLOWING = 4; + exports2.DOCUMENT_POSITION_FOLLOWING = DOCUMENT_POSITION_FOLLOWING; + var DOCUMENT_POSITION_CONTAINS = 8; + exports2.DOCUMENT_POSITION_CONTAINS = DOCUMENT_POSITION_CONTAINS; + var DOCUMENT_POSITION_CONTAINED_BY = 16; + exports2.DOCUMENT_POSITION_CONTAINED_BY = DOCUMENT_POSITION_CONTAINED_BY; + var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32; + exports2.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; + var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + exports2.SVG_NAMESPACE = SVG_NAMESPACE; + } +}); + +// node_modules/linkedom/cjs/shared/object.js +var require_object = __commonJS({ + "node_modules/linkedom/cjs/shared/object.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + assign, + create, + defineProperties, + entries, + getOwnPropertyDescriptors, + keys, + setPrototypeOf + } = Object; + exports2.assign = assign; + exports2.create = create; + exports2.defineProperties = defineProperties; + exports2.entries = entries; + exports2.getOwnPropertyDescriptors = getOwnPropertyDescriptors; + exports2.keys = keys; + exports2.setPrototypeOf = setPrototypeOf; + } +}); + +// node_modules/linkedom/cjs/shared/utils.js +var require_utils4 = __commonJS({ + "node_modules/linkedom/cjs/shared/utils.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE } = require_constants(); + var { END, MIME, NEXT, PREV } = require_symbols(); + var $String = String; + exports2.String = $String; + var getEnd = (node) => node.nodeType === ELEMENT_NODE ? node[END] : node; + exports2.getEnd = getEnd; + var ignoreCase = ({ ownerDocument }) => ownerDocument[MIME].ignoreCase; + exports2.ignoreCase = ignoreCase; + var knownAdjacent = (prev, next) => { + prev[NEXT] = next; + next[PREV] = prev; + }; + exports2.knownAdjacent = knownAdjacent; + var knownBoundaries = (prev, current, next) => { + knownAdjacent(prev, current); + knownAdjacent(getEnd(current), next); + }; + exports2.knownBoundaries = knownBoundaries; + var knownSegment = (prev, start, end, next) => { + knownAdjacent(prev, start); + knownAdjacent(getEnd(end), next); + }; + exports2.knownSegment = knownSegment; + var knownSiblings = (prev, current, next) => { + knownAdjacent(prev, current); + knownAdjacent(current, next); + }; + exports2.knownSiblings = knownSiblings; + var localCase = ({ localName, ownerDocument }) => { + return ownerDocument[MIME].ignoreCase ? localName.toUpperCase() : localName; + }; + exports2.localCase = localCase; + var setAdjacent = (prev, next) => { + if (prev) + prev[NEXT] = next; + if (next) + next[PREV] = prev; + }; + exports2.setAdjacent = setAdjacent; + var htmlToFragment = (ownerDocument, html) => { + const fragment = ownerDocument.createDocumentFragment(); + const elem = ownerDocument.createElement(""); + elem.innerHTML = html; + const { firstChild, lastChild } = elem; + if (firstChild) { + knownSegment(fragment, firstChild, lastChild, fragment[END]); + let child = firstChild; + do { + child.parentNode = fragment; + } while (child !== lastChild && (child = getEnd(child)[NEXT])); + } + return fragment; + }; + exports2.htmlToFragment = htmlToFragment; + } +}); + +// node_modules/linkedom/cjs/shared/shadow-roots.js +var require_shadow_roots = __commonJS({ + "node_modules/linkedom/cjs/shared/shadow-roots.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var shadowRoots = /* @__PURE__ */ new WeakMap(); + exports2.shadowRoots = shadowRoots; + } +}); + +// node_modules/linkedom/cjs/interface/custom-element-registry.js +var require_custom_element_registry = __commonJS({ + "node_modules/linkedom/cjs/interface/custom-element-registry.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE } = require_constants(); + var { END, NEXT, UPGRADE } = require_symbols(); + var { entries, setPrototypeOf } = require_object(); + var { shadowRoots } = require_shadow_roots(); + var reactive = false; + var Classes = /* @__PURE__ */ new WeakMap(); + exports2.Classes = Classes; + var customElements = /* @__PURE__ */ new WeakMap(); + exports2.customElements = customElements; + var attributeChangedCallback = (element, attributeName, oldValue, newValue) => { + if (reactive && customElements.has(element) && element.attributeChangedCallback && element.constructor.observedAttributes.includes(attributeName)) { + element.attributeChangedCallback(attributeName, oldValue, newValue); + } + }; + exports2.attributeChangedCallback = attributeChangedCallback; + var createTrigger = (method, isConnected) => (element) => { + if (customElements.has(element)) { + const info = customElements.get(element); + if (info.connected !== isConnected && element.isConnected === isConnected) { + info.connected = isConnected; + if (method in element) + element[method](); + } + } + }; + var triggerConnected = createTrigger("connectedCallback", true); + var connectedCallback = (element) => { + if (reactive) { + triggerConnected(element); + if (shadowRoots.has(element)) + element = shadowRoots.get(element).shadowRoot; + let { [NEXT]: next, [END]: end } = element; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE) + triggerConnected(next); + next = next[NEXT]; + } + } + }; + exports2.connectedCallback = connectedCallback; + var triggerDisconnected = createTrigger("disconnectedCallback", false); + var disconnectedCallback = (element) => { + if (reactive) { + triggerDisconnected(element); + if (shadowRoots.has(element)) + element = shadowRoots.get(element).shadowRoot; + let { [NEXT]: next, [END]: end } = element; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE) + triggerDisconnected(next); + next = next[NEXT]; + } + } + }; + exports2.disconnectedCallback = disconnectedCallback; + var CustomElementRegistry = class { + /** + * @param {Document} ownerDocument + */ + constructor(ownerDocument) { + this.ownerDocument = ownerDocument; + this.registry = /* @__PURE__ */ new Map(); + this.waiting = /* @__PURE__ */ new Map(); + this.active = false; + } + /** + * @param {string} localName the custom element definition name + * @param {Function} Class the custom element **Class** definition + * @param {object?} options the optional object with an `extends` property + */ + define(localName, Class, options = {}) { + const { ownerDocument, registry, waiting } = this; + if (registry.has(localName)) + throw new Error("unable to redefine " + localName); + if (Classes.has(Class)) + throw new Error("unable to redefine the same class: " + Class); + this.active = reactive = true; + const { extends: extend } = options; + Classes.set(Class, { + ownerDocument, + options: { is: extend ? localName : "" }, + localName: extend || localName + }); + const check2 = extend ? (element) => { + return element.localName === extend && element.getAttribute("is") === localName; + } : (element) => element.localName === localName; + registry.set(localName, { Class, check: check2 }); + if (waiting.has(localName)) { + for (const resolve of waiting.get(localName)) + resolve(Class); + waiting.delete(localName); + } + ownerDocument.querySelectorAll( + extend ? `${extend}[is="${localName}"]` : localName + ).forEach(this.upgrade, this); + } + /** + * @param {Element} element + */ + upgrade(element) { + if (customElements.has(element)) + return; + const { ownerDocument, registry } = this; + const ce = element.getAttribute("is") || element.localName; + if (registry.has(ce)) { + const { Class, check: check2 } = registry.get(ce); + if (check2(element)) { + const { attributes, isConnected } = element; + for (const attr of attributes) + element.removeAttributeNode(attr); + const values = entries(element); + for (const [key] of values) + delete element[key]; + setPrototypeOf(element, Class.prototype); + ownerDocument[UPGRADE] = { element, values }; + new Class(ownerDocument, ce); + customElements.set(element, { connected: isConnected }); + for (const attr of attributes) + element.setAttributeNode(attr); + if (isConnected && element.connectedCallback) + element.connectedCallback(); } - values = valuesArr.join("\n ") + "\n}"; - return "@scope" + (this.start ? " (" + this.start + ")" : "") + (this.end ? " to (" + this.end + ")" : "") + values; - }, - configurable: true, - enumerable: true - }, - start: { - get: function() { - return this.__start; } - }, - end: { - get: function() { - return this.__end; + } + /** + * @param {string} localName the custom element definition name + */ + whenDefined(localName) { + const { registry, waiting } = this; + return new Promise((resolve) => { + if (registry.has(localName)) + resolve(registry.get(localName).Class); + else { + if (!waiting.has(localName)) + waiting.set(localName, []); + waiting.get(localName).push(resolve); + } + }); + } + /** + * @param {string} localName the custom element definition name + * @returns {Function?} the custom element **Class**, if any + */ + get(localName) { + const info = this.registry.get(localName); + return info && info.Class; + } + /** + * @param {Function} Class **Class** of custom element + * @returns {string?} found tag name or null + */ + getName(Class) { + if (Classes.has(Class)) { + const { localName } = Classes.get(Class); + return localName; } + return null; } - }); - exports2.CSSScopeRule = CSSOM2.CSSScopeRule; + }; + exports2.CustomElementRegistry = CustomElementRegistry; } }); -// node_modules/@acemir/cssom/lib/CSSLayerBlockRule.js -var require_CSSLayerBlockRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSLayerBlockRule.js"(exports2) { +// node_modules/linkedom/cjs/shared/parse-from-string.js +var require_parse_from_string = __commonJS({ + "node_modules/linkedom/cjs/shared/parse-from-string.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - CSSOM2.CSSLayerBlockRule = function CSSLayerBlockRule() { - CSSOM2.CSSGroupingRule.call(this); - this.name = ""; + var HTMLParser2 = require_commonjs(); + var { ELEMENT_NODE, SVG_NAMESPACE } = require_constants(); + var { CUSTOM_ELEMENTS, PREV, END, VALUE } = require_symbols(); + var { keys } = require_object(); + var { knownBoundaries, knownSiblings } = require_utils4(); + var { attributeChangedCallback, connectedCallback } = require_custom_element_registry(); + var { Parser } = HTMLParser2; + var notParsing = true; + var append2 = (self2, node, active) => { + const end = self2[END]; + node.parentNode = self2; + knownBoundaries(end[PREV], node, end); + if (active && node.nodeType === ELEMENT_NODE) + connectedCallback(node); + return node; }; - CSSOM2.CSSLayerBlockRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSLayerBlockRule.prototype.constructor = CSSOM2.CSSLayerBlockRule; - Object.setPrototypeOf(CSSOM2.CSSLayerBlockRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSLayerBlockRule.prototype, "type", { - value: 18, - writable: false - }); - Object.defineProperties(CSSOM2.CSSLayerBlockRule.prototype, { - cssText: { - get: function() { - var values = ""; - var valuesArr = [" {"]; - if (this.cssRules.length) { - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); + var attribute = (element, end, attribute2, value, active) => { + attribute2[VALUE] = value; + attribute2.ownerElement = element; + knownSiblings(end[PREV], attribute2, end); + if (attribute2.name === "class") + element.className = value; + if (active) + attributeChangedCallback(element, attribute2.name, null, value); + }; + var isNotParsing = () => notParsing; + exports2.isNotParsing = isNotParsing; + var parseFromString = (document2, isHTML, markupLanguage) => { + const { active, registry } = document2[CUSTOM_ELEMENTS]; + let node = document2; + let ownerSVGElement = null; + let parsingCData = false; + notParsing = false; + const content = new Parser({ + // <!DOCTYPE ...> + onprocessinginstruction(name, data) { + if (name.toLowerCase() === "!doctype") + document2.doctype = data.slice(name.length).trim(); + }, + // <tagName> + onopentag(name, attributes) { + let create = true; + if (isHTML) { + if (ownerSVGElement) { + node = append2(node, document2.createElementNS(SVG_NAMESPACE, name), active); + node.ownerSVGElement = ownerSVGElement; + create = false; + } else if (name === "svg" || name === "SVG") { + ownerSVGElement = document2.createElementNS(SVG_NAMESPACE, name); + node = append2(node, ownerSVGElement, active); + create = false; + } else if (active) { + const ce = name.includes("-") ? name : attributes.is || ""; + if (ce && registry.has(ce)) { + const { Class } = registry.get(ce); + node = append2(node, new Class(), active); + delete attributes.is; + create = false; } - return acc; - }, []).join("\n ")); + } } - values = valuesArr.join("\n ") + "\n}"; - return "@layer" + (this.name ? " " + this.name : "") + values; + if (create) + node = append2(node, document2.createElement(name), false); + let end = node[END]; + for (const name2 of keys(attributes)) + attribute(node, end, document2.createAttribute(name2), attributes[name2], active); + }, + // #text, #comment + oncomment(data) { + append2(node, document2.createComment(data), active); + }, + ontext(text) { + if (parsingCData) { + append2(node, document2.createCDATASection(text), active); + } else { + append2(node, document2.createTextNode(text), active); + } + }, + // #cdata + oncdatastart() { + parsingCData = true; + }, + oncdataend() { + parsingCData = false; + }, + // </tagName> + onclosetag() { + if (isHTML && node === ownerSVGElement) + ownerSVGElement = null; + node = node.parentNode; } - } - }); - exports2.CSSLayerBlockRule = CSSOM2.CSSLayerBlockRule; + }, { + lowerCaseAttributeNames: false, + decodeEntities: true, + xmlMode: !isHTML + }); + content.write(markupLanguage); + content.end(); + notParsing = true; + return document2; + }; + exports2.parseFromString = parseFromString; } }); -// node_modules/@acemir/cssom/lib/CSSLayerStatementRule.js -var require_CSSLayerStatementRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSLayerStatementRule.js"(exports2) { +// node_modules/linkedom/cjs/shared/register-html-class.js +var require_register_html_class = __commonJS({ + "node_modules/linkedom/cjs/shared/register-html-class.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSRule: require_CSSRule().CSSRule - }; - CSSOM2.CSSLayerStatementRule = function CSSLayerStatementRule() { - CSSOM2.CSSRule.call(this); - this.nameList = []; + var htmlClasses = /* @__PURE__ */ new Map(); + exports2.htmlClasses = htmlClasses; + var registerHTMLClass = (names, Class) => { + for (const name of [].concat(names)) { + htmlClasses.set(name, Class); + htmlClasses.set(name.toUpperCase(), Class); + } }; - CSSOM2.CSSLayerStatementRule.prototype = Object.create(CSSOM2.CSSRule.prototype); - CSSOM2.CSSLayerStatementRule.prototype.constructor = CSSOM2.CSSLayerStatementRule; - Object.setPrototypeOf(CSSOM2.CSSLayerStatementRule, CSSOM2.CSSRule); - Object.defineProperty(CSSOM2.CSSLayerStatementRule.prototype, "type", { - value: 0, - writable: false - }); - Object.defineProperties(CSSOM2.CSSLayerStatementRule.prototype, { - cssText: { - get: function() { - return "@layer " + this.nameList.join(", ") + ";"; + exports2.registerHTMLClass = registerHTMLClass; + } +}); + +// node_modules/linkedom/cjs/shared/jsdon.js +var require_jsdon = __commonJS({ + "node_modules/linkedom/cjs/shared/jsdon.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + NODE_END, + ATTRIBUTE_NODE, + CDATA_SECTION_NODE, + COMMENT_NODE, + DOCUMENT_TYPE_NODE, + ELEMENT_NODE, + TEXT_NODE + } = require_constants(); + var { END, NEXT, VALUE } = require_symbols(); + var { getEnd } = require_utils4(); + var loopSegment = ({ [NEXT]: next, [END]: end }, json2) => { + while (next !== end) { + switch (next.nodeType) { + case ATTRIBUTE_NODE: + attrAsJSON(next, json2); + break; + case TEXT_NODE: + case COMMENT_NODE: + case CDATA_SECTION_NODE: + characterDataAsJSON(next, json2); + break; + case ELEMENT_NODE: + elementAsJSON(next, json2); + next = getEnd(next); + break; + case DOCUMENT_TYPE_NODE: + documentTypeAsJSON(next, json2); + break; } + next = next[NEXT]; } - }); - exports2.CSSLayerStatementRule = CSSOM2.CSSLayerStatementRule; + const last = json2.length - 1; + const value = json2[last]; + if (typeof value === "number" && value < 0) + json2[last] += NODE_END; + else + json2.push(NODE_END); + }; + var attrAsJSON = (attr, json2) => { + json2.push(ATTRIBUTE_NODE, attr.name); + const value = attr[VALUE].trim(); + if (value) + json2.push(value); + }; + exports2.attrAsJSON = attrAsJSON; + var characterDataAsJSON = (node, json2) => { + const value = node[VALUE]; + if (value.trim()) + json2.push(node.nodeType, value); + }; + exports2.characterDataAsJSON = characterDataAsJSON; + var nonElementAsJSON = (node, json2) => { + json2.push(node.nodeType); + loopSegment(node, json2); + }; + exports2.nonElementAsJSON = nonElementAsJSON; + var documentTypeAsJSON = ({ name, publicId, systemId }, json2) => { + json2.push(DOCUMENT_TYPE_NODE, name); + if (publicId) + json2.push(publicId); + if (systemId) + json2.push(systemId); + }; + exports2.documentTypeAsJSON = documentTypeAsJSON; + var elementAsJSON = (element, json2) => { + json2.push(ELEMENT_NODE, element.localName); + loopSegment(element, json2); + }; + exports2.elementAsJSON = elementAsJSON; } }); -// node_modules/@acemir/cssom/lib/CSSPageRule.js -var require_CSSPageRule = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSPageRule.js"(exports2) { +// node_modules/linkedom/cjs/interface/mutation-observer.js +var require_mutation_observer = __commonJS({ + "node_modules/linkedom/cjs/interface/mutation-observer.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, - CSSRule: require_CSSRule().CSSRule, - CSSRuleList: require_CSSRuleList().CSSRuleList, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule - }; - var regexPatterns = require_regexPatterns().regexPatterns; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { - } - CSSOM2.CSSPageRule = function CSSPageRule() { - CSSOM2.CSSGroupingRule.call(this); - this.__style = new CSSOM2.CSSStyleDeclaration(); - this.__style.parentRule = this; - }; - CSSOM2.CSSPageRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); - CSSOM2.CSSPageRule.prototype.constructor = CSSOM2.CSSPageRule; - Object.setPrototypeOf(CSSOM2.CSSPageRule, CSSOM2.CSSGroupingRule); - Object.defineProperty(CSSOM2.CSSPageRule.prototype, "type", { - value: 6, - writable: false + var { MUTATION_OBSERVER } = require_symbols(); + var createRecord = (type, target, element, addedNodes, removedNodes, attributeName, oldValue) => ({ + type, + target, + addedNodes, + removedNodes, + attributeName, + oldValue, + previousSibling: element?.previousSibling || null, + nextSibling: element?.nextSibling || null }); - Object.defineProperty(CSSOM2.CSSPageRule.prototype, "selectorText", { - get: function() { - return this.__selectorText; - }, - set: function(value) { - if (typeof value === "string") { - var trimmedValue = value.trim(); - if (trimmedValue === "") { - this.__selectorText = ""; - return; - } - var atPageRuleSelectorRegExp = regexPatterns.atPageRuleSelectorRegExp; - var cssCustomIdentifierRegExp = regexPatterns.cssCustomIdentifierRegExp; - var match = trimmedValue.match(atPageRuleSelectorRegExp); - if (match) { - var pageName = match[1] || ""; - var pseudoPages = match[2] || ""; - if (pageName) { - if (!cssCustomIdentifierRegExp.test(pageName)) { - return; + var queueAttribute = (observer, target, attributeName, attributeFilter, attributeOldValue, oldValue) => { + if (!attributeFilter || attributeFilter.includes(attributeName)) { + const { callback, records, scheduled } = observer; + records.push(createRecord( + "attributes", + target, + null, + [], + [], + attributeName, + attributeOldValue ? oldValue : void 0 + )); + if (!scheduled) { + observer.scheduled = true; + Promise.resolve().then(() => { + observer.scheduled = false; + callback(records.splice(0), observer); + }); + } + } + }; + var attributeChangedCallback = (element, attributeName, oldValue) => { + const { ownerDocument } = element; + const { active, observers } = ownerDocument[MUTATION_OBSERVER]; + if (active) { + for (const observer of observers) { + for (const [ + target, + { + childList, + subtree, + attributes, + attributeFilter, + attributeOldValue + } + ] of observer.nodes) { + if (childList) { + if (subtree && (target === ownerDocument || target.contains(element)) || !subtree && target.children.includes(element)) { + queueAttribute( + observer, + element, + attributeName, + attributeFilter, + attributeOldValue, + oldValue + ); + break; } + } else if (attributes && target === element) { + queueAttribute( + observer, + element, + attributeName, + attributeFilter, + attributeOldValue, + oldValue + ); + break; } - if (pseudoPages) { - var pseudos2 = pseudoPages.split(":").filter(function(p) { - return p; - }); - var validPseudos = ["left", "right", "first", "blank"]; - var allValid = true; - for (var j = 0; j < pseudos2.length; j++) { - if (validPseudos.indexOf(pseudos2[j].toLowerCase()) === -1) { - allValid = false; - break; + } + } + } + }; + exports2.attributeChangedCallback = attributeChangedCallback; + var moCallback = (element, parentNode) => { + const { ownerDocument } = element; + const { active, observers } = ownerDocument[MUTATION_OBSERVER]; + if (active) { + for (const observer of observers) { + for (const [target, { subtree, childList, characterData }] of observer.nodes) { + if (childList) { + if (parentNode && (target === parentNode || /* c8 ignore next */ + subtree && target.contains(parentNode)) || !parentNode && (subtree && (target === ownerDocument || /* c8 ignore next */ + target.contains(element)) || !subtree && target[characterData ? "childNodes" : "children"].includes(element))) { + const { callback, records, scheduled } = observer; + records.push(createRecord( + "childList", + target, + element, + parentNode ? [] : [element], + parentNode ? [element] : [] + )); + if (!scheduled) { + observer.scheduled = true; + Promise.resolve().then(() => { + observer.scheduled = false; + callback(records.splice(0), observer); + }); } - } - if (!allValid) { - return; + break; } } - this.__selectorText = pageName + pseudoPages.toLowerCase(); } } } - }); - Object.defineProperty(CSSOM2.CSSPageRule.prototype, "style", { - get: function() { - return this.__style; + }; + exports2.moCallback = moCallback; + var MutationObserverClass = class { + constructor(ownerDocument) { + const observers = /* @__PURE__ */ new Set(); + this.observers = observers; + this.active = false; + this.class = class MutationObserver { + constructor(callback) { + this.callback = callback; + this.nodes = /* @__PURE__ */ new Map(); + this.records = []; + this.scheduled = false; + } + disconnect() { + this.records.splice(0); + this.nodes.clear(); + observers.delete(this); + ownerDocument[MUTATION_OBSERVER].active = !!observers.size; + } + /** + * @param {Element} target + * @param {MutationObserverInit} options + */ + observe(target, options = { + subtree: false, + childList: false, + attributes: false, + attributeFilter: null, + attributeOldValue: false, + characterData: false + // TODO: not implemented yet + // characterDataOldValue: false + }) { + if ("attributeOldValue" in options || "attributeFilter" in options) + options.attributes = true; + options.childList = !!options.childList; + options.subtree = !!options.subtree; + this.nodes.set(target, options); + observers.add(this); + ownerDocument[MUTATION_OBSERVER].active = true; + } + /** + * @returns {MutationRecord[]} + */ + takeRecords() { + return this.records.splice(0); + } + }; + } + }; + exports2.MutationObserverClass = MutationObserverClass; + } +}); + +// node_modules/linkedom/cjs/shared/attributes.js +var require_attributes = __commonJS({ + "node_modules/linkedom/cjs/shared/attributes.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { CLASS_LIST, NEXT, PREV, VALUE } = require_symbols(); + var { knownAdjacent, knownSiblings } = require_utils4(); + var { attributeChangedCallback: ceAttributes } = require_custom_element_registry(); + var { attributeChangedCallback: moAttributes } = require_mutation_observer(); + var emptyAttributes = /* @__PURE__ */ new Set([ + "allowfullscreen", + "allowpaymentrequest", + "async", + "autofocus", + "autoplay", + "checked", + "class", + "contenteditable", + "controls", + "default", + "defer", + "disabled", + "draggable", + "formnovalidate", + "hidden", + "id", + "ismap", + "itemscope", + "loop", + "multiple", + "muted", + "nomodule", + "novalidate", + "open", + "playsinline", + "readonly", + "required", + "reversed", + "selected", + "style", + "truespeed" + ]); + exports2.emptyAttributes = emptyAttributes; + var setAttribute = (element, attribute) => { + const { [VALUE]: value, name } = attribute; + attribute.ownerElement = element; + knownSiblings(element, attribute, element[NEXT]); + if (name === "class") + element.className = value; + moAttributes(element, name, null); + ceAttributes(element, name, null, value); + }; + exports2.setAttribute = setAttribute; + var removeAttribute = (element, attribute) => { + const { [VALUE]: value, name } = attribute; + knownAdjacent(attribute[PREV], attribute[NEXT]); + attribute.ownerElement = attribute[PREV] = attribute[NEXT] = null; + if (name === "class") + element[CLASS_LIST] = null; + moAttributes(element, name, value); + ceAttributes(element, name, value, null); + }; + exports2.removeAttribute = removeAttribute; + var booleanAttribute = { + get(element, name) { + return element.hasAttribute(name); + }, + set(element, name, value) { + if (value) + element.setAttribute(name, ""); + else + element.removeAttribute(name); + } + }; + exports2.booleanAttribute = booleanAttribute; + var numericAttribute = { + get(element, name) { + return parseFloat(element.getAttribute(name) || 0); }, - set: function(value) { - if (typeof value === "string") { - this.__style.cssText = value; + set(element, name, value) { + element.setAttribute(name, value); + } + }; + exports2.numericAttribute = numericAttribute; + var stringAttribute = { + get(element, name) { + return element.getAttribute(name) || ""; + }, + set(element, name, value) { + element.setAttribute(name, value); + } + }; + exports2.stringAttribute = stringAttribute; + } +}); + +// node_modules/linkedom/cjs/interface/event-target.js +var require_event_target = __commonJS({ + "node_modules/linkedom/cjs/interface/event-target.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var wm = /* @__PURE__ */ new WeakMap(); + function dispatch(event, listener) { + if (typeof listener === "function") + listener.call(event.target, event); + else + listener.handleEvent(event); + return event._stopImmediatePropagationFlag; + } + function invokeListeners({ currentTarget, target }) { + const map = wm.get(currentTarget); + if (map && map.has(this.type)) { + const listeners = map.get(this.type); + if (currentTarget === target) { + this.eventPhase = this.AT_TARGET; } else { - this.__style = value; + this.eventPhase = this.BUBBLING_PHASE; + } + this.currentTarget = currentTarget; + this.target = target; + for (const [listener, options] of listeners) { + if (options && options.once) + listeners.delete(listener); + if (dispatch(this, listener)) + break; } + delete this.currentTarget; + delete this.target; + return this.cancelBubble; } - }); - Object.defineProperty(CSSOM2.CSSPageRule.prototype, "cssText", { - get: function() { - var values = ""; - if (this.cssRules.length) { - var valuesArr = [" {"]; - this.style.cssText && valuesArr.push(this.style.cssText); - valuesArr.push(this.cssRules.reduce(function(acc, rule) { - if (rule.cssText !== "") { - acc.push(rule.cssText); - } - return acc; - }, []).join("\n ")); - values = valuesArr.join("\n ") + "\n}"; - } else { - values = " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; + } + var DOMEventTarget = class { + constructor() { + wm.set(this, /* @__PURE__ */ new Map()); + } + /** + * @protected + */ + _getParent() { + return null; + } + addEventListener(type, listener, options) { + const map = wm.get(this); + if (!map.has(type)) + map.set(type, /* @__PURE__ */ new Map()); + map.get(type).set(listener, options); + } + removeEventListener(type, listener) { + const map = wm.get(this); + if (map.has(type)) { + const listeners = map.get(type); + if (listeners.delete(listener) && !listeners.size) + map.delete(type); } - return "@page" + (this.selectorText ? " " + this.selectorText : "") + values; } - }); - exports2.CSSPageRule = CSSOM2.CSSPageRule; + dispatchEvent(event) { + let node = this; + event.eventPhase = event.CAPTURING_PHASE; + while (node) { + if (node.dispatchEvent) + event._path.push({ currentTarget: node, target: this }); + node = event.bubbles && node._getParent && node._getParent(); + } + event._path.some(invokeListeners, event); + event._path = []; + event.eventPhase = event.NONE; + return !event.defaultPrevented; + } + }; + exports2.EventTarget = DOMEventTarget; } }); -// node_modules/@acemir/cssom/lib/cssstyleTryCatchBlock.js -var require_cssstyleTryCatchBlock = __commonJS({ - "node_modules/@acemir/cssom/lib/cssstyleTryCatchBlock.js"() { +// node_modules/linkedom/cjs/interface/node-list.js +var require_node_list = __commonJS({ + "node_modules/linkedom/cjs/interface/node-list.js"(exports2) { + "use strict"; init_define_import_meta_env(); - try { - CSSOM.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { - } + var NodeList = class extends Array { + item(i) { + return i < this.length ? this[i] : null; + } + }; + exports2.NodeList = NodeList; } }); -// node_modules/@acemir/cssom/lib/parse.js -var require_parse3 = __commonJS({ - "node_modules/@acemir/cssom/lib/parse.js"(exports2) { +// node_modules/linkedom/cjs/interface/node.js +var require_node3 = __commonJS({ + "node_modules/linkedom/cjs/interface/node.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = {}; - var regexPatterns = require_regexPatterns().regexPatterns; - CSSOM2.parse = function parse5(token, opts, errorHandler) { - errorHandler = errorHandler === true ? console && console.error : errorHandler; - var i = 0; - var state = "before-selector"; - var index2; - var buffer = ""; - var valueParenthesisDepth = 0; - var hasUnmatchedQuoteInSelector = false; - var SIGNIFICANT_WHITESPACE = { - "name": true, - "before-name": true, - "selector": true, - "value": true, - "value-parenthesis": true, - "atRule": true, - "importRule-begin": true, - "importRule": true, - "namespaceRule-begin": true, - "namespaceRule": true, - "atBlock": true, - "containerBlock": true, - "conditionBlock": true, - "counterStyleBlock": true, - "propertyBlock": true, - "documentRule-begin": true, - "scopeBlock": true, - "layerBlock": true, - "pageBlock": true - }; - var styleSheet; - if (opts && opts.styleSheet) { - styleSheet = opts.styleSheet; - } else { - if (opts && opts.globalObject && opts.globalObject.CSSStyleSheet) { - styleSheet = new opts.globalObject.CSSStyleSheet(); - } else { - styleSheet = new CSSOM2.CSSStyleSheet(); - } - styleSheet.__constructed = false; + var { + ELEMENT_NODE, + ATTRIBUTE_NODE, + TEXT_NODE, + CDATA_SECTION_NODE, + COMMENT_NODE, + DOCUMENT_NODE, + DOCUMENT_FRAGMENT_NODE, + DOCUMENT_TYPE_NODE, + DOCUMENT_POSITION_DISCONNECTED, + DOCUMENT_POSITION_PRECEDING, + DOCUMENT_POSITION_FOLLOWING, + DOCUMENT_POSITION_CONTAINS, + DOCUMENT_POSITION_CONTAINED_BY, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + } = require_constants(); + var { NEXT, PREV } = require_symbols(); + var { EventTarget } = require_event_target(); + var { NodeList } = require_node_list(); + var getParentNodeCount = ({ parentNode }) => { + let count = 0; + while (parentNode) { + count++; + parentNode = parentNode.parentNode; } - var topScope; - if (opts && opts.cssRules) { - topScope = { cssRules: opts.cssRules }; - } else { - topScope = styleSheet; + return count; + }; + var Node = class extends EventTarget { + static get ELEMENT_NODE() { + return ELEMENT_NODE; } - if (opts && opts.ownerNode) { - styleSheet.__ownerNode = opts.ownerNode; - var ownerNodeMedia = opts.ownerNode.media || opts.ownerNode.getAttribute && opts.ownerNode.getAttribute("media"); - if (ownerNodeMedia) { - styleSheet.media.mediaText = ownerNodeMedia; - } - var ownerNodeTitle = opts.ownerNode.title || opts.ownerNode.getAttribute && opts.ownerNode.getAttribute("title"); - if (ownerNodeTitle) { - styleSheet.__title = ownerNodeTitle; - } + static get ATTRIBUTE_NODE() { + return ATTRIBUTE_NODE; } - if (opts && opts.ownerRule) { - styleSheet.__ownerRule = opts.ownerRule; + static get TEXT_NODE() { + return TEXT_NODE; } - var currentScope = topScope; - var parentRule; - var ancestorRules = []; - var prevScope; - var name, priority = "", styleRule, mediaRule, containerRule, counterStyleRule, propertyRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule, scopeRule, pageRule, layerBlockRule, layerStatementRule, nestedSelectorRule, namespaceRule; - var definedNamespacePrefixes = {}; - var ruleIdCounter = 0; - var addedToParent = {}; - var addedToTopScope = {}; - var addedToCurrentScope = {}; - function getRuleId(rule) { - if (!rule.__parseId) { - rule.__parseId = ++ruleIdCounter; - } - return rule.__parseId; + static get CDATA_SECTION_NODE() { + return CDATA_SECTION_NODE; } - var lastValidationBoundary = 0; - var validationRegexCache = {}; - function getValidationRegex(atRuleKey) { - if (!validationRegexCache[atRuleKey]) { - var sourceRuleRegExp = atRuleKey === "@import" ? forwardImportRuleValidationRegExp : forwardRuleValidationRegExp; - validationRegexCache[atRuleKey] = new RegExp(atRuleKey + sourceRuleRegExp.source, sourceRuleRegExp.flags); + static get COMMENT_NODE() { + return COMMENT_NODE; + } + static get DOCUMENT_NODE() { + return DOCUMENT_NODE; + } + static get DOCUMENT_FRAGMENT_NODE() { + return DOCUMENT_FRAGMENT_NODE; + } + static get DOCUMENT_TYPE_NODE() { + return DOCUMENT_TYPE_NODE; + } + constructor(ownerDocument, localName, nodeType) { + super(); + this.ownerDocument = ownerDocument; + this.localName = localName; + this.nodeType = nodeType; + this.parentNode = null; + this[NEXT] = null; + this[PREV] = null; + } + get ELEMENT_NODE() { + return ELEMENT_NODE; + } + get ATTRIBUTE_NODE() { + return ATTRIBUTE_NODE; + } + get TEXT_NODE() { + return TEXT_NODE; + } + get CDATA_SECTION_NODE() { + return CDATA_SECTION_NODE; + } + get COMMENT_NODE() { + return COMMENT_NODE; + } + get DOCUMENT_NODE() { + return DOCUMENT_NODE; + } + get DOCUMENT_FRAGMENT_NODE() { + return DOCUMENT_FRAGMENT_NODE; + } + get DOCUMENT_TYPE_NODE() { + return DOCUMENT_TYPE_NODE; + } + get baseURI() { + const ownerDocument = this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument; + if (ownerDocument) { + const base = ownerDocument.querySelector("base"); + if (base) + return base.getAttribute("href"); + const { location } = ownerDocument.defaultView; + if (location) + return location.href; } - return validationRegexCache[atRuleKey]; + return null; } - var atKeyframesRegExp = regexPatterns.atKeyframesRegExp; - var beforeRulePortionRegExp = regexPatterns.beforeRulePortionRegExp; - var beforeRuleValidationRegExp = regexPatterns.beforeRuleValidationRegExp; - var forwardRuleValidationRegExp = regexPatterns.forwardRuleValidationRegExp; - var forwardImportRuleValidationRegExp = regexPatterns.forwardImportRuleValidationRegExp; - var regexBefore = new RegExp(beforeRulePortionRegExp.source, beforeRulePortionRegExp.flags); - var forwardRuleClosingBraceRegExp = regexPatterns.forwardRuleClosingBraceRegExp; - var forwardRuleSemicolonAndOpeningBraceRegExp = regexPatterns.forwardRuleSemicolonAndOpeningBraceRegExp; - var cssCustomIdentifierRegExp = regexPatterns.cssCustomIdentifierRegExp; - var startsWithCombinatorRegExp = regexPatterns.startsWithCombinatorRegExp; - var atPageRuleSelectorRegExp = regexPatterns.atPageRuleSelectorRegExp; - var startsWithHexEscapeRegExp = regexPatterns.startsWithHexEscapeRegExp; - var identStartCharRegExp = regexPatterns.identStartCharRegExp; - var identCharRegExp = regexPatterns.identCharRegExp; - var specialCharsNeedEscapeRegExp = regexPatterns.specialCharsNeedEscapeRegExp; - var combinatorOrSeparatorRegExp = regexPatterns.combinatorOrSeparatorRegExp; - var afterHexEscapeSeparatorRegExp = regexPatterns.afterHexEscapeSeparatorRegExp; - var trailingSpaceSeparatorRegExp = regexPatterns.trailingSpaceSeparatorRegExp; - var endsWithHexEscapeRegExp = regexPatterns.endsWithHexEscapeRegExp; - var attributeSelectorContentRegExp = regexPatterns.attributeSelectorContentRegExp; - var pseudoElementRegExp = regexPatterns.pseudoElementRegExp; - var invalidCombinatorLtGtRegExp = regexPatterns.invalidCombinatorLtGtRegExp; - var invalidCombinatorDoubleGtRegExp = regexPatterns.invalidCombinatorDoubleGtRegExp; - var consecutiveCombinatorsRegExp = regexPatterns.consecutiveCombinatorsRegExp; - var invalidSlottedRegExp = regexPatterns.invalidSlottedRegExp; - var invalidPartRegExp = regexPatterns.invalidPartRegExp; - var invalidCueRegExp = regexPatterns.invalidCueRegExp; - var invalidCueRegionRegExp = regexPatterns.invalidCueRegionRegExp; - var invalidNestingPattern = regexPatterns.invalidNestingPattern; - var emptyPseudoClassRegExp = regexPatterns.emptyPseudoClassRegExp; - var whitespaceNormalizationRegExp = regexPatterns.whitespaceNormalizationRegExp; - var newlineRemovalRegExp = regexPatterns.newlineRemovalRegExp; - var whitespaceAndDotRegExp = regexPatterns.whitespaceAndDotRegExp; - var declarationOrOpenBraceRegExp = regexPatterns.declarationOrOpenBraceRegExp; - var ampersandRegExp = regexPatterns.ampersandRegExp; - var hexEscapeSequenceRegExp = regexPatterns.hexEscapeSequenceRegExp; - var attributeCaseFlagRegExp = regexPatterns.attributeCaseFlagRegExp; - var prependedAmpersandRegExp = regexPatterns.prependedAmpersandRegExp; - var openBraceGlobalRegExp = regexPatterns.openBraceGlobalRegExp; - var closeBraceGlobalRegExp = regexPatterns.closeBraceGlobalRegExp; - var scopePreludeSplitRegExp = regexPatterns.scopePreludeSplitRegExp; - var leadingWhitespaceRegExp = regexPatterns.leadingWhitespaceRegExp; - var doubleQuoteRegExp = regexPatterns.doubleQuoteRegExp; - var backslashRegExp = regexPatterns.backslashRegExp; - var invalidMediaOperatorWithoutSpaceRegExp = regexPatterns.invalidMediaOperatorWithoutSpaceRegExp; - var invalidMediaNotAfterOperatorRegExp = regexPatterns.invalidMediaNotAfterOperatorRegExp; - var invalidMediaNotIdentifierRegExp = regexPatterns.invalidMediaNotIdentifierRegExp; - var invalidMediaNotAfterFeatureRegExp = regexPatterns.invalidMediaNotAfterFeatureRegExp; - var invalidMediaOperatorBetweenParensRegExp = regexPatterns.invalidMediaOperatorBetweenParensRegExp; - var invalidMediaNotWithMediaTypeRegExp = regexPatterns.invalidMediaNotWithMediaTypeRegExp; - var mediaFeatureColonRegExp = regexPatterns.mediaFeatureColonRegExp; - var identifierBeforeParenRegExp = regexPatterns.identifierBeforeParenRegExp; - var mediaAndOperatorRegExp = regexPatterns.mediaAndOperatorRegExp; - var mediaOrOperatorRegExp = regexPatterns.mediaOrOperatorRegExp; - var mediaNotOperatorStartRegExp = regexPatterns.mediaNotOperatorStartRegExp; - var mediaNotOperatorRegExp = regexPatterns.mediaNotOperatorRegExp; - function atRulesStatemenRegExpES5Alternative(ruleSlice) { - for (var i2 = 0; i2 < ruleSlice.length; i2++) { - var char = ruleSlice[i2]; - if (char === ";" || char === "}") { - var sliceBefore = ruleSlice.substring(0, i2); - var openBraceIndex = sliceBefore.indexOf("{"); - if (openBraceIndex === -1) { - var match = char; - var j = i2 + 1; - while (j < ruleSlice.length && /\s/.test(ruleSlice[j])) { - match += ruleSlice[j]; - j++; - } - var matchObj = [match]; - matchObj.index = i2; - matchObj.input = ruleSlice; - return matchObj; - } - } - } + /* c8 ignore start */ + // mixin: node + get isConnected() { + return false; + } + get nodeName() { + return this.localName; + } + get parentElement() { return null; } - function matchBalancedBlock(str, fromIndex) { - fromIndex = fromIndex || 0; - var openIndex = str.indexOf("{", fromIndex); - if (openIndex === -1) return null; - var depth = 0; - for (var i2 = openIndex; i2 < str.length; i2++) { - if (str[i2] === "{") { - depth++; - } else if (str[i2] === "}") { - depth--; - if (depth === 0) { - var matchedString = str.slice(openIndex, i2 + 1); - return { - 0: matchedString, - index: openIndex, - input: str - }; - } - } - } + get previousSibling() { return null; } - function ignoreBalancedBlock(i2, str, fromIndex) { - var ruleClosingMatch2 = matchBalancedBlock(str, fromIndex); - if (ruleClosingMatch2) { - var ignoreRange = ruleClosingMatch2.index + ruleClosingMatch2[0].length; - i2 += ignoreRange; - if (token.charAt(i2) === "}") { - i2 -= 1; - } - } else { - i2 += str.length; - } - return i2; + get previousElementSibling() { + return null; } - function parseScopePrelude(preludeContent) { - var parts = preludeContent.split(scopePreludeSplitRegExp); - if (parts.length === 2) { - parts[0] = parts[0] + ")"; - parts[1] = "(" + parts[1]; - } - var hasStart = parts[0] && parts[0].charAt(0) === "(" && parts[0].charAt(parts[0].length - 1) === ")"; - var hasEnd = parts[1] && parts[1].charAt(0) === "(" && parts[1].charAt(parts[1].length - 1) === ")"; - var hasOnlyEnd = !hasStart && !hasEnd && parts[0].indexOf("to (") === 0 && parts[0].charAt(parts[0].length - 1) === ")"; - var startSelector = ""; - var endSelector = ""; - if (hasStart) { - startSelector = parts[0].slice(1, -1).trim(); - } - if (hasEnd) { - endSelector = parts[1].slice(1, -1).trim(); - } - if (hasOnlyEnd) { - endSelector = parts[0].slice(4, -1).trim(); - } - return { - startSelector, - endSelector, - hasStart, - hasEnd, - hasOnlyEnd - }; + get nextSibling() { + return null; } - ; - function hasPseudoElement(selector2) { - return pseudoElementRegExp.test(selector2); + get nextElementSibling() { + return null; } - ; - function validateBalancedSyntax(selector2, trackAttributes, useStack) { - var parenDepth = 0; - var bracketDepth = 0; - var inSingleQuote = false; - var inDoubleQuote = false; - var inAttr = false; - var stack = useStack ? [] : null; - for (var i2 = 0; i2 < selector2.length; i2++) { - var char = selector2[i2]; - if (char === "\\") { - var escapeLen2 = getEscapeSequenceLength(selector2, i2); - if (escapeLen2 > 0) { - i2 += escapeLen2 - 1; - continue; - } - } - if (inSingleQuote) { - if (char === "'") { - inSingleQuote = false; - } - } else if (inDoubleQuote) { - if (char === '"') { - inDoubleQuote = false; - } - } else if (trackAttributes && inAttr) { - if (char === "]") { - inAttr = false; - } else if (char === "'") { - inSingleQuote = true; - } else if (char === '"') { - inDoubleQuote = true; - } - } else { - if (trackAttributes && char === "[") { - inAttr = true; - } else if (char === "'") { - inSingleQuote = true; - } else if (char === '"') { - inDoubleQuote = true; - } else if (char === "(") { - if (useStack) { - stack.push("("); - } else { - parenDepth++; - } - } else if (char === ")") { - if (useStack) { - if (!stack.length || stack.pop() !== "(") { - return false; - } - } else { - parenDepth--; - if (parenDepth < 0) { - return false; - } - } - } else if (char === "[") { - bracketDepth++; - } else if (char === "]") { - bracketDepth--; - if (bracketDepth < 0) { - return false; - } - } - } - } - if (useStack) { - return stack.length === 0 && bracketDepth === 0 && !inSingleQuote && !inDoubleQuote && !inAttr; - } else { - return parenDepth === 0 && bracketDepth === 0 && !inSingleQuote && !inDoubleQuote; - } + get childNodes() { + return new NodeList(); } - ; - function hasBasicSyntaxError(selector2) { - return !validateBalancedSyntax(selector2, false, false); + get firstChild() { + return null; } - ; - function hasInvalidCombinators(selector2) { - if (invalidCombinatorLtGtRegExp.test(selector2)) return true; - if (invalidCombinatorDoubleGtRegExp.test(selector2)) return true; - if (consecutiveCombinatorsRegExp.test(selector2)) return true; - return false; + get lastChild() { + return null; } - ; - function hasInvalidPseudoSyntax(selector2) { - var invalidPatterns = [ - invalidSlottedRegExp, - invalidPartRegExp, - invalidCueRegExp, - invalidCueRegionRegExp - ]; - for (var i2 = 0; i2 < invalidPatterns.length; i2++) { - if (invalidPatterns[i2].test(selector2)) { - return true; - } - } + // default values + get nodeValue() { + return null; + } + set nodeValue(value) { + } + get textContent() { + return null; + } + set textContent(value) { + } + normalize() { + } + cloneNode() { + return null; + } + contains() { return false; } - ; - function hasInvalidNestingSelector(selector2) { - return invalidNestingPattern.test(selector2); + /** + * Inserts a node before a reference node as a child of this parent node. + * @param {Node} newNode The node to be inserted. + * @param {Node} referenceNode The node before which newNode is inserted. If this is null, then newNode is inserted at the end of node's child nodes. + * @returns The added child + */ + // eslint-disable-next-line no-unused-vars + insertBefore(newNode, referenceNode) { + return newNode; } - ; - function canAtRuleBeNested() { - if (currentScope === topScope) { - return true; - } - var hasStyleRuleInChain = false; - var hasValidParent = false; - if (currentScope.constructor.name === "CSSStyleRule") { - hasStyleRuleInChain = true; - } else if (currentScope instanceof CSSOM2.CSSScopeRule || currentScope instanceof CSSOM2.CSSConditionRule) { - hasValidParent = true; - } - if (!hasStyleRuleInChain) { - for (var j = 0; j < ancestorRules.length; j++) { - if (ancestorRules[j].constructor.name === "CSSStyleRule") { - hasStyleRuleInChain = true; - break; - } - if (ancestorRules[j] instanceof CSSOM2.CSSScopeRule || ancestorRules[j] instanceof CSSOM2.CSSConditionRule) { - hasValidParent = true; - } - } - } - return hasValidParent && !hasStyleRuleInChain; + /** + * Adds a node to the end of the list of children of this node. + * @param {Node} child The node to append to the given parent node. + * @returns The appended child. + */ + appendChild(child) { + return child; } - function validateAtRule(atRuleKey, validCallback, cannotBeNested2) { - var isValid2 = false; - var ruleRegExp = getValidationRegex(atRuleKey); - var lookAheadLength = Math.min(100, token.length - i); - var ruleSlice = token.slice(i, i + lookAheadLength); - var shouldPerformCheck = cannotBeNested2 && currentScope !== topScope ? false : true; - if (shouldPerformCheck && ruleSlice.search(ruleRegExp) === 0) { - var searchStart = Math.max(0, lastValidationBoundary); - var beforeSlice = token.slice(searchStart, i); - var matches2 = beforeSlice.match(regexBefore); - var lastI = matches2 ? searchStart + beforeSlice.lastIndexOf(matches2[matches2.length - 1]) : searchStart; - var toCheckSlice = token.slice(lastI, i); - var checkedSlice = toCheckSlice.search(beforeRuleValidationRegExp); - if (checkedSlice === 0) { - isValid2 = true; - lastValidationBoundary = lastI; - } - } - if (isValid2 && atRuleKey === "@scope") { - var openBraceIndex = ruleSlice.indexOf("{"); - if (openBraceIndex !== -1) { - var rulePrelude = ruleSlice.slice(0, openBraceIndex).trim(); - var preludeContent = rulePrelude.slice("@scope".length).trim(); - if (preludeContent.length > 0) { - var parsedScopePrelude2 = parseScopePrelude(preludeContent); - var startSelector = parsedScopePrelude2.startSelector; - var endSelector = parsedScopePrelude2.endSelector; - var hasStart = parsedScopePrelude2.hasStart; - var hasEnd = parsedScopePrelude2.hasEnd; - var hasOnlyEnd = parsedScopePrelude2.hasOnlyEnd; - if (hasStart && startSelector === "" || hasEnd && endSelector === "" || hasOnlyEnd && endSelector === "") { - isValid2 = false; - } else if (startSelector && hasPseudoElement(startSelector) || endSelector && hasPseudoElement(endSelector)) { - isValid2 = false; - } else if (startSelector && hasBasicSyntaxError(startSelector) || endSelector && hasBasicSyntaxError(endSelector)) { - isValid2 = false; - } else if (startSelector && hasInvalidCombinators(startSelector) || endSelector && hasInvalidCombinators(endSelector)) { - isValid2 = false; - } else if (startSelector && hasInvalidPseudoSyntax(startSelector) || endSelector && hasInvalidPseudoSyntax(endSelector)) { - isValid2 = false; - } else if (!hasStart && !hasOnlyEnd) { - isValid2 = false; - } - } + /** + * Replaces a child node within this node + * @param {Node} newChild The new node to replace oldChild. + * @param {Node} oldChild The child to be replaced. + * @returns The replaced Node. This is the same node as oldChild. + */ + replaceChild(newChild, oldChild) { + return oldChild; + } + /** + * Removes a child node from the DOM. + * @param {Node} child A Node that is the child node to be removed from the DOM. + * @returns The removed node. + */ + removeChild(child) { + return child; + } + toString() { + return ""; + } + /* c8 ignore stop */ + hasChildNodes() { + return !!this.lastChild; + } + isSameNode(node) { + return this === node; + } + // TODO: attributes? + compareDocumentPosition(target) { + let result = 0; + if (this !== target) { + let self2 = getParentNodeCount(this); + let other = getParentNodeCount(target); + if (self2 < other) { + result += DOCUMENT_POSITION_FOLLOWING; + if (this.contains(target)) + result += DOCUMENT_POSITION_CONTAINED_BY; + } else if (other < self2) { + result += DOCUMENT_POSITION_PRECEDING; + if (target.contains(this)) + result += DOCUMENT_POSITION_CONTAINS; + } else if (self2 && other) { + const { childNodes } = this.parentNode; + if (childNodes.indexOf(this) < childNodes.indexOf(target)) + result += DOCUMENT_POSITION_FOLLOWING; + else + result += DOCUMENT_POSITION_PRECEDING; } - } - if (isValid2 && atRuleKey === "@page") { - var openBraceIndex = ruleSlice.indexOf("{"); - if (openBraceIndex !== -1) { - var rulePrelude = ruleSlice.slice(0, openBraceIndex).trim(); - var preludeContent = rulePrelude.slice("@page".length).trim(); - if (preludeContent.length > 0) { - var trimmedValue = preludeContent.trim(); - if (trimmedValue !== "") { - var match = trimmedValue.match(atPageRuleSelectorRegExp); - if (match) { - var pageName = match[1] || ""; - var pseudoPages = match[2] || ""; - if (pageName) { - if (!cssCustomIdentifierRegExp.test(pageName)) { - isValid2 = false; - } - } - if (pseudoPages) { - var pseudos2 = pseudoPages.split(":").filter(function(p) { - return p; - }); - var validPseudos = ["left", "right", "first", "blank"]; - var allValid = true; - for (var j = 0; j < pseudos2.length; j++) { - if (validPseudos.indexOf(pseudos2[j].toLowerCase()) === -1) { - allValid = false; - break; - } - } - if (!allValid) { - isValid2 = false; - } - } - } else { - isValid2 = false; - } - } - } + if (!self2 || !other) { + result += DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; + result += DOCUMENT_POSITION_DISCONNECTED; } } - if (!isValid2) { - var ruleStatementMatch = atRulesStatemenRegExpES5Alternative(ruleSlice); - if (ruleStatementMatch && currentScope !== topScope) { - var ignoreEnd = ruleStatementMatch[0].indexOf(";"); - i += ruleStatementMatch.index + ignoreEnd; - return; - } - if (atRuleKey === "@layer") { - var ruleSemicolonAndOpeningBraceMatch = ruleSlice.match(forwardRuleSemicolonAndOpeningBraceRegExp); - if (ruleSemicolonAndOpeningBraceMatch && ruleSemicolonAndOpeningBraceMatch[1] === ";") { - i += ruleSemicolonAndOpeningBraceMatch.index + ruleSemicolonAndOpeningBraceMatch[0].length; - state = "before-selector"; - return; + return result; + } + isEqualNode(node) { + if (this === node) + return true; + if (this.nodeType === node.nodeType) { + switch (this.nodeType) { + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: { + const aNodes = this.childNodes; + const bNodes = node.childNodes; + return aNodes.length === bNodes.length && aNodes.every((node2, i) => node2.isEqualNode(bNodes[i])); } } - i = ignoreBalancedBlock(i, ruleSlice); - state = "before-selector"; - } else { - validCallback.call(this); + return this.toString() === node.toString(); } + return false; } - function isIdentStart(c) { - return /[a-zA-Z_\u00A0-\uFFFF]/.test(c); + /** + * @protected + */ + _getParent() { + return this.parentNode; } - function isIdentChar(c) { - return /[a-zA-Z0-9_\u00A0-\uFFFF\-]/.test(c); + /** + * Calling it on an element inside a standard web page will return an HTMLDocument object representing the entire page (or <iframe>). + * Calling it on an element inside a shadow DOM will return the associated ShadowRoot. + * @return {ShadowRoot | HTMLDocument} + */ + getRootNode() { + let root = this; + while (root.parentNode) + root = root.parentNode; + return root; } - function looseSelectorValidator(selector2) { - if (!selector2 || selector2.length === 0) { - return false; - } - var i2 = 0; - var len = selector2.length; - var hasMatchedComponent = false; - function skipEscape() { - if (i2 < len && selector2[i2] === "\\") { - var escapeLen2 = getEscapeSequenceLength(selector2, i2); - if (escapeLen2 > 0) { - i2 += escapeLen2; - return true; - } - } - return false; - } - function parseIdentifier() { - var start2 = i2; - while (i2 < len) { - if (skipEscape()) { - continue; - } else if (isIdentChar(selector2[i2])) { - i2++; - } else { - break; - } - } - return i2 > start2; - } - function parseNamespace() { - var start2 = i2; - if (i2 < len && selector2[i2] === "*") { - i2++; - } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\")) { - parseIdentifier(); - } - if (i2 < len && selector2[i2] === "|") { - i2++; - return true; - } - i2 = start2; - return false; + }; + exports2.Node = Node; + } +}); + +// node_modules/linkedom/cjs/shared/text-escaper.js +var require_text_escaper = __commonJS({ + "node_modules/linkedom/cjs/shared/text-escaper.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { replace } = ""; + var ca = /[<>&\xA0]/g; + var esca = { + "\xA0": " ", + "&": "&", + "<": "<", + ">": ">" + }; + var pe = (m) => esca[m]; + var escape3 = (es) => replace.call(es, ca, pe); + exports2.escape = escape3; + } +}); + +// node_modules/linkedom/cjs/interface/attr.js +var require_attr = __commonJS({ + "node_modules/linkedom/cjs/interface/attr.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ATTRIBUTE_NODE } = require_constants(); + var { CHANGED, VALUE } = require_symbols(); + var { String: String2, ignoreCase } = require_utils4(); + var { attrAsJSON } = require_jsdon(); + var { emptyAttributes } = require_attributes(); + var { attributeChangedCallback: moAttributes } = require_mutation_observer(); + var { attributeChangedCallback: ceAttributes } = require_custom_element_registry(); + var { Node } = require_node3(); + var { escape: escape3 } = require_text_escaper(); + var QUOTE = /"/g; + var Attr = class _Attr extends Node { + constructor(ownerDocument, name, value = "") { + super(ownerDocument, name, ATTRIBUTE_NODE); + this.ownerElement = null; + this.name = String2(name); + this[VALUE] = String2(value); + this[CHANGED] = false; + } + get value() { + return this[VALUE]; + } + set value(newValue) { + const { [VALUE]: oldValue, name, ownerElement } = this; + this[VALUE] = String2(newValue); + this[CHANGED] = true; + if (ownerElement) { + moAttributes(ownerElement, name, oldValue); + ceAttributes(ownerElement, name, oldValue, this[VALUE]); + } + } + cloneNode() { + const { ownerDocument, name, [VALUE]: value } = this; + return new _Attr(ownerDocument, name, value); + } + toString() { + const { name, [VALUE]: value } = this; + if (emptyAttributes.has(name) && !value) { + return ignoreCase(this) ? name : `${name}=""`; } - function parsePseudoArgs() { - if (i2 >= len || selector2[i2] !== "(") { - return false; - } - i2++; - var depth2 = 1; - var inString = false; - var stringChar = ""; - while (i2 < len && depth2 > 0) { - var c = selector2[i2]; - if (c === "\\" && i2 + 1 < len) { - i2 += 2; - } else if (!inString && (c === '"' || c === "'")) { - inString = true; - stringChar = c; - i2++; - } else if (inString && c === stringChar) { - inString = false; - i2++; - } else if (!inString && c === "(") { - depth2++; - i2++; - } else if (!inString && c === ")") { - depth2--; - i2++; - } else { - i2++; - } - } - return depth2 === 0; + const escapedValue = (ignoreCase(this) ? value : escape3(value)).replace(QUOTE, """); + return `${name}="${escapedValue}"`; + } + toJSON() { + const json2 = []; + attrAsJSON(this, json2); + return json2; + } + }; + exports2.Attr = Attr; + } +}); + +// node_modules/linkedom/cjs/shared/node.js +var require_node4 = __commonJS({ + "node_modules/linkedom/cjs/shared/node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + CDATA_SECTION_NODE, + COMMENT_NODE, + DOCUMENT_NODE, + DOCUMENT_FRAGMENT_NODE, + TEXT_NODE, + NODE_END + } = require_constants(); + var { START, NEXT, PREV } = require_symbols(); + var { getEnd } = require_utils4(); + var isConnected = ({ ownerDocument, parentNode }) => { + while (parentNode) { + if (parentNode === ownerDocument) + return true; + parentNode = parentNode.parentNode || parentNode.host; + } + return false; + }; + exports2.isConnected = isConnected; + var parentElement = ({ parentNode }) => { + if (parentNode) { + switch (parentNode.nodeType) { + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + return null; } - while (i2 < len) { - var matched = false; - var start = i2; - while (i2 < len && /\s/.test(selector2[i2])) { - i2++; - } - if (i2 > start) { - hasMatchedComponent = true; - continue; - } - if (i2 < len && /[>+~]/.test(selector2[i2])) { - i2++; - hasMatchedComponent = true; - while (i2 < len && /\s/.test(selector2[i2])) { - i2++; - } - continue; - } - if (i2 < len && selector2[i2] === "&") { - i2++; - hasMatchedComponent = true; - matched = true; - } else if (i2 < len && selector2[i2] === ".") { - i2++; - if (parseIdentifier()) { - hasMatchedComponent = true; - matched = true; - } - } else if (i2 < len && selector2[i2] === "#") { - i2++; - if (parseIdentifier()) { - hasMatchedComponent = true; - matched = true; - } - } else if (i2 < len && selector2[i2] === ":") { - i2++; - if (i2 < len && selector2[i2] === ":") { - i2++; - } - if (parseIdentifier()) { - parsePseudoArgs(); - hasMatchedComponent = true; - matched = true; - } - } else if (i2 < len && selector2[i2] === "[") { - i2++; - var depth = 1; - while (i2 < len && depth > 0) { - if (selector2[i2] === "\\") { - i2 += 2; - } else if (selector2[i2] === "'") { - i2++; - while (i2 < len && selector2[i2] !== "'") { - if (selector2[i2] === "\\") i2 += 2; - else i2++; - } - if (i2 < len) i2++; - } else if (selector2[i2] === '"') { - i2++; - while (i2 < len && selector2[i2] !== '"') { - if (selector2[i2] === "\\") i2 += 2; - else i2++; - } - if (i2 < len) i2++; - } else if (selector2[i2] === "[") { - depth++; - i2++; - } else if (selector2[i2] === "]") { - depth--; - i2++; - } else { - i2++; - } - } - if (depth === 0) { - hasMatchedComponent = true; - matched = true; - } - } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\" || selector2[i2] === "*" || selector2[i2] === "|" || selector2[i2] === "-")) { - parseNamespace(); - if (i2 < len && selector2[i2] === "*") { - i2++; - hasMatchedComponent = true; - matched = true; - } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\" || selector2[i2] === "-")) { - if (parseIdentifier()) { - hasMatchedComponent = true; - matched = true; - } - } - } - if (!matched && i2 === start) { - return false; - } - } - return hasMatchedComponent; } - function basicSelectorValidator(selector2) { - if (selector2.length > 1e4) { - return false; + return parentNode; + }; + exports2.parentElement = parentElement; + var previousSibling = ({ [PREV]: prev }) => { + switch (prev ? prev.nodeType : 0) { + case NODE_END: + return prev[START]; + case TEXT_NODE: + case COMMENT_NODE: + case CDATA_SECTION_NODE: + return prev; + } + return null; + }; + exports2.previousSibling = previousSibling; + var nextSibling = (node) => { + const next = getEnd(node)[NEXT]; + return next && (next.nodeType === NODE_END ? null : next); + }; + exports2.nextSibling = nextSibling; + } +}); + +// node_modules/linkedom/cjs/mixin/non-document-type-child-node.js +var require_non_document_type_child_node = __commonJS({ + "node_modules/linkedom/cjs/mixin/non-document-type-child-node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE } = require_constants(); + var { nextSibling, previousSibling } = require_node4(); + var nextElementSibling2 = (node) => { + let next = nextSibling(node); + while (next && next.nodeType !== ELEMENT_NODE) + next = nextSibling(next); + return next; + }; + exports2.nextElementSibling = nextElementSibling2; + var previousElementSibling = (node) => { + let prev = previousSibling(node); + while (prev && prev.nodeType !== ELEMENT_NODE) + prev = previousSibling(prev); + return prev; + }; + exports2.previousElementSibling = previousElementSibling; + } +}); + +// node_modules/linkedom/cjs/mixin/child-node.js +var require_child_node = __commonJS({ + "node_modules/linkedom/cjs/mixin/child-node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE } = require_constants(); + var { NEXT, PREV } = require_symbols(); + var { getEnd, setAdjacent } = require_utils4(); + var { moCallback } = require_mutation_observer(); + var { disconnectedCallback } = require_custom_element_registry(); + var asFragment = (ownerDocument, nodes) => { + const fragment = ownerDocument.createDocumentFragment(); + fragment.append(...nodes); + return fragment; + }; + var before = (node, nodes) => { + const { ownerDocument, parentNode } = node; + if (parentNode) + parentNode.insertBefore( + asFragment(ownerDocument, nodes), + node + ); + }; + exports2.before = before; + var after = (node, nodes) => { + const { ownerDocument, parentNode } = node; + if (parentNode) + parentNode.insertBefore( + asFragment(ownerDocument, nodes), + getEnd(node)[NEXT] + ); + }; + exports2.after = after; + var replaceWith = (node, nodes) => { + const { ownerDocument, parentNode } = node; + if (parentNode) { + if (nodes.includes(node)) + replaceWith(node, [node = node.cloneNode()]); + parentNode.insertBefore( + asFragment(ownerDocument, nodes), + node + ); + node.remove(); + } + }; + exports2.replaceWith = replaceWith; + var remove = (prev, current, next) => { + const { parentNode, nodeType } = current; + if (prev || next) { + setAdjacent(prev, next); + current[PREV] = null; + getEnd(current)[NEXT] = null; + } + if (parentNode) { + current.parentNode = null; + moCallback(current, parentNode); + if (nodeType === ELEMENT_NODE) + disconnectedCallback(current); + } + }; + exports2.remove = remove; + } +}); + +// node_modules/linkedom/cjs/interface/character-data.js +var require_character_data = __commonJS({ + "node_modules/linkedom/cjs/interface/character-data.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { NEXT, PREV, VALUE } = require_symbols(); + var { String: String2 } = require_utils4(); + var { isConnected, parentElement, previousSibling, nextSibling } = require_node4(); + var { characterDataAsJSON } = require_jsdon(); + var { previousElementSibling, nextElementSibling: nextElementSibling2 } = require_non_document_type_child_node(); + var { before, after, replaceWith, remove } = require_child_node(); + var { Node } = require_node3(); + var { moCallback } = require_mutation_observer(); + var CharacterData = class extends Node { + constructor(ownerDocument, localName, nodeType, data) { + super(ownerDocument, localName, nodeType); + this[VALUE] = String2(data); + } + // <Mixins> + get isConnected() { + return isConnected(this); + } + get parentElement() { + return parentElement(this); + } + get previousSibling() { + return previousSibling(this); + } + get nextSibling() { + return nextSibling(this); + } + get previousElementSibling() { + return previousElementSibling(this); + } + get nextElementSibling() { + return nextElementSibling2(this); + } + before(...nodes) { + before(this, nodes); + } + after(...nodes) { + after(this, nodes); + } + replaceWith(...nodes) { + replaceWith(this, nodes); + } + remove() { + remove(this[PREV], this, this[NEXT]); + } + // </Mixins> + // CharacterData only + /* c8 ignore start */ + get data() { + return this[VALUE]; + } + set data(value) { + this[VALUE] = String2(value); + moCallback(this, this.parentNode); + } + get nodeValue() { + return this.data; + } + set nodeValue(value) { + this.data = value; + } + get textContent() { + return this.data; + } + set textContent(value) { + this.data = value; + } + get length() { + return this.data.length; + } + substringData(offset, count) { + return this.data.substr(offset, count); + } + appendData(data) { + this.data += data; + } + insertData(offset, data) { + const { data: t } = this; + this.data = t.slice(0, offset) + data + t.slice(offset); + } + deleteData(offset, count) { + const { data: t } = this; + this.data = t.slice(0, offset) + t.slice(offset + count); + } + replaceData(offset, count, data) { + const { data: t } = this; + this.data = t.slice(0, offset) + data + t.slice(offset + count); + } + /* c8 ignore stop */ + toJSON() { + const json2 = []; + characterDataAsJSON(this, json2); + return json2; + } + }; + exports2.CharacterData = CharacterData; + } +}); + +// node_modules/linkedom/cjs/interface/cdata-section.js +var require_cdata_section = __commonJS({ + "node_modules/linkedom/cjs/interface/cdata-section.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { CDATA_SECTION_NODE } = require_constants(); + var { VALUE } = require_symbols(); + var { CharacterData } = require_character_data(); + var CDATASection = class _CDATASection extends CharacterData { + constructor(ownerDocument, data = "") { + super(ownerDocument, "#cdatasection", CDATA_SECTION_NODE, data); + } + cloneNode() { + const { ownerDocument, [VALUE]: data } = this; + return new _CDATASection(ownerDocument, data); + } + toString() { + return `<![CDATA[${this[VALUE]}]]>`; + } + }; + exports2.CDATASection = CDATASection; + } +}); + +// node_modules/linkedom/cjs/interface/comment.js +var require_comment = __commonJS({ + "node_modules/linkedom/cjs/interface/comment.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { COMMENT_NODE } = require_constants(); + var { VALUE } = require_symbols(); + var { CharacterData } = require_character_data(); + var Comment4 = class _Comment extends CharacterData { + constructor(ownerDocument, data = "") { + super(ownerDocument, "#comment", COMMENT_NODE, data); + } + cloneNode() { + const { ownerDocument, [VALUE]: data } = this; + return new _Comment(ownerDocument, data); + } + toString() { + return `<!--${this[VALUE]}-->`; + } + }; + exports2.Comment = Comment4; + } +}); + +// node_modules/boolbase/dist/index.js +function trueFunc() { + return true; +} +function falseFunc() { + return false; +} +var init_dist = __esm({ + "node_modules/boolbase/dist/index.js"() { + init_define_import_meta_env(); + } +}); + +// node_modules/css-what/dist/types.js +var SelectorType, AttributeAction; +var init_types = __esm({ + "node_modules/css-what/dist/types.js"() { + init_define_import_meta_env(); + (function(SelectorType2) { + SelectorType2["Attribute"] = "attribute"; + SelectorType2["Pseudo"] = "pseudo"; + SelectorType2["PseudoElement"] = "pseudo-element"; + SelectorType2["Tag"] = "tag"; + SelectorType2["Universal"] = "universal"; + SelectorType2["Adjacent"] = "adjacent"; + SelectorType2["Child"] = "child"; + SelectorType2["Descendant"] = "descendant"; + SelectorType2["Parent"] = "parent"; + SelectorType2["Sibling"] = "sibling"; + SelectorType2["ColumnCombinator"] = "column-combinator"; + })(SelectorType || (SelectorType = {})); + (function(AttributeAction2) { + AttributeAction2["Any"] = "any"; + AttributeAction2["Element"] = "element"; + AttributeAction2["End"] = "end"; + AttributeAction2["Equals"] = "equals"; + AttributeAction2["Exists"] = "exists"; + AttributeAction2["Hyphen"] = "hyphen"; + AttributeAction2["Not"] = "not"; + AttributeAction2["Start"] = "start"; + })(AttributeAction || (AttributeAction = {})); + } +}); + +// node_modules/css-what/dist/parse.js +function isTraversal(selector) { + switch (selector.type) { + case SelectorType.Adjacent: + case SelectorType.Child: + case SelectorType.Descendant: + case SelectorType.Parent: + case SelectorType.Sibling: + case SelectorType.ColumnCombinator: { + return true; + } + case SelectorType.Attribute: + case SelectorType.Pseudo: + case SelectorType.PseudoElement: + case SelectorType.Tag: + case SelectorType.Universal: { + return false; + } + } +} +function funescape(_, escaped, escapedWhitespace) { + const high = Number.parseInt(escaped, 16) - 65536; + return Number.isNaN(high) || escapedWhitespace ? escaped : high < 0 ? ( + // BMP codepoint + String.fromCharCode(high + 65536) + ) : ( + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320) + ); +} +function unescapeCSS(cssString) { + return cssString.replace(reEscape, funescape); +} +function isQuote(c) { + return c === CharCode.SingleQuote || c === CharCode.DoubleQuote; +} +function isWhitespace(c) { + return c === CharCode.Space || c === CharCode.Tab || c === CharCode.NewLine || c === CharCode.FormFeed || c === CharCode.CarriageReturn; +} +function parse(selector) { + const subselects2 = []; + const endIndex = parseSelector(subselects2, `${selector}`, 0); + if (endIndex < selector.length) { + throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`); + } + return subselects2; +} +function parseSelector(subselects2, selector, selectorIndex) { + let tokens = []; + function getName2(offset) { + const match = selector.slice(selectorIndex + offset).match(reName); + if (!match) { + throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`); + } + const [name] = match; + selectorIndex += offset + name.length; + return unescapeCSS(name); + } + function stripWhitespace(offset) { + selectorIndex += offset; + while (selectorIndex < selector.length && isWhitespace(selector.charCodeAt(selectorIndex))) { + selectorIndex++; + } + } + function readValueWithParenthesis() { + selectorIndex += 1; + const start = selectorIndex; + for (let counter = 1; selectorIndex < selector.length; selectorIndex++) { + switch (selector.charCodeAt(selectorIndex)) { + case CharCode.BackSlash: { + selectorIndex += 1; + break; } - if (!validateBalancedSyntax(selector2, true, true)) { - return false; + case CharCode.LeftParenthesis: { + counter += 1; + break; } - if (hasInvalidCombinators(selector2)) { - return false; + case CharCode.RightParenthesis: { + counter -= 1; + if (counter === 0) { + return unescapeCSS(selector.slice(start, selectorIndex++)); + } + break; } - if (hasInvalidPseudoSyntax(selector2)) { - return false; + } + } + throw new Error("Parenthesis not matched"); + } + function ensureNotTraversal() { + if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) { + throw new Error("Did not expect successive traversals."); + } + } + function addTraversal(type) { + if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) { + tokens[tokens.length - 1].type = type; + return; + } + ensureNotTraversal(); + tokens.push({ type }); + } + function addSpecialAttribute(name, action) { + tokens.push({ + type: SelectorType.Attribute, + name, + action, + value: getName2(1), + namespace: null, + ignoreCase: "quirks" + }); + } + function finalizeSubselector() { + if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) { + tokens.pop(); + } + if (tokens.length === 0) { + throw new Error("Empty sub-selector"); + } + subselects2.push(tokens); + } + stripWhitespace(0); + if (selector.length === selectorIndex) { + return selectorIndex; + } + loop: while (selectorIndex < selector.length) { + const firstChar = selector.charCodeAt(selectorIndex); + switch (firstChar) { + // Whitespace + case CharCode.Space: + case CharCode.Tab: + case CharCode.NewLine: + case CharCode.FormFeed: + case CharCode.CarriageReturn: { + if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) { + ensureNotTraversal(); + tokens.push({ type: SelectorType.Descendant }); } - if (hasInvalidNestingSelector(selector2)) { - return false; + stripWhitespace(1); + break; + } + // Traversals + case CharCode.GreaterThan: { + addTraversal(SelectorType.Child); + stripWhitespace(1); + break; + } + case CharCode.LessThan: { + addTraversal(SelectorType.Parent); + stripWhitespace(1); + break; + } + case CharCode.Tilde: { + addTraversal(SelectorType.Sibling); + stripWhitespace(1); + break; + } + case CharCode.Plus: { + addTraversal(SelectorType.Adjacent); + stripWhitespace(1); + break; + } + // Special attribute selectors: .class, #id + case CharCode.Period: { + addSpecialAttribute("class", AttributeAction.Element); + break; + } + case CharCode.Hash: { + addSpecialAttribute("id", AttributeAction.Equals); + break; + } + case CharCode.LeftSquareBracket: { + stripWhitespace(1); + let name; + let namespace = null; + if (selector.charCodeAt(selectorIndex) === CharCode.Pipe) { + name = getName2(1); + } else if (selector.startsWith("*|", selectorIndex)) { + namespace = "*"; + name = getName2(2); + } else { + name = getName2(0); + if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) { + namespace = name; + name = getName2(1); + } } - var noQuotesPseudos = ["lang", "dir", "nth-child", "nth-last-child", "nth-of-type", "nth-last-of-type"]; - for (var idx = 0; idx < selector2.length; idx++) { - if (selector2[idx] === ":") { - var pseudoStart = idx; - idx++; - if (idx < selector2.length && selector2[idx] === ":") { - idx++; + stripWhitespace(0); + let action = AttributeAction.Exists; + const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex)); + if (possibleAction) { + action = possibleAction; + if (selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) { + throw new Error("Expected `=`"); + } + stripWhitespace(2); + } else if (selector.charCodeAt(selectorIndex) === CharCode.Equal) { + action = AttributeAction.Equals; + stripWhitespace(1); + } + let value = ""; + let ignoreCase = null; + if (action !== "exists") { + if (isQuote(selector.charCodeAt(selectorIndex))) { + const quote = selector.charCodeAt(selectorIndex); + selectorIndex += 1; + const sectionStart = selectorIndex; + while (selectorIndex < selector.length && selector.charCodeAt(selectorIndex) !== quote) { + selectorIndex += // Skip next character if it is escaped + selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1; } - var nameStart = idx; - while (idx < selector2.length && /[a-zA-Z0-9\-]/.test(selector2[idx])) { - idx++; + if (selector.charCodeAt(selectorIndex) !== quote) { + throw new Error("Attribute value didn't end"); } - if (idx === nameStart) { - continue; + value = unescapeCSS(selector.slice(sectionStart, selectorIndex)); + selectorIndex += 1; + } else { + const valueStart = selectorIndex; + while (selectorIndex < selector.length && !isWhitespace(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) { + selectorIndex += // Skip next character if it is escaped + selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1; } - var pseudoName = selector2.substring(nameStart, idx).toLowerCase(); - if (idx < selector2.length && selector2[idx] === "(") { - idx++; - var contentStart = idx; - var depth = 1; - while (idx < selector2.length && depth > 0) { - if (selector2[idx] === "\\") { - idx += 2; - } else if (selector2[idx] === "(") { - depth++; - idx++; - } else if (selector2[idx] === ")") { - depth--; - idx++; - } else { - idx++; - } - } - if (depth === 0) { - var pseudoContent = selector2.substring(contentStart, idx - 1); - for (var j = 0; j < noQuotesPseudos.length; j++) { - if (pseudoName === noQuotesPseudos[j] && /['"]/.test(pseudoContent)) { - return false; - } - } - } + value = unescapeCSS(selector.slice(valueStart, selectorIndex)); + } + stripWhitespace(0); + switch (selector.charCodeAt(selectorIndex) | 32) { + // If the forceIgnore flag is set (either `i` or `s`), use that value + case CharCode.LowerI: { + ignoreCase = true; + stripWhitespace(1); + break; + } + case CharCode.LowerS: { + ignoreCase = false; + stripWhitespace(1); + break; } } } - return looseSelectorValidator(selector2); + if (selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) { + throw new Error("Attribute selector didn't terminate"); + } + selectorIndex += 1; + const attributeSelector = { + type: SelectorType.Attribute, + name, + action, + value, + namespace, + ignoreCase + }; + tokens.push(attributeSelector); + break; } - function extractPseudoClasses(selector2) { - var matches2 = []; - for (var i2 = 0; i2 < selector2.length; i2++) { - if (selector2[i2] === ":") { - var pseudoStart = i2; - i2++; - if (i2 < selector2.length && selector2[i2] === ":") { - i2++; - } - var nameStart = i2; - while (i2 < selector2.length && /[a-zA-Z\-]/.test(selector2[i2])) { - i2++; + case CharCode.Colon: { + if (selector.charCodeAt(selectorIndex + 1) === CharCode.Colon) { + tokens.push({ + type: SelectorType.PseudoElement, + name: getName2(2).toLowerCase(), + data: selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis ? readValueWithParenthesis() : null + }); + break; + } + const name = getName2(1).toLowerCase(); + if (pseudosToPseudoElements.has(name)) { + tokens.push({ + type: SelectorType.PseudoElement, + name, + data: null + }); + break; + } + let data = null; + if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) { + if (unpackPseudos.has(name)) { + if (isQuote(selector.charCodeAt(selectorIndex + 1))) { + throw new Error(`Pseudo-selector ${name} cannot be quoted`); } - if (i2 === nameStart) { - continue; + data = []; + selectorIndex = parseSelector(data, selector, selectorIndex + 1); + if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) { + throw new Error(`Missing closing parenthesis in :${name} (${selector})`); } - var pseudoName = selector2.substring(nameStart, i2); - if (i2 < selector2.length && selector2[i2] === "(") { - i2++; - var argsStart = i2; - var depth = 1; - var inSingleQuote = false; - var inDoubleQuote = false; - while (i2 < selector2.length && depth > 0) { - var ch = selector2[i2]; - if (ch === "\\") { - i2 += 2; - } else if (ch === "'" && !inDoubleQuote) { - inSingleQuote = !inSingleQuote; - i2++; - } else if (ch === '"' && !inSingleQuote) { - inDoubleQuote = !inDoubleQuote; - i2++; - } else if (ch === "(" && !inSingleQuote && !inDoubleQuote) { - depth++; - i2++; - } else if (ch === ")" && !inSingleQuote && !inDoubleQuote) { - depth--; - i2++; - } else { - i2++; - } - } - if (depth === 0) { - var pseudoArgs = selector2.substring(argsStart, i2 - 1); - var fullMatch = selector2.substring(pseudoStart, i2); - matches2.push([fullMatch, pseudoName, pseudoArgs, pseudoStart]); + selectorIndex += 1; + } else { + data = readValueWithParenthesis(); + if (stripQuotesFromPseudos.has(name)) { + const quot = data.charCodeAt(0); + if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) { + data = data.slice(1, -1); } - i2--; } + data = unescapeCSS(data); } } - return matches2; + tokens.push({ type: SelectorType.Pseudo, name, data }); + break; } - function parseAndSplitNestedSelectors(selector2) { - var depth = 0; - var buffer2 = ""; - var parts = []; - var inSingleQuote = false; - var inDoubleQuote = false; - var i2, char; - for (i2 = 0; i2 < selector2.length; i2++) { - char = selector2.charAt(i2); - if (char === "\\" && i2 + 1 < selector2.length) { - buffer2 += char; - i2++; - buffer2 += selector2.charAt(i2); - continue; + case CharCode.Comma: { + finalizeSubselector(); + tokens = []; + stripWhitespace(1); + break; + } + default: { + if (selector.startsWith("/*", selectorIndex)) { + const endIndex = selector.indexOf("*/", selectorIndex + 2); + if (endIndex === -1) { + throw new Error("Comment was not terminated"); } - if (char === "'" && !inDoubleQuote) { - inSingleQuote = !inSingleQuote; - buffer2 += char; - } else if (char === '"' && !inSingleQuote) { - inDoubleQuote = !inDoubleQuote; - buffer2 += char; - } else if (!inSingleQuote && !inDoubleQuote) { - if (char === "(") { - depth++; - buffer2 += char; - } else if (char === ")") { - depth--; - buffer2 += char; - } else if (char === "," && depth === 0) { - if (buffer2.trim()) { - parts.push(buffer2.trim()); - } - buffer2 = ""; - } else { - buffer2 += char; - } - } else { - buffer2 += char; + selectorIndex = endIndex + 2; + if (tokens.length === 0) { + stripWhitespace(0); } + break; } - var trimmed = buffer2.trim(); - if (trimmed) { - var endsWithHexEscape = endsWithHexEscapeRegExp.test(buffer2); - parts.push(endsWithHexEscape ? buffer2.replace(leadingWhitespaceRegExp, "") : trimmed); - } - return parts; - } - var validatedSelectorsCache = {}; - var selectorListPseudoClasses = { - "not": true, - "is": true, - "has": true, - "where": true - }; - function validateSelector(selector2) { - if (validatedSelectorsCache.hasOwnProperty(selector2)) { - return validatedSelectorsCache[selector2]; - } - var pseudoClassMatches = extractPseudoClasses(selector2); - for (var j = 0; j < pseudoClassMatches.length; j++) { - var pseudoClass = pseudoClassMatches[j][1]; - if (selectorListPseudoClasses.hasOwnProperty(pseudoClass)) { - var nestedSelectors = parseAndSplitNestedSelectors(pseudoClassMatches[j][2]); - var hasAmpersand = false; - for (var k = 0; k < nestedSelectors.length; k++) { - if (ampersandRegExp.test(nestedSelectors[k])) { - hasAmpersand = true; - break; - } - } - if (hasAmpersand) { - continue; - } - for (var i2 = 0; i2 < nestedSelectors.length; i2++) { - var nestedSelector = nestedSelectors[i2]; - if (!validatedSelectorsCache.hasOwnProperty(nestedSelector)) { - var nestedSelectorValidation = validateSelector(nestedSelector); - validatedSelectorsCache[nestedSelector] = nestedSelectorValidation; - if (!nestedSelectorValidation) { - validatedSelectorsCache[selector2] = false; - return false; - } - } else if (!validatedSelectorsCache[nestedSelector]) { - validatedSelectorsCache[selector2] = false; - return false; - } - } + let namespace = null; + let name; + if (firstChar === CharCode.Asterisk) { + selectorIndex += 1; + name = "*"; + } else if (firstChar === CharCode.Pipe) { + name = ""; + if (selector.charCodeAt(selectorIndex + 1) === CharCode.Pipe) { + addTraversal(SelectorType.ColumnCombinator); + stripWhitespace(2); + break; } + } else if (reName.test(selector.slice(selectorIndex))) { + name = getName2(0); + } else { + break loop; } - var basicSelectorValidation = basicSelectorValidator(selector2); - validatedSelectorsCache[selector2] = basicSelectorValidation; - return basicSelectorValidation; - } - function validateNamespaceSelector(selector2) { - var pipeIndex = -1; - var inAttr = false; - var inSingleQuote = false; - var inDoubleQuote = false; - for (var i2 = 0; i2 < selector2.length; i2++) { - var char = selector2[i2]; - if (char === "\\") { - var escapeLen2 = getEscapeSequenceLength(selector2, i2); - if (escapeLen2 > 0) { - i2 += escapeLen2 - 1; - continue; - } - } - if (inSingleQuote) { - if (char === "'") { - inSingleQuote = false; - } - } else if (inDoubleQuote) { - if (char === '"') { - inDoubleQuote = false; - } - } else if (inAttr) { - if (char === "]") { - inAttr = false; - } else if (char === "'") { - inSingleQuote = true; - } else if (char === '"') { - inDoubleQuote = true; - } + if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Pipe) { + namespace = name; + if (selector.charCodeAt(selectorIndex + 1) === CharCode.Asterisk) { + name = "*"; + selectorIndex += 2; } else { - if (char === "[") { - inAttr = true; - } else if (char === "|" && !inAttr) { - pipeIndex = i2; - break; - } + name = getName2(1); } } - if (pipeIndex === -1) { - return true; - } - var namespacePrefix = selector2.substring(0, pipeIndex); - if (namespacePrefix === "*" || namespacePrefix === "") { - return true; - } - return definedNamespacePrefixes.hasOwnProperty(namespacePrefix); + tokens.push(name === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name, namespace }); } - function normalizeSelectorEscapes(selector2) { - var result = ""; - var i2 = 0; - var nextChar = ""; - var inIdentifier = false; - var inAttribute = false; - var attributeDepth = 0; - var needsEscapeForIdent = false; - var lastWasHexEscape = false; - while (i2 < selector2.length) { - var char = selector2[i2]; - if (char === "[" && !inAttribute) { - inAttribute = true; - attributeDepth = 1; - result += char; - i2++; - needsEscapeForIdent = false; - inIdentifier = false; - lastWasHexEscape = false; - continue; - } - if (inAttribute) { - if (char === "[") attributeDepth++; - if (char === "]") { - attributeDepth--; - if (attributeDepth === 0) inAttribute = false; - } - if (char === "\\" && i2 + 1 < selector2.length) { - var escapeLen2 = getEscapeSequenceLength(selector2, i2); - result += selector2.substr(i2, escapeLen2); - i2 += escapeLen2; - } else { - result += char; - i2++; - } - lastWasHexEscape = false; - continue; - } - if (char === "\\") { - var escapeLen2 = getEscapeSequenceLength(selector2, i2); - if (escapeLen2 > 0) { - var escapeSeq = selector2.substr(i2, escapeLen2); - var decoded = decodeEscapeSequence(escapeSeq); - var wasHexEscape = startsWithHexEscapeRegExp.test(escapeSeq); - var hadTerminatingSpace = wasHexEscape && escapeSeq[escapeLen2 - 1] === " "; - nextChar = selector2[i2 + escapeLen2] || ""; - var needsEscape = false; - var useHexEscape = false; - if (needsEscapeForIdent) { - if (isDigit(decoded)) { - needsEscape = true; - useHexEscape = true; - } else if (decoded === "-") { - var remainingSelector = selector2.substring(i2 + escapeLen2); - var hasMoreIdentChars = remainingSelector && identCharRegExp.test(remainingSelector[0]); - needsEscape = !hasMoreIdentChars; - } else if (!identStartCharRegExp.test(decoded)) { - needsEscape = true; - } - } else { - if (specialCharsNeedEscapeRegExp.test(decoded)) { - needsEscape = true; - } - } - if (needsEscape) { - if (useHexEscape) { - var codePoint = decoded.charCodeAt(0); - var hex = codePoint.toString(16); - result += "\\" + hex; - if (isHexDigit(nextChar) || !nextChar || afterHexEscapeSeparatorRegExp.test(nextChar)) { - result += " "; - lastWasHexEscape = false; - } else { - lastWasHexEscape = true; - } - } else { - result += "\\" + decoded; - lastWasHexEscape = false; - } - } else { - if (lastWasHexEscape && !hadTerminatingSpace && isAlphanumeric(decoded)) { - result += " "; - } - result += decoded; - if (hadTerminatingSpace && (!nextChar || afterHexEscapeSeparatorRegExp.test(nextChar))) { - result += " "; - } - lastWasHexEscape = false; - } - i2 += escapeLen2; - needsEscapeForIdent = needsEscapeForIdent && decoded === "-"; - inIdentifier = true; - continue; - } - } - if (char === "." || char === "#") { - result += char; - needsEscapeForIdent = true; - inIdentifier = false; - lastWasHexEscape = false; - i2++; - } else if (char === "-" && needsEscapeForIdent) { - result += char; - needsEscapeForIdent = true; - lastWasHexEscape = false; - i2++; - } else if (isDigit(char) && needsEscapeForIdent) { - var codePoint = char.charCodeAt(0); - var hex = codePoint.toString(16); - result += "\\" + hex; - nextChar = selector2[i2 + 1] || ""; - if (isHexDigit(nextChar) || !nextChar || afterHexEscapeSeparatorRegExp.test(nextChar)) { - result += " "; - lastWasHexEscape = false; - } else { - lastWasHexEscape = true; - } - needsEscapeForIdent = false; - inIdentifier = true; - i2++; - } else if (char === ":" || combinatorOrSeparatorRegExp.test(char)) { - if (!(char === " " && lastWasHexEscape && result[result.length - 1] === " ")) { - result += char; - } - needsEscapeForIdent = false; - inIdentifier = false; - lastWasHexEscape = false; - i2++; - } else if (isLetter(char) && lastWasHexEscape) { - result += " " + char; - needsEscapeForIdent = false; - inIdentifier = true; - lastWasHexEscape = false; - i2++; - } else if (char === " " && lastWasHexEscape) { - nextChar = selector2[i2 + 1] || ""; - if (!nextChar || trailingSpaceSeparatorRegExp.test(nextChar)) { - result += char; - } - needsEscapeForIdent = false; - inIdentifier = false; - lastWasHexEscape = false; - i2++; - } else { - result += char; - needsEscapeForIdent = false; - inIdentifier = true; - lastWasHexEscape = false; - i2++; - } - } + } + } + finalizeSubselector(); + return selectorIndex; +} +var reName, reEscape, CharCode, actionTypes, unpackPseudos, pseudosToPseudoElements, stripQuotesFromPseudos; +var init_parse = __esm({ + "node_modules/css-what/dist/parse.js"() { + init_define_import_meta_env(); + init_types(); + reName = /^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/; + reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi; + (function(CharCode2) { + CharCode2[CharCode2["LeftParenthesis"] = 40] = "LeftParenthesis"; + CharCode2[CharCode2["RightParenthesis"] = 41] = "RightParenthesis"; + CharCode2[CharCode2["LeftSquareBracket"] = 91] = "LeftSquareBracket"; + CharCode2[CharCode2["RightSquareBracket"] = 93] = "RightSquareBracket"; + CharCode2[CharCode2["Comma"] = 44] = "Comma"; + CharCode2[CharCode2["Period"] = 46] = "Period"; + CharCode2[CharCode2["Colon"] = 58] = "Colon"; + CharCode2[CharCode2["SingleQuote"] = 39] = "SingleQuote"; + CharCode2[CharCode2["DoubleQuote"] = 34] = "DoubleQuote"; + CharCode2[CharCode2["Plus"] = 43] = "Plus"; + CharCode2[CharCode2["Tilde"] = 126] = "Tilde"; + CharCode2[CharCode2["QuestionMark"] = 63] = "QuestionMark"; + CharCode2[CharCode2["ExclamationMark"] = 33] = "ExclamationMark"; + CharCode2[CharCode2["Slash"] = 47] = "Slash"; + CharCode2[CharCode2["Equal"] = 61] = "Equal"; + CharCode2[CharCode2["Dollar"] = 36] = "Dollar"; + CharCode2[CharCode2["Pipe"] = 124] = "Pipe"; + CharCode2[CharCode2["Circumflex"] = 94] = "Circumflex"; + CharCode2[CharCode2["Asterisk"] = 42] = "Asterisk"; + CharCode2[CharCode2["GreaterThan"] = 62] = "GreaterThan"; + CharCode2[CharCode2["LessThan"] = 60] = "LessThan"; + CharCode2[CharCode2["Hash"] = 35] = "Hash"; + CharCode2[CharCode2["LowerI"] = 105] = "LowerI"; + CharCode2[CharCode2["LowerS"] = 115] = "LowerS"; + CharCode2[CharCode2["BackSlash"] = 92] = "BackSlash"; + CharCode2[CharCode2["Space"] = 32] = "Space"; + CharCode2[CharCode2["Tab"] = 9] = "Tab"; + CharCode2[CharCode2["NewLine"] = 10] = "NewLine"; + CharCode2[CharCode2["FormFeed"] = 12] = "FormFeed"; + CharCode2[CharCode2["CarriageReturn"] = 13] = "CarriageReturn"; + })(CharCode || (CharCode = {})); + actionTypes = /* @__PURE__ */ new Map([ + [CharCode.Tilde, AttributeAction.Element], + [CharCode.Circumflex, AttributeAction.Start], + [CharCode.Dollar, AttributeAction.End], + [CharCode.Asterisk, AttributeAction.Any], + [CharCode.ExclamationMark, AttributeAction.Not], + [CharCode.Pipe, AttributeAction.Hyphen] + ]); + unpackPseudos = /* @__PURE__ */ new Set([ + "has", + "not", + "matches", + "is", + "where", + "host", + "host-context" + ]); + pseudosToPseudoElements = /* @__PURE__ */ new Set([ + "before", + "after", + "first-line", + "first-letter" + ]); + stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]); + } +}); + +// node_modules/css-what/dist/index.js +var init_dist2 = __esm({ + "node_modules/css-what/dist/index.js"() { + init_define_import_meta_env(); + init_parse(); + init_types(); + } +}); + +// node_modules/domhandler/node_modules/domelementtype/dist/index.js +function isTag(element) { + return element.type === ElementType.Tag || element.type === ElementType.Script || element.type === ElementType.Style; +} +var ElementType, Root, Text, Directive, Comment, Script, Style, Tag, CDATA, Doctype; +var init_dist3 = __esm({ + "node_modules/domhandler/node_modules/domelementtype/dist/index.js"() { + init_define_import_meta_env(); + (function(ElementType4) { + ElementType4["Root"] = "root"; + ElementType4["Text"] = "text"; + ElementType4["Directive"] = "directive"; + ElementType4["Comment"] = "comment"; + ElementType4["Script"] = "script"; + ElementType4["Style"] = "style"; + ElementType4["Tag"] = "tag"; + ElementType4["CDATA"] = "cdata"; + ElementType4["Doctype"] = "doctype"; + })(ElementType || (ElementType = {})); + Root = ElementType.Root; + Text = ElementType.Text; + Directive = ElementType.Directive; + Comment = ElementType.Comment; + Script = ElementType.Script; + Style = ElementType.Style; + Tag = ElementType.Tag; + CDATA = ElementType.CDATA; + Doctype = ElementType.Doctype; + } +}); + +// node_modules/domhandler/dist/node.js +function isTag2(node) { + return isTag(node); +} +function isCDATA(node) { + return node.type === ElementType.CDATA; +} +function isText(node) { + return node.type === ElementType.Text; +} +function isComment(node) { + return node.type === ElementType.Comment; +} +function hasChildren(node) { + return Object.hasOwn(node, "children"); +} +var init_node = __esm({ + "node_modules/domhandler/dist/node.js"() { + init_define_import_meta_env(); + init_dist3(); + } +}); + +// node_modules/domhandler/dist/index.js +var init_dist4 = __esm({ + "node_modules/domhandler/dist/index.js"() { + init_define_import_meta_env(); + init_node(); + } +}); + +// node_modules/domutils/dist/querying.js +function filter(test, node, recurse = true, limit = Number.POSITIVE_INFINITY) { + return find(test, Array.isArray(node) ? node : [node], recurse, limit); +} +function find(test, nodes, recurse, limit) { + const result = []; + const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; + const indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (indexStack.length === 1) { return result; } - function decodeEscapeSequencesInString(str) { - var result = ""; - for (var i2 = 0; i2 < str.length; i2++) { - if (str[i2] === "\\" && i2 + 1 < str.length) { - var escapeLen2 = getEscapeSequenceLength(str, i2); - if (escapeLen2 > 0) { - var escapeSeq = str.substr(i2, escapeLen2); - var decoded = decodeEscapeSequence(escapeSeq); - result += decoded; - i2 += escapeLen2 - 1; - continue; - } - } - result += str[i2]; - } + nodeStack.shift(); + indexStack.shift(); + continue; + } + const element = nodeStack[0][indexStack[0]++]; + if (test(element)) { + result.push(element); + if (--limit <= 0) + return result; + } + if (recurse && hasChildren(element) && element.children.length > 0) { + indexStack.unshift(0); + nodeStack.unshift(element.children); + } + } +} +function findOne(test, nodes, recurse = true) { + const searchedNodes = Array.isArray(nodes) ? nodes : [nodes]; + for (const node of searchedNodes) { + if (isTag2(node) && test(node)) { + return node; + } + if (recurse && hasChildren(node) && node.children.length > 0) { + const found = findOne(test, node.children, true); + if (found) + return found; + } + } + return null; +} +function existsOne(test, nodes) { + return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => isTag2(node) && test(node) || hasChildren(node) && existsOne(test, node.children)); +} +function findAll(test, nodes) { + const result = []; + const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; + const indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (nodeStack.length === 1) { return result; } - function decodeEscapeSequence(escapeSeq) { - if (escapeSeq.length < 2 || escapeSeq[0] !== "\\") { - return escapeSeq; + nodeStack.shift(); + indexStack.shift(); + continue; + } + const element = nodeStack[0][indexStack[0]++]; + if (isTag2(element) && test(element)) + result.push(element); + if (hasChildren(element) && element.children.length > 0) { + indexStack.unshift(0); + nodeStack.unshift(element.children); + } + } +} +var init_querying = __esm({ + "node_modules/domutils/dist/querying.js"() { + init_define_import_meta_env(); + init_dist4(); + } +}); + +// node_modules/domutils/dist/legacy.js +function getAttribCheck(attrib, value) { + if (typeof value === "function") { + return (element) => isTag2(element) && value(element.attribs[attrib]); + } + return (element) => isTag2(element) && element.attribs[attrib] === value; +} +function combineFuncs(a, b) { + return (element) => a(element) || b(element); +} +function compileTest(options) { + const funcs = Object.keys(options).map((key) => { + const value = options[key]; + return Object.hasOwn(Checks, key) ? Checks[key](value) : getAttribCheck(key, value); + }); + return funcs.length === 0 ? null : funcs.reduce(combineFuncs); +} +function testElement(options, node) { + const test = compileTest(options); + return test ? test(node) : true; +} +function getElements(options, nodes, recurse, limit = Number.POSITIVE_INFINITY) { + const test = compileTest(options); + return test ? filter(test, nodes, recurse, limit) : []; +} +function getElementById(id, nodes, recurse = true) { + if (!Array.isArray(nodes)) + nodes = [nodes]; + return findOne(getAttribCheck("id", id), nodes, recurse); +} +function getElementsByTagName(tagName, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { + return filter(Checks["tag_name"](tagName), nodes, recurse, limit); +} +function getElementsByClassName(className, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { + return filter(getAttribCheck("class", className), nodes, recurse, limit); +} +function getElementsByTagType(type, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { + return filter(Checks["tag_type"](type), nodes, recurse, limit); +} +var Checks; +var init_legacy = __esm({ + "node_modules/domutils/dist/legacy.js"() { + init_define_import_meta_env(); + init_dist4(); + init_querying(); + Checks = { + tag_name(name) { + if (typeof name === "function") { + return (element) => isTag2(element) && name(element.name); } - var content = escapeSeq.substring(1); - var hexMatch = content.match(hexEscapeSequenceRegExp); - if (hexMatch) { - var codePoint = parseInt(hexMatch[1], 16); - if (codePoint > 65535) { - codePoint -= 65536; - var high = 55296 + (codePoint >> 10); - var low = 56320 + (codePoint & 1023); - return String.fromCharCode(high, low); - } - return String.fromCharCode(codePoint); + if (name === "*") { + return isTag2; } - return content[0] || ""; + return (element) => isTag2(element) && element.name === name; + }, + tag_type(type) { + if (typeof type === "function") { + return (element) => type(element.type); + } + return (element) => element.type === type; + }, + tag_contains(data) { + if (typeof data === "function") { + return (element) => isText(element) && data(element.data); + } + return (element) => isText(element) && element.data === data; } - function normalizeAttributeSelectors(selector2) { - var result = ""; - var i2 = 0; - while (i2 < selector2.length) { - if (selector2[i2] === "[") { - result += "["; - i2++; - var attrContent = ""; - var depth = 1; - while (i2 < selector2.length && depth > 0) { - if (selector2[i2] === "\\" && i2 + 1 < selector2.length) { - attrContent += selector2.substring(i2, i2 + 2); - i2 += 2; - continue; - } - if (selector2[i2] === "[") depth++; - if (selector2[i2] === "]") { - depth--; - if (depth === 0) break; - } - attrContent += selector2[i2]; - i2++; - } - var normalized2 = normalizeAttributeContent(attrContent); - if (normalized2 === null) { - return null; - } - result += normalized2; - if (i2 < selector2.length && selector2[i2] === "]") { - result += "]"; - i2++; - } - } else { - result += selector2[i2]; - i2++; - } - } - return result; - } - function processQuotedAttributeValue(trimmedValue, quoteChar, attrName, operator, flag) { - if (trimmedValue.length < 2) { - return null; - } - var i2 = 1; - var foundClose = false; - while (i2 < trimmedValue.length) { - if (trimmedValue[i2] === "\\" && i2 + 1 < trimmedValue.length) { - var escapeLen2 = getEscapeSequenceLength(trimmedValue, i2); - i2 += escapeLen2; - continue; - } - if (trimmedValue[i2] === quoteChar) { - foundClose = i2 === trimmedValue.length - 1; - break; - } - i2++; - } - if (!foundClose) { - return null; - } - var innerValue = trimmedValue.slice(1, -1); - var decodedValue = decodeEscapeSequencesInString(innerValue); - var escapedValue = decodedValue.replace(doubleQuoteRegExp, '\\"'); - return attrName + operator + '"' + escapedValue + '"' + (flag ? " " + flag : ""); - } - function normalizeAttributeContent(content) { - var match = content.match(attributeSelectorContentRegExp); - if (!match) { - return content; - } - var attrName = match[1]; - var operator = match[2]; - var valueAndFlag = match[3].trim(); - var flagMatch = valueAndFlag.match(attributeCaseFlagRegExp); - var value = flagMatch ? flagMatch[1] : valueAndFlag; - var flag = flagMatch ? flagMatch[2] : ""; - var trimmedValue = value.trim(); - var firstChar = trimmedValue[0]; - if (firstChar === '"') { - return processQuotedAttributeValue(trimmedValue, '"', attrName, operator, flag); - } - if (firstChar === "'") { - return processQuotedAttributeValue(trimmedValue, "'", attrName, operator, flag); - } - var hasUnescapedSpecialChar = false; - for (var i2 = 0; i2 < trimmedValue.length; i2++) { - var char = trimmedValue[i2]; - if (char === "\\" && i2 + 1 < trimmedValue.length) { - var escapeLen2 = getEscapeSequenceLength(trimmedValue, i2); - if (escapeLen2 > 0) { - i2 += escapeLen2 - 1; - continue; - } - } - if (specialCharsNeedEscapeRegExp.test(char)) { - hasUnescapedSpecialChar = true; - break; - } - } - if (hasUnescapedSpecialChar) { - return null; - } - var decodedValue = decodeEscapeSequencesInString(trimmedValue); - var escapedValue = decodedValue.replace(backslashRegExp, "\\\\").replace(doubleQuoteRegExp, '\\"'); - return attrName + operator + '"' + escapedValue + '"' + (flag ? " " + flag : ""); - } - function processSelectorText(selectorText) { - var normalized2 = selectorText.replace(whitespaceNormalizationRegExp, function(match, _, newline) { - if (newline) return " "; - return match; - }); - normalized2 = normalizeSelectorEscapes(normalized2); - normalized2 = normalizeAttributeSelectors(normalized2); - if (normalized2 === null) { - return ""; - } - return processNestedPseudoClasses(normalized2); + }; + } +}); + +// node_modules/dom-serializer/node_modules/domelementtype/dist/index.js +var ElementType2, Root2, Text2, Directive2, Comment2, Script2, Style2, Tag2, CDATA2, Doctype2; +var init_dist5 = __esm({ + "node_modules/dom-serializer/node_modules/domelementtype/dist/index.js"() { + init_define_import_meta_env(); + (function(ElementType4) { + ElementType4["Root"] = "root"; + ElementType4["Text"] = "text"; + ElementType4["Directive"] = "directive"; + ElementType4["Comment"] = "comment"; + ElementType4["Script"] = "script"; + ElementType4["Style"] = "style"; + ElementType4["Tag"] = "tag"; + ElementType4["CDATA"] = "cdata"; + ElementType4["Doctype"] = "doctype"; + })(ElementType2 || (ElementType2 = {})); + Root2 = ElementType2.Root; + Text2 = ElementType2.Text; + Directive2 = ElementType2.Directive; + Comment2 = ElementType2.Comment; + Script2 = ElementType2.Script; + Style2 = ElementType2.Style; + Tag2 = ElementType2.Tag; + CDATA2 = ElementType2.CDATA; + Doctype2 = ElementType2.Doctype; + } +}); + +// node_modules/dom-serializer/node_modules/entities/dist/escape.js +function getEscape(char) { + return char === 34 ? """ : char === 38 ? "&" : char === 39 ? "'" : char === 60 ? "<" : char === 62 ? ">" : " "; +} +function isXmlEscapable(code) { + return code >= 128 || code >= 32 && code < 64 && (XML_BITSET_VALUE >>> code & 1) === 1; +} +function encodeXML(input) { + const { length } = input; + let out; + let last = 0; + let index2 = 0; + while (index2 < length) { + const char = input.charCodeAt(index2); + if (!isXmlEscapable(char)) { + const bound = Math.min(index2 + 32, length); + let next = index2 + 1; + while (next < bound && !isXmlEscapable(input.charCodeAt(next))) { + next++; } - function processNestedPseudoClasses(selectorText, depth) { - if (typeof depth === "undefined") { - depth = 0; - } - if (depth > 10) { - return selectorText; - } - var pseudoClassMatches = extractPseudoClasses(selectorText); - if (pseudoClassMatches.length === 0) { - return selectorText; - } - var result = selectorText; - for (var j = pseudoClassMatches.length - 1; j >= 0; j--) { - var pseudoClass = pseudoClassMatches[j][1]; - if (selectorListPseudoClasses.hasOwnProperty(pseudoClass)) { - var fullMatch = pseudoClassMatches[j][0]; - var pseudoArgs = pseudoClassMatches[j][2]; - var matchStart = pseudoClassMatches[j][3]; - var nestedSelectorsRaw = parseAndSplitNestedSelectors(pseudoArgs); - var hasAmpersand = false; - for (var k = 0; k < nestedSelectorsRaw.length; k++) { - if (ampersandRegExp.test(nestedSelectorsRaw[k])) { - hasAmpersand = true; - break; - } - } - if (hasAmpersand) { - continue; - } - var processedArgs = processNestedPseudoClasses(pseudoArgs, depth + 1); - var nestedSelectors = parseAndSplitNestedSelectors(processedArgs); - var validSelectors = []; - for (var i2 = 0; i2 < nestedSelectors.length; i2++) { - var nestedSelector = nestedSelectors[i2]; - if (basicSelectorValidator(nestedSelector)) { - validSelectors.push(nestedSelector); - } - } - var newArgs = validSelectors.join(", "); - var newPseudoClass = ":" + pseudoClass + "(" + newArgs + ")"; - result = result.substring(0, matchStart) + newPseudoClass + result.substring(matchStart + fullMatch.length); - } - } - return result; - return normalized; + if (next < bound) { + index2 = next; + continue; } - function hasNewlineInQuotedString(selectorText) { - for (var i2 = 0; i2 < selectorText.length; i2++) { - var char = selectorText[i2]; - if (char === "'") { - i2++; - while (i2 < selectorText.length) { - if (selectorText[i2] === "\\" && i2 + 1 < selectorText.length) { - i2 += 2; - continue; - } - if (selectorText[i2] === "'") { - break; - } - if (selectorText[i2] === "\r" || selectorText[i2] === "\n") { - return true; - } - i2++; - } - } else if (char === '"') { - i2++; - while (i2 < selectorText.length) { - if (selectorText[i2] === "\\" && i2 + 1 < selectorText.length) { - i2 += 2; - continue; - } - if (selectorText[i2] === '"') { - break; - } - if (selectorText[i2] === "\r" || selectorText[i2] === "\n") { - return true; - } - i2++; - } - } - } - return false; + if (next >= length) + break; + xmlEncodeRegex.lastIndex = next; + if (!xmlEncodeRegex.test(input)) + break; + index2 = xmlEncodeRegex.lastIndex - 1; + continue; + } + if (out === void 0) + out = input.substring(0, index2); + else if (last !== index2) + out += input.substring(last, index2); + if (char < 64) { + out += getEscape(char); + last = index2 += 1; + continue; + } + const cp = input.codePointAt(index2); + out += `&#x${cp.toString(16)};`; + if (cp !== char) + index2++; + last = index2 += 1; + } + if (out === void 0) + return input; + if (last < length) + out += input.substr(last); + return out; +} +function escapeWithRegex(re, data) { + re.lastIndex = 0; + if (!re.test(data)) + return data; + let out = ""; + let last = 0; + do { + const index2 = re.lastIndex - 1; + if (last !== index2) + out += data.substring(last, index2); + const char = data.charCodeAt(index2); + out += getEscape(char); + last = index2 + 1; + } while (re.test(data)); + return out + data.substring(last); +} +function escapeAttribute(data) { + return escapeWithRegex(attributeEscapeRegex, data); +} +function escapeText(data) { + return escapeWithRegex(textEscapeRegex, data); +} +var XML_BITSET_VALUE, xmlEncodeRegex, attributeEscapeRegex, textEscapeRegex; +var init_escape = __esm({ + "node_modules/dom-serializer/node_modules/entities/dist/escape.js"() { + init_define_import_meta_env(); + XML_BITSET_VALUE = 1342177476; + xmlEncodeRegex = /["&'<>\u0080-\uFFFF]/g; + attributeEscapeRegex = /["&\u{A0}]/gu; + textEscapeRegex = /[&<>\u{A0}]/gu; + } +}); + +// node_modules/dom-serializer/node_modules/entities/dist/index.js +var EntityLevel, EncodingMode; +var init_dist6 = __esm({ + "node_modules/dom-serializer/node_modules/entities/dist/index.js"() { + init_define_import_meta_env(); + init_escape(); + (function(EntityLevel2) { + EntityLevel2[EntityLevel2["XML"] = 0] = "XML"; + EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML"; + })(EntityLevel || (EntityLevel = {})); + (function(EncodingMode2) { + EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8"; + EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII"; + EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive"; + EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute"; + EncodingMode2[EncodingMode2["Text"] = 4] = "Text"; + })(EncodingMode || (EncodingMode = {})); + } +}); + +// node_modules/dom-serializer/dist/foreign-names.js +var elementNames, attributeNames; +var init_foreign_names = __esm({ + "node_modules/dom-serializer/dist/foreign-names.js"() { + init_define_import_meta_env(); + elementNames = new Map("altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath".split(" ").map((name) => [name.toLowerCase(), name])); + attributeNames = new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map((name) => [name.toLowerCase(), name])); + } +}); + +// node_modules/dom-serializer/dist/index.js +function render(node, options = {}) { + const nodes = "length" in node ? node : [node]; + const xmlMode = options.xmlMode ?? false; + let output = ""; + for (let index2 = 0; index2 < nodes.length; index2++) { + output += renderNode(nodes[index2], options, xmlMode); + } + return output; +} +function renderChildren(children, options, xmlMode) { + let output = ""; + for (let index2 = 0; index2 < children.length; index2++) { + output += renderNode(children[index2], options, xmlMode); + } + return output; +} +function renderNode(node, options, xmlMode) { + switch (node.type) { + case Root2: { + return renderChildren(node.children, options, xmlMode); + } + case Directive2: { + return `<${node.data}>`; + } + case Comment2: { + return `<!--${node.data}-->`; + } + case CDATA2: { + return `<![CDATA[${node.children[0].data}]]>`; + } + case Script2: + case Style2: + case Tag2: { + return renderTag(node, options, xmlMode); + } + case Text2: { + const element = node; + const data = element.data || ""; + if ((options.encodeEntities ?? options.decodeEntities) !== false && !(!xmlMode && element.parent && unencodedElements.has(element.parent.name))) { + return xmlMode || options.encodeEntities !== "utf8" ? encodeXML(data) : escapeText(data); } - function isValidSelectorText(selectorText) { - if (!selectorText || selectorText.trim() === "") { - return false; - } - if (emptyPseudoClassRegExp.test(selectorText)) { - return false; - } - if (hasNewlineInQuotedString(selectorText)) { - return false; - } - var selectors = parseAndSplitNestedSelectors(selectorText); - for (var i2 = 0; i2 < selectors.length; i2++) { - var selector2 = selectors[i2].trim(); - if (!validateSelector(selector2) || !validateNamespaceSelector(selector2)) { - return false; - } - } - return true; + return data; + } + } +} +function renderTag(element, options, xmlMode) { + if (xmlMode === "foreign") { + element.name = elementNames.get(element.name) ?? element.name; + if (element.parent && foreignModeIntegrationPoints.has(element.parent.name)) { + xmlMode = false; + } + } + if (!xmlMode && foreignElements.has(element.name)) { + xmlMode = "foreign"; + } + const { name, children } = element; + const isVoid = !xmlMode && voidElements.has(name); + let tag = `<${name}${formatAttributes(element.attribs, options, xmlMode)}`; + if (children.length === 0 && (xmlMode ? options.selfClosingTags !== false : options.selfClosingTags && isVoid)) { + tag += xmlMode ? "/>" : " />"; + } else { + tag += ">"; + if (children.length > 0) { + tag += renderChildren(children, options, xmlMode); + } + if (!isVoid) { + tag += `</${name}>`; + } + } + return tag; +} +function replaceQuotes(value) { + return value.replaceAll('"', """); +} +function formatAttributes(attributes, options, xmlMode) { + if (!attributes) + return ""; + const encode = (options.encodeEntities ?? options.decodeEntities) === false ? replaceQuotes : xmlMode || options.encodeEntities !== "utf8" ? encodeXML : escapeAttribute; + const isForeign = xmlMode === "foreign"; + const showEmpty = !!(options.emptyAttrs ?? xmlMode); + let result = ""; + for (const key in attributes) { + if (!Object.hasOwn(attributes, key)) + continue; + const value = attributes[key]; + const k = isForeign ? attributeNames.get(key) ?? key : key; + result += !showEmpty && (value == null || value === "") ? ` ${k}` : ` ${k}="${encode(value == null ? "" : String(value))}"`; + } + return result; +} +var unencodedElements, voidElements, foreignElements, foreignModeIntegrationPoints, dist_default; +var init_dist7 = __esm({ + "node_modules/dom-serializer/dist/index.js"() { + init_define_import_meta_env(); + init_dist5(); + init_dist6(); + init_foreign_names(); + unencodedElements = new Set("style script xmp iframe noembed noframes plaintext noscript".split(" ")); + voidElements = new Set("area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr".split(" ")); + foreignElements = /* @__PURE__ */ new Set(["svg", "math"]); + foreignModeIntegrationPoints = new Set("mi mo mn ms mtext annotation-xml foreignObject desc title".split(" ")); + dist_default = render; + } +}); + +// node_modules/domutils/node_modules/domelementtype/dist/index.js +var ElementType3, Root3, Text3, Directive3, Comment3, Script3, Style3, Tag3, CDATA3, Doctype3; +var init_dist8 = __esm({ + "node_modules/domutils/node_modules/domelementtype/dist/index.js"() { + init_define_import_meta_env(); + (function(ElementType4) { + ElementType4["Root"] = "root"; + ElementType4["Text"] = "text"; + ElementType4["Directive"] = "directive"; + ElementType4["Comment"] = "comment"; + ElementType4["Script"] = "script"; + ElementType4["Style"] = "style"; + ElementType4["Tag"] = "tag"; + ElementType4["CDATA"] = "cdata"; + ElementType4["Doctype"] = "doctype"; + })(ElementType3 || (ElementType3 = {})); + Root3 = ElementType3.Root; + Text3 = ElementType3.Text; + Directive3 = ElementType3.Directive; + Comment3 = ElementType3.Comment; + Script3 = ElementType3.Script; + Style3 = ElementType3.Style; + Tag3 = ElementType3.Tag; + CDATA3 = ElementType3.CDATA; + Doctype3 = ElementType3.Doctype; + } +}); + +// node_modules/domutils/dist/stringify.js +function getOuterHTML(node, options) { + return dist_default(node, options); +} +function getInnerHTML(node, options) { + return hasChildren(node) ? node.children.map((node2) => getOuterHTML(node2, options)).join("") : ""; +} +function getText(node) { + if (Array.isArray(node)) + return node.map(getText).join(""); + if (isTag2(node)) + return node.name === "br" ? "\n" : getText(node.children); + if (isCDATA(node)) + return getText(node.children); + if (isText(node)) + return node.data; + return ""; +} +function textContent(node) { + if (Array.isArray(node)) + return node.map(textContent).join(""); + if (hasChildren(node) && !isComment(node)) { + return textContent(node.children); + } + if (isText(node)) + return node.data; + return ""; +} +function innerText(node) { + if (Array.isArray(node)) + return node.map(innerText).join(""); + if (hasChildren(node) && (node.type === ElementType3.Tag || isCDATA(node))) { + return innerText(node.children); + } + if (isText(node)) + return node.data; + return ""; +} +var init_stringify = __esm({ + "node_modules/domutils/dist/stringify.js"() { + init_define_import_meta_env(); + init_dist7(); + init_dist8(); + init_dist4(); + } +}); + +// node_modules/domutils/dist/feeds.js +function getFeed(document2) { + const feedRoot = getOneElement(isValidFeed, document2); + return feedRoot ? feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot) : null; +} +function getAtomFeed(feedRoot) { + const childs = feedRoot.children; + const feed = { + type: "atom", + items: getElementsByTagName("entry", childs).map((item) => { + const { children } = item; + const entry = { media: getMediaElements(children) }; + addConditionally(entry, "id", "id", children); + addConditionally(entry, "title", "title", children); + const href2 = getOneElement("link", children)?.attribs["href"]; + if (href2) { + entry.link = href2; } - function pushToAncestorRules(rule) { - ancestorRules.push(rule); + const description = fetch2("summary", children) || fetch2("content", children); + if (description) { + entry.description = description; } - function parseError(message, isNested) { - var lines = token.substring(0, i).split("\n"); - var lineCount = lines.length; - var charCount = lines.pop().length + 1; - var error = new Error(message + " (line " + lineCount + ", char " + charCount + ")"); - error.line = lineCount; - error["char"] = charCount; - error.styleSheet = styleSheet; - error.isNested = !!isNested; - try { - throw error; - } catch (e) { - errorHandler && errorHandler(e); - } + const pubDate = fetch2("updated", children); + if (pubDate) { + entry.pubDate = new Date(pubDate); } - ; - function handleUnmatchedQuoteInSelector(nextState) { - var ruleClosingMatch2 = token.slice(i).match(forwardRuleClosingBraceRegExp); - if (ruleClosingMatch2) { - i += ruleClosingMatch2.index + ruleClosingMatch2[0].length - 1; - } - styleRule = null; - buffer = ""; - hasUnmatchedQuoteInSelector = false; - state = nextState; + return entry; + }) + }; + addConditionally(feed, "id", "id", childs); + addConditionally(feed, "title", "title", childs); + const href = getOneElement("link", childs)?.attribs["href"]; + if (href) { + feed.link = href; + } + addConditionally(feed, "description", "subtitle", childs); + const updated = fetch2("updated", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally(feed, "author", "email", childs, true); + return feed; +} +function getRssFeed(feedRoot) { + const childs = getOneElement("channel", feedRoot.children)?.children ?? []; + const feed = { + type: feedRoot.name.substr(0, 3), + id: "", + items: getElementsByTagName("item", feedRoot.children).map((item) => { + const { children } = item; + const entry = { media: getMediaElements(children) }; + addConditionally(entry, "id", "guid", children); + addConditionally(entry, "title", "title", children); + addConditionally(entry, "link", "link", children); + addConditionally(entry, "description", "description", children); + const pubDate = fetch2("pubDate", children) || fetch2("dc:date", children); + if (pubDate) + entry.pubDate = new Date(pubDate); + return entry; + }) + }; + addConditionally(feed, "title", "title", childs); + addConditionally(feed, "link", "link", childs); + addConditionally(feed, "description", "description", childs); + const updated = fetch2("lastBuildDate", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally(feed, "author", "managingEditor", childs, true); + return feed; +} +function getMediaElements(where) { + return getElementsByTagName("media:content", where).map((element) => { + const { attribs } = element; + const media = { + medium: attribs["medium"], + isDefault: !!attribs["isDefault"] + }; + for (const attrib of MEDIA_KEYS_STRING) { + if (attribs[attrib]) { + media[attrib] = attribs[attrib]; } - function isSelectorStartChar(char) { - return ".:#&*[\\".indexOf(char) !== -1; + } + for (const attrib of MEDIA_KEYS_INT) { + if (attribs[attrib]) { + media[attrib] = Number.parseInt(attribs[attrib], 10); } - function isWhitespaceChar(char) { - return " \n\r".indexOf(char) !== -1; - } - function isDigit(char) { - var code = char.charCodeAt(0); - return code >= 48 && code <= 57; + } + if (attribs["expression"]) { + media.expression = attribs["expression"]; + } + return media; + }); +} +function getOneElement(tagName, node) { + return getElementsByTagName(tagName, node, true, 1)[0]; +} +function fetch2(tagName, where, recurse = false) { + return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim(); +} +function addConditionally(object, property, tagName, where, recurse = false) { + const value = fetch2(tagName, where, recurse); + if (value) + object[property] = value; +} +function isValidFeed(value) { + return value === "rss" || value === "feed" || value === "rdf:RDF"; +} +var MEDIA_KEYS_STRING, MEDIA_KEYS_INT; +var init_feeds = __esm({ + "node_modules/domutils/dist/feeds.js"() { + init_define_import_meta_env(); + init_legacy(); + init_stringify(); + MEDIA_KEYS_STRING = ["url", "type", "lang"]; + MEDIA_KEYS_INT = [ + "fileSize", + "bitrate", + "framerate", + "samplingrate", + "channels", + "duration", + "height", + "width" + ]; + } +}); + +// node_modules/domutils/dist/helpers.js +function removeSubsets(nodes) { + let index2 = nodes.length; + while (--index2 >= 0) { + const node = nodes[index2]; + if (index2 > 0 && nodes.lastIndexOf(node, index2 - 1) >= 0) { + nodes.splice(index2, 1); + continue; + } + for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + if (nodes.includes(ancestor)) { + nodes.splice(index2, 1); + break; } - function isHexDigit(char) { - if (!char) return false; - var code = char.charCodeAt(0); - return code >= 48 && code <= 57 || // 0-9 - code >= 65 && code <= 70 || // A-F - code >= 97 && code <= 102; + } + } + return nodes; +} +function compareDocumentPosition(nodeA, nodeB) { + const aParents = []; + const bParents = []; + if (nodeA === nodeB) { + return 0; + } + let current = hasChildren(nodeA) ? nodeA : nodeA.parent; + while (current) { + aParents.unshift(current); + current = current.parent; + } + current = hasChildren(nodeB) ? nodeB : nodeB.parent; + while (current) { + bParents.unshift(current); + current = current.parent; + } + const maxIndex = Math.min(aParents.length, bParents.length); + let index2 = 0; + while (index2 < maxIndex && aParents[index2] === bParents[index2]) { + index2++; + } + if (index2 === 0) { + return DocumentPosition.DISCONNECTED; + } + const sharedParent = aParents[index2 - 1]; + const siblings = sharedParent.children; + const aSibling = aParents[index2]; + const bSibling = bParents[index2]; + if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { + if (sharedParent === nodeB) { + return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY; + } + return DocumentPosition.FOLLOWING; + } + if (sharedParent === nodeA) { + return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS; + } + return DocumentPosition.PRECEDING; +} +function uniqueSort(nodes) { + nodes = nodes.filter((node, index2, array) => !array.includes(node, index2 + 1)); + nodes.sort((a, b) => { + const relative = compareDocumentPosition(a, b); + if (relative & DocumentPosition.PRECEDING) { + return -1; + } + if (relative & DocumentPosition.FOLLOWING) { + return 1; + } + return 0; + }); + return nodes; +} +var DocumentPosition; +var init_helpers = __esm({ + "node_modules/domutils/dist/helpers.js"() { + init_define_import_meta_env(); + init_dist4(); + (function(DocumentPosition2) { + DocumentPosition2[DocumentPosition2["DISCONNECTED"] = 1] = "DISCONNECTED"; + DocumentPosition2[DocumentPosition2["PRECEDING"] = 2] = "PRECEDING"; + DocumentPosition2[DocumentPosition2["FOLLOWING"] = 4] = "FOLLOWING"; + DocumentPosition2[DocumentPosition2["CONTAINS"] = 8] = "CONTAINS"; + DocumentPosition2[DocumentPosition2["CONTAINED_BY"] = 16] = "CONTAINED_BY"; + })(DocumentPosition || (DocumentPosition = {})); + } +}); + +// node_modules/domutils/dist/manipulation.js +function removeElement(element) { + if (element.prev) + element.prev.next = element.next; + if (element.next) + element.next.prev = element.prev; + if (element.parent) { + const childs = element.parent.children; + const childsIndex = childs.lastIndexOf(element); + if (childsIndex !== -1) { + childs.splice(childsIndex, 1); + } + } + element.next = null; + element.prev = null; + element.parent = null; +} +function replaceElement(element, replacement) { + replacement.prev = element.prev; + if (replacement.prev) { + replacement.prev.next = replacement; + } + replacement.next = element.next; + if (replacement.next) { + replacement.next.prev = replacement; + } + replacement.parent = element.parent; + if (replacement.parent) { + const { children } = replacement.parent; + const elementIndex = children.lastIndexOf(element); + if (elementIndex === -1) { + return; + } + children[elementIndex] = replacement; + element.parent = null; + } +} +function appendChild(parent, child) { + removeElement(child); + child.next = null; + child.parent = parent; + if (parent.children.push(child) > 1) { + const sibling = parent.children[parent.children.length - 2]; + sibling.next = child; + child.prev = sibling; + } else { + child.prev = null; + } +} +function append(element, next) { + removeElement(next); + const { parent } = element; + const currentNext = element.next; + next.next = currentNext; + next.prev = element; + element.next = next; + next.parent = parent; + if (currentNext) { + currentNext.prev = next; + if (parent) { + const childs = parent.children; + childs.splice(childs.lastIndexOf(currentNext), 0, next); + } + } else if (parent) { + parent.children.push(next); + } +} +function prependChild(parent, child) { + removeElement(child); + child.parent = parent; + child.prev = null; + if (parent.children.unshift(child) === 1) { + child.next = null; + } else { + const sibling = parent.children[1]; + sibling.prev = child; + child.next = sibling; + } +} +function prepend(element, previous) { + removeElement(previous); + const { parent } = element; + if (parent) { + const childs = parent.children; + childs.splice(childs.indexOf(element), 0, previous); + } + if (element.prev) { + element.prev.next = previous; + } + previous.parent = parent; + previous.prev = element.prev; + previous.next = element; + element.prev = previous; +} +var init_manipulation = __esm({ + "node_modules/domutils/dist/manipulation.js"() { + init_define_import_meta_env(); + } +}); + +// node_modules/domutils/dist/traversal.js +function getChildren(element) { + return hasChildren(element) ? element.children : []; +} +function getParent(element) { + return element.parent || null; +} +function getSiblings(element) { + const parent = getParent(element); + if (parent != null) + return getChildren(parent); + const siblings = [element]; + let { prev, next } = element; + while (prev != null) { + siblings.unshift(prev); + ({ prev } = prev); + } + while (next != null) { + siblings.push(next); + ({ next } = next); + } + return siblings; +} +function getAttributeValue(element, name) { + const { attribs } = element; + return attribs?.[name]; +} +function hasAttrib(element, name) { + const { attribs } = element; + return attribs != null && Object.hasOwn(attribs, name) && attribs[name] != null; +} +function getName(element) { + return element.name; +} +function nextElementSibling(element) { + let { next } = element; + while (next !== null && !isTag2(next)) + ({ next } = next); + return next; +} +function prevElementSibling(element) { + let { prev } = element; + while (prev !== null && !isTag2(prev)) + ({ prev } = prev); + return prev; +} +var init_traversal = __esm({ + "node_modules/domutils/dist/traversal.js"() { + init_define_import_meta_env(); + init_dist4(); + } +}); + +// node_modules/domutils/dist/index.js +var dist_exports2 = {}; +__export(dist_exports2, { + DocumentPosition: () => DocumentPosition, + append: () => append, + appendChild: () => appendChild, + compareDocumentPosition: () => compareDocumentPosition, + existsOne: () => existsOne, + filter: () => filter, + find: () => find, + findAll: () => findAll, + findOne: () => findOne, + getAttributeValue: () => getAttributeValue, + getChildren: () => getChildren, + getElementById: () => getElementById, + getElements: () => getElements, + getElementsByClassName: () => getElementsByClassName, + getElementsByTagName: () => getElementsByTagName, + getElementsByTagType: () => getElementsByTagType, + getFeed: () => getFeed, + getInnerHTML: () => getInnerHTML, + getName: () => getName, + getOuterHTML: () => getOuterHTML, + getParent: () => getParent, + getSiblings: () => getSiblings, + getText: () => getText, + hasAttrib: () => hasAttrib, + innerText: () => innerText, + nextElementSibling: () => nextElementSibling, + prepend: () => prepend, + prependChild: () => prependChild, + prevElementSibling: () => prevElementSibling, + removeElement: () => removeElement, + removeSubsets: () => removeSubsets, + replaceElement: () => replaceElement, + testElement: () => testElement, + textContent: () => textContent, + uniqueSort: () => uniqueSort +}); +var init_dist9 = __esm({ + "node_modules/domutils/dist/index.js"() { + init_define_import_meta_env(); + init_feeds(); + init_helpers(); + init_legacy(); + init_manipulation(); + init_querying(); + init_stringify(); + init_traversal(); + } +}); + +// node_modules/css-select/dist/attributes.js +function escapeRegex(value) { + return value.replace(reChars, "\\$&"); +} +function shouldIgnoreCase(selector, options) { + return typeof selector.ignoreCase === "boolean" ? selector.ignoreCase : selector.ignoreCase === "quirks" ? !!options.quirksMode : !options.xmlMode && caseInsensitiveAttributes.has(selector.name); +} +var reChars, whitespaceRe, caseInsensitiveAttributes, attributeRules; +var init_attributes = __esm({ + "node_modules/css-select/dist/attributes.js"() { + init_define_import_meta_env(); + init_dist(); + reChars = /[-[\]{}()*+?.,\\^$|#\s]/g; + whitespaceRe = /\s/; + caseInsensitiveAttributes = /* @__PURE__ */ new Set([ + "accept", + "accept-charset", + "align", + "alink", + "axis", + "bgcolor", + "charset", + "checked", + "clear", + "codetype", + "color", + "compact", + "declare", + "defer", + "dir", + "direction", + "disabled", + "enctype", + "face", + "frame", + "hreflang", + "http-equiv", + "lang", + "language", + "link", + "media", + "method", + "multiple", + "nohref", + "noresize", + "noshade", + "nowrap", + "readonly", + "rel", + "rev", + "rules", + "scope", + "scrolling", + "selected", + "shape", + "target", + "text", + "type", + "valign", + "valuetype", + "vlink" + ]); + attributeRules = { + equals(next, data, options) { + const { adapter } = options; + const { name } = data; + let { value } = data; + if (shouldIgnoreCase(data, options)) { + value = value.toLowerCase(); + return (element) => { + const attribute = adapter.getAttributeValue(element, name); + return attribute != null && attribute.length === value.length && attribute.toLowerCase() === value && next(element); + }; + } + return (element) => adapter.getAttributeValue(element, name) === value && next(element); + }, + hyphen(next, data, options) { + const { adapter } = options; + const { name } = data; + let { value } = data; + const { length } = value; + if (shouldIgnoreCase(data, options)) { + value = value.toLowerCase(); + return function hyphenIC(element) { + const attribute = adapter.getAttributeValue(element, name); + return attribute != null && (attribute.length === length || attribute.charAt(length) === "-") && attribute.substr(0, length).toLowerCase() === value && next(element); + }; + } + return function hyphen(element) { + const attribute = adapter.getAttributeValue(element, name); + return attribute != null && (attribute.length === length || attribute.charAt(length) === "-") && attribute.substr(0, length) === value && next(element); + }; + }, + element(next, data, options) { + const { adapter } = options; + const { name, value } = data; + if (whitespaceRe.test(value)) { + return falseFunc; + } + const regex = new RegExp(`(?:^|\\s)${escapeRegex(value)}(?:$|\\s)`, shouldIgnoreCase(data, options) ? "i" : ""); + return function element(node) { + const attribute = adapter.getAttributeValue(node, name); + return attribute != null && attribute.length >= value.length && regex.test(attribute) && next(node); + }; + }, + exists(next, { name }, { adapter }) { + return (element) => adapter.hasAttrib(element, name) && next(element); + }, + start(next, data, options) { + const { adapter } = options; + const { name } = data; + let { value } = data; + const { length } = value; + if (length === 0) { + return falseFunc; + } + if (shouldIgnoreCase(data, options)) { + value = value.toLowerCase(); + return (element) => { + const attribute = adapter.getAttributeValue(element, name); + return attribute != null && attribute.length >= length && attribute.substr(0, length).toLowerCase() === value && next(element); + }; + } + return (element) => !!adapter.getAttributeValue(element, name)?.startsWith(value) && next(element); + }, + end(next, data, options) { + const { adapter } = options; + const { name } = data; + let { value } = data; + const length = -value.length; + if (length === 0) { + return falseFunc; + } + if (shouldIgnoreCase(data, options)) { + value = value.toLowerCase(); + return (element) => adapter.getAttributeValue(element, name)?.substr(length).toLowerCase() === value && next(element); + } + return (element) => !!adapter.getAttributeValue(element, name)?.endsWith(value) && next(element); + }, + any(next, data, options) { + const { adapter } = options; + const { name, value } = data; + if (value === "") { + return falseFunc; + } + if (shouldIgnoreCase(data, options)) { + const regex = new RegExp(escapeRegex(value), "i"); + return function anyIC(element) { + const attribute = adapter.getAttributeValue(element, name); + return attribute != null && attribute.length >= value.length && regex.test(attribute) && next(element); + }; + } + return (element) => !!adapter.getAttributeValue(element, name)?.includes(value) && next(element); + }, + not(next, data, options) { + const { adapter } = options; + const { name } = data; + let { value } = data; + if (value === "") { + return (element) => !!adapter.getAttributeValue(element, name) && next(element); + } + if (shouldIgnoreCase(data, options)) { + value = value.toLowerCase(); + return (element) => { + const attribute = adapter.getAttributeValue(element, name); + return (attribute == null || attribute.length !== value.length || attribute.toLowerCase() !== value) && next(element); + }; + } + return (element) => adapter.getAttributeValue(element, name) !== value && next(element); } - function isLetter(char) { - if (!char) return false; - var code = char.charCodeAt(0); - return code >= 65 && code <= 90 || // A-Z - code >= 97 && code <= 122; + }; + } +}); + +// node_modules/css-select/dist/helpers/querying.js +function findAll2(query, nodes, options) { + const { adapter, xmlMode = false } = options; + const result = []; + const nodeStack = [nodes]; + const indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (nodeStack.length === 1) { + return result; } - function isAlphanumeric(char) { - var code = char.charCodeAt(0); - return code >= 48 && code <= 57 || // 0-9 - code >= 65 && code <= 90 || // A-Z - code >= 97 && code <= 122; + nodeStack.shift(); + indexStack.shift(); + continue; + } + const element = nodeStack[0][indexStack[0]++]; + if (!adapter.isTag(element)) { + continue; + } + if (query(element)) { + result.push(element); + } + if (xmlMode || adapter.getName(element) !== "template") { + const children = adapter.getChildren(element); + if (children.length > 0) { + nodeStack.unshift(children); + indexStack.unshift(0); } - function getEscapeSequenceLength(str, pos) { - if (str[pos] !== "\\" || pos + 1 >= str.length) { - return 0; - } - var nextChar = str[pos + 1]; - if (isHexDigit(nextChar)) { - var hexLength = 1; - while (hexLength < 6 && pos + 1 + hexLength < str.length && isHexDigit(str[pos + 1 + hexLength])) { - hexLength++; - } - if (pos + 1 + hexLength < str.length && isWhitespaceChar(str[pos + 1 + hexLength])) { - return 1 + hexLength + 1; - } - return 1 + hexLength; - } - return 2; + } + } +} +function findOne2(query, nodes, options) { + const { adapter, xmlMode = false } = options; + const nodeStack = [nodes]; + const indexStack = [0]; + for (; ; ) { + if (indexStack[0] >= nodeStack[0].length) { + if (nodeStack.length === 1) { + return null; } - function containsUnescaped(str, char) { - for (var i2 = 0; i2 < str.length; i2++) { - if (str[i2] === "\\") { - var escapeLen2 = getEscapeSequenceLength(str, i2); - if (escapeLen2 > 0) { - i2 += escapeLen2 - 1; - continue; - } - } - if (str[i2] === char) { - return true; - } - } - return false; + nodeStack.shift(); + indexStack.shift(); + continue; + } + const element = nodeStack[0][indexStack[0]++]; + if (!adapter.isTag(element)) { + continue; + } + if (query(element)) { + return element; + } + if (xmlMode || adapter.getName(element) !== "template") { + const children = adapter.getChildren(element); + if (children.length > 0) { + nodeStack.unshift(children); + indexStack.unshift(0); } - function isInvalidConditionText(text) { - return invalidMediaOperatorWithoutSpaceRegExp.test(text) || invalidMediaNotAfterOperatorRegExp.test(text) || invalidMediaNotIdentifierRegExp.test(text) || invalidMediaNotAfterFeatureRegExp.test(text) || invalidMediaOperatorBetweenParensRegExp.test(text) || invalidMediaNotWithMediaTypeRegExp.test(text); + } + } +} +function getNextSiblings(element, adapter) { + const siblings = adapter.getSiblings(element); + if (siblings.length <= 1) { + return []; + } + const elementIndex = siblings.indexOf(element); + if (elementIndex === -1 || elementIndex === siblings.length - 1) { + return []; + } + return siblings.slice(elementIndex + 1).filter(adapter.isTag); +} +function getElementParent(node, adapter) { + const parent = adapter.getParent(node); + return parent != null && adapter.isTag(parent) ? parent : null; +} +var init_querying2 = __esm({ + "node_modules/css-select/dist/helpers/querying.js"() { + init_define_import_meta_env(); + } +}); + +// node_modules/css-select/dist/pseudo-selectors/aliases.js +var textControl, aliases; +var init_aliases = __esm({ + "node_modules/css-select/dist/pseudo-selectors/aliases.js"() { + init_define_import_meta_env(); + textControl = "input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])"; + aliases = { + // Links + "any-link": ":is(a, area, link)[href]", + link: ":any-link:not(:visited)", + // Forms + // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements + disabled: `:is( + :is(button, input, select, textarea, optgroup, option)[disabled], + optgroup[disabled] > option, + fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *) + )`, + enabled: ":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)", + checked: ":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)", + required: ":is(input, select, textarea)[required]", + optional: ":is(input, select, textarea):not([required])", + "read-only": `[readonly]:is(textarea, ${textControl})`, + "read-write": `:not([readonly]):is(textarea, ${textControl})`, + // JQuery extensions + /** + * `:selected` matches option elements that have the `selected` attribute, + * or are the first option element in a select element that does not have + * the `multiple` attribute and does not have any option elements with the + * `selected` attribute. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness + */ + selected: "option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)", + checkbox: "[type=checkbox]", + file: "[type=file]", + password: "[type=password]", + radio: "[type=radio]", + reset: "[type=reset]", + image: "[type=image]", + submit: "[type=submit]", + parent: ":not(:empty)", + header: ":is(h1, h2, h3, h4, h5, h6)", + button: ":is(button, input[type=button])", + input: ":is(input, textarea, select, button)", + text: "input:is(:not([type!='']), [type=text])" + }; + } +}); + +// node_modules/nth-check/dist/compile.js +function compile(parsed) { + const a = parsed[0]; + const b = parsed[1] - 1; + if (b < 0 && a <= 0) + return falseFunc; + if (a === -1) + return (index2) => index2 <= b; + if (a === 0) + return (index2) => index2 === b; + if (a === 1) + return b < 0 ? trueFunc : (index2) => index2 >= b; + const absA = Math.abs(a); + const bModulo = (b % absA + absA) % absA; + return a > 1 ? (index2) => index2 >= b && index2 % absA === bModulo : (index2) => index2 <= b && index2 % absA === bModulo; +} +var init_compile = __esm({ + "node_modules/nth-check/dist/compile.js"() { + init_define_import_meta_env(); + init_dist(); + } +}); + +// node_modules/nth-check/dist/parse.js +function parse2(formula) { + formula = formula.trim().toLowerCase(); + switch (formula) { + case "even": { + return [2, 0]; + } + case "odd": { + return [2, 1]; + } + } + let index2 = 0; + let a = 0; + let sign = readSign(); + let number = readNumber(); + if (index2 < formula.length && formula.charAt(index2) === "n") { + index2++; + a = sign * (number ?? 1); + skipWhitespace(); + if (index2 < formula.length) { + sign = readSign(); + skipWhitespace(); + number = readNumber(); + } else { + sign = number = 0; + } + } + if (number === null || index2 < formula.length) { + throw new Error(`n-th rule couldn't be parsed ('${formula}')`); + } + return [a, sign * number]; + function readSign() { + switch (formula.charAt(index2)) { + case "-": { + index2++; + return -1; } - function normalizeConditionText(text) { - if (isInvalidConditionText(text)) { - return "not all"; - } - var result = text; - result = result.replace(mediaFeatureColonRegExp, function(match, openParen, name2, spaces, rest) { - var beforeMatch = result.lastIndexOf(match); - var beforeParen = beforeMatch > 0 ? result.charAt(beforeMatch - 1) : ""; - if (identifierBeforeParenRegExp.test(beforeParen)) { - return match; - } - return openParen + name2 + ": " + rest; - }); - result = result.replace(mediaAndOperatorRegExp, " and "); - result = result.replace(mediaOrOperatorRegExp, " or "); - result = result.replace(mediaNotOperatorStartRegExp, "not "); - result = result.replace(mediaNotOperatorRegExp, " not "); - return result.trim(); + case "+": { + index2++; + break; } - var endingIndex = token.length - 1; - var initialEndingIndex = endingIndex; - for (var character; character = token.charAt(i); i++) { - if (i === endingIndex) { - switch (state) { - case "importRule": - case "namespaceRule": - case "layerBlock": - if (character !== ";") { - token += ";"; - endingIndex += 1; - } - break; - case "value": - if (character !== "}") { - if (character === ";") { - token += "}"; - } else { - token += ";"; - } - endingIndex += 1; - break; - } - case "name": - case "before-name": - if (character === "}") { - token += " "; - } else { - token += "}"; - } - endingIndex += 1; - break; - case "before-selector": - if (character !== "}" && currentScope !== styleSheet) { - token += "}"; - endingIndex += 1; - break; + } + return 1; + } + function readNumber() { + const start = index2; + let value = 0; + while (index2 < formula.length && formula.charCodeAt(index2) >= ZERO && formula.charCodeAt(index2) <= NINE) { + value = value * 10 + (formula.charCodeAt(index2) - ZERO); + index2++; + } + return index2 === start ? null : value; + } + function skipWhitespace() { + while (index2 < formula.length && whitespace.has(formula.charCodeAt(index2))) { + index2++; + } + } +} +var whitespace, ZERO, NINE; +var init_parse2 = __esm({ + "node_modules/nth-check/dist/parse.js"() { + init_define_import_meta_env(); + whitespace = /* @__PURE__ */ new Set([9, 10, 12, 13, 32]); + ZERO = "0".charCodeAt(0); + NINE = "9".charCodeAt(0); + } +}); + +// node_modules/nth-check/dist/index.js +function nthCheck(formula) { + return compile(parse2(formula)); +} +var init_dist10 = __esm({ + "node_modules/nth-check/dist/index.js"() { + init_define_import_meta_env(); + init_compile(); + init_parse2(); + } +}); + +// node_modules/css-select/dist/helpers/cache.js +function cacheParentResults(next, { adapter, cacheResults }, matches) { + if (cacheResults === false || typeof WeakMap === "undefined") { + return (element) => next(element) && matches(element); + } + const resultCache = /* @__PURE__ */ new WeakMap(); + function addResultToCache(element) { + const result = matches(element); + resultCache.set(element, result); + return result; + } + return function cachedMatcher(element) { + if (!next(element)) { + return false; + } + if (resultCache.has(element)) { + return resultCache.get(element) ?? false; + } + let node = element; + do { + const parent = getElementParent(node, adapter); + if (parent === null) { + return addResultToCache(element); + } + node = parent; + } while (!resultCache.has(node)); + return resultCache.get(node) ? addResultToCache(element) : false; + }; +} +var init_cache = __esm({ + "node_modules/css-select/dist/helpers/cache.js"() { + init_define_import_meta_env(); + init_querying2(); + } +}); + +// node_modules/css-select/dist/helpers/options.js +function copyOptions(options) { + const { context: _, rootFunc: __, ...copied } = options; + return copied; +} +var init_options = __esm({ + "node_modules/css-select/dist/helpers/options.js"() { + init_define_import_meta_env(); + } +}); + +// node_modules/css-select/dist/pseudo-selectors/filters.js +function extendedFilter(tag, range) { + if (range[0] !== "*" && range[0] !== tag[0]) + return false; + let tagIndex = 1; + for (let rangeIndex = 1; rangeIndex < range.length; rangeIndex++) { + if (range[rangeIndex] === "*") + continue; + while (tagIndex < tag.length && tag[tagIndex] !== range[rangeIndex]) { + if (tag[tagIndex++].length <= 1) + return false; + } + if (tagIndex >= tag.length) + return false; + tagIndex++; + } + return true; +} +function compileNth(reverse, ofType) { + return function nth(next, rule, options, context2, compileToken2) { + const { adapter, equals } = options; + const ofMatch = ofType ? null : rule.match(nthOfRegex); + const nthCheck2 = nthCheck(ofMatch ? ofMatch[1].trim() : rule); + if (nthCheck2 === falseFunc) + return falseFunc; + const ofSelector = ofMatch && compileToken2 ? compileToken2(parse(ofMatch[2].trim()), copyOptions(options), context2) : void 0; + if (ofSelector === falseFunc) + return falseFunc; + if (nthCheck2 === trueFunc && !ofSelector) { + return (element) => getElementParent(element, adapter) !== null && next(element); + } + const shouldCount = ofSelector ? (_element, sibling) => ofSelector(sibling) : ofType ? (element, sibling) => adapter.getName(sibling) === adapter.getName(element) : trueFunc; + if (reverse) { + return function nthLast(element) { + if (ofSelector && !ofSelector(element)) + return false; + const siblings = adapter.getSiblings(element); + let pos = 0; + for (let index2 = siblings.length - 1; index2 >= 0; index2--) { + const sibling = siblings[index2]; + if (equals(element, sibling)) + break; + if (adapter.isTag(sibling) && shouldCount(element, sibling)) + pos++; + } + return nthCheck2(pos) && next(element); + }; + } + return function nth2(element) { + if (ofSelector && !ofSelector(element)) + return false; + const siblings = adapter.getSiblings(element); + let pos = 0; + for (const sibling of siblings) { + if (equals(element, sibling)) + break; + if (adapter.isTag(sibling) && shouldCount(element, sibling)) + pos++; + } + return nthCheck2(pos) && next(element); + }; + }; +} +function dynamicStatePseudo(name) { + return function dynamicPseudo(next, _rule, { adapter }) { + const filterFunction = adapter[name]; + if (typeof filterFunction !== "function") { + return falseFunc; + } + return function active(element) { + return filterFunction(element) && next(element); + }; + }; +} +var nthOfRegex, filters; +var init_filters = __esm({ + "node_modules/css-select/dist/pseudo-selectors/filters.js"() { + init_define_import_meta_env(); + init_dist(); + init_dist2(); + init_dist10(); + init_cache(); + init_options(); + init_querying2(); + nthOfRegex = /^(.+?)\s+of\s+(.+)$/is; + filters = { + contains(next, text, options) { + const { getText: getText2 } = options.adapter; + return cacheParentResults(next, options, (element) => getText2(element).includes(text)); + }, + icontains(next, text, options) { + const itext = text.toLowerCase(); + const { getText: getText2 } = options.adapter; + return cacheParentResults(next, options, (element) => getText2(element).toLowerCase().includes(itext)); + }, + // Location specific methods + "nth-child": compileNth(false, false), + "nth-last-child": compileNth(true, false), + "nth-of-type": compileNth(false, true), + "nth-last-of-type": compileNth(true, true), + // TODO determine the actual root element + root(next, _rule, { adapter }) { + return (element) => getElementParent(element, adapter) === null && next(element); + }, + scope(next, rule, options, context2) { + const { equals } = options; + if (!context2 || context2.length === 0) { + return filters["root"](next, rule, options); + } + if (context2.length === 1) { + return (element) => equals(context2[0], element) && next(element); + } + return (element) => context2.includes(element) && next(element); + }, + lang(next, code, { adapter }) { + const ranges = code.split(",").map((r) => r.trim()).filter((r) => r.length > 0).map((r) => r.replace(/^['"]|['"]$/g, "").toLowerCase().split("-")); + return function lang(element) { + let node = element; + while (node != null) { + const value = adapter.getAttributeValue(node, "xml:lang") ?? adapter.getAttributeValue(node, "lang"); + if (value != null) { + if (!value) { + return ranges.some((r) => r[0] === "") && next(element); } + const tag = value.toLowerCase().split("-"); + return ranges.some((r) => extendedFilter(tag, r)) && next(element); + } + const parent = adapter.getParent(node); + node = parent != null && adapter.isTag(parent) ? parent : null; } + return ranges.some((r) => r[0] === "") && next(element); + }; + }, + hover: dynamicStatePseudo("isHovered"), + visited: dynamicStatePseudo("isVisited"), + active: dynamicStatePseudo("isActive") + }; + } +}); + +// node_modules/css-select/dist/pseudo-selectors/pseudos.js +function verifyPseudoArguments(pseudoClassCondition, name, subselect, argumentIndex) { + if (subselect === null) { + if (pseudoClassCondition.length > argumentIndex) { + throw new Error(`Pseudo-class :${name} requires an argument`); + } + } else if (pseudoClassCondition.length === argumentIndex) { + throw new Error(`Pseudo-class :${name} doesn't have any arguments`); + } +} +var isDocumentWhiteSpace, pseudos; +var init_pseudos = __esm({ + "node_modules/css-select/dist/pseudo-selectors/pseudos.js"() { + init_define_import_meta_env(); + isDocumentWhiteSpace = /^[ \t\r\n]*$/; + pseudos = { + empty(element, { adapter }) { + const children = adapter.getChildren(element); + return ( + // First, make sure the tag does not have any element children. + children.every((element2) => !adapter.isTag(element2)) && // Then, check that the text content is only whitespace. + children.every((element2) => ( + // FIXME: `getText` call is potentially expensive. + isDocumentWhiteSpace.test(adapter.getText(element2)) + )) + ); + }, + "first-child"(element, { adapter, equals }) { + if (adapter.prevElementSibling) { + return adapter.prevElementSibling(element) == null; } - if (character === "\\" && i + 1 < token.length) { - var escapeLen = getEscapeSequenceLength(token, i); - if (escapeLen > 0) { - buffer += token.substr(i, escapeLen); - i += escapeLen - 1; - continue; + const firstChild = adapter.getSiblings(element).find((sibling) => adapter.isTag(sibling)); + return firstChild != null && equals(element, firstChild); + }, + "last-child"(element, { adapter, equals }) { + const siblings = adapter.getSiblings(element); + for (let index2 = siblings.length - 1; index2 >= 0; index2--) { + if (equals(element, siblings[index2])) { + return true; } - } - switch (character) { - case " ": - case " ": - case "\r": - case "\n": - case "\f": - if (SIGNIFICANT_WHITESPACE[state]) { - buffer += character; - } + if (adapter.isTag(siblings[index2])) { break; - // String - case '"': - index2 = i + 1; - do { - index2 = token.indexOf('"', index2) + 1; - if (!index2) { - parseError('Unmatched "'); - if (state === "selector" || state === "atRule") { - hasUnmatchedQuoteInSelector = true; - } - } - } while (token[index2 - 2] === "\\"); - if (index2 === 0) { - break; - } - buffer += token.slice(i, index2); - i = index2 - 1; - switch (state) { - case "before-value": - state = "value"; - break; - case "importRule-begin": - state = "importRule"; - if (i === endingIndex) { - token += ";"; - } - break; - case "namespaceRule-begin": - state = "namespaceRule"; - if (i === endingIndex) { - token += ";"; - } - break; - } + } + } + return false; + }, + "first-of-type"(element, { adapter, equals }) { + const siblings = adapter.getSiblings(element); + const elementName = adapter.getName(element); + for (const currentSibling of siblings) { + if (equals(element, currentSibling)) { + return true; + } + if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elementName) { break; - case "'": - index2 = i + 1; - do { - index2 = token.indexOf("'", index2) + 1; - if (!index2) { - parseError("Unmatched '"); - if (state === "selector" || state === "atRule") { - hasUnmatchedQuoteInSelector = true; - } - } - } while (token[index2 - 2] === "\\"); - if (index2 === 0) { - break; - } - buffer += token.slice(i, index2); - i = index2 - 1; - switch (state) { - case "before-value": - state = "value"; - break; - case "importRule-begin": - state = "importRule"; - break; - case "namespaceRule-begin": - state = "namespaceRule"; - break; - } + } + } + return false; + }, + "last-of-type"(element, { adapter, equals }) { + const siblings = adapter.getSiblings(element); + const elementName = adapter.getName(element); + for (let index2 = siblings.length - 1; index2 >= 0; index2--) { + const currentSibling = siblings[index2]; + if (equals(element, currentSibling)) { + return true; + } + if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elementName) { break; - // Comment - case "/": - if (token.charAt(i + 1) === "*") { - i += 2; - index2 = token.indexOf("*/", i); - if (index2 === -1) { - i = token.length - 1; - buffer = ""; - } else { - i = index2 + 1; - } - } else { - buffer += character; + } + } + return false; + }, + "only-of-type"(element, { adapter, equals }) { + const elementName = adapter.getName(element); + return adapter.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter.isTag(sibling) || adapter.getName(sibling) !== elementName); + }, + "only-child"(element, { adapter, equals }) { + return adapter.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter.isTag(sibling)); + } + }; + } +}); + +// node_modules/css-select/dist/helpers/selectors.js +function isTraversal2(token) { + return token.type === "_flexibleDescendant" || isTraversal(token); +} +function sortRules(array) { + const ratings = array.map(getQuality); + for (let index2 = 1; index2 < array.length; index2++) { + const procNew = ratings[index2]; + if (procNew < 0) { + continue; + } + for (let currentIndex = index2; currentIndex > 0 && procNew < ratings[currentIndex - 1]; currentIndex--) { + const token = array[currentIndex]; + array[currentIndex] = array[currentIndex - 1]; + array[currentIndex - 1] = token; + ratings[currentIndex] = ratings[currentIndex - 1]; + ratings[currentIndex - 1] = procNew; + } + } +} +function getAttributeQuality(token) { + switch (token.action) { + case AttributeAction.Exists: { + return 10; + } + case AttributeAction.Equals: { + return token.name === "id" ? 9 : 8; + } + case AttributeAction.Not: { + return 7; + } + case AttributeAction.Start: { + return 6; + } + case AttributeAction.End: { + return 6; + } + case AttributeAction.Any: { + return 5; + } + case AttributeAction.Hyphen: { + return 4; + } + case AttributeAction.Element: { + return 3; + } + } +} +function getQuality(token) { + switch (token.type) { + case SelectorType.Universal: { + return 50; + } + case SelectorType.Tag: { + return 30; + } + case SelectorType.Attribute: { + return Math.floor(getAttributeQuality(token) / // `ignoreCase` adds some overhead, half the result if applicable. + (token.ignoreCase ? 2 : 1)); + } + case SelectorType.Pseudo: { + return token.data ? token.name === "has" || token.name === "contains" || token.name === "icontains" ? ( + // Expensive in any case — run as late as possible. + 0 + ) : Array.isArray(token.data) ? ( + // Eg. `:is`, `:not` + Math.max( + // If we have traversals, try to avoid executing this selector + 0, + Math.min(...token.data.map((d) => Math.min(...d.map(getQuality)))) + ) + ) : 2 : 3; + } + default: { + return -1; + } + } +} +function includesScopePseudo(t) { + return t.type === SelectorType.Pseudo && (t.name === "scope" || Array.isArray(t.data) && t.data.some((data) => data.some(includesScopePseudo))); +} +var init_selectors = __esm({ + "node_modules/css-select/dist/helpers/selectors.js"() { + init_define_import_meta_env(); + init_dist2(); + } +}); + +// node_modules/css-select/dist/pseudo-selectors/subselects.js +function hasDependsOnCurrentElement(selector) { + return selector.some((sel) => sel.length > 0 && (isTraversal2(sel[0]) || sel.some(includesScopePseudo))); +} +var PLACEHOLDER_ELEMENT, is, subselects; +var init_subselects = __esm({ + "node_modules/css-select/dist/pseudo-selectors/subselects.js"() { + init_define_import_meta_env(); + init_dist(); + init_cache(); + init_options(); + init_querying2(); + init_selectors(); + PLACEHOLDER_ELEMENT = {}; + is = (next, token, options, context2, compileToken2) => { + const compiledToken = compileToken2(token, copyOptions(options), context2); + return compiledToken === trueFunc ? next : compiledToken === falseFunc ? falseFunc : (element) => compiledToken(element) && next(element); + }; + subselects = { + is, + /** + * `:matches` and `:where` are aliases for `:is`. + */ + matches: is, + where: is, + not(next, token, options, context2, compileToken2) { + const compiledToken = compileToken2(token, copyOptions(options), context2); + return compiledToken === falseFunc ? next : compiledToken === trueFunc ? falseFunc : (element) => !compiledToken(element) && next(element); + }, + has(next, subselect, options, _context, compileToken2) { + const { adapter } = options; + const copiedOptions = copyOptions(options); + copiedOptions.relativeSelector = true; + const context2 = subselect.some((s) => s.some(isTraversal2)) ? ( + // Used as a placeholder. Will be replaced with the actual element. + [PLACEHOLDER_ELEMENT] + ) : void 0; + const skipCache = hasDependsOnCurrentElement(subselect); + const compiled = compileToken2(subselect, copiedOptions, context2); + if (compiled === falseFunc) { + return falseFunc; + } + if (context2 && compiled !== trueFunc) { + return skipCache ? (element) => { + if (!next(element)) { + return false; } - if (state === "importRule-begin") { - buffer += " "; - state = "importRule"; + context2[0] = element; + const childs = adapter.getChildren(element); + return findOne2(compiled, compiled.shouldTestNextSiblings ? [ + ...childs, + ...getNextSiblings(element, adapter) + ] : childs, options) !== null; + } : cacheParentResults(next, options, (element) => { + context2[0] = element; + return findOne2(compiled, adapter.getChildren(element), options) !== null; + }); + } + const hasOne = (element) => findOne2(compiled, adapter.getChildren(element), options) !== null; + return skipCache ? (element) => next(element) && hasOne(element) : cacheParentResults(next, options, hasOne); + } + }; + } +}); + +// node_modules/css-select/dist/pseudo-selectors/index.js +function compilePseudoSelector(next, selector, options, context2, compileToken2) { + const { name, data } = selector; + if (Array.isArray(data)) { + if (!(name in subselects)) { + throw new Error(`Unknown pseudo-class :${name}(${data})`); + } + return subselects[name](next, data, options, context2, compileToken2); + } + const userPseudo = options.pseudos?.[name]; + const stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases[name]; + if (typeof stringPseudo === "string") { + if (data != null) { + throw new Error(`Pseudo ${name} doesn't have any arguments`); + } + const alias = parse(stringPseudo); + return subselects["is"](next, alias, options, context2, compileToken2); + } + if (typeof userPseudo === "function") { + verifyPseudoArguments(userPseudo, name, data, 1); + return (element) => userPseudo(element, data) && next(element); + } + if (name in filters) { + return filters[name](next, data, options, context2, compileToken2); + } + if (name in pseudos) { + const pseudo = pseudos[name]; + verifyPseudoArguments(pseudo, name, data, 2); + return (element) => pseudo(element, options, data) && next(element); + } + throw new Error(`Unknown pseudo-class :${name}`); +} +var init_pseudo_selectors = __esm({ + "node_modules/css-select/dist/pseudo-selectors/index.js"() { + init_define_import_meta_env(); + init_dist2(); + init_aliases(); + init_filters(); + init_pseudos(); + init_subselects(); + } +}); + +// node_modules/css-select/dist/general.js +function compileGeneralSelector(next, selector, options, context2, compileToken2, hasExpensiveSubselector) { + const { adapter, equals, cacheResults } = options; + switch (selector.type) { + case SelectorType.PseudoElement: { + throw new Error("Pseudo-elements are not supported by css-select"); + } + case SelectorType.ColumnCombinator: { + throw new Error("Column combinators are not yet supported by css-select"); + } + case SelectorType.Attribute: { + if (selector.namespace != null) { + throw new Error("Namespaced attributes are not yet supported by css-select"); + } + if (!options.xmlMode || options.lowerCaseAttributeNames) { + selector.name = selector.name.toLowerCase(); + } + return attributeRules[selector.action](next, selector, options); + } + case SelectorType.Pseudo: { + return compilePseudoSelector(next, selector, options, context2, compileToken2); + } + // Tags + case SelectorType.Tag: { + if (selector.namespace != null) { + throw new Error("Namespaced tag names are not yet supported by css-select"); + } + let { name } = selector; + if (!options.xmlMode || options.lowerCaseTags) { + name = name.toLowerCase(); + } + return function tag(element) { + return adapter.getName(element) === name && next(element); + }; + } + // Traversal + case SelectorType.Descendant: { + if (!hasExpensiveSubselector || cacheResults === false || typeof WeakMap === "undefined") { + return function descendant(element) { + let current = element; + while (current = getElementParent(current, adapter)) { + if (next(current)) { + return true; } - if (state === "namespaceRule-begin") { - buffer += " "; - state = "namespaceRule"; + } + return false; + }; + } + const resultCache = /* @__PURE__ */ new WeakMap(); + return function cachedDescendant(element) { + let current = element; + let result; + while (current = getElementParent(current, adapter)) { + const cached = resultCache.get(current); + if (cached === void 0) { + result ??= { matches: false }; + result.matches = next(current); + resultCache.set(current, result); + if (result.matches) { + return true; } - break; - // At-rule - case "@": - if (nestedSelectorRule) { - if (styleRule && styleRule.constructor.name === "CSSNestedDeclarations") { - currentScope.cssRules.push(styleRule); - } - if (styleRule !== nestedSelectorRule && nestedSelectorRule.parentRule && nestedSelectorRule.parentRule.constructor.name === "CSSStyleRule") { - styleRule = nestedSelectorRule.parentRule; - } + } else { + if (result) { + result.matches = cached.matches; } - if (token.indexOf("@-moz-document", i) === i) { - validateAtRule("@-moz-document", function() { - state = "documentRule-begin"; - documentRule = new CSSOM2.CSSDocumentRule(); - documentRule.__starts = i; - i += "-moz-document".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@media", i) === i) { - validateAtRule("@media", function() { - state = "atBlock"; - mediaRule = new CSSOM2.CSSMediaRule(); - mediaRule.__starts = i; - i += "media".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@container", i) === i) { - validateAtRule("@container", function() { - state = "containerBlock"; - containerRule = new CSSOM2.CSSContainerRule(); - containerRule.__starts = i; - i += "container".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@counter-style", i) === i) { - buffer = ""; - var cannotBeNested = !canAtRuleBeNested(); - validateAtRule("@counter-style", function() { - state = "counterStyleBlock"; - counterStyleRule = new CSSOM2.CSSCounterStyleRule(); - counterStyleRule.__starts = i; - i += "counter-style".length; - }, cannotBeNested); - break; - } else if (token.indexOf("@property", i) === i) { - buffer = ""; - var cannotBeNested = !canAtRuleBeNested(); - validateAtRule("@property", function() { - state = "propertyBlock"; - propertyRule = new CSSOM2.CSSPropertyRule(); - propertyRule.__starts = i; - i += "property".length; - }, cannotBeNested); - break; - } else if (token.indexOf("@scope", i) === i) { - validateAtRule("@scope", function() { - state = "scopeBlock"; - scopeRule = new CSSOM2.CSSScopeRule(); - scopeRule.__starts = i; - i += "scope".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@layer", i) === i) { - validateAtRule("@layer", function() { - state = "layerBlock"; - layerBlockRule = new CSSOM2.CSSLayerBlockRule(); - layerBlockRule.__starts = i; - i += "layer".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@page", i) === i) { - validateAtRule("@page", function() { - state = "pageBlock"; - pageRule = new CSSOM2.CSSPageRule(); - pageRule.__starts = i; - i += "page".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@supports", i) === i) { - validateAtRule("@supports", function() { - state = "conditionBlock"; - supportsRule = new CSSOM2.CSSSupportsRule(); - supportsRule.__starts = i; - i += "supports".length; - }); - buffer = ""; - break; - } else if (token.indexOf("@host", i) === i) { - validateAtRule("@host", function() { - state = "hostRule-begin"; - i += "host".length; - hostRule = new CSSOM2.CSSHostRule(); - hostRule.__starts = i; - }); - buffer = ""; - break; - } else if (token.indexOf("@starting-style", i) === i) { - validateAtRule("@starting-style", function() { - state = "startingStyleRule-begin"; - i += "starting-style".length; - startingStyleRule = new CSSOM2.CSSStartingStyleRule(); - startingStyleRule.__starts = i; - }); - buffer = ""; - break; - } else if (token.indexOf("@import", i) === i) { - buffer = ""; - validateAtRule("@import", function() { - state = "importRule-begin"; - i += "import".length; - buffer += "@import"; - }, true); - break; - } else if (token.indexOf("@namespace", i) === i) { - buffer = ""; - validateAtRule("@namespace", function() { - state = "namespaceRule-begin"; - i += "namespace".length; - buffer += "@namespace"; - }, true); - break; - } else if (token.indexOf("@font-face", i) === i) { - buffer = ""; - var cannotBeNested = !canAtRuleBeNested(); - validateAtRule("@font-face", function() { - state = "fontFaceRule-begin"; - i += "font-face".length; - fontFaceRule = new CSSOM2.CSSFontFaceRule(); - fontFaceRule.__starts = i; - }, cannotBeNested); - break; - } else { - atKeyframesRegExp.lastIndex = i; - var matchKeyframes = atKeyframesRegExp.exec(token); - if (matchKeyframes && matchKeyframes.index === i) { - state = "keyframesRule-begin"; - keyframesRule = new CSSOM2.CSSKeyframesRule(); - keyframesRule.__starts = i; - keyframesRule._vendorPrefix = matchKeyframes[1]; - i += matchKeyframes[0].length - 1; - buffer = ""; - break; - } else if (state === "selector") { - state = "atRule"; - } + return cached.matches; + } + } + return false; + }; + } + case "_flexibleDescendant": { + return function flexibleDescendant(element) { + let current = element; + do { + if (next(current)) { + return true; + } + current = getElementParent(current, adapter); + } while (current); + return false; + }; + } + case SelectorType.Parent: { + return function parent(element) { + return adapter.getChildren(element).some((element2) => adapter.isTag(element2) && next(element2)); + }; + } + case SelectorType.Child: { + return function child(element) { + const parent = getElementParent(element, adapter); + return parent !== null && next(parent); + }; + } + case SelectorType.Sibling: { + return function sibling(element) { + const siblings = adapter.getSiblings(element); + for (const currentSibling of siblings) { + if (equals(element, currentSibling)) { + break; + } + if (adapter.isTag(currentSibling) && next(currentSibling)) { + return true; + } + } + return false; + }; + } + case SelectorType.Adjacent: { + if (adapter.prevElementSibling) { + return function adjacent(element) { + const previous = adapter.prevElementSibling(element); + return previous != null && next(previous); + }; + } + return function adjacent(element) { + const siblings = adapter.getSiblings(element); + let lastElement; + for (const currentSibling of siblings) { + if (equals(element, currentSibling)) { + break; + } + if (adapter.isTag(currentSibling)) { + lastElement = currentSibling; + } + } + return !!lastElement && next(lastElement); + }; + } + case SelectorType.Universal: { + if (selector.namespace != null && selector.namespace !== "*") { + throw new Error("Namespaced universal selectors are not yet supported by css-select"); + } + return next; + } + } +} +var init_general = __esm({ + "node_modules/css-select/dist/general.js"() { + init_define_import_meta_env(); + init_dist2(); + init_attributes(); + init_querying2(); + init_pseudo_selectors(); + } +}); + +// node_modules/css-select/dist/compile.js +function absolutize(token, { adapter }, context2) { + const hasContext = !!context2?.every((element) => element === PLACEHOLDER_ELEMENT || adapter.isTag(element) && getElementParent(element, adapter) !== null); + for (const t of token) { + if (t.length > 0 && isTraversal2(t[0]) && t[0].type !== SelectorType.Descendant) { + } else if (hasContext && !t.some(includesScopePseudo)) { + t.unshift(DESCENDANT_TOKEN); + } else { + continue; + } + t.unshift(SCOPE_TOKEN); + } +} +function compileToken(token, options, compilationContext) { + for (const rules of token) { + sortRules(rules); + } + const { context: context2 = compilationContext, rootFunc: rootFunction = trueFunc } = options; + const isArrayContext = Array.isArray(context2); + const finalContext = context2 && (Array.isArray(context2) ? context2 : [context2]); + if (options.relativeSelector !== false) { + absolutize(token, options, finalContext); + } else if (token.some((t) => t.length > 0 && isTraversal2(t[0]))) { + throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled"); + } + let shouldTestNextSiblings = false; + let query = falseFunc; + combineLoop: for (const rules of token) { + if (rules.length >= 2) { + const [first, second] = rules; + if (first.type !== SelectorType.Pseudo || first.name !== "scope") { + } else if (isArrayContext && second.type === SelectorType.Descendant) { + rules[1] = FLEXIBLE_DESCENDANT_TOKEN; + } else if (second.type === SelectorType.Adjacent || second.type === SelectorType.Sibling) { + shouldTestNextSiblings = true; + } + } + let next = rootFunction; + let hasExpensiveSubselector = false; + for (const rule of rules) { + next = compileGeneralSelector(next, rule, options, finalContext, compileToken, hasExpensiveSubselector); + const quality = getQuality(rule); + if (quality === 0) { + hasExpensiveSubselector = true; + } + if (next === falseFunc) { + continue combineLoop; + } + } + if (next === rootFunction) { + return rootFunction; + } + query = query === falseFunc ? next : or(query, next); + } + query.shouldTestNextSiblings = shouldTestNextSiblings; + return query; +} +function or(a, b) { + return (element) => a(element) || b(element); +} +var DESCENDANT_TOKEN, FLEXIBLE_DESCENDANT_TOKEN, SCOPE_TOKEN; +var init_compile2 = __esm({ + "node_modules/css-select/dist/compile.js"() { + init_define_import_meta_env(); + init_dist(); + init_dist2(); + init_general(); + init_querying2(); + init_selectors(); + init_subselects(); + DESCENDANT_TOKEN = { type: SelectorType.Descendant }; + FLEXIBLE_DESCENDANT_TOKEN = { + type: "_flexibleDescendant" + }; + SCOPE_TOKEN = { + type: SelectorType.Pseudo, + name: "scope", + data: null + }; + } +}); + +// node_modules/css-select/dist/index.js +var dist_exports4 = {}; +__export(dist_exports4, { + _compileUnsafe: () => _compileUnsafe, + compile: () => compile2, + default: () => dist_default2, + is: () => is2, + prepareContext: () => prepareContext, + selectAll: () => selectAll, + selectOne: () => selectOne +}); +function convertOptionFormats(options) { + const finalOptions = options ?? defaultOptions; + finalOptions.adapter ??= defaultOptions.adapter; + finalOptions.equals ??= finalOptions.adapter?.equals ?? defaultEquals; + return finalOptions; +} +function compile2(selector, options, context2) { + const convertedOptions = convertOptionFormats(options); + const next = _compileUnsafe(selector, convertedOptions, context2); + return next === falseFunc ? falseFunc : (element) => convertedOptions.adapter.isTag(element) && next(element); +} +function _compileUnsafe(selector, options, context2) { + return compileToken(typeof selector === "string" ? parse(selector) : selector, convertOptionFormats(options), context2); +} +function getSelectorFunction(searchFunction) { + return function select(query, elements, options) { + const convertedOptions = convertOptionFormats(options); + if (typeof query !== "function") { + query = _compileUnsafe(query, convertedOptions, elements); + } + const filteredElements = prepareContext(elements, convertedOptions.adapter, query.shouldTestNextSiblings); + return searchFunction(query, filteredElements, convertedOptions); + }; +} +function prepareContext(elements, adapter, shouldTestNextSiblings = false) { + if (shouldTestNextSiblings) { + elements = appendNextSiblings(elements, adapter); + } + return Array.isArray(elements) ? adapter.removeSubsets(elements) : adapter.getChildren(elements); +} +function appendNextSiblings(element, adapter) { + const elements = Array.isArray(element) ? [...element] : [element]; + const elementsLength = elements.length; + for (let index2 = 0; index2 < elementsLength; index2++) { + const nextSiblings = getNextSiblings(elements[index2], adapter); + elements.push(...nextSiblings); + } + return elements; +} +function is2(element, query, options) { + return (typeof query === "function" ? query : compile2(query, options))(element); +} +var defaultEquals, defaultOptions, selectAll, selectOne, dist_default2; +var init_dist11 = __esm({ + "node_modules/css-select/dist/index.js"() { + init_define_import_meta_env(); + init_dist(); + init_dist2(); + init_dist4(); + init_dist9(); + init_compile2(); + init_querying2(); + defaultEquals = (a, b) => a === b; + defaultOptions = { + adapter: { ...dist_exports2, isTag: isTag2 }, + equals: defaultEquals + }; + selectAll = getSelectorFunction((query, elements, options) => query === falseFunc || !elements || elements.length === 0 ? [] : findAll2(query, elements, options)); + selectOne = getSelectorFunction((query, elements, options) => query === falseFunc || !elements || elements.length === 0 ? null : findOne2(query, elements, options)); + dist_default2 = selectAll; + } +}); + +// node_modules/linkedom/cjs/shared/matches.js +var require_matches = __commonJS({ + "node_modules/linkedom/cjs/shared/matches.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var CSSselect = (init_dist11(), __toCommonJS(dist_exports4)); + var { ELEMENT_NODE, TEXT_NODE } = require_constants(); + var { ignoreCase } = require_utils4(); + var { isArray } = Array; + var isTag3 = ({ nodeType }) => nodeType === ELEMENT_NODE; + var existsOne2 = (test, elements) => elements.some( + (element) => isTag3(element) && (test(element) || existsOne2(test, getChildren2(element))) + ); + var getAttributeValue2 = (element, name) => name === "class" ? element.getAttributeNode("class")?.value ?? null : element.getAttribute(name); + var getChildren2 = ({ childNodes }) => childNodes; + var getName2 = (element) => { + const { localName } = element; + return ignoreCase(element) ? localName.toLowerCase() : localName; + }; + var getParent2 = ({ parentNode }) => parentNode; + var getSiblings2 = (element) => { + const { parentNode } = element; + return parentNode ? getChildren2(parentNode) : element; + }; + var getText2 = (node) => { + if (isArray(node)) + return node.map(getText2).join(""); + if (isTag3(node)) + return getText2(getChildren2(node)); + if (node.nodeType === TEXT_NODE) + return node.data; + return ""; + }; + var hasAttrib2 = (element, name) => element.hasAttribute(name); + var removeSubsets2 = (nodes) => { + let { length } = nodes; + while (length--) { + const node = nodes[length]; + if (length && -1 < nodes.lastIndexOf(node, length - 1)) { + nodes.splice(length, 1); + continue; + } + for (let { parentNode } = node; parentNode; parentNode = parentNode.parentNode) { + if (nodes.includes(parentNode)) { + nodes.splice(length, 1); + break; + } + } + } + return nodes; + }; + var findAll3 = (test, nodes) => { + const matches2 = []; + for (const node of nodes) { + if (isTag3(node)) { + if (test(node)) + matches2.push(node); + matches2.push(...findAll3(test, getChildren2(node))); + } + } + return matches2; + }; + var findOne3 = (test, nodes) => { + for (let node of nodes) + if (test(node) || (node = findOne3(test, getChildren2(node)))) + return node; + return null; + }; + var adapter = { + isTag: isTag3, + existsOne: existsOne2, + getAttributeValue: getAttributeValue2, + getChildren: getChildren2, + getName: getName2, + getParent: getParent2, + getSiblings: getSiblings2, + getText: getText2, + hasAttrib: hasAttrib2, + removeSubsets: removeSubsets2, + findAll: findAll3, + findOne: findOne3 + }; + var prepareMatch = (element, selectors) => CSSselect.compile( + selectors, + { + context: selectors.includes(":scope") ? element : void 0, + xmlMode: !ignoreCase(element), + adapter + } + ); + exports2.prepareMatch = prepareMatch; + var matches = (element, selectors) => CSSselect.is( + element, + selectors, + { + strict: true, + context: selectors.includes(":scope") ? element : void 0, + xmlMode: !ignoreCase(element), + adapter + } + ); + exports2.matches = matches; + } +}); + +// node_modules/linkedom/cjs/interface/text.js +var require_text2 = __commonJS({ + "node_modules/linkedom/cjs/interface/text.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { TEXT_NODE } = require_constants(); + var { VALUE } = require_symbols(); + var { escape: escape3 } = require_text_escaper(); + var { CharacterData } = require_character_data(); + var Text4 = class _Text extends CharacterData { + constructor(ownerDocument, data = "") { + super(ownerDocument, "#text", TEXT_NODE, data); + } + get wholeText() { + const text = []; + let { previousSibling, nextSibling } = this; + while (previousSibling) { + if (previousSibling.nodeType === TEXT_NODE) + text.unshift(previousSibling[VALUE]); + else + break; + previousSibling = previousSibling.previousSibling; + } + text.push(this[VALUE]); + while (nextSibling) { + if (nextSibling.nodeType === TEXT_NODE) + text.push(nextSibling[VALUE]); + else + break; + nextSibling = nextSibling.nextSibling; + } + return text.join(""); + } + cloneNode() { + const { ownerDocument, [VALUE]: data } = this; + return new _Text(ownerDocument, data); + } + toString() { + return escape3(this[VALUE]); + } + }; + exports2.Text = Text4; + } +}); + +// node_modules/linkedom/cjs/mixin/parent-node.js +var require_parent_node = __commonJS({ + "node_modules/linkedom/cjs/mixin/parent-node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + ATTRIBUTE_NODE, + DOCUMENT_FRAGMENT_NODE, + ELEMENT_NODE, + TEXT_NODE, + NODE_END, + CDATA_SECTION_NODE, + COMMENT_NODE + } = require_constants(); + var { PRIVATE, END, NEXT, PREV, START, VALUE } = require_symbols(); + var { prepareMatch } = require_matches(); + var { previousSibling, nextSibling } = require_node4(); + var { getEnd, knownAdjacent, knownBoundaries, knownSegment, knownSiblings, localCase } = require_utils4(); + var { Node } = require_node3(); + var { Text: Text4 } = require_text2(); + var { NodeList } = require_node_list(); + var { moCallback } = require_mutation_observer(); + var { connectedCallback } = require_custom_element_registry(); + var { nextElementSibling: nextElementSibling2 } = require_non_document_type_child_node(); + var isNode = (node) => node instanceof Node; + var insert = (parentNode, child, nodes) => { + const { ownerDocument } = parentNode; + for (const node of nodes) + parentNode.insertBefore( + isNode(node) ? node : new Text4(ownerDocument, node), + child + ); + }; + var ParentNode = class extends Node { + constructor(ownerDocument, localName, nodeType) { + super(ownerDocument, localName, nodeType); + this[PRIVATE] = null; + this[NEXT] = this[END] = { + [NEXT]: null, + [PREV]: this, + [START]: this, + nodeType: NODE_END, + ownerDocument: this.ownerDocument, + parentNode: null + }; + } + get childNodes() { + const childNodes = new NodeList(); + let { firstChild } = this; + while (firstChild) { + childNodes.push(firstChild); + firstChild = nextSibling(firstChild); + } + return childNodes; + } + get children() { + const children = new NodeList(); + let { firstElementChild } = this; + while (firstElementChild) { + children.push(firstElementChild); + firstElementChild = nextElementSibling2(firstElementChild); + } + return children; + } + /** + * @returns {NodeStruct | null} + */ + get firstChild() { + let { [NEXT]: next, [END]: end } = this; + while (next.nodeType === ATTRIBUTE_NODE) + next = next[NEXT]; + return next === end ? null : next; + } + /** + * @returns {NodeStruct | null} + */ + get firstElementChild() { + let { firstChild } = this; + while (firstChild) { + if (firstChild.nodeType === ELEMENT_NODE) + return firstChild; + firstChild = nextSibling(firstChild); + } + return null; + } + get lastChild() { + const prev = this[END][PREV]; + switch (prev.nodeType) { + case NODE_END: + return prev[START]; + case ATTRIBUTE_NODE: + return null; + } + return prev === this ? null : prev; + } + get lastElementChild() { + let { lastChild } = this; + while (lastChild) { + if (lastChild.nodeType === ELEMENT_NODE) + return lastChild; + lastChild = previousSibling(lastChild); + } + return null; + } + get childElementCount() { + return this.children.length; + } + prepend(...nodes) { + insert(this, this.firstChild, nodes); + } + append(...nodes) { + insert(this, this[END], nodes); + } + replaceChildren(...nodes) { + let { [NEXT]: next, [END]: end } = this; + while (next !== end && next.nodeType === ATTRIBUTE_NODE) + next = next[NEXT]; + while (next !== end) { + const after = getEnd(next)[NEXT]; + next.remove(); + next = after; + } + if (nodes.length) + insert(this, end, nodes); + } + getElementsByClassName(className) { + const elements = new NodeList(); + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE && next.hasAttribute("class") && next.classList.has(className)) + elements.push(next); + next = next[NEXT]; + } + return elements; + } + getElementsByTagName(tagName) { + const elements = new NodeList(); + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE && (next.localName === tagName || localCase(next) === tagName)) + elements.push(next); + next = next[NEXT]; + } + return elements; + } + querySelector(selectors) { + const matches = prepareMatch(this, selectors); + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE && matches(next)) + return next; + next = next.nodeType === ELEMENT_NODE && next.localName === "template" ? next[END] : next[NEXT]; + } + return null; + } + querySelectorAll(selectors) { + const matches = prepareMatch(this, selectors); + const elements = new NodeList(); + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE && matches(next)) + elements.push(next); + next = next.nodeType === ELEMENT_NODE && next.localName === "template" ? next[END] : next[NEXT]; + } + return elements; + } + appendChild(node) { + return this.insertBefore(node, this[END]); + } + contains(node) { + let parentNode = node; + while (parentNode && parentNode !== this) + parentNode = parentNode.parentNode; + return parentNode === this; + } + insertBefore(node, before = null) { + if (node === before) + return node; + if (node === this) + throw new Error("unable to append a node to itself"); + const next = before || this[END]; + switch (node.nodeType) { + case ELEMENT_NODE: + node.remove(); + node.parentNode = this; + knownBoundaries(next[PREV], node, next); + moCallback(node, null); + connectedCallback(node); + break; + case DOCUMENT_FRAGMENT_NODE: { + let { [PRIVATE]: parentNode, firstChild, lastChild } = node; + if (firstChild) { + knownSegment(next[PREV], firstChild, lastChild, next); + knownAdjacent(node, node[END]); + if (parentNode) + parentNode.replaceChildren(); + do { + firstChild.parentNode = this; + moCallback(firstChild, null); + if (firstChild.nodeType === ELEMENT_NODE) + connectedCallback(firstChild); + } while (firstChild !== lastChild && (firstChild = nextSibling(firstChild))); } - buffer += character; break; - case "{": - if (currentScope === topScope) { - nestedSelectorRule = null; + } + case TEXT_NODE: + case COMMENT_NODE: + case CDATA_SECTION_NODE: + node.remove(); + /* eslint no-fallthrough:0 */ + // this covers DOCUMENT_TYPE_NODE too + default: + node.parentNode = this; + knownSiblings(next[PREV], node, next); + moCallback(node, null); + break; + } + return node; + } + normalize() { + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + const { [NEXT]: $next, [PREV]: $prev, nodeType } = next; + if (nodeType === TEXT_NODE) { + if (!next[VALUE]) + next.remove(); + else if ($prev && $prev.nodeType === TEXT_NODE) { + $prev.textContent += next.textContent; + next.remove(); } - if (state === "before-selector") { - parseError("Unexpected {"); - i = ignoreBalancedBlock(i, token.slice(i)); - break; + } + next = $next; + } + } + removeChild(node) { + if (node.parentNode !== this) + throw new Error("node is not a child"); + node.remove(); + return node; + } + replaceChild(node, replaced) { + const next = getEnd(replaced)[NEXT]; + replaced.remove(); + this.insertBefore(node, next); + return replaced; + } + }; + exports2.ParentNode = ParentNode; + } +}); + +// node_modules/linkedom/cjs/mixin/non-element-parent-node.js +var require_non_element_parent_node = __commonJS({ + "node_modules/linkedom/cjs/mixin/non-element-parent-node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE } = require_constants(); + var { END, NEXT } = require_symbols(); + var { nonElementAsJSON } = require_jsdon(); + var { ParentNode } = require_parent_node(); + var NonElementParentNode = class extends ParentNode { + getElementById(id) { + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE && next.id === id) + return next; + next = next[NEXT]; + } + return null; + } + cloneNode(deep) { + const { ownerDocument, constructor } = this; + const nonEPN = new constructor(ownerDocument); + if (deep) { + const { [END]: end } = nonEPN; + for (const node of this.childNodes) + nonEPN.insertBefore(node.cloneNode(deep), end); + } + return nonEPN; + } + toString() { + const { childNodes, localName } = this; + return `<${localName}>${childNodes.join("")}</${localName}>`; + } + toJSON() { + const json2 = []; + nonElementAsJSON(this, json2); + return json2; + } + }; + exports2.NonElementParentNode = NonElementParentNode; + } +}); + +// node_modules/linkedom/cjs/interface/document-fragment.js +var require_document_fragment = __commonJS({ + "node_modules/linkedom/cjs/interface/document-fragment.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { DOCUMENT_FRAGMENT_NODE } = require_constants(); + var { NonElementParentNode } = require_non_element_parent_node(); + var DocumentFragment = class extends NonElementParentNode { + constructor(ownerDocument) { + super(ownerDocument, "#document-fragment", DOCUMENT_FRAGMENT_NODE); + } + }; + exports2.DocumentFragment = DocumentFragment; + } +}); + +// node_modules/linkedom/cjs/interface/document-type.js +var require_document_type = __commonJS({ + "node_modules/linkedom/cjs/interface/document-type.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { DOCUMENT_TYPE_NODE } = require_constants(); + var { documentTypeAsJSON } = require_jsdon(); + var { Node } = require_node3(); + var DocumentType = class _DocumentType extends Node { + constructor(ownerDocument, name, publicId = "", systemId = "") { + super(ownerDocument, "#document-type", DOCUMENT_TYPE_NODE); + this.name = name; + this.publicId = publicId; + this.systemId = systemId; + } + cloneNode() { + const { ownerDocument, name, publicId, systemId } = this; + return new _DocumentType(ownerDocument, name, publicId, systemId); + } + toString() { + const { name, publicId, systemId } = this; + const hasPublic = 0 < publicId.length; + const str = [name]; + if (hasPublic) + str.push("PUBLIC", `"${publicId}"`); + if (systemId.length) { + if (!hasPublic) + str.push("SYSTEM"); + str.push(`"${systemId}"`); + } + return `<!DOCTYPE ${str.join(" ")}>`; + } + toJSON() { + const json2 = []; + documentTypeAsJSON(this, json2); + return json2; + } + }; + exports2.DocumentType = DocumentType; + } +}); + +// node_modules/linkedom/cjs/mixin/inner-html.js +var require_inner_html = __commonJS({ + "node_modules/linkedom/cjs/mixin/inner-html.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { ELEMENT_NODE, DOCUMENT_FRAGMENT_NODE } = require_constants(); + var { CUSTOM_ELEMENTS } = require_symbols(); + var { parseFromString } = require_parse_from_string(); + var { ignoreCase } = require_utils4(); + var getInnerHtml = (node) => node.childNodes.join(""); + exports2.getInnerHtml = getInnerHtml; + var setInnerHtml = (node, html) => { + const { ownerDocument } = node; + const { constructor } = ownerDocument; + const document2 = new constructor(); + document2[CUSTOM_ELEMENTS] = ownerDocument[CUSTOM_ELEMENTS]; + const { childNodes } = parseFromString(document2, ignoreCase(node), html); + node.replaceChildren(...childNodes.map(setOwnerDocument, ownerDocument)); + }; + exports2.setInnerHtml = setInnerHtml; + function setOwnerDocument(node) { + node.ownerDocument = this; + switch (node.nodeType) { + case ELEMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + node.childNodes.forEach(setOwnerDocument, this); + break; + } + return node; + } + } +}); + +// node_modules/uhyphen/cjs/index.js +var require_cjs = __commonJS({ + "node_modules/uhyphen/cjs/index.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + module2.exports = (camel) => camel.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g, "$2$5-$3$6").toLowerCase(); + } +}); + +// node_modules/linkedom/cjs/dom/string-map.js +var require_string_map = __commonJS({ + "node_modules/linkedom/cjs/dom/string-map.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var uhyphen = ((m) => ( + /* c8 ignore start */ + m.__esModule ? m.default : m + ))(require_cjs()); + var { setPrototypeOf } = require_object(); + var refs = /* @__PURE__ */ new WeakMap(); + var key = (name) => `data-${uhyphen(name)}`; + var prop = (name) => name.slice(5).replace(/-([a-z])/g, (_, $1) => $1.toUpperCase()); + var handler = { + get(dataset, name) { + if (name in dataset) + return refs.get(dataset).getAttribute(key(name)); + }, + set(dataset, name, value) { + dataset[name] = value; + refs.get(dataset).setAttribute(key(name), value); + return true; + }, + deleteProperty(dataset, name) { + if (name in dataset) + refs.get(dataset).removeAttribute(key(name)); + return delete dataset[name]; + } + }; + var DOMStringMap = class { + /** + * @param {Element} ref + */ + constructor(ref) { + for (const { name, value } of ref.attributes) { + if (/^data-/.test(name)) + this[prop(name)] = value; + } + refs.set(this, ref); + return new Proxy(this, handler); + } + }; + exports2.DOMStringMap = DOMStringMap; + setPrototypeOf(DOMStringMap.prototype, null); + } +}); + +// node_modules/linkedom/cjs/dom/token-list.js +var require_token_list = __commonJS({ + "node_modules/linkedom/cjs/dom/token-list.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { OWNER_ELEMENT } = require_symbols(); + var { setAttribute } = require_attributes(); + var { Attr } = require_attr(); + var { add } = Set.prototype; + var addTokens = (self2, tokens) => { + for (const token of tokens) { + if (token) + add.call(self2, token); + } + }; + var update = ({ [OWNER_ELEMENT]: ownerElement, value }) => { + const attribute = ownerElement.getAttributeNode("class"); + if (attribute) + attribute.value = value; + else + setAttribute( + ownerElement, + new Attr(ownerElement.ownerDocument, "class", value) + ); + }; + var DOMTokenList = class extends Set { + constructor(ownerElement) { + super(); + this[OWNER_ELEMENT] = ownerElement; + const attribute = ownerElement.getAttributeNode("class"); + if (attribute) + addTokens(this, attribute.value.split(/\s+/)); + } + get length() { + return this.size; + } + get value() { + return [...this].join(" "); + } + /** + * @param {...string} tokens + */ + add(...tokens) { + addTokens(this, tokens); + update(this); + } + /** + * @param {string} token + */ + contains(token) { + return this.has(token); + } + /** + * @param {...string} tokens + */ + remove(...tokens) { + for (const token of tokens) + this.delete(token); + update(this); + } + /** + * @param {string} token + * @param {boolean?} force + */ + toggle(token, force) { + if (this.has(token)) { + if (force) + return true; + this.delete(token); + update(this); + } else if (force || arguments.length === 1) { + super.add(token); + update(this); + return true; + } + return false; + } + /** + * @param {string} token + * @param {string} newToken + */ + replace(token, newToken) { + if (this.has(token)) { + this.delete(token); + super.add(newToken); + update(this); + return true; + } + return false; + } + /** + * @param {string} token + */ + supports() { + return true; + } + }; + exports2.DOMTokenList = DOMTokenList; + } +}); + +// node_modules/linkedom/cjs/interface/css-style-declaration.js +var require_css_style_declaration = __commonJS({ + "node_modules/linkedom/cjs/interface/css-style-declaration.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var uhyphen = ((m) => ( + /* c8 ignore start */ + m.__esModule ? m.default : m + ))(require_cjs()); + var { CHANGED, PRIVATE, VALUE } = require_symbols(); + var refs = /* @__PURE__ */ new WeakMap(); + var getKeys = (style) => [...style.keys()].filter((key) => key !== PRIVATE); + var updateKeys = (style) => { + const attr = refs.get(style).getAttributeNode("style"); + if (!attr || attr[CHANGED] || style.get(PRIVATE) !== attr) { + style.clear(); + if (attr) { + style.set(PRIVATE, attr); + for (const rule of attr[VALUE].split(/\s*;\s*/)) { + let [key, ...rest] = rule.split(":"); + if (rest.length > 0) { + key = key.trim(); + const value = rest.join(":").trim(); + if (key && value) + style.set(key, value); } - if (state === "selector" || state === "atRule") { - if (!nestedSelectorRule && containsUnescaped(buffer, ";")) { - var ruleClosingMatch = token.slice(i).match(forwardRuleClosingBraceRegExp); - if (ruleClosingMatch) { - styleRule = null; - buffer = ""; - state = "before-selector"; - i += ruleClosingMatch.index + ruleClosingMatch[0].length; - break; - } - } - if (!styleRule) { - styleRule = new CSSOM2.CSSStyleRule(); - styleRule.__starts = i; - } - if (hasUnmatchedQuoteInSelector) { - handleUnmatchedQuoteInSelector("before-selector"); - break; - } - var originalParentRule = parentRule; - if (parentRule) { - styleRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - } - currentScope = parentRule = styleRule; - var processedSelectorText = processSelectorText(buffer.trim()); - if (originalParentRule && originalParentRule.constructor.name === "CSSStyleRule") { - styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).map(function(sel) { - return sel.indexOf("&") === -1 || startsWithCombinatorRegExp.test(sel) ? "& " + sel : sel; - }).join(", "); - } else { - styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).join(", "); - } - styleRule.style.__starts = i; - styleRule.__parentStyleSheet = styleSheet; - buffer = ""; - state = "before-name"; - } else if (state === "atBlock") { - mediaRule.media.mediaText = normalizeConditionText(buffer.trim()); - if (parentRule) { - mediaRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = mediaRule; - pushToAncestorRules(mediaRule); - mediaRule.__parentStyleSheet = styleSheet; - if (!styleRule || styleRule.constructor.name !== "CSSStyleRule" || !styleRule.__parentRule) { - styleRule = null; - } - buffer = ""; - state = "before-selector"; - } else if (state === "containerBlock") { - containerRule.__conditionText = normalizeConditionText(buffer.trim()); - if (parentRule) { - containerRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = containerRule; - pushToAncestorRules(containerRule); - containerRule.__parentStyleSheet = styleSheet; - styleRule = null; - buffer = ""; - state = "before-selector"; - } else if (state === "counterStyleBlock") { - var counterStyleName = buffer.trim().replace(newlineRemovalRegExp, ""); - var isValidCounterStyleName = counterStyleName.length > 0 && !whitespaceAndDotRegExp.test(counterStyleName); - if (isValidCounterStyleName) { - counterStyleRule.name = counterStyleName; - if (parentRule) { - counterStyleRule.__parentRule = parentRule; - } - counterStyleRule.__parentStyleSheet = styleSheet; - styleRule = counterStyleRule; - } - buffer = ""; - } else if (state === "propertyBlock") { - var propertyName = buffer.trim().replace(newlineRemovalRegExp, ""); - var isValidPropertyName = propertyName.indexOf("--") === 0; - if (isValidPropertyName) { - propertyRule.__name = propertyName; - if (parentRule) { - propertyRule.__parentRule = parentRule; - } - propertyRule.__parentStyleSheet = styleSheet; - styleRule = propertyRule; - } - buffer = ""; - } else if (state === "conditionBlock") { - supportsRule.__conditionText = normalizeConditionText(buffer.trim()); - if (parentRule) { - supportsRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = supportsRule; - pushToAncestorRules(supportsRule); - supportsRule.__parentStyleSheet = styleSheet; - styleRule = null; - buffer = ""; - state = "before-selector"; - } else if (state === "scopeBlock") { - var parsedScopePrelude = parseScopePrelude(buffer.trim()); - if (parsedScopePrelude.hasStart) { - scopeRule.__start = parsedScopePrelude.startSelector; - } - if (parsedScopePrelude.hasEnd) { - scopeRule.__end = parsedScopePrelude.endSelector; - } - if (parsedScopePrelude.hasOnlyEnd) { - scopeRule.__end = parsedScopePrelude.endSelector; - } - if (parentRule) { - scopeRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = scopeRule; - pushToAncestorRules(scopeRule); - scopeRule.__parentStyleSheet = styleSheet; - styleRule = null; - buffer = ""; - state = "before-selector"; - } else if (state === "layerBlock") { - layerBlockRule.name = buffer.trim(); - var isValidName = layerBlockRule.name.length === 0 || layerBlockRule.name.match(cssCustomIdentifierRegExp) !== null; - if (isValidName) { - if (parentRule) { - layerBlockRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = layerBlockRule; - pushToAncestorRules(layerBlockRule); - layerBlockRule.__parentStyleSheet = styleSheet; - } - styleRule = null; - buffer = ""; - state = "before-selector"; - } else if (state === "pageBlock") { - pageRule.selectorText = buffer.trim(); - if (parentRule) { - pageRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - } - currentScope = parentRule = pageRule; - pageRule.__parentStyleSheet = styleSheet; - styleRule = pageRule; - buffer = ""; - state = "before-name"; - } else if (state === "hostRule-begin") { - if (parentRule) { - pushToAncestorRules(parentRule); - } - currentScope = parentRule = hostRule; - pushToAncestorRules(hostRule); - hostRule.__parentStyleSheet = styleSheet; - buffer = ""; - state = "before-selector"; - } else if (state === "startingStyleRule-begin") { - if (parentRule) { - startingStyleRule.__parentRule = parentRule; - pushToAncestorRules(parentRule); - if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { - nestedSelectorRule = parentRule; - } - } - currentScope = parentRule = startingStyleRule; - pushToAncestorRules(startingStyleRule); - startingStyleRule.__parentStyleSheet = styleSheet; - styleRule = null; - buffer = ""; - state = "before-selector"; - } else if (state === "fontFaceRule-begin") { - if (parentRule) { - fontFaceRule.__parentRule = parentRule; - } - fontFaceRule.__parentStyleSheet = styleSheet; - styleRule = fontFaceRule; - buffer = ""; - state = "before-name"; - } else if (state === "keyframesRule-begin") { - keyframesRule.name = buffer.trim(); - if (parentRule) { - pushToAncestorRules(parentRule); - keyframesRule.__parentRule = parentRule; - } - keyframesRule.__parentStyleSheet = styleSheet; - currentScope = parentRule = keyframesRule; - buffer = ""; - state = "keyframeRule-begin"; - } else if (state === "keyframeRule-begin") { - styleRule = new CSSOM2.CSSKeyframeRule(); - styleRule.keyText = buffer.trim(); - styleRule.__starts = i; - buffer = ""; - state = "before-name"; - } else if (state === "documentRule-begin") { - documentRule.matcher.matcherText = buffer.trim(); - if (parentRule) { - pushToAncestorRules(parentRule); - documentRule.__parentRule = parentRule; - } - currentScope = parentRule = documentRule; - pushToAncestorRules(documentRule); - documentRule.__parentStyleSheet = styleSheet; - buffer = ""; - state = "before-selector"; - } else if (state === "before-name" || state === "name") { - if (styleRule.constructor.name === "CSSFontFaceRule" || styleRule.constructor.name === "CSSKeyframeRule" || styleRule.constructor.name === "CSSPageRule" && parentRule === styleRule) { - var ruleClosingMatch = token.slice(i).match(forwardRuleClosingBraceRegExp); - if (ruleClosingMatch) { - i += ruleClosingMatch.index + ruleClosingMatch[0].length - 1; - buffer = ""; - state = "before-name"; - break; - } - } - if (styleRule.constructor.name === "CSSNestedDeclarations") { - if (styleRule.style.length) { - parentRule.cssRules.push(styleRule); - styleRule.__parentRule = parentRule; - styleRule.__parentStyleSheet = styleSheet; - pushToAncestorRules(parentRule); - } else { - pushToAncestorRules(parentRule); - } - } else { - currentScope = parentRule = styleRule; - pushToAncestorRules(parentRule); - styleRule.__parentStyleSheet = styleSheet; - } - styleRule = new CSSOM2.CSSStyleRule(); - if (hasUnmatchedQuoteInSelector) { - handleUnmatchedQuoteInSelector("before-name"); - break; - } - var processedSelectorText = processSelectorText(buffer.trim()); - if (parentRule.constructor.name === "CSSScopeRule" || parentRule.constructor.name !== "CSSStyleRule" && parentRule.parentRule === null) { - styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).join(", "); - } else { - styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).map(function(sel) { - return sel.indexOf("&") === -1 || startsWithCombinatorRegExp.test(sel) ? "& " + sel : sel; - }).join(", "); - } - styleRule.style.__starts = i - buffer.length; - styleRule.__parentRule = parentRule; - if (parentRule.constructor.name === "CSSStyleRule" || parentRule.constructor.name === "CSSScopeRule") { - nestedSelectorRule = styleRule; - } - styleRule.__parentStyleSheet = styleSheet; - currentScope = parentRule = styleRule; - buffer = ""; - state = "before-name"; - } - break; - case ":": - if (state === "name") { - var openBraceBeforeMatch = token.slice(i).match(declarationOrOpenBraceRegExp); - var hasOpenBraceBefore = openBraceBeforeMatch && openBraceBeforeMatch[0] === "{"; - if (hasOpenBraceBefore) { - buffer += character; - } else { - name = buffer.trim(); - buffer = ""; - state = "before-value"; - } - } else { - buffer += character; - } - break; - case "(": - if (state === "value") { - if (buffer.trim() === "expression") { - var info = new CSSOM2.CSSValueExpression(token, i).parse(); - if (info.error) { - parseError(info.error); - } else { - buffer += info.expression; - i = info.idx; - } - } else { - state = "value-parenthesis"; - valueParenthesisDepth = 1; - buffer += character; - } - } else if (state === "value-parenthesis") { - valueParenthesisDepth++; - buffer += character; - } else { - buffer += character; + } + } + } + return attr; + }; + var handler = { + get(style, name) { + if (name in prototype) + return style[name]; + updateKeys(style); + if (name === "length") + return getKeys(style).length; + if (/^\d+$/.test(name)) + return getKeys(style)[name]; + return style.get(uhyphen(name)) ?? ""; + }, + set(style, name, value) { + if (name === "cssText") + style[name] = value; + else { + let attr = updateKeys(style); + if (value == null) + style.delete(uhyphen(name)); + else + style.set(uhyphen(name), value); + if (!attr) { + const element = refs.get(style); + attr = element.ownerDocument.createAttribute("style"); + element.setAttributeNode(attr); + style.set(PRIVATE, attr); + } + attr[CHANGED] = false; + attr[VALUE] = style.toString(); + } + return true; + } + }; + var CSSStyleDeclaration = class extends Map { + constructor(element) { + super(); + refs.set(this, element); + return new Proxy(this, handler); + } + get cssText() { + return this.toString(); + } + set cssText(value) { + refs.get(this).setAttribute("style", value); + } + getPropertyValue(name) { + const self2 = this[PRIVATE]; + return handler.get(self2, name); + } + setProperty(name, value) { + const self2 = this[PRIVATE]; + handler.set(self2, name, value); + } + removeProperty(name) { + const self2 = this[PRIVATE]; + handler.set(self2, name, null); + } + [Symbol.iterator]() { + const self2 = this[PRIVATE]; + updateKeys(self2); + const keys = getKeys(self2); + const { length } = keys; + let i = 0; + return { + next() { + const done = i === length; + return { done, value: done ? null : keys[i++] }; + } + }; + } + get [PRIVATE]() { + return this; + } + toString() { + const self2 = this[PRIVATE]; + updateKeys(self2); + const cssText = []; + self2.forEach(push, cssText); + return cssText.join(";"); + } + }; + exports2.CSSStyleDeclaration = CSSStyleDeclaration; + var { prototype } = CSSStyleDeclaration; + function push(value, key) { + if (key !== PRIVATE) + this.push(`${key}:${value}`); + } + } +}); + +// node_modules/linkedom/cjs/interface/event.js +var require_event = __commonJS({ + "node_modules/linkedom/cjs/interface/event.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var BUBBLING_PHASE = 3; + var AT_TARGET = 2; + var CAPTURING_PHASE = 1; + var NONE = 0; + function getCurrentTarget(ev) { + return ev.currentTarget; + } + var GlobalEvent = class { + static get BUBBLING_PHASE() { + return BUBBLING_PHASE; + } + static get AT_TARGET() { + return AT_TARGET; + } + static get CAPTURING_PHASE() { + return CAPTURING_PHASE; + } + static get NONE() { + return NONE; + } + constructor(type, eventInitDict = {}) { + this.type = type; + this.bubbles = !!eventInitDict.bubbles; + this.cancelBubble = false; + this._stopImmediatePropagationFlag = false; + this.cancelable = !!eventInitDict.cancelable; + this.eventPhase = this.NONE; + this.timeStamp = Date.now(); + this.defaultPrevented = false; + this.originalTarget = null; + this.returnValue = null; + this.srcElement = null; + this.target = null; + this._path = []; + } + get BUBBLING_PHASE() { + return BUBBLING_PHASE; + } + get AT_TARGET() { + return AT_TARGET; + } + get CAPTURING_PHASE() { + return CAPTURING_PHASE; + } + get NONE() { + return NONE; + } + preventDefault() { + this.defaultPrevented = true; + } + // simplified implementation, should be https://dom.spec.whatwg.org/#dom-event-composedpath + composedPath() { + return this._path.map(getCurrentTarget); + } + stopPropagation() { + this.cancelBubble = true; + } + stopImmediatePropagation() { + this.stopPropagation(); + this._stopImmediatePropagationFlag = true; + } + }; + exports2.Event = GlobalEvent; + } +}); + +// node_modules/linkedom/cjs/interface/named-node-map.js +var require_named_node_map = __commonJS({ + "node_modules/linkedom/cjs/interface/named-node-map.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var NamedNodeMap = class extends Array { + constructor(ownerElement) { + super(); + this.ownerElement = ownerElement; + } + getNamedItem(name) { + return this.ownerElement.getAttributeNode(name); + } + setNamedItem(attr) { + this.ownerElement.setAttributeNode(attr); + this.unshift(attr); + } + removeNamedItem(name) { + const item = this.getNamedItem(name); + this.ownerElement.removeAttribute(name); + this.splice(this.indexOf(item), 1); + } + item(index2) { + return index2 < this.length ? this[index2] : null; + } + /* c8 ignore start */ + getNamedItemNS(_, name) { + return this.getNamedItem(name); + } + setNamedItemNS(_, attr) { + return this.setNamedItem(attr); + } + removeNamedItemNS(_, name) { + return this.removeNamedItem(name); + } + /* c8 ignore stop */ + }; + exports2.NamedNodeMap = NamedNodeMap; + } +}); + +// node_modules/linkedom/cjs/interface/shadow-root.js +var require_shadow_root = __commonJS({ + "node_modules/linkedom/cjs/interface/shadow-root.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { DOCUMENT_FRAGMENT_NODE } = require_constants(); + var { getInnerHtml, setInnerHtml } = require_inner_html(); + var { NonElementParentNode } = require_non_element_parent_node(); + var ShadowRoot = class extends NonElementParentNode { + constructor(host) { + super(host.ownerDocument, "#shadow-root", DOCUMENT_FRAGMENT_NODE); + this.host = host; + } + get innerHTML() { + return getInnerHtml(this); + } + set innerHTML(html) { + setInnerHtml(this, html); + } + }; + exports2.ShadowRoot = ShadowRoot; + } +}); + +// node_modules/linkedom/cjs/interface/element.js +var require_element = __commonJS({ + "node_modules/linkedom/cjs/interface/element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + ATTRIBUTE_NODE, + BLOCK_ELEMENTS, + CDATA_SECTION_NODE, + COMMENT_NODE, + ELEMENT_NODE, + NODE_END, + TEXT_NODE, + SVG_NAMESPACE + } = require_constants(); + var { + setAttribute, + removeAttribute, + numericAttribute, + stringAttribute + } = require_attributes(); + var { + CLASS_LIST, + DATASET, + STYLE, + END, + NEXT, + PREV, + START, + MIME + } = require_symbols(); + var { + htmlToFragment, + ignoreCase, + knownAdjacent, + localCase, + String: String2 + } = require_utils4(); + var { elementAsJSON } = require_jsdon(); + var { matches, prepareMatch } = require_matches(); + var { shadowRoots } = require_shadow_roots(); + var { isConnected, parentElement, previousSibling, nextSibling } = require_node4(); + var { previousElementSibling, nextElementSibling: nextElementSibling2 } = require_non_document_type_child_node(); + var { before, after, replaceWith, remove } = require_child_node(); + var { getInnerHtml, setInnerHtml } = require_inner_html(); + var { ParentNode } = require_parent_node(); + var { DOMStringMap } = require_string_map(); + var { DOMTokenList } = require_token_list(); + var { CSSStyleDeclaration } = require_css_style_declaration(); + var { Event: Event2 } = require_event(); + var { NamedNodeMap } = require_named_node_map(); + var { ShadowRoot } = require_shadow_root(); + var { NodeList } = require_node_list(); + var { Attr } = require_attr(); + var { Text: Text4 } = require_text2(); + var { escape: escape3 } = require_text_escaper(); + var attributesHandler = { + get(target, key) { + return key in target ? target[key] : target.find(({ name }) => name === key); + } + }; + var create = (ownerDocument, element, localName) => { + if ("ownerSVGElement" in element) { + const svg = ownerDocument.createElementNS(SVG_NAMESPACE, localName); + svg.ownerSVGElement = element.ownerSVGElement; + return svg; + } + return ownerDocument.createElement(localName); + }; + var isVoid = ({ localName, ownerDocument }) => { + return ownerDocument[MIME].voidElements.test(localName); + }; + var Element = class extends ParentNode { + constructor(ownerDocument, localName) { + super(ownerDocument, localName, ELEMENT_NODE); + this[CLASS_LIST] = null; + this[DATASET] = null; + this[STYLE] = null; + } + // <Mixins> + get isConnected() { + return isConnected(this); + } + get parentElement() { + return parentElement(this); + } + get previousSibling() { + return previousSibling(this); + } + get nextSibling() { + return nextSibling(this); + } + get namespaceURI() { + return "http://www.w3.org/1999/xhtml"; + } + get previousElementSibling() { + return previousElementSibling(this); + } + get nextElementSibling() { + return nextElementSibling2(this); + } + before(...nodes) { + before(this, nodes); + } + after(...nodes) { + after(this, nodes); + } + replaceWith(...nodes) { + replaceWith(this, nodes); + } + remove() { + remove(this[PREV], this, this[END][NEXT]); + } + // </Mixins> + // <specialGetters> + get id() { + return stringAttribute.get(this, "id"); + } + set id(value) { + stringAttribute.set(this, "id", value); + } + get className() { + return this.classList.value; + } + set className(value) { + const { classList } = this; + classList.clear(); + classList.add(...String2(value).split(/\s+/)); + } + get nodeName() { + return localCase(this); + } + get tagName() { + return localCase(this); + } + get classList() { + return this[CLASS_LIST] || (this[CLASS_LIST] = new DOMTokenList(this)); + } + get dataset() { + return this[DATASET] || (this[DATASET] = new DOMStringMap(this)); + } + getBoundingClientRect() { + return { + x: 0, + y: 0, + bottom: 0, + height: 0, + left: 0, + right: 0, + top: 0, + width: 0 + }; + } + get nonce() { + return stringAttribute.get(this, "nonce"); + } + set nonce(value) { + stringAttribute.set(this, "nonce", value); + } + get style() { + return this[STYLE] || (this[STYLE] = new CSSStyleDeclaration(this)); + } + get tabIndex() { + return numericAttribute.get(this, "tabindex") || -1; + } + set tabIndex(value) { + numericAttribute.set(this, "tabindex", value); + } + get slot() { + return stringAttribute.get(this, "slot"); + } + set slot(value) { + stringAttribute.set(this, "slot", value); + } + // </specialGetters> + // <contentRelated> + get innerText() { + const text = []; + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + if (next.nodeType === TEXT_NODE) { + text.push(next.textContent.replace(/\s+/g, " ")); + } else if (text.length && next[NEXT] != end && BLOCK_ELEMENTS.has(next.tagName)) { + text.push("\n"); + } + next = next[NEXT]; + } + return text.join(""); + } + /** + * @returns {String} + */ + get textContent() { + const text = []; + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + const nodeType = next.nodeType; + if (nodeType === TEXT_NODE || nodeType === CDATA_SECTION_NODE) + text.push(next.textContent); + next = next[NEXT]; + } + return text.join(""); + } + set textContent(text) { + this.replaceChildren(); + if (text != null && text !== "") + this.appendChild(new Text4(this.ownerDocument, text)); + } + get innerHTML() { + return getInnerHtml(this); + } + set innerHTML(html) { + setInnerHtml(this, html); + } + get outerHTML() { + return this.toString(); + } + set outerHTML(html) { + const template = this.ownerDocument.createElement(""); + template.innerHTML = html; + this.replaceWith(...template.childNodes); + } + // </contentRelated> + // <attributes> + get attributes() { + const attributes = new NamedNodeMap(this); + let next = this[NEXT]; + while (next.nodeType === ATTRIBUTE_NODE) { + attributes.push(next); + next = next[NEXT]; + } + return new Proxy(attributes, attributesHandler); + } + focus() { + this.dispatchEvent(new Event2("focus")); + } + getAttribute(name) { + if (name === "class") + return this.className; + const attribute = this.getAttributeNode(name); + return attribute && (ignoreCase(this) ? attribute.value : escape3(attribute.value)); + } + getAttributeNode(name) { + let next = this[NEXT]; + while (next.nodeType === ATTRIBUTE_NODE) { + if (next.name === name) + return next; + next = next[NEXT]; + } + return null; + } + getAttributeNames() { + const attributes = new NodeList(); + let next = this[NEXT]; + while (next.nodeType === ATTRIBUTE_NODE) { + attributes.push(next.name); + next = next[NEXT]; + } + return attributes; + } + hasAttribute(name) { + return !!this.getAttributeNode(name); + } + hasAttributes() { + return this[NEXT].nodeType === ATTRIBUTE_NODE; + } + removeAttribute(name) { + if (name === "class" && this[CLASS_LIST]) + this[CLASS_LIST].clear(); + let next = this[NEXT]; + while (next.nodeType === ATTRIBUTE_NODE) { + if (next.name === name) { + removeAttribute(this, next); + return; + } + next = next[NEXT]; + } + } + removeAttributeNode(attribute) { + let next = this[NEXT]; + while (next.nodeType === ATTRIBUTE_NODE) { + if (next === attribute) { + removeAttribute(this, next); + return; + } + next = next[NEXT]; + } + } + setAttribute(name, value) { + if (name === "class") + this.className = value; + else { + const attribute = this.getAttributeNode(name); + if (attribute) + attribute.value = value; + else + setAttribute(this, new Attr(this.ownerDocument, name, value)); + } + } + setAttributeNode(attribute) { + const { name } = attribute; + const previously = this.getAttributeNode(name); + if (previously !== attribute) { + if (previously) + this.removeAttributeNode(previously); + const { ownerElement } = attribute; + if (ownerElement) + ownerElement.removeAttributeNode(attribute); + setAttribute(this, attribute); + } + return previously; + } + toggleAttribute(name, force) { + if (this.hasAttribute(name)) { + if (!force) { + this.removeAttribute(name); + return false; + } + return true; + } else if (force || arguments.length === 1) { + this.setAttribute(name, ""); + return true; + } + return false; + } + // </attributes> + // <ShadowDOM> + get shadowRoot() { + if (shadowRoots.has(this)) { + const { mode, shadowRoot } = shadowRoots.get(this); + if (mode === "open") + return shadowRoot; + } + return null; + } + attachShadow(init) { + if (shadowRoots.has(this)) + throw new Error("operation not supported"); + const shadowRoot = new ShadowRoot(this); + shadowRoots.set(this, { + mode: init.mode, + shadowRoot + }); + return shadowRoot; + } + // </ShadowDOM> + // <selectors> + matches(selectors) { + return matches(this, selectors); + } + closest(selectors) { + let parentElement2 = this; + const matches2 = prepareMatch(parentElement2, selectors); + while (parentElement2 && !matches2(parentElement2)) + parentElement2 = parentElement2.parentElement; + return parentElement2; + } + // </selectors> + // <insertAdjacent> + insertAdjacentElement(position, element) { + const { parentElement: parentElement2 } = this; + switch (position) { + case "beforebegin": + if (parentElement2) { + parentElement2.insertBefore(element, this); + break; } + return null; + case "afterbegin": + this.insertBefore(element, this.firstChild); break; - case ")": - if (state === "value-parenthesis") { - valueParenthesisDepth--; - if (valueParenthesisDepth === 0) state = "value"; - } - buffer += character; + case "beforeend": + this.insertBefore(element, null); break; - case "!": - if (state === "value" && token.indexOf("!important", i) === i) { - priority = "important"; - i += "important".length; - } else { - buffer += character; + case "afterend": + if (parentElement2) { + parentElement2.insertBefore(element, this.nextSibling); + break; } - break; - case ";": - switch (state) { - case "before-value": - case "before-name": - parseError("Unexpected ;"); - buffer = ""; - state = "before-name"; - break; - case "value": - styleRule.style.setProperty(name, buffer.trim(), priority, parseError); - priority = ""; - buffer = ""; - state = "before-name"; - break; - case "atRule": - buffer = ""; - state = "before-selector"; - break; - case "importRule": - var isValid = topScope.cssRules.length === 0 || topScope.cssRules.some(function(rule) { - return ["CSSImportRule", "CSSLayerStatementRule"].indexOf(rule.constructor.name) !== -1; - }); - if (isValid) { - importRule = new CSSOM2.CSSImportRule(); - if (opts && opts.globalObject && opts.globalObject.CSSStyleSheet) { - importRule.__styleSheet = new opts.globalObject.CSSStyleSheet(); - } - importRule.styleSheet.__constructed = false; - importRule.__parentStyleSheet = importRule.styleSheet.__parentStyleSheet = styleSheet; - importRule.parse(buffer + character); - topScope.cssRules.push(importRule); - } - buffer = ""; - state = "before-selector"; - break; - case "namespaceRule": - var isValid = topScope.cssRules.length === 0 || topScope.cssRules.every(function(rule) { - return ["CSSImportRule", "CSSLayerStatementRule", "CSSNamespaceRule"].indexOf(rule.constructor.name) !== -1; - }); - if (isValid) { - try { - var testNamespaceRule = new CSSOM2.CSSNamespaceRule(); - testNamespaceRule.parse(buffer + character); - namespaceRule = testNamespaceRule; - namespaceRule.__parentStyleSheet = styleSheet; - topScope.cssRules.push(namespaceRule); - if (namespaceRule.prefix) { - definedNamespacePrefixes[namespaceRule.prefix] = namespaceRule.namespaceURI; - } - } catch (e) { - parseError(e.message); - } - } - buffer = ""; - state = "before-selector"; - break; - case "layerBlock": - var nameListStr = buffer.trim().split(",").map(function(name2) { - return name2.trim(); - }); - var isInvalid = nameListStr.some(function(name2) { - return name2.trim().match(cssCustomIdentifierRegExp) === null; - }); - var hasStyleRuleParent = false; - if (parentRule) { - var checkParent = parentRule; - while (checkParent) { - if (checkParent.constructor.name === "CSSStyleRule") { - hasStyleRuleParent = true; - break; - } - checkParent = checkParent.__parentRule; - } - } - if (!isInvalid && !hasStyleRuleParent) { - layerStatementRule = new CSSOM2.CSSLayerStatementRule(); - layerStatementRule.__parentStyleSheet = styleSheet; - layerStatementRule.__starts = layerBlockRule.__starts; - layerStatementRule.__ends = i; - layerStatementRule.nameList = nameListStr; - if (parentRule) { - layerStatementRule.__parentRule = parentRule; - parentRule.cssRules.push(layerStatementRule); - } else { - topScope.cssRules.push(layerStatementRule); - } - } - buffer = ""; - state = "before-selector"; - break; - default: - buffer += character; - break; + return null; + } + return element; + } + insertAdjacentHTML(position, html) { + this.insertAdjacentElement(position, htmlToFragment(this.ownerDocument, html)); + } + insertAdjacentText(position, text) { + const node = this.ownerDocument.createTextNode(text); + this.insertAdjacentElement(position, node); + } + // </insertAdjacent> + cloneNode(deep = false) { + const { ownerDocument, localName } = this; + const addNext = (next2) => { + next2.parentNode = parentNode; + knownAdjacent($next, next2); + $next = next2; + }; + const clone = create(ownerDocument, this, localName); + let parentNode = clone, $next = clone; + let { [NEXT]: next, [END]: prev } = this; + while (next !== prev && (deep || next.nodeType === ATTRIBUTE_NODE)) { + switch (next.nodeType) { + case NODE_END: + knownAdjacent($next, parentNode[END]); + $next = parentNode[END]; + parentNode = parentNode.parentNode; + break; + case ELEMENT_NODE: { + const node = create(ownerDocument, next, next.localName); + addNext(node); + parentNode = node; + break; } - break; - case "}": - if (state === "counterStyleBlock") { - if (counterStyleRule.name) { - counterStyleRule.parse("@counter-style " + counterStyleRule.name + " { " + buffer + " }"); - counterStyleRule.__ends = i + 1; - if (counterStyleRule.__parentRule) { - counterStyleRule.__parentRule.cssRules.push(counterStyleRule); - } else { - topScope.cssRules.push(counterStyleRule); - } - } - if (counterStyleRule.__parentRule) { - currentScope = counterStyleRule.__parentRule; - } - styleRule = null; - buffer = ""; - state = "before-selector"; + case ATTRIBUTE_NODE: { + const attr = next.cloneNode(deep); + attr.ownerElement = parentNode; + addNext(attr); break; } - if (state === "propertyBlock") { - if (propertyRule.__name) { - var parseSuccess = propertyRule.parse("@property " + propertyRule.__name + " { " + buffer + " }"); - if (parseSuccess) { - propertyRule.__ends = i + 1; - if (propertyRule.__parentRule) { - propertyRule.__parentRule.cssRules.push(propertyRule); - } else { - topScope.cssRules.push(propertyRule); - } - } - } - if (propertyRule.__parentRule) { - currentScope = propertyRule.__parentRule; - } - styleRule = null; - buffer = ""; - state = "before-selector"; + case TEXT_NODE: + case COMMENT_NODE: + case CDATA_SECTION_NODE: + addNext(next.cloneNode(deep)); break; - } - switch (state) { - case "value": - styleRule.style.setProperty(name, buffer.trim(), priority, parseError); - priority = ""; - /* falls through */ - case "before-value": - case "before-name": - case "name": - styleRule.__ends = i + 1; - if (parentRule === styleRule) { - parentRule = ancestorRules.pop(); - } - if (parentRule) { - styleRule.__parentRule = parentRule; - } - styleRule.__parentStyleSheet = styleSheet; - if (currentScope === styleRule) { - currentScope = parentRule || topScope; - } - if (styleRule.constructor.name === "CSSStyleRule" && !isValidSelectorText(styleRule.selectorText)) { - if (styleRule === nestedSelectorRule) { - nestedSelectorRule = null; - } - parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null); - } else { - if (styleRule.parentRule) { - styleRule.parentRule.cssRules.push(styleRule); - } else { - currentScope.cssRules.push(styleRule); - } - } - buffer = ""; - if (currentScope.constructor === CSSOM2.CSSKeyframesRule) { - state = "keyframeRule-begin"; - } else { - state = "before-selector"; - } - if (styleRule.constructor.name === "CSSNestedDeclarations") { - if (currentScope !== topScope) { - if (currentScope.constructor.name === "CSSStyleRule" || currentScope.constructor.name === "CSSScopeRule") { - nestedSelectorRule = currentScope; - } - } - styleRule = null; - } else { - if (styleRule === nestedSelectorRule) { - var selector = styleRule.selectorText && styleRule.selectorText.trim(); - var isPrependedAmpersand = selector && selector.match(prependedAmpersandRegExp); - var isGroupingRule = currentScope && currentScope instanceof CSSOM2.CSSGroupingRule; - if (!isPrependedAmpersand && isGroupingRule) { - if (currentScope.constructor.name === "CSSStyleRule" || currentScope.constructor.name === "CSSScopeRule") { - nestedSelectorRule = currentScope; - } - } else { - nestedSelectorRule = null; - } - } else if (nestedSelectorRule && currentScope instanceof CSSOM2.CSSGroupingRule) { - } - styleRule = null; - break; - } - case "keyframeRule-begin": - case "before-selector": - case "selector": - if (!parentRule) { - parseError("Unexpected }"); - var hasPreviousStyleRule = currentScope.cssRules.length && currentScope.cssRules[currentScope.cssRules.length - 1].constructor.name === "CSSStyleRule"; - if (hasPreviousStyleRule) { - i = ignoreBalancedBlock(i, token.slice(i), 1); - } + } + next = next[NEXT]; + } + knownAdjacent($next, clone[END]); + return clone; + } + // <custom> + toString() { + const out = []; + const { [END]: end } = this; + let next = { [NEXT]: this }; + let isOpened = false; + do { + next = next[NEXT]; + switch (next.nodeType) { + case ATTRIBUTE_NODE: { + const attr = " " + next; + switch (attr) { + case " id": + case " class": + case " style": break; - } - while (ancestorRules.length > 0) { - parentRule = ancestorRules.pop(); - if (parentRule === currentScope) { - continue; - } - if (!(parentRule instanceof CSSOM2.CSSGroupingRule && (parentRule.constructor.name !== "CSSStyleRule" || parentRule.__parentRule))) { - continue; - } - var isClosingNestedSelectorContext = nestedSelectorRule && (currentScope === nestedSelectorRule || nestedSelectorRule.__parentRule === currentScope); - if (isClosingNestedSelectorContext) { - if (nestedSelectorRule.parentRule) { - prevScope = nestedSelectorRule; - currentScope = nestedSelectorRule.parentRule; - var scopeId = getRuleId(prevScope); - if (!addedToCurrentScope[scopeId]) { - currentScope.cssRules.push(prevScope); - addedToCurrentScope[scopeId] = true; - } - nestedSelectorRule = currentScope; - break; - } else { - prevScope = currentScope; - var actualParent = ancestorRules.length > 0 ? ancestorRules[ancestorRules.length - 1] : nestedSelectorRule; - if (actualParent !== prevScope) { - actualParent.cssRules.push(prevScope); - } - currentScope = actualParent; - parentRule = actualParent; - break; - } - } else { - prevScope = currentScope; - if (parentRule !== prevScope) { - parentRule.cssRules.push(prevScope); - } - break; - } - } - if (ancestorRules.length === 0 && currentScope.__parentRule && currentScope.__parentRule.cssRules) { - var parentId = getRuleId(currentScope); - if (!addedToParent[parentId]) { - currentScope.__parentRule.cssRules.push(currentScope); - addedToParent[parentId] = true; - } - } - if (ancestorRules.length === 0 && currentScope.parentRule == null) { - currentScope.__ends = i + 1; - var topId = getRuleId(currentScope); - if (currentScope !== topScope && !addedToTopScope[topId]) { - topScope.cssRules.push(currentScope); - addedToTopScope[topId] = true; - } - currentScope = topScope; - if (nestedSelectorRule === parentRule) { - var nestedSelectorTokenToCurrentSelectorToken = token.slice(nestedSelectorRule.__starts, i + 1); - var openingBraceMatch = nestedSelectorTokenToCurrentSelectorToken.match(openBraceGlobalRegExp); - var closingBraceMatch = nestedSelectorTokenToCurrentSelectorToken.match(closeBraceGlobalRegExp); - var openingBraceLen = openingBraceMatch && openingBraceMatch.length; - var closingBraceLen = closingBraceMatch && closingBraceMatch.length; - if (openingBraceLen === closingBraceLen) { - nestedSelectorRule.__ends = i + 1; - nestedSelectorRule = null; - parentRule = null; - } - } else { - parentRule = null; - } - } else { - currentScope = parentRule; - } - buffer = ""; - state = "before-selector"; - break; + default: + out.push(attr); + } + break; } - break; - default: - switch (state) { - case "before-selector": - state = "selector"; - if ((styleRule || scopeRule) && parentRule) { - if (!isSelectorStartChar(character) && !isWhitespaceChar(character) && parentRule instanceof CSSOM2.CSSGroupingRule) { - state = "before-name"; - if (styleRule !== parentRule) { - styleRule = new CSSOM2.CSSNestedDeclarations(); - styleRule.__starts = i; - } - } - } else if (nestedSelectorRule && parentRule && parentRule instanceof CSSOM2.CSSGroupingRule) { - if (isSelectorStartChar(character)) { - styleRule = new CSSOM2.CSSStyleRule(); - styleRule.__starts = i; - } else if (!isWhitespaceChar(character)) { - state = "before-name"; - if (parentRule.cssRules.length || nestedSelectorRule) { - currentScope = parentRule; - if (parentRule.constructor.name === "CSSStyleRule" || parentRule.constructor.name === "CSSScopeRule") { - nestedSelectorRule = parentRule; - } - styleRule = new CSSOM2.CSSNestedDeclarations(); - styleRule.__starts = i; - } else { - if (parentRule.constructor.name === "CSSStyleRule") { - styleRule = parentRule; - } else { - styleRule = new CSSOM2.CSSStyleRule(); - styleRule.__starts = i; - } - } - } - } - break; - case "before-name": - state = "name"; - break; - case "before-value": - state = "value"; - break; - case "importRule-begin": - state = "importRule"; - break; - case "namespaceRule-begin": - state = "namespaceRule"; - break; + case NODE_END: { + const start = next[START]; + if (isOpened) { + if ("ownerSVGElement" in start) + out.push(" />"); + else if (isVoid(start)) + out.push(ignoreCase(start) ? ">" : " />"); + else + out.push(`></${start.localName}>`); + isOpened = false; + } else + out.push(`</${start.localName}>`); + break; } - buffer += character; - break; - } - if (i === initialEndingIndex && (currentScope !== topScope || ancestorRules.length > 0)) { - var needsClosing = ancestorRules.length; - if (currentScope !== topScope && ancestorRules.indexOf(currentScope) === -1) { - needsClosing += 1; - } - for (var closeIdx = 0; closeIdx < needsClosing; closeIdx++) { - token += "}"; - endingIndex += 1; + case ELEMENT_NODE: + if (isOpened) + out.push(">"); + if (next.toString !== this.toString) { + out.push(next.toString()); + next = next[END]; + isOpened = false; + } else { + out.push(`<${next.localName}`); + isOpened = true; + } + break; + case TEXT_NODE: + case COMMENT_NODE: + case CDATA_SECTION_NODE: + out.push((isOpened ? ">" : "") + next); + isOpened = false; + break; } - } + } while (next !== end); + return out.join(""); } - if (buffer.trim() !== "") { - parseError("Unexpected end of input"); + toJSON() { + const json2 = []; + elementAsJSON(this, json2); + return json2; } - return styleSheet; - }; - exports2.parse = CSSOM2.parse; - CSSOM2.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet; - CSSOM2.CSSStyleRule = require_CSSStyleRule().CSSStyleRule; - CSSOM2.CSSNestedDeclarations = require_CSSNestedDeclarations().CSSNestedDeclarations; - CSSOM2.CSSImportRule = require_CSSImportRule().CSSImportRule; - CSSOM2.CSSNamespaceRule = require_CSSNamespaceRule().CSSNamespaceRule; - CSSOM2.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule; - CSSOM2.CSSMediaRule = require_CSSMediaRule().CSSMediaRule; - CSSOM2.CSSCounterStyleRule = require_CSSCounterStyleRule().CSSCounterStyleRule; - CSSOM2.CSSPropertyRule = require_CSSPropertyRule().CSSPropertyRule; - CSSOM2.CSSContainerRule = require_CSSContainerRule().CSSContainerRule; - CSSOM2.CSSConditionRule = require_CSSConditionRule().CSSConditionRule; - CSSOM2.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule; - CSSOM2.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule; - CSSOM2.CSSHostRule = require_CSSHostRule().CSSHostRule; - CSSOM2.CSSStartingStyleRule = require_CSSStartingStyleRule().CSSStartingStyleRule; - CSSOM2.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration; - CSSOM2.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule; - CSSOM2.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule; - CSSOM2.CSSValueExpression = require_CSSValueExpression().CSSValueExpression; - CSSOM2.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule; - CSSOM2.CSSScopeRule = require_CSSScopeRule().CSSScopeRule; - CSSOM2.CSSLayerBlockRule = require_CSSLayerBlockRule().CSSLayerBlockRule; - CSSOM2.CSSLayerStatementRule = require_CSSLayerStatementRule().CSSLayerStatementRule; - CSSOM2.CSSPageRule = require_CSSPageRule().CSSPageRule; - require_cssstyleTryCatchBlock(); - } -}); - -// node_modules/@acemir/cssom/lib/CSSStyleDeclaration.js -var require_CSSStyleDeclaration = __commonJS({ - "node_modules/@acemir/cssom/lib/CSSStyleDeclaration.js"(exports2) { - init_define_import_meta_env(); - var CSSOM2 = {}; - var regexPatterns = require_regexPatterns().regexPatterns; - var indexedPropertyNameRegExp = /^(0|[1-9][0-9]*)$/; - CSSOM2.CSSStyleDeclaration = function CSSStyleDeclaration2() { - this.length = 0; - this.parentRule = null; - this._importants = {}; - }; - CSSOM2.CSSStyleDeclaration.prototype = { - constructor: CSSOM2.CSSStyleDeclaration, - /** - * - * @param {string} name - * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue - * @return {string} the value of the property if it has been explicitly set for this declaration block. - * Returns the empty string if the property has not been set. - */ - getPropertyValue: function(name) { - return this[name] || ""; - }, - /** - * - * @param {string} name - * @param {string} value - * @param {string} [priority=null] "important" or null - * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty - */ - setProperty: function(name, value, priority, parseErrorHandler) { - if (name === "length" || name === "parentRule" || name === "_importants" || name === "__starts" || name in CSSOM2.CSSStyleDeclaration.prototype || indexedPropertyNameRegExp.test(name)) { - return; - } - var basicStylePropertyValueValidationRegExp = regexPatterns.basicStylePropertyValueValidationRegExp; - if (basicStylePropertyValueValidationRegExp.test(value)) { - parseErrorHandler && parseErrorHandler('Invalid CSSStyleDeclaration property (name = "' + name + '", value = "' + value + '")'); - } else if (this[name]) { - var index2 = Array.prototype.indexOf.call(this, name); - if (index2 < 0) { - this[this.length] = name; - this.length++; - } - if (priority || !this._importants[name]) { - this.removeProperty(name); - this[this.length] = name; - this.length++; - this[name] = value + ""; - this._importants[name] = priority; - } - } else { - this[this.length] = name; - this.length++; - this[name] = value + ""; - this._importants[name] = priority; - } - }, - /** - * - * @param {string} name - * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty - * @return {string} the value of the property if it has been explicitly set for this declaration block. - * Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property. - */ - removeProperty: function(name) { - if (!(name in this)) { - return ""; - } - var index2 = Array.prototype.indexOf.call(this, name); - if (index2 < 0) { - return ""; - } - var prevValue = this[name]; - this[name] = ""; - Array.prototype.splice.call(this, index2, 1); - return prevValue; - }, - getPropertyCSSValue: function() { - }, - /** - * - * @param {String} name - */ - getPropertyPriority: function(name) { - return this._importants[name] || ""; - }, - /** - * element.style.overflow = "auto" - * element.style.getPropertyShorthand("overflow-x") - * -> "overflow" - */ - getPropertyShorthand: function() { - }, - isPropertyImplicit: function() { - }, - // Doesn't work in IE < 9 - get cssText() { - var properties = []; - for (var i = 0, length = this.length; i < length; ++i) { - var name = this[i]; - var value = this.getPropertyValue(name); - var priority = this.getPropertyPriority(name); - if (priority) { - priority = " !" + priority; - } - properties[i] = name + ": " + value + priority + ";"; - } - return properties.join(" "); - }, - set cssText(text) { - var i, name; - for (i = this.length; i--; ) { - name = this[i]; - this[name] = ""; - } - Array.prototype.splice.call(this, 0, this.length); - this._importants = {}; - var dummyRule = CSSOM2.parse("#bogus{" + text + "}").cssRules[0].style; - var length = dummyRule.length; - for (i = 0; i < length; ++i) { - name = dummyRule[i]; - this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name)); - } + // </custom> + /* c8 ignore start */ + getAttributeNS(_, name) { + return this.getAttribute(name); + } + getElementsByTagNameNS(_, name) { + return this.getElementsByTagName(name); + } + hasAttributeNS(_, name) { + return this.hasAttribute(name); + } + removeAttributeNS(_, name) { + this.removeAttribute(name); + } + setAttributeNS(_, name, value) { + this.setAttribute(name, value); } + setAttributeNodeNS(attr) { + return this.setAttributeNode(attr); + } + /* c8 ignore stop */ }; - exports2.CSSStyleDeclaration = CSSOM2.CSSStyleDeclaration; - CSSOM2.parse = require_parse3().parse; + exports2.Element = Element; } }); -// node_modules/@acemir/cssom/lib/clone.js -var require_clone = __commonJS({ - "node_modules/@acemir/cssom/lib/clone.js"(exports2) { +// node_modules/linkedom/cjs/svg/element.js +var require_element2 = __commonJS({ + "node_modules/linkedom/cjs/svg/element.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var CSSOM2 = { - CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet, - CSSRule: require_CSSRule().CSSRule, - CSSNestedDeclarations: require_CSSNestedDeclarations().CSSNestedDeclarations, - CSSStyleRule: require_CSSStyleRule().CSSStyleRule, - CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, - CSSConditionRule: require_CSSConditionRule().CSSConditionRule, - CSSMediaRule: require_CSSMediaRule().CSSMediaRule, - CSSContainerRule: require_CSSContainerRule().CSSContainerRule, - CSSSupportsRule: require_CSSSupportsRule().CSSSupportsRule, - CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, - CSSKeyframeRule: require_CSSKeyframeRule().CSSKeyframeRule, - CSSKeyframesRule: require_CSSKeyframesRule().CSSKeyframesRule, - CSSScopeRule: require_CSSScopeRule().CSSScopeRule, - CSSLayerBlockRule: require_CSSLayerBlockRule().CSSLayerBlockRule, - CSSLayerStatementRule: require_CSSLayerStatementRule().CSSLayerStatementRule + var { Element } = require_element(); + var { String: String2 } = require_utils4(); + var classNames = /* @__PURE__ */ new WeakMap(); + var handler = { + get(target, name) { + return target[name]; + }, + set(target, name, value) { + target[name] = value; + return true; + } }; - try { - CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; - } catch (e) { - } - CSSOM2.clone = function clone(stylesheet) { - var cloned = new CSSOM2.CSSStyleSheet(); - var rules = stylesheet.cssRules; - if (!rules) { - return cloned; + var SVGElement = class extends Element { + constructor(ownerDocument, localName, ownerSVGElement = null) { + super(ownerDocument, localName); + this.ownerSVGElement = ownerSVGElement; } - for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) { - var rule = rules[i]; - var ruleClone = cloned.cssRules[i] = new rule.constructor(); - var style = rule.style; - if (style) { - var styleClone = ruleClone.style = new CSSOM2.CSSStyleDeclaration(); - for (var j = 0, styleLength = style.length; j < styleLength; j++) { - var name = style[j]; - styleClone.setProperty(name, style.getPropertyValue(name), style.getPropertyPriority(name)); - } - } - if (rule.hasOwnProperty("keyText")) { - ruleClone.keyText = rule.keyText; - } - if (rule.hasOwnProperty("selectorText")) { - ruleClone.selectorText = rule.selectorText; - } - if (rule.hasOwnProperty("mediaText")) { - ruleClone.mediaText = rule.mediaText; - } - if (rule.hasOwnProperty("supportsText")) { - ruleClone.supports = rule.supports; - } - if (rule.hasOwnProperty("conditionText")) { - ruleClone.conditionText = rule.conditionText; - } - if (rule.hasOwnProperty("layerName")) { - ruleClone.layerName = rule.layerName; - } - if (rule.hasOwnProperty("href")) { - ruleClone.href = rule.href; - } - if (rule.hasOwnProperty("name")) { - ruleClone.name = rule.name; - } - if (rule.hasOwnProperty("nameList")) { - ruleClone.nameList = rule.nameList; - } - if (rule.hasOwnProperty("cssRules")) { - ruleClone.cssRules = clone(rule).cssRules; + get className() { + if (!classNames.has(this)) + classNames.set(this, new Proxy({ baseVal: "", animVal: "" }, handler)); + return classNames.get(this); + } + /* c8 ignore start */ + set className(value) { + const { classList } = this; + classList.clear(); + classList.add(...String2(value).split(/\s+/)); + } + /* c8 ignore stop */ + get namespaceURI() { + return "http://www.w3.org/2000/svg"; + } + getAttribute(name) { + return name === "class" ? [...this.classList].join(" ") : super.getAttribute(name); + } + setAttribute(name, value) { + if (name === "class") + this.className = value; + else if (name === "style") { + const { className } = this; + className.baseVal = className.animVal = value; } + super.setAttribute(name, value); } - return cloned; }; - exports2.clone = CSSOM2.clone; + exports2.SVGElement = SVGElement; } }); -// node_modules/@acemir/cssom/lib/index.js -var require_lib5 = __commonJS({ - "node_modules/@acemir/cssom/lib/index.js"(exports2) { +// node_modules/linkedom/cjs/shared/facades.js +var require_facades = __commonJS({ + "node_modules/linkedom/cjs/shared/facades.js"(exports2) { "use strict"; init_define_import_meta_env(); - exports2.setup = require_CSSOM().setup; - require_errorUtils(); - require_regexPatterns(); - exports2.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration; - require_cssstyleTryCatchBlock(); - exports2.CSSRule = require_CSSRule().CSSRule; - exports2.CSSRuleList = require_CSSRuleList().CSSRuleList; - exports2.CSSNestedDeclarations = require_CSSNestedDeclarations().CSSNestedDeclarations; - exports2.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule; - exports2.CSSCounterStyleRule = require_CSSCounterStyleRule().CSSCounterStyleRule; - exports2.CSSPropertyRule = require_CSSPropertyRule().CSSPropertyRule; - exports2.CSSConditionRule = require_CSSConditionRule().CSSConditionRule; - exports2.CSSStyleRule = require_CSSStyleRule().CSSStyleRule; - exports2.MediaList = require_MediaList().MediaList; - exports2.CSSMediaRule = require_CSSMediaRule().CSSMediaRule; - exports2.CSSContainerRule = require_CSSContainerRule().CSSContainerRule; - exports2.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule; - exports2.CSSImportRule = require_CSSImportRule().CSSImportRule; - exports2.CSSNamespaceRule = require_CSSNamespaceRule().CSSNamespaceRule; - exports2.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule; - exports2.CSSHostRule = require_CSSHostRule().CSSHostRule; - exports2.CSSStartingStyleRule = require_CSSStartingStyleRule().CSSStartingStyleRule; - exports2.StyleSheet = require_StyleSheet().StyleSheet; - exports2.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet; - exports2.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule; - exports2.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule; - exports2.MatcherList = require_MatcherList().MatcherList; - exports2.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule; - exports2.CSSValue = require_CSSValue().CSSValue; - exports2.CSSValueExpression = require_CSSValueExpression().CSSValueExpression; - exports2.CSSScopeRule = require_CSSScopeRule().CSSScopeRule; - exports2.CSSLayerBlockRule = require_CSSLayerBlockRule().CSSLayerBlockRule; - exports2.CSSLayerStatementRule = require_CSSLayerStatementRule().CSSLayerStatementRule; - exports2.CSSPageRule = require_CSSPageRule().CSSPageRule; - exports2.parse = require_parse3().parse; - exports2.clone = require_clone().clone; + var { Attr: _Attr } = require_attr(); + var { CharacterData: _CharacterData } = require_character_data(); + var { CDATASection: _CDATASection } = require_cdata_section(); + var { Comment: _Comment } = require_comment(); + var { DocumentFragment: _DocumentFragment } = require_document_fragment(); + var { DocumentType: _DocumentType } = require_document_type(); + var { Element: _Element } = require_element(); + var { Node: _Node } = require_node3(); + var { ShadowRoot: _ShadowRoot } = require_shadow_root(); + var { Text: _Text } = require_text2(); + var { SVGElement: _SVGElement } = require_element2(); + var { setPrototypeOf } = require_object(); + var illegalConstructor = () => { + throw new TypeError("Illegal constructor"); + }; + exports2.illegalConstructor = illegalConstructor; + function Attr() { + illegalConstructor(); + } + exports2.Attr = Attr; + setPrototypeOf(Attr, _Attr); + Attr.prototype = _Attr.prototype; + function CDATASection() { + illegalConstructor(); + } + exports2.CDATASection = CDATASection; + setPrototypeOf(CDATASection, _CDATASection); + CDATASection.prototype = _CDATASection.prototype; + function CharacterData() { + illegalConstructor(); + } + exports2.CharacterData = CharacterData; + setPrototypeOf(CharacterData, _CharacterData); + CharacterData.prototype = _CharacterData.prototype; + function Comment4() { + illegalConstructor(); + } + exports2.Comment = Comment4; + setPrototypeOf(Comment4, _Comment); + Comment4.prototype = _Comment.prototype; + function DocumentFragment() { + illegalConstructor(); + } + exports2.DocumentFragment = DocumentFragment; + setPrototypeOf(DocumentFragment, _DocumentFragment); + DocumentFragment.prototype = _DocumentFragment.prototype; + function DocumentType() { + illegalConstructor(); + } + exports2.DocumentType = DocumentType; + setPrototypeOf(DocumentType, _DocumentType); + DocumentType.prototype = _DocumentType.prototype; + function Element() { + illegalConstructor(); + } + exports2.Element = Element; + setPrototypeOf(Element, _Element); + Element.prototype = _Element.prototype; + function Node() { + illegalConstructor(); + } + exports2.Node = Node; + setPrototypeOf(Node, _Node); + Node.prototype = _Node.prototype; + function ShadowRoot() { + illegalConstructor(); + } + exports2.ShadowRoot = ShadowRoot; + setPrototypeOf(ShadowRoot, _ShadowRoot); + ShadowRoot.prototype = _ShadowRoot.prototype; + function Text4() { + illegalConstructor(); + } + exports2.Text = Text4; + setPrototypeOf(Text4, _Text); + Text4.prototype = _Text.prototype; + function SVGElement() { + illegalConstructor(); + } + exports2.SVGElement = SVGElement; + setPrototypeOf(SVGElement, _SVGElement); + SVGElement.prototype = _SVGElement.prototype; + var Facades = { + Attr, + CDATASection, + CharacterData, + Comment: Comment4, + DocumentFragment, + DocumentType, + Element, + Node, + ShadowRoot, + Text: Text4, + SVGElement + }; + exports2.Facades = Facades; } }); -// node_modules/linkedom/commonjs/canvas-shim.cjs -var require_canvas_shim = __commonJS({ - "node_modules/linkedom/commonjs/canvas-shim.cjs"(exports2, module2) { +// node_modules/linkedom/cjs/html/element.js +var require_element3 = __commonJS({ + "node_modules/linkedom/cjs/html/element.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var Canvas2 = class { - constructor(width, height) { - this.width = width; - this.height = height; + var { END, UPGRADE } = require_symbols(); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { Event: Event2 } = require_event(); + var { Element } = require_element(); + var { Classes, customElements } = require_custom_element_registry(); + var Level0 = /* @__PURE__ */ new WeakMap(); + var level0 = { + get(element, name) { + return Level0.has(element) && Level0.get(element)[name] || null; + }, + set(element, name, value) { + if (!Level0.has(element)) + Level0.set(element, {}); + const handlers = Level0.get(element); + const type = name.slice(2); + if (handlers[name]) + element.removeEventListener(type, handlers[name], false); + if (handlers[name] = value) + element.addEventListener(type, value, false); + } + }; + var HTMLElement2 = class extends Element { + static get observedAttributes() { + return []; } - getContext() { - return null; + constructor(ownerDocument = null, localName = "") { + super(ownerDocument, localName); + const ownerLess = !ownerDocument; + let options; + if (ownerLess) { + const { constructor: Class } = this; + if (!Classes.has(Class)) + throw new Error("unable to initialize this Custom Element"); + ({ ownerDocument, localName, options } = Classes.get(Class)); + } + if (ownerDocument[UPGRADE]) { + const { element, values } = ownerDocument[UPGRADE]; + ownerDocument[UPGRADE] = null; + for (const [key, value] of values) + element[key] = value; + return element; + } + if (ownerLess) { + this.ownerDocument = this[END].ownerDocument = ownerDocument; + this.localName = localName; + customElements.set(this, { connected: false }); + if (options.is) + this.setAttribute("is", options.is); + } + } + /* c8 ignore start */ + /* TODO: what about these? + offsetHeight + offsetLeft + offsetParent + offsetTop + offsetWidth + */ + blur() { + this.dispatchEvent(new Event2("blur")); } - toDataURL() { - return ""; + click() { + const clickEvent = new Event2("click", { bubbles: true, cancelable: true }); + clickEvent.button = 0; + this.dispatchEvent(clickEvent); + } + // Boolean getters + get accessKeyLabel() { + const { accessKey } = this; + return accessKey && `Alt+Shift+${accessKey}`; + } + get isContentEditable() { + return this.hasAttribute("contenteditable"); + } + // Boolean Accessors + get contentEditable() { + return booleanAttribute.get(this, "contenteditable"); + } + set contentEditable(value) { + booleanAttribute.set(this, "contenteditable", value); + } + get draggable() { + return booleanAttribute.get(this, "draggable"); + } + set draggable(value) { + booleanAttribute.set(this, "draggable", value); + } + get hidden() { + return booleanAttribute.get(this, "hidden"); + } + set hidden(value) { + booleanAttribute.set(this, "hidden", value); + } + get spellcheck() { + return booleanAttribute.get(this, "spellcheck"); + } + set spellcheck(value) { + booleanAttribute.set(this, "spellcheck", value); + } + // String Accessors + get accessKey() { + return stringAttribute.get(this, "accesskey"); + } + set accessKey(value) { + stringAttribute.set(this, "accesskey", value); + } + get dir() { + return stringAttribute.get(this, "dir"); + } + set dir(value) { + stringAttribute.set(this, "dir", value); + } + get lang() { + return stringAttribute.get(this, "lang"); + } + set lang(value) { + stringAttribute.set(this, "lang", value); + } + get title() { + return stringAttribute.get(this, "title"); + } + set title(value) { + stringAttribute.set(this, "title", value); + } + // DOM Level 0 + get onabort() { + return level0.get(this, "onabort"); + } + set onabort(value) { + level0.set(this, "onabort", value); + } + get onblur() { + return level0.get(this, "onblur"); + } + set onblur(value) { + level0.set(this, "onblur", value); + } + get oncancel() { + return level0.get(this, "oncancel"); + } + set oncancel(value) { + level0.set(this, "oncancel", value); + } + get oncanplay() { + return level0.get(this, "oncanplay"); + } + set oncanplay(value) { + level0.set(this, "oncanplay", value); + } + get oncanplaythrough() { + return level0.get(this, "oncanplaythrough"); + } + set oncanplaythrough(value) { + level0.set(this, "oncanplaythrough", value); + } + get onchange() { + return level0.get(this, "onchange"); + } + set onchange(value) { + level0.set(this, "onchange", value); + } + get onclick() { + return level0.get(this, "onclick"); + } + set onclick(value) { + level0.set(this, "onclick", value); + } + get onclose() { + return level0.get(this, "onclose"); + } + set onclose(value) { + level0.set(this, "onclose", value); + } + get oncontextmenu() { + return level0.get(this, "oncontextmenu"); + } + set oncontextmenu(value) { + level0.set(this, "oncontextmenu", value); + } + get oncuechange() { + return level0.get(this, "oncuechange"); + } + set oncuechange(value) { + level0.set(this, "oncuechange", value); + } + get ondblclick() { + return level0.get(this, "ondblclick"); + } + set ondblclick(value) { + level0.set(this, "ondblclick", value); + } + get ondrag() { + return level0.get(this, "ondrag"); + } + set ondrag(value) { + level0.set(this, "ondrag", value); + } + get ondragend() { + return level0.get(this, "ondragend"); + } + set ondragend(value) { + level0.set(this, "ondragend", value); + } + get ondragenter() { + return level0.get(this, "ondragenter"); + } + set ondragenter(value) { + level0.set(this, "ondragenter", value); + } + get ondragleave() { + return level0.get(this, "ondragleave"); + } + set ondragleave(value) { + level0.set(this, "ondragleave", value); + } + get ondragover() { + return level0.get(this, "ondragover"); + } + set ondragover(value) { + level0.set(this, "ondragover", value); + } + get ondragstart() { + return level0.get(this, "ondragstart"); + } + set ondragstart(value) { + level0.set(this, "ondragstart", value); + } + get ondrop() { + return level0.get(this, "ondrop"); + } + set ondrop(value) { + level0.set(this, "ondrop", value); + } + get ondurationchange() { + return level0.get(this, "ondurationchange"); + } + set ondurationchange(value) { + level0.set(this, "ondurationchange", value); + } + get onemptied() { + return level0.get(this, "onemptied"); + } + set onemptied(value) { + level0.set(this, "onemptied", value); + } + get onended() { + return level0.get(this, "onended"); + } + set onended(value) { + level0.set(this, "onended", value); + } + get onerror() { + return level0.get(this, "onerror"); + } + set onerror(value) { + level0.set(this, "onerror", value); + } + get onfocus() { + return level0.get(this, "onfocus"); + } + set onfocus(value) { + level0.set(this, "onfocus", value); + } + get oninput() { + return level0.get(this, "oninput"); + } + set oninput(value) { + level0.set(this, "oninput", value); + } + get oninvalid() { + return level0.get(this, "oninvalid"); + } + set oninvalid(value) { + level0.set(this, "oninvalid", value); + } + get onkeydown() { + return level0.get(this, "onkeydown"); + } + set onkeydown(value) { + level0.set(this, "onkeydown", value); + } + get onkeypress() { + return level0.get(this, "onkeypress"); + } + set onkeypress(value) { + level0.set(this, "onkeypress", value); + } + get onkeyup() { + return level0.get(this, "onkeyup"); + } + set onkeyup(value) { + level0.set(this, "onkeyup", value); + } + get onload() { + return level0.get(this, "onload"); + } + set onload(value) { + level0.set(this, "onload", value); + } + get onloadeddata() { + return level0.get(this, "onloadeddata"); + } + set onloadeddata(value) { + level0.set(this, "onloadeddata", value); + } + get onloadedmetadata() { + return level0.get(this, "onloadedmetadata"); + } + set onloadedmetadata(value) { + level0.set(this, "onloadedmetadata", value); + } + get onloadstart() { + return level0.get(this, "onloadstart"); + } + set onloadstart(value) { + level0.set(this, "onloadstart", value); + } + get onmousedown() { + return level0.get(this, "onmousedown"); + } + set onmousedown(value) { + level0.set(this, "onmousedown", value); + } + get onmouseenter() { + return level0.get(this, "onmouseenter"); + } + set onmouseenter(value) { + level0.set(this, "onmouseenter", value); + } + get onmouseleave() { + return level0.get(this, "onmouseleave"); + } + set onmouseleave(value) { + level0.set(this, "onmouseleave", value); + } + get onmousemove() { + return level0.get(this, "onmousemove"); + } + set onmousemove(value) { + level0.set(this, "onmousemove", value); + } + get onmouseout() { + return level0.get(this, "onmouseout"); + } + set onmouseout(value) { + level0.set(this, "onmouseout", value); + } + get onmouseover() { + return level0.get(this, "onmouseover"); + } + set onmouseover(value) { + level0.set(this, "onmouseover", value); + } + get onmouseup() { + return level0.get(this, "onmouseup"); + } + set onmouseup(value) { + level0.set(this, "onmouseup", value); + } + get onmousewheel() { + return level0.get(this, "onmousewheel"); + } + set onmousewheel(value) { + level0.set(this, "onmousewheel", value); + } + get onpause() { + return level0.get(this, "onpause"); + } + set onpause(value) { + level0.set(this, "onpause", value); + } + get onplay() { + return level0.get(this, "onplay"); + } + set onplay(value) { + level0.set(this, "onplay", value); + } + get onplaying() { + return level0.get(this, "onplaying"); + } + set onplaying(value) { + level0.set(this, "onplaying", value); + } + get onprogress() { + return level0.get(this, "onprogress"); + } + set onprogress(value) { + level0.set(this, "onprogress", value); + } + get onratechange() { + return level0.get(this, "onratechange"); + } + set onratechange(value) { + level0.set(this, "onratechange", value); + } + get onreset() { + return level0.get(this, "onreset"); + } + set onreset(value) { + level0.set(this, "onreset", value); + } + get onresize() { + return level0.get(this, "onresize"); + } + set onresize(value) { + level0.set(this, "onresize", value); + } + get onscroll() { + return level0.get(this, "onscroll"); + } + set onscroll(value) { + level0.set(this, "onscroll", value); + } + get onseeked() { + return level0.get(this, "onseeked"); + } + set onseeked(value) { + level0.set(this, "onseeked", value); + } + get onseeking() { + return level0.get(this, "onseeking"); + } + set onseeking(value) { + level0.set(this, "onseeking", value); + } + get onselect() { + return level0.get(this, "onselect"); + } + set onselect(value) { + level0.set(this, "onselect", value); + } + get onshow() { + return level0.get(this, "onshow"); + } + set onshow(value) { + level0.set(this, "onshow", value); + } + get onstalled() { + return level0.get(this, "onstalled"); + } + set onstalled(value) { + level0.set(this, "onstalled", value); + } + get onsubmit() { + return level0.get(this, "onsubmit"); } + set onsubmit(value) { + level0.set(this, "onsubmit", value); + } + get onsuspend() { + return level0.get(this, "onsuspend"); + } + set onsuspend(value) { + level0.set(this, "onsuspend", value); + } + get ontimeupdate() { + return level0.get(this, "ontimeupdate"); + } + set ontimeupdate(value) { + level0.set(this, "ontimeupdate", value); + } + get ontoggle() { + return level0.get(this, "ontoggle"); + } + set ontoggle(value) { + level0.set(this, "ontoggle", value); + } + get onvolumechange() { + return level0.get(this, "onvolumechange"); + } + set onvolumechange(value) { + level0.set(this, "onvolumechange", value); + } + get onwaiting() { + return level0.get(this, "onwaiting"); + } + set onwaiting(value) { + level0.set(this, "onwaiting", value); + } + get onauxclick() { + return level0.get(this, "onauxclick"); + } + set onauxclick(value) { + level0.set(this, "onauxclick", value); + } + get ongotpointercapture() { + return level0.get(this, "ongotpointercapture"); + } + set ongotpointercapture(value) { + level0.set(this, "ongotpointercapture", value); + } + get onlostpointercapture() { + return level0.get(this, "onlostpointercapture"); + } + set onlostpointercapture(value) { + level0.set(this, "onlostpointercapture", value); + } + get onpointercancel() { + return level0.get(this, "onpointercancel"); + } + set onpointercancel(value) { + level0.set(this, "onpointercancel", value); + } + get onpointerdown() { + return level0.get(this, "onpointerdown"); + } + set onpointerdown(value) { + level0.set(this, "onpointerdown", value); + } + get onpointerenter() { + return level0.get(this, "onpointerenter"); + } + set onpointerenter(value) { + level0.set(this, "onpointerenter", value); + } + get onpointerleave() { + return level0.get(this, "onpointerleave"); + } + set onpointerleave(value) { + level0.set(this, "onpointerleave", value); + } + get onpointermove() { + return level0.get(this, "onpointermove"); + } + set onpointermove(value) { + level0.set(this, "onpointermove", value); + } + get onpointerout() { + return level0.get(this, "onpointerout"); + } + set onpointerout(value) { + level0.set(this, "onpointerout", value); + } + get onpointerover() { + return level0.get(this, "onpointerover"); + } + set onpointerover(value) { + level0.set(this, "onpointerover", value); + } + get onpointerup() { + return level0.get(this, "onpointerup"); + } + set onpointerup(value) { + level0.set(this, "onpointerup", value); + } + /* c8 ignore stop */ }; - module2.exports = { - createCanvas: (width, height) => new Canvas2(width, height) + exports2.HTMLElement = HTMLElement2; + } +}); + +// node_modules/linkedom/cjs/html/template-element.js +var require_template_element = __commonJS({ + "node_modules/linkedom/cjs/html/template-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { CONTENT, PRIVATE } = require_symbols(); + var { registerHTMLClass } = require_register_html_class(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "template"; + var HTMLTemplateElement = class extends HTMLElement2 { + constructor(ownerDocument) { + super(ownerDocument, tagName); + const content = this.ownerDocument.createDocumentFragment(); + (this[CONTENT] = content)[PRIVATE] = this; + } + get content() { + if (this.hasChildNodes() && !this[CONTENT].hasChildNodes()) { + for (const node of this.childNodes) + this[CONTENT].appendChild(node.cloneNode(true)); + } + return this[CONTENT]; + } }; + registerHTMLClass(tagName, HTMLTemplateElement); + exports2.HTMLTemplateElement = HTMLTemplateElement; } }); -// node_modules/linkedom/commonjs/canvas.cjs -var require_canvas = __commonJS({ - "node_modules/linkedom/commonjs/canvas.cjs"(exports2, module2) { +// node_modules/linkedom/cjs/html/html-element.js +var require_html_element = __commonJS({ + "node_modules/linkedom/cjs/html/html-element.js"(exports2) { + "use strict"; init_define_import_meta_env(); - try { - module2.exports = require("canvas"); - } catch (fallback) { - module2.exports = require_canvas_shim(); - } + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLHtmlElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "html") { + super(ownerDocument, localName); + } + }; + exports2.HTMLHtmlElement = HTMLHtmlElement; } }); -// node_modules/telegram/inspect.js -var require_inspect = __commonJS({ - "node_modules/telegram/inspect.js"(exports2) { +// node_modules/linkedom/cjs/html/text-element.js +var require_text_element = __commonJS({ + "node_modules/linkedom/cjs/html/text-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.inspect = void 0; - var util_1 = require("util"); - Object.defineProperty(exports2, "inspect", { enumerable: true, get: function() { - return util_1.inspect; - } }); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { toString } = HTMLElement2.prototype; + var TextElement = class extends HTMLElement2 { + get innerHTML() { + return this.textContent; + } + set innerHTML(html) { + this.textContent = html; + } + toString() { + const outerHTML = toString.call(this.cloneNode()); + return outerHTML.replace("><", () => `>${this.textContent}<`); + } + }; + exports2.TextElement = TextElement; } }); -// node_modules/big-integer/BigInteger.js -var require_BigInteger = __commonJS({ - "node_modules/big-integer/BigInteger.js"(exports2, module2) { +// node_modules/linkedom/cjs/html/script-element.js +var require_script_element = __commonJS({ + "node_modules/linkedom/cjs/html/script-element.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var bigInt = (function(undefined2) { - "use strict"; - var BASE2 = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; - var supportsNativeBigInt = typeof BigInt === "function"; - function Integer(v, radix, alphabet, caseSensitive) { - if (typeof v === "undefined") return Integer[0]; - if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); - return parseValue(v); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { registerHTMLClass } = require_register_html_class(); + var { TextElement } = require_text_element(); + var tagName = "script"; + var HTMLScriptElement = class extends TextElement { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - function BigInteger(value, sign) { - this.value = value; - this.sign = sign; - this.isSmall = false; + get type() { + return stringAttribute.get(this, "type"); } - BigInteger.prototype = Object.create(Integer.prototype); - function SmallInteger(value) { - this.value = value; - this.sign = value < 0; - this.isSmall = true; + set type(value) { + stringAttribute.set(this, "type", value); } - SmallInteger.prototype = Object.create(Integer.prototype); - function NativeBigInt(value) { - this.value = value; + get src() { + return stringAttribute.get(this, "src"); } - NativeBigInt.prototype = Object.create(Integer.prototype); - function isPrecise(n) { - return -MAX_INT < n && n < MAX_INT; + set src(value) { + stringAttribute.set(this, "src", value); } - function smallToArray(n) { - if (n < 1e7) - return [n]; - if (n < 1e14) - return [n % 1e7, Math.floor(n / 1e7)]; - return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; + get defer() { + return booleanAttribute.get(this, "defer"); } - function arrayToSmall(arr) { - trim(arr); - var length = arr.length; - if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { - switch (length) { - case 0: - return 0; - case 1: - return arr[0]; - case 2: - return arr[0] + arr[1] * BASE2; - default: - return arr[0] + (arr[1] + arr[2] * BASE2) * BASE2; - } - } - return arr; + set defer(value) { + booleanAttribute.set(this, "defer", value); } - function trim(v) { - var i2 = v.length; - while (v[--i2] === 0) ; - v.length = i2 + 1; + get crossOrigin() { + return stringAttribute.get(this, "crossorigin"); } - function createArray(length) { - var x = new Array(length); - var i2 = -1; - while (++i2 < length) { - x[i2] = 0; - } - return x; + set crossOrigin(value) { + stringAttribute.set(this, "crossorigin", value); } - function truncate(n) { - if (n > 0) return Math.floor(n); - return Math.ceil(n); + get nomodule() { + return booleanAttribute.get(this, "nomodule"); } - function add2(a, b) { - var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE2, sum, i2; - for (i2 = 0; i2 < l_b; i2++) { - sum = a[i2] + b[i2] + carry; - carry = sum >= base ? 1 : 0; - r[i2] = sum - carry * base; - } - while (i2 < l_a) { - sum = a[i2] + carry; - carry = sum === base ? 1 : 0; - r[i2++] = sum - carry * base; - } - if (carry > 0) r.push(carry); - return r; + set nomodule(value) { + booleanAttribute.set(this, "nomodule", value); } - function addAny(a, b) { - if (a.length >= b.length) return add2(a, b); - return add2(b, a); + get referrerPolicy() { + return stringAttribute.get(this, "referrerpolicy"); } - function addSmall(a, carry) { - var l = a.length, r = new Array(l), base = BASE2, sum, i2; - for (i2 = 0; i2 < l; i2++) { - sum = a[i2] - base + carry; - carry = Math.floor(sum / base); - r[i2] = sum - carry * base; - carry += 1; - } - while (carry > 0) { - r[i2++] = carry % base; - carry = Math.floor(carry / base); - } - return r; + set referrerPolicy(value) { + stringAttribute.set(this, "referrerpolicy", value); } - BigInteger.prototype.add = function(v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.subtract(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) { - return new BigInteger(addSmall(a, Math.abs(b)), this.sign); - } - return new BigInteger(addAny(a, b), this.sign); - }; - BigInteger.prototype.plus = BigInteger.prototype.add; - SmallInteger.prototype.add = function(v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.subtract(n.negate()); - } - var b = n.value; - if (n.isSmall) { - if (isPrecise(a + b)) return new SmallInteger(a + b); - b = smallToArray(Math.abs(b)); - } - return new BigInteger(addSmall(b, Math.abs(a)), a < 0); - }; - SmallInteger.prototype.plus = SmallInteger.prototype.add; - NativeBigInt.prototype.add = function(v) { - return new NativeBigInt(this.value + parseValue(v).value); - }; - NativeBigInt.prototype.plus = NativeBigInt.prototype.add; - function subtract(a, b) { - var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE2, i2, difference; - for (i2 = 0; i2 < b_l; i2++) { - difference = a[i2] - borrow - b[i2]; - if (difference < 0) { - difference += base; - borrow = 1; - } else borrow = 0; - r[i2] = difference; - } - for (i2 = b_l; i2 < a_l; i2++) { - difference = a[i2] - borrow; - if (difference < 0) difference += base; - else { - r[i2++] = difference; - break; - } - r[i2] = difference; - } - for (; i2 < a_l; i2++) { - r[i2] = a[i2]; - } - trim(r); - return r; + get nonce() { + return stringAttribute.get(this, "nonce"); } - function subtractAny(a, b, sign) { - var value; - if (compareAbs(a, b) >= 0) { - value = subtract(a, b); - } else { - value = subtract(b, a); - sign = !sign; - } - value = arrayToSmall(value); - if (typeof value === "number") { - if (sign) value = -value; - return new SmallInteger(value); - } - return new BigInteger(value, sign); + set nonce(value) { + stringAttribute.set(this, "nonce", value); } - function subtractSmall(a, b, sign) { - var l = a.length, r = new Array(l), carry = -b, base = BASE2, i2, difference; - for (i2 = 0; i2 < l; i2++) { - difference = a[i2] + carry; - carry = Math.floor(difference / base); - difference %= base; - r[i2] = difference < 0 ? difference + base : difference; - } - r = arrayToSmall(r); - if (typeof r === "number") { - if (sign) r = -r; - return new SmallInteger(r); - } - return new BigInteger(r, sign); + get async() { + return booleanAttribute.get(this, "async"); } - BigInteger.prototype.subtract = function(v) { - var n = parseValue(v); - if (this.sign !== n.sign) { - return this.add(n.negate()); - } - var a = this.value, b = n.value; - if (n.isSmall) - return subtractSmall(a, Math.abs(b), this.sign); - return subtractAny(a, b, this.sign); - }; - BigInteger.prototype.minus = BigInteger.prototype.subtract; - SmallInteger.prototype.subtract = function(v) { - var n = parseValue(v); - var a = this.value; - if (a < 0 !== n.sign) { - return this.add(n.negate()); - } - var b = n.value; - if (n.isSmall) { - return new SmallInteger(a - b); - } - return subtractSmall(b, Math.abs(a), a >= 0); - }; - SmallInteger.prototype.minus = SmallInteger.prototype.subtract; - NativeBigInt.prototype.subtract = function(v) { - return new NativeBigInt(this.value - parseValue(v).value); - }; - NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; - BigInteger.prototype.negate = function() { - return new BigInteger(this.value, !this.sign); - }; - SmallInteger.prototype.negate = function() { - var sign = this.sign; - var small = new SmallInteger(-this.value); - small.sign = !sign; - return small; - }; - NativeBigInt.prototype.negate = function() { - return new NativeBigInt(-this.value); - }; - BigInteger.prototype.abs = function() { - return new BigInteger(this.value, false); - }; - SmallInteger.prototype.abs = function() { - return new SmallInteger(Math.abs(this.value)); - }; - NativeBigInt.prototype.abs = function() { - return new NativeBigInt(this.value >= 0 ? this.value : -this.value); - }; - function multiplyLong(a, b) { - var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE2, product, carry, i2, a_i, b_j; - for (i2 = 0; i2 < a_l; ++i2) { - a_i = a[i2]; - for (var j = 0; j < b_l; ++j) { - b_j = b[j]; - product = a_i * b_j + r[i2 + j]; - carry = Math.floor(product / base); - r[i2 + j] = product - carry * base; - r[i2 + j + 1] += carry; - } - } - trim(r); - return r; + set async(value) { + booleanAttribute.set(this, "async", value); } - function multiplySmall(a, b) { - var l = a.length, r = new Array(l), base = BASE2, carry = 0, product, i2; - for (i2 = 0; i2 < l; i2++) { - product = a[i2] * b + carry; - carry = Math.floor(product / base); - r[i2] = product - carry * base; - } - while (carry > 0) { - r[i2++] = carry % base; - carry = Math.floor(carry / base); - } - return r; + get text() { + return this.textContent; } - function shiftLeft(x, n) { - var r = []; - while (n-- > 0) r.push(0); - return r.concat(x); + set text(content) { + this.textContent = content; } - function multiplyKaratsuba(x, y) { - var n = Math.max(x.length, y.length); - if (n <= 30) return multiplyLong(x, y); - n = Math.ceil(n / 2); - var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n); - var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); - var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); - trim(product); - return product; + }; + registerHTMLClass(tagName, HTMLScriptElement); + exports2.HTMLScriptElement = HTMLScriptElement; + } +}); + +// node_modules/linkedom/cjs/html/frame-element.js +var require_frame_element = __commonJS({ + "node_modules/linkedom/cjs/html/frame-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLFrameElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "frame") { + super(ownerDocument, localName); } - function useKaratsuba(l1, l2) { - return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0; + }; + exports2.HTMLFrameElement = HTMLFrameElement; + } +}); + +// node_modules/linkedom/cjs/html/i-frame-element.js +var require_i_frame_element = __commonJS({ + "node_modules/linkedom/cjs/html/i-frame-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "iframe"; + var HTMLIFrameElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - BigInteger.prototype.multiply = function(v) { - var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs; - if (n.isSmall) { - if (b === 0) return Integer[0]; - if (b === 1) return this; - if (b === -1) return this.negate(); - abs = Math.abs(b); - if (abs < BASE2) { - return new BigInteger(multiplySmall(a, abs), sign); - } - b = smallToArray(abs); - } - if (useKaratsuba(a.length, b.length)) - return new BigInteger(multiplyKaratsuba(a, b), sign); - return new BigInteger(multiplyLong(a, b), sign); - }; - BigInteger.prototype.times = BigInteger.prototype.multiply; - function multiplySmallAndArray(a, b, sign) { - if (a < BASE2) { - return new BigInteger(multiplySmall(b, a), sign); - } - return new BigInteger(multiplyLong(b, smallToArray(a)), sign); + /* c8 ignore start */ + get src() { + return stringAttribute.get(this, "src"); } - SmallInteger.prototype._multiplyBySmall = function(a) { - if (isPrecise(a.value * this.value)) { - return new SmallInteger(a.value * this.value); - } - return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); - }; - BigInteger.prototype._multiplyBySmall = function(a) { - if (a.value === 0) return Integer[0]; - if (a.value === 1) return this; - if (a.value === -1) return this.negate(); - return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); - }; - SmallInteger.prototype.multiply = function(v) { - return parseValue(v)._multiplyBySmall(this); - }; - SmallInteger.prototype.times = SmallInteger.prototype.multiply; - NativeBigInt.prototype.multiply = function(v) { - return new NativeBigInt(this.value * parseValue(v).value); - }; - NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; - function square(a) { - var l = a.length, r = createArray(l + l), base = BASE2, product, carry, i2, a_i, a_j; - for (i2 = 0; i2 < l; i2++) { - a_i = a[i2]; - carry = 0 - a_i * a_i; - for (var j = i2; j < l; j++) { - a_j = a[j]; - product = 2 * (a_i * a_j) + r[i2 + j] + carry; - carry = Math.floor(product / base); - r[i2 + j] = product - carry * base; - } - r[i2 + l] = carry; - } - trim(r); - return r; + set src(value) { + stringAttribute.set(this, "src", value); } - BigInteger.prototype.square = function() { - return new BigInteger(square(this.value), false); - }; - SmallInteger.prototype.square = function() { - var value = this.value * this.value; - if (isPrecise(value)) return new SmallInteger(value); - return new BigInteger(square(smallToArray(Math.abs(this.value))), false); - }; - NativeBigInt.prototype.square = function(v) { - return new NativeBigInt(this.value * this.value); - }; - function divMod1(a, b) { - var a_l = a.length, b_l = b.length, base = BASE2, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q; - if (remainder.length <= a_l) remainder.push(0); - divisor.push(0); - divisorMostSignificantDigit = divisor[b_l - 1]; - for (shift = a_l - b_l; shift >= 0; shift--) { - quotientDigit = base - 1; - if (remainder[shift + b_l] !== divisorMostSignificantDigit) { - quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); - } - carry = 0; - borrow = 0; - l = divisor.length; - for (i2 = 0; i2 < l; i2++) { - carry += quotientDigit * divisor[i2]; - q = Math.floor(carry / base); - borrow += remainder[shift + i2] - (carry - q * base); - carry = q; - if (borrow < 0) { - remainder[shift + i2] = borrow + base; - borrow = -1; - } else { - remainder[shift + i2] = borrow; - borrow = 0; - } - } - while (borrow !== 0) { - quotientDigit -= 1; - carry = 0; - for (i2 = 0; i2 < l; i2++) { - carry += remainder[shift + i2] - base + divisor[i2]; - if (carry < 0) { - remainder[shift + i2] = carry + base; - carry = 0; - } else { - remainder[shift + i2] = carry; - carry = 1; - } - } - borrow += carry; - } - result[shift] = quotientDigit; - } - remainder = divModSmall(remainder, lambda)[0]; - return [arrayToSmall(result), arrayToSmall(remainder)]; + get srcdoc() { + return stringAttribute.get(this, "srcdoc"); } - function divMod2(a, b) { - var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE2, guess, xlen, highx, highy, check; - while (a_l) { - part.unshift(a[--a_l]); - trim(part); - if (compareAbs(part, b) < 0) { - result.push(0); - continue; - } - xlen = part.length; - highx = part[xlen - 1] * base + part[xlen - 2]; - highy = b[b_l - 1] * base + b[b_l - 2]; - if (xlen > b_l) { - highx = (highx + 1) * base; - } - guess = Math.ceil(highx / highy); - do { - check = multiplySmall(b, guess); - if (compareAbs(check, part) <= 0) break; - guess--; - } while (guess); - result.push(guess); - part = subtract(part, check); - } - result.reverse(); - return [arrayToSmall(result), arrayToSmall(part)]; + set srcdoc(value) { + stringAttribute.set(this, "srcdoc", value); } - function divModSmall(value, lambda) { - var length = value.length, quotient = createArray(length), base = BASE2, i2, q, remainder, divisor; - remainder = 0; - for (i2 = length - 1; i2 >= 0; --i2) { - divisor = remainder * base + value[i2]; - q = truncate(divisor / lambda); - remainder = divisor - q * lambda; - quotient[i2] = q | 0; - } - return [quotient, remainder | 0]; + get name() { + return stringAttribute.get(this, "name"); } - function divModAny(self2, v) { - var value, n = parseValue(v); - if (supportsNativeBigInt) { - return [new NativeBigInt(self2.value / n.value), new NativeBigInt(self2.value % n.value)]; - } - var a = self2.value, b = n.value; - var quotient; - if (b === 0) throw new Error("Cannot divide by zero"); - if (self2.isSmall) { - if (n.isSmall) { - return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; - } - return [Integer[0], self2]; - } - if (n.isSmall) { - if (b === 1) return [self2, Integer[0]]; - if (b == -1) return [self2.negate(), Integer[0]]; - var abs = Math.abs(b); - if (abs < BASE2) { - value = divModSmall(a, abs); - quotient = arrayToSmall(value[0]); - var remainder = value[1]; - if (self2.sign) remainder = -remainder; - if (typeof quotient === "number") { - if (self2.sign !== n.sign) quotient = -quotient; - return [new SmallInteger(quotient), new SmallInteger(remainder)]; - } - return [new BigInteger(quotient, self2.sign !== n.sign), new SmallInteger(remainder)]; + set name(value) { + stringAttribute.set(this, "name", value); + } + get allow() { + return stringAttribute.get(this, "allow"); + } + set allow(value) { + stringAttribute.set(this, "allow", value); + } + get allowFullscreen() { + return booleanAttribute.get(this, "allowfullscreen"); + } + set allowFullscreen(value) { + booleanAttribute.set(this, "allowfullscreen", value); + } + get referrerPolicy() { + return stringAttribute.get(this, "referrerpolicy"); + } + set referrerPolicy(value) { + stringAttribute.set(this, "referrerpolicy", value); + } + get loading() { + return stringAttribute.get(this, "loading"); + } + set loading(value) { + stringAttribute.set(this, "loading", value); + } + /* c8 ignore stop */ + }; + registerHTMLClass(tagName, HTMLIFrameElement); + exports2.HTMLIFrameElement = HTMLIFrameElement; + } +}); + +// node_modules/linkedom/cjs/html/object-element.js +var require_object_element = __commonJS({ + "node_modules/linkedom/cjs/html/object-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLObjectElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "object") { + super(ownerDocument, localName); + } + }; + exports2.HTMLObjectElement = HTMLObjectElement; + } +}); + +// node_modules/linkedom/cjs/html/head-element.js +var require_head_element = __commonJS({ + "node_modules/linkedom/cjs/html/head-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLHeadElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "head") { + super(ownerDocument, localName); + } + }; + exports2.HTMLHeadElement = HTMLHeadElement; + } +}); + +// node_modules/linkedom/cjs/html/body-element.js +var require_body_element = __commonJS({ + "node_modules/linkedom/cjs/html/body-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLBodyElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "body") { + super(ownerDocument, localName); + } + }; + exports2.HTMLBodyElement = HTMLBodyElement; + } +}); + +// node_modules/@acemir/cssom/lib/CSSOM.js +var require_CSSOM = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSOM.js"(exports2, module2) { + init_define_import_meta_env(); + var CSSOM2 = { + /** + * Creates and configures a new CSSOM instance with the specified options. + * + * @param {Object} opts - Configuration options for the CSSOM instance + * @param {Object} [opts.globalObject] - Optional global object to be assigned to CSSOM objects prototype + * @returns {Object} A new CSSOM instance with the applied configuration + * @description + * This method creates a new instance of CSSOM and optionally + * configures CSSStyleSheet with a global object reference. When a globalObject is provided + * and CSSStyleSheet exists on the instance, it creates a new CSSStyleSheet constructor + * using a factory function and assigns the globalObject to its prototype's __globalObject property. + */ + setup: function(opts) { + var instance = Object.create(this); + if (opts.globalObject) { + if (instance.CSSStyleSheet) { + var factoryCSSStyleSheet = createFunctionFactory(instance.CSSStyleSheet); + var CSSStyleSheet = factoryCSSStyleSheet(); + CSSStyleSheet.prototype.__globalObject = opts.globalObject; + instance.CSSStyleSheet = CSSStyleSheet; } - b = smallToArray(abs); } - var comparison = compareAbs(a, b); - if (comparison === -1) return [Integer[0], self2]; - if (comparison === 0) return [Integer[self2.sign === n.sign ? 1 : -1], Integer[0]]; - if (a.length + b.length <= 200) - value = divMod1(a, b); - else value = divMod2(a, b); - quotient = value[0]; - var qSign = self2.sign !== n.sign, mod = value[1], mSign = self2.sign; - if (typeof quotient === "number") { - if (qSign) quotient = -quotient; - quotient = new SmallInteger(quotient); - } else quotient = new BigInteger(quotient, qSign); - if (typeof mod === "number") { - if (mSign) mod = -mod; - mod = new SmallInteger(mod); - } else mod = new BigInteger(mod, mSign); - return [quotient, mod]; + return instance; } - BigInteger.prototype.divmod = function(v) { - var result = divModAny(this, v); - return { - quotient: result[0], - remainder: result[1] + }; + function createFunctionFactory(fn) { + return function() { + var newFn = function() { + return fn.apply(this, arguments); }; - }; - NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; - BigInteger.prototype.divide = function(v) { - return divModAny(this, v)[0]; - }; - NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) { - return new NativeBigInt(this.value / parseValue(v).value); - }; - SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; - BigInteger.prototype.mod = function(v) { - return divModAny(this, v)[1]; - }; - NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) { - return new NativeBigInt(this.value % parseValue(v).value); - }; - SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; - BigInteger.prototype.pow = function(v) { - var n = parseValue(v), a = this.value, b = n.value, value, x, y; - if (b === 0) return Integer[1]; - if (a === 0) return Integer[0]; - if (a === 1) return Integer[1]; - if (a === -1) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.sign) { - return Integer[0]; - } - if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large."); - if (this.isSmall) { - if (isPrecise(value = Math.pow(a, b))) - return new SmallInteger(truncate(value)); - } - x = this; - y = Integer[1]; - while (true) { - if (b & true) { - y = y.times(x); - --b; - } - if (b === 0) break; - b /= 2; - x = x.square(); - } - return y; - }; - SmallInteger.prototype.pow = BigInteger.prototype.pow; - NativeBigInt.prototype.pow = function(v) { - var n = parseValue(v); - var a = this.value, b = n.value; - var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); - if (b === _0) return Integer[1]; - if (a === _0) return Integer[0]; - if (a === _1) return Integer[1]; - if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1]; - if (n.isNegative()) return new NativeBigInt(_0); - var x = this; - var y = Integer[1]; - while (true) { - if ((b & _1) === _1) { - y = y.times(x); - --b; + Object.setPrototypeOf(newFn, Object.getPrototypeOf(fn)); + for (var key in fn) { + if (Object.prototype.hasOwnProperty.call(fn, key)) { + newFn[key] = fn[key]; } - if (b === _0) break; - b /= _2; - x = x.square(); - } - return y; - }; - BigInteger.prototype.modPow = function(exp, mod) { - exp = parseValue(exp); - mod = parseValue(mod); - if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0"); - var r = Integer[1], base = this.mod(mod); - if (exp.isNegative()) { - exp = exp.multiply(Integer[-1]); - base = base.modInv(mod); } - while (exp.isPositive()) { - if (base.isZero()) return Integer[0]; - if (exp.isOdd()) r = r.multiply(base).mod(mod); - exp = exp.divide(2); - base = base.square().mod(mod); + if (fn.prototype) { + newFn.prototype = Object.create(fn.prototype); } - return r; + return newFn; }; - NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; - function compareAbs(a, b) { - if (a.length !== b.length) { - return a.length > b.length ? 1 : -1; - } - for (var i2 = a.length - 1; i2 >= 0; i2--) { - if (a[i2] !== b[i2]) return a[i2] > b[i2] ? 1 : -1; - } - return 0; + } + module2.exports = CSSOM2; + } +}); + +// node_modules/@acemir/cssom/lib/errorUtils.js +var require_errorUtils = __commonJS({ + "node_modules/@acemir/cssom/lib/errorUtils.js"(exports, module) { + init_define_import_meta_env(); + function getErrorConstructor(context, errorType) { + if (context.parentStyleSheet && context.parentStyleSheet.__globalObject && context.parentStyleSheet.__globalObject[errorType]) { + return context.parentStyleSheet.__globalObject[errorType]; } - BigInteger.prototype.compareAbs = function(v) { - var n = parseValue(v), a = this.value, b = n.value; - if (n.isSmall) return 1; - return compareAbs(a, b); - }; - SmallInteger.prototype.compareAbs = function(v) { - var n = parseValue(v), a = Math.abs(this.value), b = n.value; - if (n.isSmall) { - b = Math.abs(b); - return a === b ? 0 : a > b ? 1 : -1; - } - return -1; - }; - NativeBigInt.prototype.compareAbs = function(v) { - var a = this.value; - var b = parseValue(v).value; - a = a >= 0 ? a : -a; - b = b >= 0 ? b : -b; - return a === b ? 0 : a > b ? 1 : -1; - }; - BigInteger.prototype.compare = function(v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - var n = parseValue(v), a = this.value, b = n.value; - if (this.sign !== n.sign) { - return n.sign ? 1 : -1; - } - if (n.isSmall) { - return this.sign ? -1 : 1; - } - return compareAbs(a, b) * (this.sign ? -1 : 1); - }; - BigInteger.prototype.compareTo = BigInteger.prototype.compare; - SmallInteger.prototype.compare = function(v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - var n = parseValue(v), a = this.value, b = n.value; - if (n.isSmall) { - return a == b ? 0 : a > b ? 1 : -1; - } - if (a < 0 !== n.sign) { - return a < 0 ? -1 : 1; - } - return a < 0 ? 1 : -1; - }; - SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; - NativeBigInt.prototype.compare = function(v) { - if (v === Infinity) { - return -1; - } - if (v === -Infinity) { - return 1; - } - var a = this.value; - var b = parseValue(v).value; - return a === b ? 0 : a > b ? 1 : -1; - }; - NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; - BigInteger.prototype.equals = function(v) { - return this.compare(v) === 0; - }; - NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; - BigInteger.prototype.notEquals = function(v) { - return this.compare(v) !== 0; - }; - NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; - BigInteger.prototype.greater = function(v) { - return this.compare(v) > 0; - }; - NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; - BigInteger.prototype.lesser = function(v) { - return this.compare(v) < 0; - }; - NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; - BigInteger.prototype.greaterOrEquals = function(v) { - return this.compare(v) >= 0; - }; - NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; - BigInteger.prototype.lesserOrEquals = function(v) { - return this.compare(v) <= 0; - }; - NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; - BigInteger.prototype.isEven = function() { - return (this.value[0] & 1) === 0; - }; - SmallInteger.prototype.isEven = function() { - return (this.value & 1) === 0; - }; - NativeBigInt.prototype.isEven = function() { - return (this.value & BigInt(1)) === BigInt(0); - }; - BigInteger.prototype.isOdd = function() { - return (this.value[0] & 1) === 1; - }; - SmallInteger.prototype.isOdd = function() { - return (this.value & 1) === 1; - }; - NativeBigInt.prototype.isOdd = function() { - return (this.value & BigInt(1)) === BigInt(1); - }; - BigInteger.prototype.isPositive = function() { - return !this.sign; - }; - SmallInteger.prototype.isPositive = function() { - return this.value > 0; - }; - NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; - BigInteger.prototype.isNegative = function() { - return this.sign; - }; - SmallInteger.prototype.isNegative = function() { - return this.value < 0; - }; - NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; - BigInteger.prototype.isUnit = function() { - return false; - }; - SmallInteger.prototype.isUnit = function() { - return Math.abs(this.value) === 1; - }; - NativeBigInt.prototype.isUnit = function() { - return this.abs().value === BigInt(1); - }; - BigInteger.prototype.isZero = function() { - return false; - }; - SmallInteger.prototype.isZero = function() { - return this.value === 0; - }; - NativeBigInt.prototype.isZero = function() { - return this.value === BigInt(0); - }; - BigInteger.prototype.isDivisibleBy = function(v) { - var n = parseValue(v); - if (n.isZero()) return false; - if (n.isUnit()) return true; - if (n.compareAbs(2) === 0) return this.isEven(); - return this.mod(n).isZero(); - }; - NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; - function isBasicPrime(v) { - var n = v.abs(); - if (n.isUnit()) return false; - if (n.equals(2) || n.equals(3) || n.equals(5)) return true; - if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false; - if (n.lesser(49)) return true; + if (context.__parentStyleSheet && context.__parentStyleSheet.__globalObject && context.__parentStyleSheet.__globalObject[errorType]) { + return context.__parentStyleSheet.__globalObject[errorType]; } - function millerRabinTest(n, a) { - var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x; - while (b.isEven()) b = b.divide(2), r++; - next: for (i2 = 0; i2 < a.length; i2++) { - if (n.lesser(a[i2])) continue; - x = bigInt(a[i2]).modPow(b, n); - if (x.isUnit() || x.equals(nPrev)) continue; - for (d = r - 1; d != 0; d--) { - x = x.square().mod(n); - if (x.isUnit()) return false; - if (x.equals(nPrev)) continue next; - } - return false; - } - return true; + if (context.__globalObject && context.__globalObject[errorType]) { + return context.__globalObject[errorType]; } - BigInteger.prototype.isPrime = function(strict) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined2) return isPrime; - var n = this.abs(); - var bits = n.bitLength(); - if (bits <= 64) - return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); - var logN = Math.log(2) * bits.toJSNumber(); - var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN); - for (var a = [], i2 = 0; i2 < t; i2++) { - a.push(bigInt(i2 + 2)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; - BigInteger.prototype.isProbablePrime = function(iterations, rng) { - var isPrime = isBasicPrime(this); - if (isPrime !== undefined2) return isPrime; - var n = this.abs(); - var t = iterations === undefined2 ? 5 : iterations; - for (var a = [], i2 = 0; i2 < t; i2++) { - a.push(bigInt.randBetween(2, n.minus(2), rng)); - } - return millerRabinTest(n, a); - }; - NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; - BigInteger.prototype.modInv = function(n) { - var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; - while (!newR.isZero()) { - q = r.divide(newR); - lastT = t; - lastR = r; - t = newT; - r = newR; - newT = lastT.subtract(q.multiply(newT)); - newR = lastR.subtract(q.multiply(newR)); - } - if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); - if (t.compare(0) === -1) { - t = t.add(n); - } - if (this.isNegative()) { - return t.negate(); + return typeof global !== "undefined" && global[errorType] || typeof window !== "undefined" && window[errorType] || eval(errorType); + } + function createError(context2, errorType2, message, name) { + var ErrorConstructor = getErrorConstructor(context2, errorType2); + return new ErrorConstructor(message, name); + } + function throwError(context2, errorType2, message, name) { + throw createError(context2, errorType2, message, name); + } + function throwMissingArguments(context2, methodName, objectName, required, provided) { + required = required || 1; + provided = provided || 0; + var message = "Failed to execute '" + methodName + "' on '" + objectName + "': " + required + " argument" + (required > 1 ? "s" : "") + " required, but only " + provided + " present."; + throwError(context2, "TypeError", message); + } + function throwParseError(context2, methodName, objectName, rule, name) { + var message = "Failed to execute '" + methodName + "' on '" + objectName + "': Failed to parse the rule '" + rule + "'."; + throwError(context2, "DOMException", message, name || "SyntaxError"); + } + function throwIndexError(context2, methodName, objectName, index2, maxIndex, name) { + var message = "Failed to execute '" + methodName + "' on '" + objectName + "': The index provided (" + index2 + ") is larger than the maximum index (" + maxIndex + ")."; + throwError(context2, "DOMException", message, name || "IndexSizeError"); + } + var errorUtils = { + createError, + getErrorConstructor, + throwError, + throwMissingArguments, + throwParseError, + throwIndexError + }; + exports.errorUtils = errorUtils; + } +}); + +// node_modules/@acemir/cssom/lib/regexPatterns.js +var require_regexPatterns = __commonJS({ + "node_modules/@acemir/cssom/lib/regexPatterns.js"(exports2) { + init_define_import_meta_env(); + var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; + var beforeRulePortionRegExp = /{(?!.*{)|}(?!.*})|;(?!.*;)|\*\/(?!.*\*\/)/g; + var beforeRuleValidationRegExp = /^[\s{};]*(\*\/\s*)?$/; + var forwardRuleValidationRegExp = /(?:\s|\/\*|\{|\()/; + var forwardImportRuleValidationRegExp = /(?:\s|\/\*|'|")/; + var forwardRuleClosingBraceRegExp = /{[^{}]*}|}/; + var forwardRuleSemicolonAndOpeningBraceRegExp = /^.*?({|;)/; + var cssCustomIdentifierRegExp = /^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/; + var startsWithCombinatorRegExp = /^\s*[>+~]/; + var atPageRuleSelectorRegExp = /^([^\s:]+)?((?::\w+)*)$/; + var layerRegExp = /layer\(([^)]*)\)/; + var layerRuleNameRegExp = /^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/; + var doubleOrMoreSpacesRegExp = /\s{2,}/g; + var startsWithHexEscapeRegExp = /^\\[0-9a-fA-F]/; + var identStartCharRegExp = /[a-zA-Z_\u00A0-\uFFFF]/; + var identCharRegExp = /^[a-zA-Z0-9_\-\u00A0-\uFFFF\\]/; + var specialCharsNeedEscapeRegExp = /[!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~\s]/; + var combinatorOrSeparatorRegExp = /[\s>+~,()]/; + var afterHexEscapeSeparatorRegExp = /[\s>+~,(){}\[\]]/; + var trailingSpaceSeparatorRegExp = /[\s>+~,(){}]/; + var endsWithHexEscapeRegExp = /\\[0-9a-fA-F]{1,6}\s+$/; + var basicStylePropertyValueValidationRegExp = /:(?![^(]*\))(?=(?:[^'"]|'[^']*'|"[^"]*")*$)/; + var attributeSelectorContentRegExp = /^([^\s=~|^$*]+)\s*(~=|\|=|\^=|\$=|\*=|=)\s*(.+)$/; + var pseudoElementRegExp = /::[a-zA-Z][\w-]*|:(before|after|first-line|first-letter)(?![a-zA-Z0-9_-])/; + var invalidCombinatorLtGtRegExp = /<>/; + var invalidCombinatorDoubleGtRegExp = />>/; + var consecutiveCombinatorsRegExp = /[>+~]\s*[>+~]/; + var invalidSlottedRegExp = /(?:^|[\s>+~,\[])slotted\s*\(/i; + var invalidPartRegExp = /(?:^|[\s>+~,\[])part\s*\(/i; + var invalidCueRegExp = /(?:^|[\s>+~,\[])cue\s*\(/i; + var invalidCueRegionRegExp = /(?:^|[\s>+~,\[])cue-region\s*\(/i; + var invalidNestingPattern = /&(?![.\#\[:>\+~\s])[a-zA-Z]/; + var emptyPseudoClassRegExp = /:(?:is|not|where|has)\(\s*\)/; + var whitespaceNormalizationRegExp = /(['"])(?:\\.|[^\\])*?\1|(\r\n|\r|\n)/g; + var newlineRemovalRegExp = /\n/g; + var whitespaceAndDotRegExp = /[\s.]/; + var declarationOrOpenBraceRegExp = /[{;}]/; + var ampersandRegExp = /&/; + var hexEscapeSequenceRegExp = /^([0-9a-fA-F]{1,6})[ \t\r\n\f]?/; + var attributeCaseFlagRegExp = /^(.+?)\s+([is])$/i; + var prependedAmpersandRegExp = /^&\s+[:\\.]/; + var openBraceGlobalRegExp = /{/g; + var closeBraceGlobalRegExp = /}/g; + var scopePreludeSplitRegExp = /\s*\)\s*to\s+\(/; + var leadingWhitespaceRegExp = /^\s+/; + var doubleQuoteRegExp = /"/g; + var backslashRegExp = /\\/g; + var invalidMediaOperatorWithoutSpaceRegExp = /\)(and|or)\(/i; + var invalidMediaNotAfterOperatorRegExp = /\b(and|or)\s+not\b/i; + var invalidMediaNotIdentifierRegExp = /\)\s+not\(/i; + var invalidMediaNotAfterFeatureRegExp = /\)\s+not\s+/i; + var invalidMediaOperatorBetweenParensRegExp = /\)\s+(?!and\b|or\b)[a-z]+\s+\(/i; + var invalidMediaNotWithMediaTypeRegExp = /\bnot\s+[a-z][a-z0-9_-]*\s+\(/i; + var mediaFeatureColonRegExp = /(\(\s*)([^():]+):(\s*)([^()]*\))/g; + var identifierBeforeParenRegExp = /[a-z0-9_-]/i; + var mediaAndOperatorRegExp = /\s*\band\b\s*/gi; + var mediaOrOperatorRegExp = /\s*\bor\b\s*/gi; + var mediaNotOperatorStartRegExp = /^\s*not\s+(?=\S)/i; + var mediaNotOperatorRegExp = /\s+\bnot\s+(?=\S)/gi; + var regexPatterns = { + // Parsing patterns + atKeyframesRegExp, + beforeRulePortionRegExp, + beforeRuleValidationRegExp, + forwardRuleValidationRegExp, + forwardImportRuleValidationRegExp, + forwardRuleClosingBraceRegExp, + forwardRuleSemicolonAndOpeningBraceRegExp, + // Selector validation patterns + cssCustomIdentifierRegExp, + startsWithCombinatorRegExp, + atPageRuleSelectorRegExp, + // Parsing patterns used in CSSImportRule + layerRegExp, + layerRuleNameRegExp, + doubleOrMoreSpacesRegExp, + // Escape sequence and identifier patterns + startsWithHexEscapeRegExp, + identStartCharRegExp, + identCharRegExp, + specialCharsNeedEscapeRegExp, + combinatorOrSeparatorRegExp, + afterHexEscapeSeparatorRegExp, + trailingSpaceSeparatorRegExp, + endsWithHexEscapeRegExp, + // Basic style property value validation + basicStylePropertyValueValidationRegExp, + // Attribute selector patterns + attributeSelectorContentRegExp, + // Selector validation patterns + pseudoElementRegExp, + invalidCombinatorLtGtRegExp, + invalidCombinatorDoubleGtRegExp, + consecutiveCombinatorsRegExp, + invalidSlottedRegExp, + invalidPartRegExp, + invalidCueRegExp, + invalidCueRegionRegExp, + invalidNestingPattern, + emptyPseudoClassRegExp, + whitespaceNormalizationRegExp, + newlineRemovalRegExp, + whitespaceAndDotRegExp, + declarationOrOpenBraceRegExp, + ampersandRegExp, + hexEscapeSequenceRegExp, + attributeCaseFlagRegExp, + prependedAmpersandRegExp, + openBraceGlobalRegExp, + closeBraceGlobalRegExp, + scopePreludeSplitRegExp, + leadingWhitespaceRegExp, + doubleQuoteRegExp, + backslashRegExp, + // Media query validation patterns + invalidMediaOperatorWithoutSpaceRegExp, + invalidMediaNotAfterOperatorRegExp, + invalidMediaNotIdentifierRegExp, + invalidMediaNotAfterFeatureRegExp, + invalidMediaOperatorBetweenParensRegExp, + invalidMediaNotWithMediaTypeRegExp, + // Media query normalization patterns + mediaFeatureColonRegExp, + identifierBeforeParenRegExp, + mediaAndOperatorRegExp, + mediaOrOperatorRegExp, + mediaNotOperatorStartRegExp, + mediaNotOperatorRegExp + }; + exports2.regexPatterns = regexPatterns; + } +}); + +// node_modules/@acemir/cssom/lib/MediaList.js +var require_MediaList = __commonJS({ + "node_modules/@acemir/cssom/lib/MediaList.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + CSSOM2.MediaList = function MediaList() { + this.length = 0; + }; + CSSOM2.MediaList.prototype = { + constructor: CSSOM2.MediaList, + /** + * @return {string} + */ + get mediaText() { + return Array.prototype.join.call(this, ", "); + }, + /** + * @param {string} value + */ + set mediaText(value) { + if (typeof value === "string") { + var values = value.split(",").filter(function(text) { + return !!text; + }); + var length = this.length = values.length; + for (var i = 0; i < length; i++) { + this[i] = values[i].trim(); + } + } else if (value === null) { + var length = this.length; + for (var i = 0; i < length; i++) { + delete this[i]; + } + this.length = 0; } - return t; - }; - NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; - BigInteger.prototype.next = function() { - var value = this.value; - if (this.sign) { - return subtractSmall(value, 1, this.sign); + }, + /** + * @param {string} medium + */ + appendMedium: function(medium) { + if (Array.prototype.indexOf.call(this, medium) === -1) { + this[this.length] = medium; + this.length++; } - return new BigInteger(addSmall(value, 1), this.sign); - }; - SmallInteger.prototype.next = function() { - var value = this.value; - if (value + 1 < MAX_INT) return new SmallInteger(value + 1); - return new BigInteger(MAX_INT_ARR, false); - }; - NativeBigInt.prototype.next = function() { - return new NativeBigInt(this.value + BigInt(1)); - }; - BigInteger.prototype.prev = function() { - var value = this.value; - if (this.sign) { - return new BigInteger(addSmall(value, 1), true); + }, + /** + * @param {string} medium + */ + deleteMedium: function(medium) { + var index2 = Array.prototype.indexOf.call(this, medium); + if (index2 !== -1) { + Array.prototype.splice.call(this, index2, 1); } - return subtractSmall(value, 1, this.sign); - }; - SmallInteger.prototype.prev = function() { - var value = this.value; - if (value - 1 > -MAX_INT) return new SmallInteger(value - 1); - return new BigInteger(MAX_INT_ARR, true); - }; - NativeBigInt.prototype.prev = function() { - return new NativeBigInt(this.value - BigInt(1)); - }; - var powersOfTwo = [1]; - while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE2) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); - var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; - function shift_isSmall(n) { - return Math.abs(n) <= BASE2; + }, + item: function(index2) { + return this[index2] || null; + }, + toString: function() { + return this.mediaText; } - BigInteger.prototype.shiftLeft = function(v) { - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); + }; + exports2.MediaList = CSSOM2.MediaList; + } +}); + +// node_modules/@acemir/cssom/lib/StyleSheet.js +var require_StyleSheet = __commonJS({ + "node_modules/@acemir/cssom/lib/StyleSheet.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + MediaList: require_MediaList().MediaList + }; + CSSOM2.StyleSheet = function StyleSheet() { + this.__href = null; + this.__ownerNode = null; + this.__title = null; + this.__media = new CSSOM2.MediaList(); + this.__parentStyleSheet = null; + this.disabled = false; + }; + Object.defineProperties(CSSOM2.StyleSheet.prototype, { + type: { + get: function() { + return "text/css"; } - if (n < 0) return this.shiftRight(-n); - var result = this; - if (result.isZero()) return result; - while (n >= powers2Length) { - result = result.multiply(highestPower2); - n -= powers2Length - 1; + }, + href: { + get: function() { + return this.__href; } - return result.multiply(powersOfTwo[n]); - }; - NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; - BigInteger.prototype.shiftRight = function(v) { - var remQuo; - var n = parseValue(v).toJSNumber(); - if (!shift_isSmall(n)) { - throw new Error(String(n) + " is too large for shifting."); + }, + ownerNode: { + get: function() { + return this.__ownerNode; } - if (n < 0) return this.shiftLeft(-n); - var result = this; - while (n >= powers2Length) { - if (result.isZero() || result.isNegative() && result.isUnit()) return result; - remQuo = divModAny(result, highestPower2); - result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - n -= powers2Length - 1; + }, + title: { + get: function() { + return this.__title; } - remQuo = divModAny(result, powersOfTwo[n]); - return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; - }; - NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; - function bitwise(x, y, fn) { - y = parseValue(y); - var xSign = x.isNegative(), ySign = y.isNegative(); - var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y; - var xDigit = 0, yDigit = 0; - var xDivMod = null, yDivMod = null; - var result = []; - while (!xRem.isZero() || !yRem.isZero()) { - xDivMod = divModAny(xRem, highestPower2); - xDigit = xDivMod[1].toJSNumber(); - if (xSign) { - xDigit = highestPower2 - 1 - xDigit; - } - yDivMod = divModAny(yRem, highestPower2); - yDigit = yDivMod[1].toJSNumber(); - if (ySign) { - yDigit = highestPower2 - 1 - yDigit; + }, + media: { + get: function() { + return this.__media; + }, + set: function(value) { + if (typeof value === "string") { + this.__media.mediaText = value; + } else { + this.__media = value; } - xRem = xDivMod[0]; - yRem = yDivMod[0]; - result.push(fn(xDigit, yDigit)); } - var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); - for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) { - sum = sum.multiply(highestPower2).add(bigInt(result[i2])); + }, + parentStyleSheet: { + get: function() { + return this.__parentStyleSheet; } - return sum; - } - BigInteger.prototype.not = function() { - return this.negate().prev(); - }; - NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; - BigInteger.prototype.and = function(n) { - return bitwise(this, n, function(a, b) { - return a & b; - }); - }; - NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; - BigInteger.prototype.or = function(n) { - return bitwise(this, n, function(a, b) { - return a | b; - }); - }; - NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; - BigInteger.prototype.xor = function(n) { - return bitwise(this, n, function(a, b) { - return a ^ b; - }); - }; - NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; - var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE2 & -BASE2) * (BASE2 & -BASE2) | LOBMASK_I; - function roughLOB(n) { - var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE2 | LOBMASK_BI; - return x & -x; } - function integerLogarithm(value, base) { - if (base.compareTo(value) <= 0) { - var tmp = integerLogarithm(value, base.square(base)); - var p = tmp.p; - var e = tmp.e; - var t = p.multiply(base); - return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 }; + }); + exports2.StyleSheet = CSSOM2.StyleSheet; + } +}); + +// node_modules/@acemir/cssom/lib/CSSRuleList.js +var require_CSSRuleList = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSRuleList.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + CSSOM2.CSSRuleList = function CSSRuleList() { + var arr = new Array(); + Object.setPrototypeOf(arr, CSSOM2.CSSRuleList.prototype); + return arr; + }; + CSSOM2.CSSRuleList.prototype = Object.create(Array.prototype); + CSSOM2.CSSRuleList.prototype.constructor = CSSOM2.CSSRuleList; + CSSOM2.CSSRuleList.prototype.item = function(index2) { + return this[index2] || null; + }; + exports2.CSSRuleList = CSSOM2.CSSRuleList; + } +}); + +// node_modules/@acemir/cssom/lib/CSSRule.js +var require_CSSRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + CSSOM2.CSSRule = function CSSRule() { + this.__parentRule = null; + this.__parentStyleSheet = null; + }; + CSSOM2.CSSRule.UNKNOWN_RULE = 0; + CSSOM2.CSSRule.STYLE_RULE = 1; + CSSOM2.CSSRule.CHARSET_RULE = 2; + CSSOM2.CSSRule.IMPORT_RULE = 3; + CSSOM2.CSSRule.MEDIA_RULE = 4; + CSSOM2.CSSRule.FONT_FACE_RULE = 5; + CSSOM2.CSSRule.PAGE_RULE = 6; + CSSOM2.CSSRule.KEYFRAMES_RULE = 7; + CSSOM2.CSSRule.KEYFRAME_RULE = 8; + CSSOM2.CSSRule.MARGIN_RULE = 9; + CSSOM2.CSSRule.NAMESPACE_RULE = 10; + CSSOM2.CSSRule.COUNTER_STYLE_RULE = 11; + CSSOM2.CSSRule.SUPPORTS_RULE = 12; + CSSOM2.CSSRule.DOCUMENT_RULE = 13; + CSSOM2.CSSRule.FONT_FEATURE_VALUES_RULE = 14; + CSSOM2.CSSRule.VIEWPORT_RULE = 15; + CSSOM2.CSSRule.REGION_STYLE_RULE = 16; + CSSOM2.CSSRule.CONTAINER_RULE = 17; + CSSOM2.CSSRule.LAYER_BLOCK_RULE = 18; + CSSOM2.CSSRule.STARTING_STYLE_RULE = 1002; + Object.defineProperties(CSSOM2.CSSRule.prototype, { + constructor: { value: CSSOM2.CSSRule }, + cssRule: { + value: "", + configurable: true, + enumerable: true + }, + cssText: { + get: function() { + return ""; + }, + set: function(cssText) { + return cssText; } - return { p: bigInt(1), e: 0 }; - } - BigInteger.prototype.bitLength = function() { - var n = this; - if (n.compareTo(bigInt(0)) < 0) { - n = n.negate().subtract(bigInt(1)); + }, + parentRule: { + get: function() { + return this.__parentRule; } - if (n.compareTo(bigInt(0)) === 0) { - return bigInt(0); + }, + parentStyleSheet: { + get: function() { + return this.__parentStyleSheet; } - return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); - }; - NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; - function max(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.greater(b) ? a : b; + }, + UNKNOWN_RULE: { value: 0, enumerable: true }, + // obsolet + STYLE_RULE: { value: 1, enumerable: true }, + CHARSET_RULE: { value: 2, enumerable: true }, + // obsolet + IMPORT_RULE: { value: 3, enumerable: true }, + MEDIA_RULE: { value: 4, enumerable: true }, + FONT_FACE_RULE: { value: 5, enumerable: true }, + PAGE_RULE: { value: 6, enumerable: true }, + KEYFRAMES_RULE: { value: 7, enumerable: true }, + KEYFRAME_RULE: { value: 8, enumerable: true }, + MARGIN_RULE: { value: 9, enumerable: true }, + NAMESPACE_RULE: { value: 10, enumerable: true }, + COUNTER_STYLE_RULE: { value: 11, enumerable: true }, + SUPPORTS_RULE: { value: 12, enumerable: true }, + DOCUMENT_RULE: { value: 13, enumerable: true }, + FONT_FEATURE_VALUES_RULE: { value: 14, enumerable: true }, + VIEWPORT_RULE: { value: 15, enumerable: true }, + REGION_STYLE_RULE: { value: 16, enumerable: true }, + CONTAINER_RULE: { value: 17, enumerable: true }, + LAYER_BLOCK_RULE: { value: 18, enumerable: true }, + STARTING_STYLE_RULE: { value: 1002, enumerable: true } + }); + exports2.CSSRule = CSSOM2.CSSRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSGroupingRule.js +var require_CSSGroupingRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSGroupingRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + parse: require_parse3().parse + }; + var errorUtils2 = require_errorUtils().errorUtils; + CSSOM2.CSSGroupingRule = function CSSGroupingRule() { + CSSOM2.CSSRule.call(this); + this.__cssRules = new CSSOM2.CSSRuleList(); + }; + CSSOM2.CSSGroupingRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSGroupingRule.prototype.constructor = CSSOM2.CSSGroupingRule; + Object.setPrototypeOf(CSSOM2.CSSGroupingRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSGroupingRule.prototype, "cssRules", { + get: function() { + return this.__cssRules; } - function min(a, b) { - a = parseValue(a); - b = parseValue(b); - return a.lesser(b) ? a : b; + }); + CSSOM2.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index2) { + if (rule === void 0 && index2 === void 0) { + errorUtils2.throwMissingArguments(this, "insertRule", this.constructor.name); } - function gcd(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - if (a.equals(b)) return a; - if (a.isZero()) return b; - if (b.isZero()) return a; - var c = Integer[1], d, t; - while (a.isEven() && b.isEven()) { - d = min(roughLOB(a), roughLOB(b)); - a = a.divide(d); - b = b.divide(d); - c = c.multiply(d); - } - while (a.isEven()) { - a = a.divide(roughLOB(a)); - } - do { - while (b.isEven()) { - b = b.divide(roughLOB(b)); - } - if (a.greater(b)) { - t = b; - b = a; - a = t; - } - b = b.subtract(a); - } while (!b.isZero()); - return c.isUnit() ? a : a.multiply(c); + if (index2 === void 0) { + index2 = 0; } - function lcm(a, b) { - a = parseValue(a).abs(); - b = parseValue(b).abs(); - return a.divide(gcd(a, b)).multiply(b); + index2 = Number(index2); + if (index2 < 0) { + index2 = 4294967296 + index2; } - function randBetween(a, b, rng) { - a = parseValue(a); - b = parseValue(b); - var usedRNG = rng || Math.random; - var low = min(a, b), high = max(a, b); - var range = high.subtract(low).add(1); - if (range.isSmall) return low.add(Math.floor(usedRNG() * range)); - var digits = toBase(range, BASE2).value; - var result = [], restricted = true; - for (var i2 = 0; i2 < digits.length; i2++) { - var top = restricted ? digits[i2] + (i2 + 1 < digits.length ? digits[i2 + 1] / BASE2 : 0) : BASE2; - var digit = truncate(usedRNG() * top); - result.push(digit); - if (digit < digits[i2]) restricted = false; - } - return low.add(Integer.fromArray(result, BASE2, false)); + if (index2 > this.cssRules.length) { + errorUtils2.throwIndexError(this, "insertRule", this.constructor.name, index2, this.cssRules.length); } - var parseBase = function(text, base, alphabet, caseSensitive) { - alphabet = alphabet || DEFAULT_ALPHABET; - text = String(text); - if (!caseSensitive) { - text = text.toLowerCase(); - alphabet = alphabet.toLowerCase(); - } - var length = text.length; - var i2; - var absBase = Math.abs(base); - var alphabetValues = {}; - for (i2 = 0; i2 < alphabet.length; i2++) { - alphabetValues[alphabet[i2]] = i2; - } - for (i2 = 0; i2 < length; i2++) { - var c = text[i2]; - if (c === "-") continue; - if (c in alphabetValues) { - if (alphabetValues[c] >= absBase) { - if (c === "1" && absBase === 1) continue; - throw new Error(c + " is not a valid digit in base " + base + "."); - } + var ruleToParse = processedRuleToParse = String(rule); + ruleToParse = ruleToParse.trim().replace(/^\/\*[\s\S]*?\*\/\s*/, ""); + var isNestedSelector = this.constructor.name === "CSSStyleRule"; + if (isNestedSelector === false) { + var currentRule = this; + while (currentRule.parentRule) { + currentRule = currentRule.parentRule; + if (currentRule.constructor.name === "CSSStyleRule") { + isNestedSelector = true; + break; } } - base = parseValue(base); - var digits = []; - var isNegative = text[0] === "-"; - for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) { - var c = text[i2]; - if (c in alphabetValues) digits.push(parseValue(alphabetValues[c])); - else if (c === "<") { - var start = i2; - do { - i2++; - } while (text[i2] !== ">" && i2 < text.length); - digits.push(parseValue(text.slice(start + 1, i2))); - } else throw new Error(c + " is not a valid character"); - } - return parseBaseFromArray(digits, base, isNegative); - }; - function parseBaseFromArray(digits, base, isNegative) { - var val = Integer[0], pow = Integer[1], i2; - for (i2 = digits.length - 1; i2 >= 0; i2--) { - val = val.add(digits[i2].times(pow)); - pow = pow.times(base); - } - return isNegative ? val.negate() : val; } - function stringify(digit, alphabet) { - alphabet = alphabet || DEFAULT_ALPHABET; - if (digit < alphabet.length) { - return alphabet[digit]; - } - return "<" + digit + ">"; + if (isNestedSelector) { + processedRuleToParse = "s { n { } " + ruleToParse + "}"; } - function toBase(n, base) { - base = bigInt(base); - if (base.isZero()) { - if (n.isZero()) return { value: [0], isNegative: false }; - throw new Error("Cannot convert nonzero numbers to base 0."); - } - if (base.equals(-1)) { - if (n.isZero()) return { value: [0], isNegative: false }; - if (n.isNegative()) - return { - value: [].concat.apply( - [], - Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0]) - ), - isNegative: false - }; - var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]); - arr.unshift([1]); - return { - value: [].concat.apply([], arr), - isNegative: false - }; - } - var neg = false; - if (n.isNegative() && base.isPositive()) { - neg = true; - n = n.abs(); - } - if (base.isUnit()) { - if (n.isZero()) return { value: [0], isNegative: false }; - return { - value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1), - isNegative: neg - }; + var isScopeRule = this.constructor.name === "CSSScopeRule"; + if (isScopeRule) { + if (isNestedSelector) { + processedRuleToParse = "s { @scope {" + ruleToParse + "}}"; + } else { + processedRuleToParse = "@scope {" + ruleToParse + "}"; } - var out = []; - var left = n, divmod; - while (left.isNegative() || left.compareAbs(base) >= 0) { - divmod = left.divmod(base); - left = divmod.quotient; - var digit = divmod.remainder; - if (digit.isNegative()) { - digit = base.minus(digit).abs(); - left = left.next(); - } - out.push(digit.toJSNumber()); + } + var parsedRules = new CSSOM2.CSSRuleList(); + CSSOM2.parse(processedRuleToParse, { + styleSheet: this.parentStyleSheet, + cssRules: parsedRules + }); + if (isScopeRule) { + if (isNestedSelector) { + parsedRules = parsedRules[0].cssRules[0].cssRules; + } else { + parsedRules = parsedRules[0].cssRules; } - out.push(left.toJSNumber()); - return { value: out.reverse(), isNegative: neg }; } - function toBaseString(n, base, alphabet) { - var arr = toBase(n, base); - return (arr.isNegative ? "-" : "") + arr.value.map(function(x) { - return stringify(x, alphabet); - }).join(""); + if (isNestedSelector) { + parsedRules = parsedRules[0].cssRules.slice(1); } - BigInteger.prototype.toArray = function(radix) { - return toBase(this, radix); - }; - SmallInteger.prototype.toArray = function(radix) { - return toBase(this, radix); - }; - NativeBigInt.prototype.toArray = function(radix) { - return toBase(this, radix); - }; - BigInteger.prototype.toString = function(radix, alphabet) { - if (radix === undefined2) radix = 10; - if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet); - var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; - while (--l >= 0) { - digit = String(v[l]); - str += zeros.slice(digit.length) + digit; - } - var sign = this.sign ? "-" : ""; - return sign + str; - }; - SmallInteger.prototype.toString = function(radix, alphabet) { - if (radix === undefined2) radix = 10; - if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet); - return String(this.value); - }; - NativeBigInt.prototype.toString = SmallInteger.prototype.toString; - NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() { - return this.toString(); - }; - BigInteger.prototype.valueOf = function() { - return parseInt(this.toString(), 10); - }; - BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; - SmallInteger.prototype.valueOf = function() { - return this.value; - }; - SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; - NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() { - return parseInt(this.toString(), 10); - }; - function parseStringValue(v) { - if (isPrecise(+v)) { - var x = +v; - if (x === truncate(x)) - return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); - throw new Error("Invalid integer: " + v); - } - var sign = v[0] === "-"; - if (sign) v = v.slice(1); - var split = v.split(/e/i); - if (split.length > 2) throw new Error("Invalid integer: " + split.join("e")); - if (split.length === 2) { - var exp = split[1]; - if (exp[0] === "+") exp = exp.slice(1); - exp = +exp; - if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent."); - var text = split[0]; - var decimalPlace = text.indexOf("."); - if (decimalPlace >= 0) { - exp -= text.length - decimalPlace - 1; - text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); - } - if (exp < 0) throw new Error("Cannot include negative exponent part for integers"); - text += new Array(exp + 1).join("0"); - v = text; - } - var isValid = /^([0-9][0-9]*)$/.test(v); - if (!isValid) throw new Error("Invalid integer: " + v); - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(sign ? "-" + v : v)); - } - var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l; - while (max2 > 0) { - r.push(+v.slice(min2, max2)); - min2 -= l; - if (min2 < 0) min2 = 0; - max2 -= l; + if (parsedRules.length !== 1) { + if (isNestedSelector && parsedRules.length === 0 && ruleToParse.indexOf("@font-face") === 0) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Only conditional nested group rules, style rules, @scope rules, @apply rules, and nested declaration rules may be nested.", + "HierarchyRequestError" + ); + } else { + errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); } - trim(r); - return new BigInteger(r, sign); } - function parseNumberValue(v) { - if (supportsNativeBigInt) { - return new NativeBigInt(BigInt(v)); - } - if (isPrecise(v)) { - if (v !== truncate(v)) throw new Error(v + " is not an integer."); - return new SmallInteger(v); - } - return parseStringValue(v.toString()); + var cssRule = parsedRules[0]; + if (cssRule.constructor.name === "CSSNestedDeclarations" && cssRule.style.length === 0) { + errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); } - function parseValue(v) { - if (typeof v === "number") { - return parseNumberValue(v); - } - if (typeof v === "string") { - return parseStringValue(v); - } - if (typeof v === "bigint") { - return new NativeBigInt(v); - } - return v; + if (cssRule.constructor.name === "CSSImportRule" || cssRule.constructor.name === "CSSNamespaceRule") { + var ruleKeyword = cssRule.constructor.name === "CSSImportRule" ? "@import" : "@namespace"; + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': '" + ruleKeyword + "' rules cannot be inserted inside a group rule.", + "HierarchyRequestError" + ); } - for (var i = 0; i < 1e3; i++) { - Integer[i] = parseValue(i); - if (i > 0) Integer[-i] = parseValue(-i); + if (cssRule.constructor.name === "CSSLayerStatementRule") { + errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); } - Integer.one = Integer[1]; - Integer.zero = Integer[0]; - Integer.minusOne = Integer[-1]; - Integer.max = max; - Integer.min = min; - Integer.gcd = gcd; - Integer.lcm = lcm; - Integer.isInstance = function(x) { - return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; - }; - Integer.randBetween = randBetween; - Integer.fromArray = function(digits, base, isNegative) { - return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); - }; - return Integer; - })(); - if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) { - module2.exports = bigInt; - } - if (typeof define === "function" && define.amd) { - define(function() { - return bigInt; - }); - } - } -}); - -// node_modules/telegram/CryptoFile.js -var require_CryptoFile = __commonJS({ - "node_modules/telegram/CryptoFile.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + cssRule.__parentRule = this; + this.cssRules.splice(index2, 0, cssRule); + return index2; + }; + CSSOM2.CSSGroupingRule.prototype.deleteRule = function deleteRule(index2) { + if (index2 === void 0) { + errorUtils2.throwMissingArguments(this, "deleteRule", this.constructor.name); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + index2 = Number(index2); + if (index2 < 0) { + index2 = 4294967296 + index2; } - __setModuleDefault2(result, mod); - return result; + if (index2 >= this.cssRules.length) { + errorUtils2.throwIndexError(this, "deleteRule", this.constructor.name, index2, this.cssRules.length); + } + this.cssRules[index2].__parentRule = null; + this.cssRules[index2].__parentStyleSheet = null; + this.cssRules.splice(index2, 1); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var crypto4 = __importStar2(require("crypto")); - exports2.default = crypto4; - } -}); - -// node_modules/telegram/platform.js -var require_platform = __commonJS({ - "node_modules/telegram/platform.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isNode = exports2.isBrowser = exports2.isDeno = void 0; - exports2.isDeno = "Deno" in globalThis; - exports2.isBrowser = !exports2.isDeno && typeof window !== "undefined"; - exports2.isNode = !exports2.isBrowser; + exports2.CSSGroupingRule = CSSOM2.CSSGroupingRule; } }); -// node_modules/telegram/Helpers.js -var require_Helpers = __commonJS({ - "node_modules/telegram/Helpers.js"(exports2) { - "use strict"; +// node_modules/@acemir/cssom/lib/CSSStyleRule.js +var require_CSSStyleRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSStyleRule.js"(exports2) { init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) { - return mod2 && mod2.__esModule ? mod2 : { "default": mod2 }; + var CSSOM2 = { + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._EntityType = exports2.TotalList = exports2.sleep = exports2.isArrayLike = void 0; - exports2.readBigIntFromBuffer = readBigIntFromBuffer; - exports2.generateRandomBigInt = generateRandomBigInt; - exports2.escapeRegex = escapeRegex2; - exports2.groupBy = groupBy; - exports2.betterConsoleLog = betterConsoleLog; - exports2.toSignedLittleBuffer = toSignedLittleBuffer; - exports2.readBufferFromBigInt = readBufferFromBigInt; - exports2.generateRandomLong = generateRandomLong; - exports2.mod = mod; - exports2.bigIntMod = bigIntMod; - exports2.generateRandomBytes = generateRandomBytes; - exports2.stripText = stripText; - exports2.generateKeyDataFromNonce = generateKeyDataFromNonce; - exports2.convertToLittle = convertToLittle; - exports2.sha1 = sha1; - exports2.sha256 = sha256; - exports2.modExp = modExp; - exports2.getByteArray = getByteArray; - exports2.returnBigInt = returnBigInt; - exports2.getMinBigInt = getMinBigInt; - exports2.getRandomInt = getRandomInt; - exports2.bufferXor = bufferXor; - exports2.crc32 = crc32; - exports2._entityType = _entityType; - var big_integer_1 = __importDefault2(require_BigInteger()); - var CryptoFile_1 = __importDefault2(require_CryptoFile()); - var platform_1 = require_platform(); - function readBigIntFromBuffer(buffer, little = true, signed = false) { - let randBuffer = Buffer.from(buffer); - const bytesNumber = randBuffer.length; - if (little) { - randBuffer = randBuffer.reverse(); - } - let bigIntVar = (0, big_integer_1.default)(randBuffer.toString("hex"), 16); - if (signed && Math.floor(bigIntVar.toString(2).length / 8) >= bytesNumber) { - bigIntVar = bigIntVar.subtract((0, big_integer_1.default)(2).pow((0, big_integer_1.default)(bytesNumber * 8))); - } - return bigIntVar; - } - function generateRandomBigInt() { - return readBigIntFromBuffer(generateRandomBytes(8), false); - } - function escapeRegex2(string) { - return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); + var regexPatterns = require_regexPatterns().regexPatterns; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } - function groupBy(list, keyGetter) { - const map = /* @__PURE__ */ new Map(); - list.forEach((item) => { - const key2 = keyGetter(item); - const collection = map.get(key2); - if (!collection) { - map.set(key2, [item]); + CSSOM2.CSSStyleRule = function CSSStyleRule() { + CSSOM2.CSSGroupingRule.call(this); + this.__selectorText = ""; + this.__style = new CSSOM2.CSSStyleDeclaration(); + this.__style.parentRule = this; + }; + CSSOM2.CSSStyleRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSStyleRule.prototype.constructor = CSSOM2.CSSStyleRule; + Object.setPrototypeOf(CSSOM2.CSSStyleRule, CSSOM2.CSSGroupingRule); + Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "type", { + value: 1, + writable: false + }); + Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "selectorText", { + get: function() { + return this.__selectorText; + }, + set: function(value) { + if (typeof value === "string") { + var endsWithHexEscapeRegExp = regexPatterns.endsWithHexEscapeRegExp; + var endsWithEscape = endsWithHexEscapeRegExp.test(value); + var trimmedValue = endsWithEscape ? value.replace(/\s+$/, " ").trimStart() : value.trim(); + if (trimmedValue === "") { + return; + } + this.__selectorText = trimmedValue; + } + }, + configurable: true + }); + Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "style", { + get: function() { + return this.__style; + }, + set: function(value) { + if (typeof value === "string") { + this.__style.cssText = value; } else { - collection.push(item); + this.__style = value; } - }); - return map; - } - function betterConsoleLog(object) { - const toPrint = {}; - for (const key2 in object) { - if (object.hasOwnProperty(key2)) { - if (!key2.startsWith("_") && key2 != "originalArgs") { - toPrint[key2] = object[key2]; + }, + configurable: true + }); + Object.defineProperty(CSSOM2.CSSStyleRule.prototype, "cssText", { + get: function() { + var text; + if (this.selectorText) { + var values = ""; + if (this.cssRules.length) { + var valuesArr = [" {"]; + this.style.cssText && valuesArr.push(this.style.cssText); + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + values = valuesArr.join("\n ") + "\n}"; + } else { + values = " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; } + text = this.selectorText + values; + } else { + text = ""; } + return text; } - return toPrint; - } - var isArrayLike = (x) => x && typeof x.length === "number" && typeof x !== "function" && typeof x !== "string"; - exports2.isArrayLike = isArrayLike; - function toSignedLittleBuffer(big, number = 8) { - const bigNumber = returnBigInt(big); - const byteArray = []; - for (let i = 0; i < number; i++) { - byteArray[i] = bigNumber.shiftRight(8 * i).and(255); + }); + exports2.CSSStyleRule = CSSOM2.CSSStyleRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSStyleSheet.js +var require_CSSStyleSheet = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSStyleSheet.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + MediaList: require_MediaList().MediaList, + StyleSheet: require_StyleSheet().StyleSheet, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSStyleRule: require_CSSStyleRule().CSSStyleRule + }; + var errorUtils2 = require_errorUtils().errorUtils; + CSSOM2.CSSStyleSheet = function CSSStyleSheet(opts) { + CSSOM2.StyleSheet.call(this); + this.__constructed = true; + this.__cssRules = new CSSOM2.CSSRuleList(); + this.__ownerRule = null; + if (opts && typeof opts === "object") { + if (opts.baseURL && typeof opts.baseURL === "string") { + this.__baseURL = opts.baseURL; + } + if (opts.media && typeof opts.media === "string") { + this.media.mediaText = opts.media; + } + if (typeof opts.disabled === "boolean") { + this.disabled = opts.disabled; + } } - return Buffer.from(byteArray); - } - function readBufferFromBigInt(bigIntVar, bytesNumber, little = true, signed = false) { - bigIntVar = (0, big_integer_1.default)(bigIntVar); - const bitLength = bigIntVar.bitLength().toJSNumber(); - const bytes = Math.ceil(bitLength / 8); - if (bytesNumber < bytes) { - throw new Error("OverflowError: int too big to convert"); + }; + CSSOM2.CSSStyleSheet.prototype = Object.create(CSSOM2.StyleSheet.prototype); + CSSOM2.CSSStyleSheet.prototype.constructor = CSSOM2.CSSStyleSheet; + Object.setPrototypeOf(CSSOM2.CSSStyleSheet, CSSOM2.StyleSheet); + Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "cssRules", { + get: function() { + return this.__cssRules; } - if (!signed && bigIntVar.lesser((0, big_integer_1.default)(0))) { - throw new Error("Cannot convert to unsigned"); + }); + Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "rules", { + get: function() { + return this.__cssRules; } - if (signed && bigIntVar.lesser((0, big_integer_1.default)(0))) { - bigIntVar = (0, big_integer_1.default)(2).pow((0, big_integer_1.default)(bytesNumber).multiply(8)).add(bigIntVar); + }); + Object.defineProperty(CSSOM2.CSSStyleSheet.prototype, "ownerRule", { + get: function() { + return this.__ownerRule; } - const hex = bigIntVar.toString(16).padStart(bytesNumber * 2, "0"); - let buffer = Buffer.from(hex, "hex"); - if (little) { - buffer = buffer.reverse(); + }); + CSSOM2.CSSStyleSheet.prototype.insertRule = function(rule, index2) { + if (rule === void 0 && index2 === void 0) { + errorUtils2.throwMissingArguments(this, "insertRule", this.constructor.name); } - return buffer; - } - function generateRandomLong(signed = true) { - return readBigIntFromBuffer(generateRandomBytes(8), true, signed); - } - function mod(n, m) { - return (n % m + m) % m; - } - function bigIntMod(n, m) { - return n.remainder(m).add(m).remainder(m); - } - function generateRandomBytes(count) { - return Buffer.from(CryptoFile_1.default.randomBytes(count)); - } - function stripText(text, entities2) { - if (!entities2 || !entities2.length) { - return text.trim(); + if (index2 === void 0) { + index2 = 0; } - while (text && text[text.length - 1].trim() === "") { - const e = entities2[entities2.length - 1]; - if (e.offset + e.length == text.length) { - if (e.length == 1) { - entities2.pop(); - if (!entities2.length) { - return text.trim(); - } - } else { - e.length -= 1; + index2 = Number(index2); + if (index2 < 0) { + index2 = 4294967296 + index2; + } + if (index2 > this.cssRules.length) { + errorUtils2.throwIndexError(this, "insertRule", this.constructor.name, index2, this.cssRules.length); + } + var ruleToParse = String(rule); + var parseErrors = []; + var parsedSheet = CSSOM2.parse(ruleToParse, void 0, function(err) { + parseErrors.push(err); + }); + if (parsedSheet.cssRules.length !== 1) { + errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); + } + var cssRule = parsedSheet.cssRules[0]; + function findLastIndexOfConstructor(rules, constructorName) { + for (var i2 = rules.length - 1; i2 >= 0; i2--) { + if (rules[i2].constructor.name === constructorName) { + return i2; } } - text = text.slice(0, -1); + return -1; } - while (text && text[0].trim() === "") { - for (let i = 0; i < entities2.length; i++) { - const e = entities2[i]; - if (e.offset != 0) { - e.offset--; - continue; - } - if (e.length == 1) { - entities2.shift(); - if (!entities2.length) { - return text.trimLeft(); - } - } else { - e.length -= 1; + function findFirstNonConstructorIndex(rules, constructorNames) { + for (var i2 = 0; i2 < rules.length; i2++) { + if (constructorNames.indexOf(rules[i2].constructor.name) === -1) { + return i2; } } - text = text.slice(1); - } - return text; - } - async function generateKeyDataFromNonce(serverNonceBigInt, newNonceBigInt) { - const serverNonce = toSignedLittleBuffer(serverNonceBigInt, 16); - const newNonce = toSignedLittleBuffer(newNonceBigInt, 32); - const [hash1, hash2, hash3] = await Promise.all([ - sha1(Buffer.concat([newNonce, serverNonce])), - sha1(Buffer.concat([serverNonce, newNonce])), - sha1(Buffer.concat([newNonce, newNonce])) - ]); - const keyBuffer = Buffer.concat([hash1, hash2.slice(0, 12)]); - const ivBuffer = Buffer.concat([ - hash2.slice(12, 20), - hash3, - newNonce.slice(0, 4) - ]); - return { - key: keyBuffer, - iv: ivBuffer - }; - } - function convertToLittle(buf) { - const correct = Buffer.alloc(buf.length * 4); - for (let i = 0; i < buf.length; i++) { - correct.writeUInt32BE(buf[i], i * 4); + return rules.length; } - return correct; - } - function sha1(data) { - const shaSum = CryptoFile_1.default.createHash("sha1"); - shaSum.update(data); - return shaSum.digest(); - } - function sha256(data) { - const shaSum = CryptoFile_1.default.createHash("sha256"); - shaSum.update(data); - return shaSum.digest(); - } - function modExp(a, b, n) { - a = a.remainder(n); - let result = big_integer_1.default.one; - let x = a; - while (b.greater(big_integer_1.default.zero)) { - const leastSignificantBit = b.remainder((0, big_integer_1.default)(2)); - b = b.divide((0, big_integer_1.default)(2)); - if (leastSignificantBit.eq(big_integer_1.default.one)) { - result = result.multiply(x); - result = result.remainder(n); + if (cssRule.constructor.name === "CSSImportRule") { + if (this.__constructed === true) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Can't insert @import rules into a constructed stylesheet.", + "SyntaxError" + ); + } + var firstLayerIndex = findFirstNonConstructorIndex(this.cssRules, ["CSSImportRule"]); + if (firstLayerIndex < this.cssRules.length && this.cssRules[firstLayerIndex].constructor.name === "CSSLayerStatementRule" && index2 > firstLayerIndex) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "HierarchyRequestError" + ); + } + var firstNonImportIndex = findFirstNonConstructorIndex(this.cssRules, ["CSSImportRule"]); + if (index2 > firstNonImportIndex && firstNonImportIndex < this.cssRules.length && this.cssRules[firstNonImportIndex].constructor.name !== "CSSLayerStatementRule") { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "HierarchyRequestError" + ); + } + } else if (cssRule.constructor.name === "CSSNamespaceRule") { + var firstImportIndex = -1; + for (var i = 0; i < this.cssRules.length; i++) { + if (this.cssRules[i].constructor.name === "CSSImportRule") { + firstImportIndex = i; + break; + } + } + var firstNonImportNamespaceIndex = findFirstNonConstructorIndex(this.cssRules, [ + "CSSLayerStatementRule", + "CSSImportRule", + "CSSNamespaceRule" + ]); + if (firstImportIndex !== -1 && index2 <= firstImportIndex) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "HierarchyRequestError" + ); + } + if (firstNonImportNamespaceIndex < this.cssRules.length) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "InvalidStateError" + ); + } + if (index2 > firstNonImportNamespaceIndex) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "HierarchyRequestError" + ); + } + } else if (cssRule.constructor.name === "CSSLayerStatementRule") { + } else { + var firstNonSpecialRuleIndex = findFirstNonConstructorIndex(this.cssRules, [ + "CSSLayerStatementRule", + "CSSImportRule", + "CSSNamespaceRule" + ]); + if (index2 < firstNonSpecialRuleIndex) { + errorUtils2.throwError( + this, + "DOMException", + "Failed to execute 'insertRule' on '" + this.constructor.name + "': Failed to insert the rule.", + "HierarchyRequestError" + ); + } + if (parseErrors.filter(function(error) { + return !error.isNested; + }).length !== 0) { + errorUtils2.throwParseError(this, "insertRule", this.constructor.name, ruleToParse, "SyntaxError"); } - x = x.multiply(x); - x = x.remainder(n); - } - return result; - } - function getByteArray(integer, signed = false) { - const bits = integer.toString(2).length; - const byteLength = Math.floor((bits + 8 - 1) / 8); - return readBufferFromBigInt(typeof integer == "number" ? (0, big_integer_1.default)(integer) : integer, byteLength, false, signed); - } - function returnBigInt(num) { - if (big_integer_1.default.isInstance(num)) { - return num; } - if (typeof num == "number") { - return (0, big_integer_1.default)(num); + cssRule.__parentStyleSheet = this; + this.cssRules.splice(index2, 0, cssRule); + return index2; + }; + CSSOM2.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2) { + if (index2 === void 0) { + index2 = this.cssRules.length; } - if (typeof num == "bigint") { - return (0, big_integer_1.default)(num); + this.insertRule(selector + "{" + styleBlock + "}", index2); + return -1; + }; + CSSOM2.CSSStyleSheet.prototype.deleteRule = function(index2) { + if (index2 === void 0) { + errorUtils2.throwMissingArguments(this, "deleteRule", this.constructor.name); } - return (0, big_integer_1.default)(num); - } - function getMinBigInt(arrayOfBigInts) { - if (arrayOfBigInts.length == 0) { - return big_integer_1.default.zero; + index2 = Number(index2); + if (index2 < 0) { + index2 = 4294967296 + index2; } - if (arrayOfBigInts.length == 1) { - return returnBigInt(arrayOfBigInts[0]); + if (index2 >= this.cssRules.length) { + errorUtils2.throwIndexError(this, "deleteRule", this.constructor.name, index2, this.cssRules.length); } - let smallest = returnBigInt(arrayOfBigInts[0]); - for (let i = 1; i < arrayOfBigInts.length; i++) { - if (returnBigInt(arrayOfBigInts[i]).lesser(smallest)) { - smallest = returnBigInt(arrayOfBigInts[i]); + if (this.cssRules[index2]) { + if (this.cssRules[index2].constructor.name == "CSSNamespaceRule") { + var shouldContinue = this.cssRules.every(function(rule) { + return ["CSSImportRule", "CSSLayerStatementRule", "CSSNamespaceRule"].indexOf(rule.constructor.name) !== -1; + }); + if (!shouldContinue) { + errorUtils2.throwError(this, "DOMException", "Failed to execute 'deleteRule' on '" + this.constructor.name + "': Failed to delete rule.", "InvalidStateError"); + } } - } - return smallest; - } - function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min + 1)) + min; - } - var sleep4 = (ms, isUnref = false) => new Promise((resolve) => isUnref && platform_1.isNode ? setTimeout(resolve, ms).unref() : setTimeout(resolve, ms)); - exports2.sleep = sleep4; - function bufferXor(a, b) { - const res = []; - for (let i = 0; i < a.length; i++) { - res.push(a[i] ^ b[i]); - } - return Buffer.from(res); - } - function makeCRCTable() { - let c; - const crcTable2 = []; - for (let n = 0; n < 256; n++) { - c = n; - for (let k = 0; k < 8; k++) { - c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; + if (this.cssRules[index2].constructor.name == "CSSImportRule") { + this.cssRules[index2].styleSheet.__parentStyleSheet = null; } - crcTable2[n] = c; - } - return crcTable2; - } - var crcTable = void 0; - function crc32(buf) { - if (!crcTable) { - crcTable = makeCRCTable(); - } - if (!Buffer.isBuffer(buf)) { - buf = Buffer.from(buf); - } - let crc = -1; - for (let index2 = 0; index2 < buf.length; index2++) { - const byte = buf[index2]; - crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8; - } - return (crc ^ -1) >>> 0; - } - var TotalList = class extends Array { - constructor() { - super(); - this.total = 0; + this.cssRules[index2].__parentStyleSheet = null; } + this.cssRules.splice(index2, 1); }; - exports2.TotalList = TotalList; - exports2._EntityType = { - USER: 0, - CHAT: 1, - CHANNEL: 2 - }; - Object.freeze(exports2._EntityType); - function _entityType(entity) { - if (typeof entity !== "object" || !("SUBCLASS_OF_ID" in entity)) { - throw new Error(`${entity} is not a TLObject, cannot determine entity type`); + CSSOM2.CSSStyleSheet.prototype.removeRule = function(index2) { + if (index2 === void 0) { + index2 = 0; } - if (![ - 47470215, - // crc32('Peer') - 3374092470, - // crc32('InputPeer') - 3865689926, - // crc32('InputUser') - 1089602301, - // crc32('InputChannel') - 765557111, - // crc32('User') - 3316604308, - // crc32('Chat') - 524706233, - // crc32('UserFull') - 3566872215 - // crc32('ChatFull') - ].includes(entity.SUBCLASS_OF_ID)) { - throw new Error(`${entity} does not have any entity type`); + this.deleteRule(index2); + }; + CSSOM2.CSSStyleSheet.prototype.replace = function(text) { + var _Promise; + if (this.__globalObject && this.__globalObject["Promise"]) { + _Promise = this.__globalObject["Promise"]; + } else { + _Promise = Promise; } - const name = entity.className; - if (name.includes("User")) { - return exports2._EntityType.USER; - } else if (name.includes("Chat")) { - return exports2._EntityType.CHAT; - } else if (name.includes("Channel")) { - return exports2._EntityType.CHANNEL; - } else if (name.includes("Self")) { - return exports2._EntityType.USER; + var _setTimeout; + if (this.__globalObject && this.__globalObject["setTimeout"]) { + _setTimeout = this.__globalObject["setTimeout"]; + } else { + _setTimeout = setTimeout; } - throw new Error(`${entity} does not have any entity type`); + var sheet = this; + return new _Promise(function(resolve, reject) { + if (!sheet.__constructed || sheet.__disallowModification) { + reject(errorUtils2.createError( + sheet, + "DOMException", + "Failed to execute 'replaceSync' on '" + sheet.constructor.name + "': Not allowed.", + "NotAllowedError" + )); + } + sheet.__disallowModification = true; + _setTimeout(function() { + var rules = new CSSOM2.CSSRuleList(); + CSSOM2.parse(text, { styleSheet: sheet, cssRules: rules }); + var i = 0; + while (i < rules.length) { + if (rules[i].constructor.name === "CSSImportRule") { + rules.splice(i, 1); + } else { + i++; + } + } + sheet.__cssRules.splice.apply(sheet.__cssRules, [0, sheet.__cssRules.length].concat(rules)); + delete sheet.__disallowModification; + resolve(sheet); + }); + }); + }; + CSSOM2.CSSStyleSheet.prototype.replaceSync = function(text) { + var sheet = this; + if (!sheet.__constructed || sheet.__disallowModification) { + errorUtils2.throwError( + sheet, + "DOMException", + "Failed to execute 'replaceSync' on '" + sheet.constructor.name + "': Not allowed.", + "NotAllowedError" + ); + } + var rules = new CSSOM2.CSSRuleList(); + CSSOM2.parse(text, { styleSheet: sheet, cssRules: rules }); + var i = 0; + while (i < rules.length) { + if (rules[i].constructor.name === "CSSImportRule") { + rules.splice(i, 1); + } else { + i++; + } + } + sheet.__cssRules.splice.apply(sheet.__cssRules, [0, sheet.__cssRules.length].concat(rules)); + }; + CSSOM2.CSSStyleSheet.prototype.toString = function() { + var result = ""; + var rules = this.cssRules; + for (var i = 0; i < rules.length; i++) { + result += rules[i].cssText + "\n"; + } + return result; + }; + exports2.CSSStyleSheet = CSSOM2.CSSStyleSheet; + CSSOM2.parse = require_parse3().parse; + } +}); + +// node_modules/@acemir/cssom/lib/CSSNestedDeclarations.js +var require_CSSNestedDeclarations = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSNestedDeclarations.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration + }; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } + CSSOM2.CSSNestedDeclarations = function CSSNestedDeclarations() { + CSSOM2.CSSRule.call(this); + this.__style = new CSSOM2.CSSStyleDeclaration(); + this.__style.parentRule = this; + }; + CSSOM2.CSSNestedDeclarations.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSNestedDeclarations.prototype.constructor = CSSOM2.CSSNestedDeclarations; + Object.setPrototypeOf(CSSOM2.CSSNestedDeclarations, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "type", { + value: 0, + writable: false + }); + Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "style", { + get: function() { + return this.__style; + }, + set: function(value) { + if (typeof value === "string") { + this.__style.cssText = value; + } else { + this.__style = value; + } + } + }); + Object.defineProperty(CSSOM2.CSSNestedDeclarations.prototype, "cssText", { + get: function() { + return this.style.cssText; + } + }); + exports2.CSSNestedDeclarations = CSSOM2.CSSNestedDeclarations; } }); -// node_modules/telegram/tl/apiTl.js -var require_apiTl = __commonJS({ - "node_modules/telegram/tl/apiTl.js"(exports2, module2) { - "use strict"; +// node_modules/@acemir/cssom/lib/CSSImportRule.js +var require_CSSImportRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSImportRule.js"(exports2) { init_define_import_meta_env(); - module2.exports = `boolFalse#bc799737 = Bool; -boolTrue#997275b5 = Bool; -true#3fedd339 = True; -vector#1cb5c415 {t:Type} # [ t ] = Vector t; -error#c4b9f9bb code:int text:string = Error; -null#56730bcc = Null; -inputPeerEmpty#7f3b18ea = InputPeer; -inputPeerSelf#7da07ec9 = InputPeer; -inputPeerChat#35a95cb9 chat_id:long = InputPeer; -inputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer; -inputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer; -inputPeerUserFromMessage#a87b0a1c peer:InputPeer msg_id:int user_id:long = InputPeer; -inputPeerChannelFromMessage#bd2a0840 peer:InputPeer msg_id:int channel_id:long = InputPeer; -inputUserEmpty#b98886cf = InputUser; -inputUserSelf#f7c1b13f = InputUser; -inputUser#f21158c6 user_id:long access_hash:long = InputUser; -inputUserFromMessage#1da448e2 peer:InputPeer msg_id:int user_id:long = InputUser; -inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; -inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; -inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; -inputFileStoryDocument#62dc8b48 id:InputDocument = InputFile; -inputMediaEmpty#9664f57f = InputMedia; -inputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; -inputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia; -inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; -inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; -inputMediaUploadedDocument#37c9330 flags:# nosound_video:flags.3?true force_file:flags.4?true spoiler:flags.5?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> video_cover:flags.6?InputPhoto video_timestamp:flags.7?int ttl_seconds:flags.1?int = InputMedia; -inputMediaDocument#a8763ab5 flags:# spoiler:flags.2?true id:InputDocument video_cover:flags.3?InputPhoto video_timestamp:flags.4?int ttl_seconds:flags.0?int query:flags.1?string = InputMedia; -inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; -inputMediaPhotoExternal#e5bbfe1a flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int = InputMedia; -inputMediaDocumentExternal#779600f9 flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int video_cover:flags.2?InputPhoto video_timestamp:flags.3?int = InputMedia; -inputMediaGame#d33f43f3 id:InputGame = InputMedia; -inputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:flags.3?string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia; -inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia; -inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia; -inputMediaDice#e66fbf7b emoticon:string = InputMedia; -inputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia; -inputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia; -inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector<InputMedia> payload:flags.0?string = InputMedia; -inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; -inputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto; -inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; -inputGeoPointEmpty#e4c123d6 = InputGeoPoint; -inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint; -inputPhotoEmpty#1cd7bf0d = InputPhoto; -inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; -inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; -inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; -inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; -inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; -inputTakeoutFileLocation#29be5899 = InputFileLocation; -inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; -inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation; -inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation; -inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation; -inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation; -peerUser#59511722 user_id:long = Peer; -peerChat#36c6019a chat_id:long = Peer; -peerChannel#a2a5371e channel_id:long = Peer; -storage.fileUnknown#aa963b05 = storage.FileType; -storage.filePartial#40bc6f52 = storage.FileType; -storage.fileJpeg#7efe0e = storage.FileType; -storage.fileGif#cae1aadf = storage.FileType; -storage.filePng#a4f63c0 = storage.FileType; -storage.filePdf#ae1e508d = storage.FileType; -storage.fileMp3#528a0677 = storage.FileType; -storage.fileMov#4b09ebbc = storage.FileType; -storage.fileMp4#b3cea0e4 = storage.FileType; -storage.fileWebp#1081464c = storage.FileType; -userEmpty#d3bc4b7a id:long = User; -user#4b46c37e flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long = User; -userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; -userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; -userStatusEmpty#9d05049 = UserStatus; -userStatusOnline#edb93949 expires:int = UserStatus; -userStatusOffline#8c703f was_online:int = UserStatus; -userStatusRecently#7b197dc8 flags:# by_me:flags.0?true = UserStatus; -userStatusLastWeek#541a1d1a flags:# by_me:flags.0?true = UserStatus; -userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus; -chatEmpty#29562865 id:long = Chat; -chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; -chatForbidden#6592a1a7 id:long title:string = Chat; -channel#e00998b7 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long = Chat; -channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; -chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; -channelFull#52d6806b flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int = ChatFull; -chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; -chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; -chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; -chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; -chatParticipants#3cbc93f8 chat_id:long participants:Vector<ChatParticipant> version:int = ChatParticipants; -chatPhotoEmpty#37c1011c = ChatPhoto; -chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto; -messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; -message#96fdbbe9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int = Message; -messageService#d3d28540 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message; -messageMediaEmpty#3ded6320 = MessageMedia; -messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; -messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; -messageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia; -messageMediaUnsupported#9f84f49e = MessageMedia; -messageMediaDocument#52d8ccd9 flags:# nopremium:flags.3?true spoiler:flags.4?true video:flags.6?true round:flags.7?true voice:flags.8?true document:flags.0?Document alt_documents:flags.5?Vector<Document> video_cover:flags.9?Photo video_timestamp:flags.10?int ttl_seconds:flags.2?int = MessageMedia; -messageMediaWebPage#ddf10c3b flags:# force_large_media:flags.0?true force_small_media:flags.1?true manual:flags.3?true safe:flags.4?true webpage:WebPage = MessageMedia; -messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; -messageMediaGame#fdb19008 game:Game = MessageMedia; -messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia; -messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia; -messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; -messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; -messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#aa073beb flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector<long> countries_iso2:flags.1?Vector<string> prize_description:flags.3?string quantity:int months:flags.4?int stars:flags.5?long until_date:int = MessageMedia; -messageMediaGiveawayResults#ceaa3ea1 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector<long> months:flags.4?int stars:flags.5?long prize_description:flags.1?string until_date:int = MessageMedia; -messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector<MessageExtendedMedia> = MessageMedia; -messageActionEmpty#b6aef7b0 = MessageAction; -messageActionChatCreate#bd47cbad title:string users:Vector<long> = MessageAction; -messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; -messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; -messageActionChatDeletePhoto#95e3fbef = MessageAction; -messageActionChatAddUser#15cefd00 users:Vector<long> = MessageAction; -messageActionChatDeleteUser#a43f30cc user_id:long = MessageAction; -messageActionChatJoinedByLink#31224c3 inviter_id:long = MessageAction; -messageActionChannelCreate#95d2ac92 title:string = MessageAction; -messageActionChatMigrateTo#e1037f92 channel_id:long = MessageAction; -messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageAction; -messageActionPinMessage#94bd38ed = MessageAction; -messageActionHistoryClear#9fbab604 = MessageAction; -messageActionGameScore#92a72876 game_id:long score:int = MessageAction; -messageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction; -messageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction; -messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; -messageActionScreenshotTaken#4792929b = MessageAction; -messageActionCustomAction#fae69f56 message:string = MessageAction; -messageActionBotAllowed#c516d679 flags:# attach_menu:flags.1?true from_request:flags.3?true domain:flags.0?string app:flags.2?BotApp = MessageAction; -messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction; -messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction; -messageActionContactSignUp#f3f25f76 = MessageAction; -messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction; -messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction; -messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector<long> = MessageAction; -messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; -messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; -messageActionSetChatTheme#aa786345 emoticon:string = MessageAction; -messageActionChatJoinedByRequest#ebbca3cb = MessageAction; -messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; -messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; -messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; -messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; -messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; -messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; -messageActionRequestedPeer#31518e9b button_id:int peers:Vector<Peer> = MessageAction; -messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; -messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; -messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction; -messageActionBoostApply#cc02aa6d boosts:int = MessageAction; -messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector<RequestedPeer> = MessageAction; -messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; -messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction; -messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; -messageActionStarGift#4717e8a4 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long = MessageAction; -messageActionStarGiftUnique#acdfcb81 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long = MessageAction; -dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; -dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; -photoEmpty#2331b22d id:long = Photo; -photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo; -photoSizeEmpty#e17e23c type:string = PhotoSize; -photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize; -photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize; -photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize; -photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize; -photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize; -geoPointEmpty#1117dd5f = GeoPoint; -geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint; -auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; -auth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode; -auth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization; -auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization; -auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization; -inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; -inputNotifyUsers#193b4417 = InputNotifyPeer; -inputNotifyChats#4a95e84e = InputNotifyPeer; -inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; -inputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer; -inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings; -peerNotifySettings#99622c0c flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_ios_sound:flags.8?NotificationSound stories_android_sound:flags.9?NotificationSound stories_other_sound:flags.10?NotificationSound = PeerNotifySettings; -peerSettings#acd66c5e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string = PeerSettings; -wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; -wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper; -inputReportReasonSpam#58dbcab8 = ReportReason; -inputReportReasonViolence#1e22c78d = ReportReason; -inputReportReasonPornography#2e59d922 = ReportReason; -inputReportReasonChildAbuse#adf44ee3 = ReportReason; -inputReportReasonOther#c1e4a2b1 = ReportReason; -inputReportReasonCopyright#9b89f93a = ReportReason; -inputReportReasonGeoIrrelevant#dbd4feed = ReportReason; -inputReportReasonFake#f5ddd6e7 = ReportReason; -inputReportReasonIllegalDrugs#a8eb2be = ReportReason; -inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#4d975bbc flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification = UserFull; -contact#145ade0b user_id:long mutual:Bool = Contact; -importedContact#c13e3c50 user_id:long client_id:long = ImportedContact; -contactStatus#16d9703b user_id:long status:UserStatus = ContactStatus; -contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; -contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts; -contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts; -contacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked; -contacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked; -messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; -messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; -messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; -messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; -messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; -messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> topics:Vector<ForumTopic> chats:Vector<Chat> users:Vector<User> = messages.Messages; -messages.messagesNotModified#74535f21 count:int = messages.Messages; -messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; -messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats; -messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; -messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; -inputMessagesFilterEmpty#57e2f66c = MessagesFilter; -inputMessagesFilterPhotos#9609a51c = MessagesFilter; -inputMessagesFilterVideo#9fc00e65 = MessagesFilter; -inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; -inputMessagesFilterDocument#9eddf188 = MessagesFilter; -inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; -inputMessagesFilterGif#ffc86587 = MessagesFilter; -inputMessagesFilterVoice#50f5c392 = MessagesFilter; -inputMessagesFilterMusic#3751b49e = MessagesFilter; -inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; -inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; -inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; -inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; -inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; -inputMessagesFilterGeo#e7026d0d = MessagesFilter; -inputMessagesFilterContacts#e062db83 = MessagesFilter; -inputMessagesFilterPinned#1bb00451 = MessagesFilter; -updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; -updateMessageID#4e90bfd6 id:int random_id:long = Update; -updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update; -updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update; -updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update; -updateChatParticipants#7761198 participants:ChatParticipants = Update; -updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update; -updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector<Username> = Update; -updateNewAuthorization#8951abef flags:# unconfirmed:flags.0?true hash:long date:flags.0?int device:flags.0?string location:flags.0?string = Update; -updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; -updateEncryptedChatTyping#1710f156 chat_id:int = Update; -updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; -updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; -updateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date:int version:int = Update; -updateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update; -updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update; -updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; -updateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update; -updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; -updateUserPhone#5492a13 user_id:long phone:string = Update; -updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update; -updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; -updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; -updateReadMessagesContents#f8227181 flags:# messages:Vector<int> pts:int pts_count:int date:flags.0?int = Update; -updateChannelTooLong#108d941f flags:# channel_id:long pts:flags.0?int = Update; -updateChannel#635b4c09 channel_id:long = Update; -updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; -updateReadChannelInbox#922e6e10 flags:# folder_id:flags.0?int channel_id:long max_id:int still_unread_count:int pts:int = Update; -updateDeleteChannelMessages#c32d5b12 channel_id:long messages:Vector<int> pts:int pts_count:int = Update; -updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update; -updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update; -updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; -updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update; -updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update; -updateSavedGifs#9375341e = Update; -updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update; -updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; -updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; -updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; -updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; -updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; -updateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update; -updateDraftMessage#1b49ec6d flags:# peer:Peer top_msg_id:flags.0?int draft:DraftMessage = Update; -updateReadFeaturedStickers#571d2742 = Update; -updateRecentStickers#9a422c20 = Update; -updateConfig#a229dd06 = Update; -updatePtsChanged#3354678f = Update; -updateChannelWebPage#2f2ba99f channel_id:long webpage:WebPage pts:int pts_count:int = Update; -updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update; -updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update; -updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; -updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; -updateBotShippingQuery#b5aefd7d query_id:long user_id:long payload:bytes shipping_address:PostAddress = Update; -updateBotPrecheckoutQuery#8caa9a96 flags:# query_id:long user_id:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; -updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; -updateLangPackTooLong#46560264 lang_code:string = Update; -updateLangPack#56022f4d difference:LangPackDifference = Update; -updateFavedStickers#e511996d = Update; -updateChannelReadMessagesContents#ea29055d flags:# channel_id:long top_msg_id:flags.0?int messages:Vector<int> = Update; -updateContactsReset#7084a7be = Update; -updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update; -updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; -updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update; -updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update; -updateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update; -updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update; -updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update; -updateNewScheduledMessage#39a51dfb message:Message = Update; -updateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector<int> sent_messages:flags.0?Vector<int> = Update; -updateTheme#8216fba3 theme:Theme = Update; -updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update; -updateLoginToken#564fe691 = Update; -updateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector<bytes> qts:int = Update; -updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update; -updateDialogFilterOrder#a5d72105 order:Vector<int> = Update; -updateDialogFilters#3504914f = Update; -updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update; -updateChannelMessageForwards#d29a27f4 channel_id:long id:int forwards:int = Update; -updateReadChannelDiscussionInbox#d6b19546 flags:# channel_id:long top_msg_id:int read_max_id:int broadcast_id:flags.0?long broadcast_post:flags.0?int = Update; -updateReadChannelDiscussionOutbox#695c9e7c channel_id:long top_msg_id:int read_max_id:int = Update; -updatePeerBlocked#ebe07752 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer = Update; -updateChannelUserTyping#8c88c923 flags:# channel_id:long top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update; -updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update; -updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update; -updateChat#f89a6a4e chat_id:long = Update; -updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update; -updateGroupCall#97d64341 flags:# chat_id:flags.0?long call:GroupCall = Update; -updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update; -updateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update; -updateChannelParticipant#985d3abb flags:# via_chatlist:flags.3?true channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update; -updateBotStopped#c4870a49 user_id:long date:int stopped:Bool qts:int = Update; -updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update; -updateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector<BotCommand> = Update; -updatePendingJoinRequests#7063c3db peer:Peer requests_pending:int recent_requesters:Vector<long> = Update; -updateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:string invite:ExportedChatInvite qts:int = Update; -updateMessageReactions#5e1b3cb8 flags:# peer:Peer msg_id:int top_msg_id:flags.0?int reactions:MessageReactions = Update; -updateAttachMenuBots#17b7a20b = Update; -updateWebViewResultSent#1592b79d query_id:long = Update; -updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update; -updateSavedRingtones#74d8be99 = Update; -updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update; -updateReadFeaturedEmojiStickers#fb4c496c = Update; -updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update; -updateRecentEmojiStatuses#30f443db = Update; -updateRecentReactions#6f7863f4 = Update; -updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update; -updateMessageExtendedMedia#d5a41724 peer:Peer msg_id:int extended_media:Vector<MessageExtendedMedia> = Update; -updateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update; -updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector<int> = Update; -updateUser#20529438 user_id:long = Update; -updateAutoSaveSettings#ec05b097 = Update; -updateStory#75b3b798 peer:Peer story:StoryItem = Update; -updateReadStories#f74e932b peer:Peer max_id:int = Update; -updateStoryID#1bf335b9 id:int random_id:long = Update; -updateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update; -updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update; -updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; -updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; -updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; -updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector<Reaction> new_reactions:Vector<Reaction> qts:int = Update; -updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector<ReactionCount> qts:int = Update; -updateSavedDialogPinned#aeaf9e74 flags:# pinned:flags.0?true peer:DialogPeer = Update; -updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector<DialogPeer> = Update; -updateSavedReactionTags#39c67432 = Update; -updateSmsJob#f16269d4 job_id:string = Update; -updateQuickReplies#f9470ab2 quick_replies:Vector<QuickReply> = Update; -updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; -updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; -updateQuickReplyMessage#3e050d0f message:Message = Update; -updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector<int> = Update; -updateBotBusinessConnect#8ae5c97a connection:BotBusinessConnection qts:int = Update; -updateBotNewBusinessMessage#9ddb347c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; -updateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; -updateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector<int> qts:int = Update; -updateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update; -updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update; -updateStarsBalance#4e80a379 balance:StarsAmount = Update; -updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update; -updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update; -updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update; -updatePaidReactionPrivacy#51ca7aec private:Bool = Update; -updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; -updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; -updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference; -updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference; -updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; -updatesTooLong#e317af7e = Updates; -updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; -updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; -updateShort#78d4dec1 update:Update date:int = Updates; -updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates; -updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates; -updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; -photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos; -photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos; -photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; -upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; -upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File; -dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; -config#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config; -nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; -help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate; -help.noAppUpdate#c45a6536 = help.AppUpdate; -help.inviteText#18cb9f78 message:string = help.InviteText; -encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; -encryptedChatWaiting#66b25953 id:int access_hash:long date:int admin_id:long participant_id:long = EncryptedChat; -encryptedChatRequested#48f1d94c flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:long participant_id:long g_a:bytes = EncryptedChat; -encryptedChat#61f0d4c7 id:int access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long = EncryptedChat; -encryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat; -inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; -encryptedFileEmpty#c21f497e = EncryptedFile; -encryptedFile#a8008cd8 id:long access_hash:long size:long dc_id:int key_fingerprint:int = EncryptedFile; -inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; -inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; -inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; -inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; -encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; -encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; -messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; -messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; -messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; -messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; -inputDocumentEmpty#72f0eaae = InputDocument; -inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; -documentEmpty#36f8c871 id:long = Document; -document#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document; -help.support#17c6b5f6 phone_number:string user:User = help.Support; -notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; -notifyUsers#b4c83b4c = NotifyPeer; -notifyChats#c007cec3 = NotifyPeer; -notifyBroadcasts#d612e8ef = NotifyPeer; -notifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer; -sendMessageTypingAction#16bf744e = SendMessageAction; -sendMessageCancelAction#fd5ec8f5 = SendMessageAction; -sendMessageRecordVideoAction#a187d66f = SendMessageAction; -sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; -sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; -sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; -sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; -sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; -sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; -sendMessageChooseContactAction#628cbc6f = SendMessageAction; -sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; -sendMessageRecordRoundAction#88f27fbc = SendMessageAction; -sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; -speakingInGroupCallAction#d92c2285 = SendMessageAction; -sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction; -sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction; -sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction; -sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction; -contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; -inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; -inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; -inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; -inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; -inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey; -inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey; -inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey; -inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey; -inputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey; -inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; -inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; -inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; -privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; -privacyKeyChatInvite#500e6dfa = PrivacyKey; -privacyKeyPhoneCall#3d662b7b = PrivacyKey; -privacyKeyPhoneP2P#39491cc8 = PrivacyKey; -privacyKeyForwards#69ec56a3 = PrivacyKey; -privacyKeyProfilePhoto#96151fed = PrivacyKey; -privacyKeyPhoneNumber#d19ae46d = PrivacyKey; -privacyKeyAddedByPhone#42ffd42b = PrivacyKey; -privacyKeyVoiceMessages#697f414 = PrivacyKey; -privacyKeyAbout#a486b761 = PrivacyKey; -privacyKeyBirthday#2000a518 = PrivacyKey; -privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; -inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; -inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; -inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; -inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; -inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; -inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; -inputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule; -inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule; -inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; -inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; -inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; -inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule; -privacyValueAllowContacts#fffe1bac = PrivacyRule; -privacyValueAllowAll#65427b82 = PrivacyRule; -privacyValueAllowUsers#b8905fb2 users:Vector<long> = PrivacyRule; -privacyValueDisallowContacts#f888fa1a = PrivacyRule; -privacyValueDisallowAll#8b73e763 = PrivacyRule; -privacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule; -privacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule; -privacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule; -privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; -privacyValueAllowPremium#ece9814b = PrivacyRule; -privacyValueAllowBots#21461b5d = PrivacyRule; -privacyValueDisallowBots#f6a5f82f = PrivacyRule; -account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules; -accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; -documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; -documentAttributeAnimated#11b58939 = DocumentAttribute; -documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; -documentAttributeVideo#43c57c48 flags:# round_message:flags.0?true supports_streaming:flags.1?true nosound:flags.3?true duration:double w:int h:int preload_prefix_size:flags.2?int video_start_ts:flags.4?double video_codec:flags.5?string = DocumentAttribute; -documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; -documentAttributeFilename#15590068 file_name:string = DocumentAttribute; -documentAttributeHasStickers#9801d2f7 = DocumentAttribute; -documentAttributeCustomEmoji#fd149899 flags:# free:flags.0?true text_color:flags.1?true alt:string stickerset:InputStickerSet = DocumentAttribute; -messages.stickersNotModified#f1749a22 = messages.Stickers; -messages.stickers#30a6ec7e hash:long stickers:Vector<Document> = messages.Stickers; -stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack; -messages.allStickersNotModified#e86602c3 = messages.AllStickers; -messages.allStickers#cdbbcebb hash:long sets:Vector<StickerSet> = messages.AllStickers; -messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; -webPageEmpty#211a1788 flags:# id:long url:flags.0?string = WebPage; -webPagePending#b0d13e47 flags:# id:long url:flags.0?string date:int = WebPage; -webPage#e89c45b2 flags:# has_large_media:flags.13?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage; -webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage; -authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true unconfirmed:flags.5?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; -account.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector<Authorization> = account.Authorizations; -account.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password; -account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; -account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; -auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; -receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; -chatInviteExported#a22cbd96 flags:# revoked:flags.0?true permanent:flags.5?true request_needed:flags.6?true link:string admin_id:long date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int requested:flags.7?int subscription_expired:flags.10?int title:flags.8?string subscription_pricing:flags.9?StarsSubscriptionPricing = ExportedChatInvite; -chatInvitePublicJoinRequests#ed107ab7 = ExportedChatInvite; -chatInviteAlready#5a686d7c chat:Chat = ChatInvite; -chatInvite#5c9d3702 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true can_refulfill_subscription:flags.11?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector<User> color:int subscription_pricing:flags.10?StarsSubscriptionPricing subscription_form_id:flags.12?long bot_verification:flags.13?BotVerification = ChatInvite; -chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite; -inputStickerSetEmpty#ffb62b95 = InputStickerSet; -inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; -inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; -inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet; -inputStickerSetDice#e67f520e emoticon:string = InputStickerSet; -inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet; -inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet; -inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; -inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; -inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; -inputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet; -stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true creator:flags.11?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; -messages.stickerSet#6e153f16 set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = messages.StickerSet; -messages.stickerSetNotModified#d3f924eb = messages.StickerSet; -botCommand#c27ac8c7 command:string description:string = BotCommand; -botInfo#4d8a0299 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings verifier_settings:flags.9?BotVerifierSettings = BotInfo; -keyboardButton#a2fa4880 text:string = KeyboardButton; -keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; -keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; -keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; -keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; -keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector<InlineQueryPeerType> = KeyboardButton; -keyboardButtonGame#50f41ccf text:string = KeyboardButton; -keyboardButtonBuy#afd93fbb text:string = KeyboardButton; -keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; -inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; -keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; -inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; -keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; -keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; -keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; -keyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton; -keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow; -replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; -replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup; -replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup; -replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup; -messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; -messageEntityMention#fa04579d offset:int length:int = MessageEntity; -messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; -messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; -messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; -messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; -messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; -messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; -messageEntityCode#28a20571 offset:int length:int = MessageEntity; -messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; -messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; -messageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity; -inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; -messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; -messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; -messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity; -messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity; -messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity; -messageEntitySpoiler#32ca960f offset:int length:int = MessageEntity; -messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = MessageEntity; -messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; -inputChannelEmpty#ee8c1e86 = InputChannel; -inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; -inputChannelFromMessage#5b934f9d peer:InputPeer msg_id:int channel_id:long = InputChannel; -contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; -messageRange#ae30253 min_id:int max_id:int = MessageRange; -updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; -updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; -updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; -channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; -channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter; -channelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant; -channelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant; -channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; -channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; -channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; -channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; -channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; -channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; -channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; -channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; -channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; -channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; -channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter; -channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter; -channels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants; -channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; -channels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant; -help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService; -messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; -messages.savedGifs#84a02a0d hash:long gifs:Vector<Document> = messages.SavedGifs; -inputBotInlineMessageMediaAuto#3380c786 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaWebPage#bddcc510 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true optional:flags.6?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; -inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; -inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; -inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; -botInlineMessageMediaAuto#764cf810 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaWebPage#809ad9a6 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true manual:flags.7?true safe:flags.8?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; -botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; -messages.botResults#e021f2f6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM switch_webview:flags.3?InlineBotWebView results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults; -exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; -messageFwdHeader#4e4df4bb flags:# imported:flags.7?true saved_out:flags.11?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int saved_from_id:flags.8?Peer saved_from_name:flags.9?string saved_date:flags.10?int psa_type:flags.6?string = MessageFwdHeader; -auth.codeTypeSms#72a3158c = auth.CodeType; -auth.codeTypeCall#741cd3e3 = auth.CodeType; -auth.codeTypeFlashCall#226ccefb = auth.CodeType; -auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; -auth.codeTypeFragmentSms#6ed998c = auth.CodeType; -auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; -auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; -auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; -auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; -auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType; -auth.sentCodeTypeEmailCode#f450f59b flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int reset_available_period:flags.3?int reset_pending_date:flags.4?int = auth.SentCodeType; -auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; -auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; -auth.sentCodeTypeFirebaseSms#9fd736 flags:# nonce:flags.0?bytes play_integrity_project_id:flags.2?long play_integrity_nonce:flags.2?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType; -auth.sentCodeTypeSmsWord#a416ac81 flags:# beginning:flags.0?string = auth.SentCodeType; -auth.sentCodeTypeSmsPhrase#b37794af flags:# beginning:flags.0?string = auth.SentCodeType; -messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; -messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; -inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; -inputBotInlineMessageID64#b6d915d7 dc_id:int owner_id:long id:int access_hash:long = InputBotInlineMessageID; -inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; -messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs; -topPeer#edcdc05b peer:Peer rating:double = TopPeer; -topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; -topPeerCategoryBotsInline#148677e2 = TopPeerCategory; -topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; -topPeerCategoryGroups#bd17a14a = TopPeerCategory; -topPeerCategoryChannels#161d9628 = TopPeerCategory; -topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; -topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory; -topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory; -topPeerCategoryBotsApp#fd9e7bec = TopPeerCategory; -topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers; -contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; -contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers; -contacts.topPeersDisabled#b52c939d = contacts.TopPeers; -draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; -draftMessage#2d65321f flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia date:int effect:flags.7?long = DraftMessage; -messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers; -messages.featuredStickers#be382906 flags:# premium:flags.0?true hash:long count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers; -messages.recentStickersNotModified#b17f890 = messages.RecentStickers; -messages.recentStickers#88d37c56 hash:long packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers; -messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers; -messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; -messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult; -stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; -stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered; -stickerSetFullCovered#40d13c0e set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = StickerSetCovered; -stickerSetNoCovered#77b15d1c set:StickerSet = StickerSetCovered; -maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; -inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; -inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; -game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; -inputGameID#32c3e77 id:long access_hash:long = InputGame; -inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; -highScore#73a379eb pos:int user_id:long score:int = HighScore; -messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores; -textEmpty#dc3d824f = RichText; -textPlain#744694e0 text:string = RichText; -textBold#6724abc4 text:RichText = RichText; -textItalic#d912a59c text:RichText = RichText; -textUnderline#c12622c4 text:RichText = RichText; -textStrike#9bf8bb95 text:RichText = RichText; -textFixed#6c3f19b9 text:RichText = RichText; -textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; -textEmail#de5a0dd6 text:RichText email:string = RichText; -textConcat#7e6260d7 texts:Vector<RichText> = RichText; -textSubscript#ed6a8504 text:RichText = RichText; -textSuperscript#c7fb5e01 text:RichText = RichText; -textMarked#34b8621 text:RichText = RichText; -textPhone#1ccb966a text:RichText phone:string = RichText; -textImage#81ccf4f document_id:long w:int h:int = RichText; -textAnchor#35553762 text:RichText name:string = RichText; -pageBlockUnsupported#13567e8a = PageBlock; -pageBlockTitle#70abc3fd text:RichText = PageBlock; -pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; -pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; -pageBlockHeader#bfd064ec text:RichText = PageBlock; -pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; -pageBlockParagraph#467a0766 text:RichText = PageBlock; -pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; -pageBlockFooter#48870999 text:RichText = PageBlock; -pageBlockDivider#db20b188 = PageBlock; -pageBlockAnchor#ce0d37b0 name:string = PageBlock; -pageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock; -pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; -pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; -pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; -pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; -pageBlockCover#39f23300 cover:PageBlock = PageBlock; -pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; -pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock; -pageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock; -pageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock; -pageBlockChannel#ef1751b5 channel:Chat = PageBlock; -pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; -pageBlockKicker#1e148390 text:RichText = PageBlock; -pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock; -pageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock; -pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock; -pageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock; -pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; -phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; -phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; -phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; -phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; -phoneCallDiscardReasonAllowGroupCall#afe2b839 encrypted_key:bytes = PhoneCallDiscardReason; -dataJSON#7d748d04 data:string = DataJSON; -labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> terms_url:flags.10?string subscription_period:flags.11?int = Invoice; -paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; -postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; -paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; -paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; -webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; -webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; -inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument; -inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; -inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; -inputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document:flags.0?InputDocument title:flags.1?string performer:flags.1?string = InputWebFileLocation; -upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; -payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector<PaymentFormMethod> saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector<PaymentSavedCredentials> users:Vector<User> = payments.PaymentForm; -payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector<User> = payments.PaymentForm; -payments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm; -payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; -payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; -payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult; -payments.paymentReceipt#70c4fe03 flags:# date:int bot_id:long provider_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; -payments.paymentReceiptStars#dabbf83a flags:# date:int bot_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice currency:string total_amount:long transaction_id:string users:Vector<User> = payments.PaymentReceipt; -payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; -inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; -inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; -inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; -inputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials; -account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; -shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption; -inputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords keywords:flags.1?string = InputStickerSetItem; -inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; -phoneCallEmpty#5366c915 id:long = PhoneCall; -phoneCallWaiting#eed42858 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int conference_call:flags.8?InputGroupCall = PhoneCall; -phoneCallRequested#45361c63 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall; -phoneCallAccepted#22fd7181 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall; -phoneCall#3ba5940c flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON conference_call:flags.8?InputGroupCall = PhoneCall; -phoneCallDiscarded#f9d25503 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int conference_call:flags.8?InputGroupCall = PhoneCall; -phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; -phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection; -phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol; -phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall; -upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; -upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; -cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; -cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig; -langPackString#cad181f6 key:string value:string = LangPackString; -langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; -langPackStringDeleted#2979eeb2 key:string = LangPackString; -langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference; -langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage; -channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; -channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; -channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; -channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; -channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction; -channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeLinkedChat#50c7ac8 prev_value:long new_value:long = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction; -channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction; -channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantJoinByInvite#fe9fc158 flags:# via_chatlist:flags.0?true invite:ExportedChatInvite = ChannelAdminLogEventAction; -channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction; -channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction; -channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleForum#2cc6383 new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction; -channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction; -channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction; -channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; -channelAdminLogEventActionToggleSignatureProfiles#60a79c79 new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; -channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; -channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; -popularContact#5ce14175 client_id:long importers:int = PopularContact; -messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; -messages.favedStickers#2cb51097 hash:long packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers; -recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; -recentMeUrlUser#b92c09e2 url:string user_id:long = RecentMeUrl; -recentMeUrlChat#b2da71d2 url:string chat_id:long = RecentMeUrl; -recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; -recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; -help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls; -inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia; -webAuthorization#a6f8f452 hash:long bot_id:long domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; -account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations; -inputMessageID#a676a322 id:int = InputMessage; -inputMessageReplyTo#bad88395 id:int = InputMessage; -inputMessagePinned#86872538 = InputMessage; -inputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage; -inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; -inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer; -dialogPeer#e56dbf05 peer:Peer = DialogPeer; -dialogPeerFolder#514519e2 folder_id:int = DialogPeer; -messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; -messages.foundStickerSets#8af09dd2 hash:long sets:Vector<StickerSetCovered> = messages.FoundStickerSets; -fileHash#f39b035c offset:long limit:int hash:bytes = FileHash; -inputClientProxy#75588b3f address:string port:int = InputClientProxy; -help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; -help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; -inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; -inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; -secureFileEmpty#64199744 = SecureFile; -secureFile#7d09c27e id:long access_hash:long size:long dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; -secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; -securePlainPhone#7d6099dd phone:string = SecurePlainData; -securePlainEmail#21ec5a5f email:string = SecurePlainData; -secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; -secureValueTypePassport#3dac6a00 = SecureValueType; -secureValueTypeDriverLicense#6e425c4 = SecureValueType; -secureValueTypeIdentityCard#a0d0744b = SecureValueType; -secureValueTypeInternalPassport#99a48f23 = SecureValueType; -secureValueTypeAddress#cbe31e26 = SecureValueType; -secureValueTypeUtilityBill#fc36954e = SecureValueType; -secureValueTypeBankStatement#89137c0d = SecureValueType; -secureValueTypeRentalAgreement#8b883488 = SecureValueType; -secureValueTypePassportRegistration#99e3806a = SecureValueType; -secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; -secureValueTypePhone#b320aadb = SecureValueType; -secureValueTypeEmail#8e3ca7ee = SecureValueType; -secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; -inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue; -secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; -secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; -secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError; -secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; -secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError; -secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; -account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm; -account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; -help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; -help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo; -savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; -account.takeout#4dba4501 id:long = account.Takeout; -passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; -passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; -securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; -securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; -securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; -secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; -inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; -inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; -secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; -secureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType; -help.passportConfigNotModified#bfb9f457 = help.PassportConfig; -help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; -inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent; -jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue; -jsonNull#3f6d7b68 = JSONValue; -jsonBool#c7345e6a value:Bool = JSONValue; -jsonNumber#2be0dfa4 value:double = JSONValue; -jsonString#b71e767a value:string = JSONValue; -jsonArray#f7444763 value:Vector<JSONValue> = JSONValue; -jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue; -pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; -pageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow; -pageCaption#6f747657 text:RichText credit:RichText = PageCaption; -pageListItemText#b92fb6cd text:RichText = PageListItem; -pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem; -pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; -pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem; -pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle; -page#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page; -help.supportName#8c05f1c9 name:string = help.SupportName; -help.userInfoEmpty#f3ae2eed = help.UserInfo; -help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo; -pollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer; -poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll; -pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters; -pollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults; -chatOnlines#f041e250 onlines:int = ChatOnlines; -statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; -inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; -inputWallPaperSlug#72091c80 slug:string = InputWallPaper; -inputWallPaperNoFile#967a462e id:long = InputWallPaper; -account.wallPapersNotModified#1c199183 = account.WallPapers; -account.wallPapers#cdc3858c hash:long wallpapers:Vector<WallPaper> = account.WallPapers; -codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true unknown_number:flags.9?true logout_tokens:flags.6?Vector<bytes> token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; -wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; -autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; -account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings; -emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword; -emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword; -emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference; -emojiURL#a575739d url:string = EmojiURL; -emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage; -folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder; -inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer; -folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; -messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; -urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; -urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; -urlAuthResultDefault#a9d6db1f = UrlAuthResult; -channelLocationEmpty#bfb5ad8b = ChannelLocation; -channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation; -peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated; -peerSelfLocated#f8ec284b expires:int = PeerLocated; -restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason; -inputTheme#3c5693e9 id:long access_hash:long = InputTheme; -inputThemeSlug#f5890df1 slug:string = InputTheme; -theme#a00e67d6 flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?Vector<ThemeSettings> emoticon:flags.6?string installs_count:flags.4?int = Theme; -account.themesNotModified#f41eb622 = account.Themes; -account.themes#9a3d8c6d hash:long themes:Vector<Theme> = account.Themes; -auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken; -auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken; -auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken; -account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings; -messages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats; -baseThemeClassic#c3a12462 = BaseTheme; -baseThemeDay#fbd81688 = BaseTheme; -baseThemeNight#b7b31ea8 = BaseTheme; -baseThemeTinted#6d5f77ee = BaseTheme; -baseThemeArctic#5b11125a = BaseTheme; -inputThemeSettings#8fde504f flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; -themeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?WallPaper = ThemeSettings; -webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute; -webPageAttributeStory#2e94c3e7 flags:# peer:Peer id:int story:flags.0?StoryItem = WebPageAttribute; -webPageAttributeStickerSet#50cc03d3 flags:# emojis:flags.0?true text_color:flags.1?true stickers:Vector<Document> = WebPageAttribute; -webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute; -messages.votesList#4899484e flags:# count:int votes:Vector<MessagePeerVote> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.VotesList; -bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; -payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData; -dialogFilter#aa472651 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter; -dialogFilterDefault#363293ae = DialogFilter; -dialogFilterChatlist#96537bd7 flags:# has_my_invites:flags.26?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter; -dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; -statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays; -statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev; -statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue; -statsGraphAsync#4a27eb2d token:string = StatsGraph; -statsGraphError#bedc9822 error:string = StatsGraph; -statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; -stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector<PostInteractionCounters> = stats.BroadcastStats; -help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; -help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData; -videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize; -videoSizeEmojiMarkup#f85c413c emoji_id:long background_colors:Vector<int> = VideoSize; -videoSizeStickerMarkup#da082fe stickerset:InputStickerSet sticker_id:long background_colors:Vector<int> = VideoSize; -statsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster; -statsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin; -statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter; -stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats; -globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings; -help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode; -help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country; -help.countriesListNotModified#93cc1f32 = help.CountriesList; -help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList; -messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews; -messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews; -messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage; -messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int = MessageReplyHeader; -messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; -messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; -peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; -stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; -groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; -groupCall#cdf8d3e3 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int conference_from_call:flags.14?long = GroupCall; -inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall; -groupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant; -phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall; -phone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants; -inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType; -inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType; -inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType; -inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType; -inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType; -inlineQueryPeerTypeBotPM#e3b2d0c = InlineQueryPeerType; -messages.historyImport#1662af0b id:long = messages.HistoryImport; -messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed; -messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages; -chatInviteImporter#8c5adfd9 flags:# requested:flags.0?true via_chatlist:flags.3?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter; -messages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites; -messages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite; -messages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite; -messages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters; -chatAdminWithInvites#f2ecef23 admin_id:long invites_count:int revoked_invites_count:int = ChatAdminWithInvites; -messages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites; -messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer; -phone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers; -phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite; -groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup; -groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo; -stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName; -botCommandScopeDefault#2f6cb2ab = BotCommandScope; -botCommandScopeUsers#3c4f04d8 = BotCommandScope; -botCommandScopeChats#6fe1a881 = BotCommandScope; -botCommandScopeChatAdmins#b9aa606a = BotCommandScope; -botCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope; -botCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope; -botCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope; -account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult; -account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult; -account.resetPasswordOk#e926d63e = account.ResetPasswordResult; -sponsoredMessage#4d93a990 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector<MessageEntity> photo:flags.6?Photo media:flags.14?MessageMedia color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; -messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages; -messages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages; -searchResultsCalendarPeriod#c9b0539f date:int min_msg_id:int max_msg_id:int count:int = SearchResultsCalendarPeriod; -messages.searchResultsCalendar#147ee23c flags:# inexact:flags.0?true count:int min_date:int min_msg_id:int offset_id_offset:flags.1?int periods:Vector<SearchResultsCalendarPeriod> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SearchResultsCalendar; -searchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosition; -messages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResultsPosition> = messages.SearchResultsPositions; -channels.sendAsPeers#f496b0c6 peers:Vector<SendAsPeer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers; -users.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull; -messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Vector<User> = messages.PeerSettings; -auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut; -reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount; -messageReactions#a339f0b flags:# min:flags.0?true can_see_list:flags.2?true reactions_as_tags:flags.3?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> top_reactors:flags.4?Vector<MessageReactor> = MessageReactions; -messages.messageReactionsList#31bd492d flags:# count:int reactions:Vector<MessagePeerReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.MessageReactionsList; -availableReaction#c077ec01 flags:# inactive:flags.0?true premium:flags.2?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction; -messages.availableReactionsNotModified#9f071957 = messages.AvailableReactions; -messages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction> = messages.AvailableReactions; -messagePeerReaction#8c79b63c flags:# big:flags.0?true unread:flags.1?true my:flags.2?true peer_id:Peer date:int reaction:Reaction = MessagePeerReaction; -groupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel; -phone.groupCallStreamChannels#d0e482b2 channels:Vector<GroupCallStreamChannel> = phone.GroupCallStreamChannels; -phone.groupCallStreamRtmpUrl#2dbf3432 url:string key:string = phone.GroupCallStreamRtmpUrl; -attachMenuBotIconColor#4576f3f0 name:string color:int = AttachMenuBotIconColor; -attachMenuBotIcon#b2a7386b flags:# name:string icon:Document colors:flags.0?Vector<AttachMenuBotIconColor> = AttachMenuBotIcon; -attachMenuBot#d90d8dfe flags:# inactive:flags.0?true has_settings:flags.1?true request_write_access:flags.2?true show_in_attach_menu:flags.3?true show_in_side_menu:flags.4?true side_menu_disclaimer_needed:flags.5?true bot_id:long short_name:string peer_types:flags.3?Vector<AttachMenuPeerType> icons:Vector<AttachMenuBotIcon> = AttachMenuBot; -attachMenuBotsNotModified#f1d88a5c = AttachMenuBots; -attachMenuBots#3c4301c0 hash:long bots:Vector<AttachMenuBot> users:Vector<User> = AttachMenuBots; -attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector<User> = AttachMenuBotsBot; -webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult; -webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; -botMenuButtonDefault#7533a588 = BotMenuButton; -botMenuButtonCommands#4258c205 = BotMenuButton; -botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; -account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; -account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones; -notificationSoundDefault#97e8bebe = NotificationSound; -notificationSoundNone#6f0c34df = NotificationSound; -notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; -notificationSoundRingtone#ff6c8049 id:long = NotificationSound; -account.savedRingtone#b7263f6d = account.SavedRingtone; -account.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone; -attachMenuPeerTypeSameBotPM#7d6be90e = AttachMenuPeerType; -attachMenuPeerTypeBotPM#c32bfa1a = AttachMenuPeerType; -attachMenuPeerTypePM#f146d31f = AttachMenuPeerType; -attachMenuPeerTypeChat#509113f = AttachMenuPeerType; -attachMenuPeerTypeBroadcast#7bfbdefc = AttachMenuPeerType; -inputInvoiceMessage#c5b56859 peer:InputPeer msg_id:int = InputInvoice; -inputInvoiceSlug#c326caef slug:string = InputInvoice; -inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice; -inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice; -inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice; -inputInvoiceStarGift#e8625e92 flags:# hide_name:flags.0?true include_upgrade:flags.2?true peer:InputPeer gift_id:long message:flags.1?TextWithEntities = InputInvoice; -inputInvoiceStarGiftUpgrade#4d818d5d flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = InputInvoice; -inputInvoiceStarGiftTransfer#4a5f5bd9 stargift:InputSavedStarGift to_id:InputPeer = InputInvoice; -payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; -messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; -help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo; -inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgrade:flags.1?true = InputStorePaymentPurpose; -inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector<InputUser> boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; -inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose; -premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; -paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod; -emojiStatusEmpty#2de11aae = EmojiStatus; -emojiStatus#e7ff068a flags:# document_id:long until:flags.0?int = EmojiStatus; -emojiStatusCollectible#7184603b flags:# collectible_id:long document_id:long title:string slug:string pattern_document_id:long center_color:int edge_color:int pattern_color:int text_color:int until:flags.0?int = EmojiStatus; -inputEmojiStatusCollectible#7141dbf flags:# collectible_id:long until:flags.0?int = EmojiStatus; -account.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses; -account.emojiStatuses#90c467d1 hash:long statuses:Vector<EmojiStatus> = account.EmojiStatuses; -reactionEmpty#79f5d419 = Reaction; -reactionEmoji#1b2286b8 emoticon:string = Reaction; -reactionCustomEmoji#8935fc73 document_id:long = Reaction; -reactionPaid#523da4eb = Reaction; -chatReactionsNone#eafc32bc = ChatReactions; -chatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions; -chatReactionsSome#661d4037 reactions:Vector<Reaction> = ChatReactions; -messages.reactionsNotModified#b06fdbdf = messages.Reactions; -messages.reactions#eafdf716 hash:long reactions:Vector<Reaction> = messages.Reactions; -emailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose; -emailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose; -emailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose; -emailVerificationCode#922e55a9 code:string = EmailVerification; -emailVerificationGoogle#db909ec2 token:string = EmailVerification; -emailVerificationApple#96d074fd token:string = EmailVerification; -account.emailVerified#2b96cd1b email:string = account.EmailVerified; -account.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified; -premiumSubscriptionOption#5f2d1df2 flags:# current:flags.1?true can_purchase_upgrade:flags.2?true transaction:flags.3?string months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption; -sendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer; -messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia; -messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia; -stickerKeyword#fcfeb29c document_id:long keyword:Vector<string> = StickerKeyword; -username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username; -forumTopicDeleted#23f109b id:int = ForumTopic; -forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; -messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics; -defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; -exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; -requestPeerTypeUser#5f3b8a00 flags:# bot:flags.0?Bool premium:flags.1?Bool = RequestPeerType; -requestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.5?true has_username:flags.3?Bool forum:flags.4?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; -requestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; -emojiListNotModified#481eadfa = EmojiList; -emojiList#7a1e11d1 hash:long document_id:Vector<long> = EmojiList; -emojiGroup#7a9abda9 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup; -emojiGroupGreeting#80d26cc7 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup; -emojiGroupPremium#93bcf34 title:string icon_emoji_id:long = EmojiGroup; -messages.emojiGroupsNotModified#6fb4ad87 = messages.EmojiGroups; -messages.emojiGroups#881fb94b hash:int groups:Vector<EmojiGroup> = messages.EmojiGroups; -textWithEntities#751f3146 text:string entities:Vector<MessageEntity> = TextWithEntities; -messages.translateResult#33db32f8 result:Vector<TextWithEntities> = messages.TranslatedText; -autoSaveSettings#c84834ce flags:# photos:flags.0?true videos:flags.1?true video_max_size:flags.2?long = AutoSaveSettings; -autoSaveException#81602d47 peer:Peer settings:AutoSaveSettings = AutoSaveException; -account.autoSaveSettings#4c3e069d users_settings:AutoSaveSettings chats_settings:AutoSaveSettings broadcasts_settings:AutoSaveSettings exceptions:Vector<AutoSaveException> chats:Vector<Chat> users:Vector<User> = account.AutoSaveSettings; -help.appConfigNotModified#7cde641d = help.AppConfig; -help.appConfig#dd18782e hash:int config:JSONValue = help.AppConfig; -inputBotAppID#a920bd7a id:long access_hash:long = InputBotApp; -inputBotAppShortName#908c0407 bot_id:InputUser short_name:string = InputBotApp; -botAppNotModified#5da674b7 = BotApp; -botApp#95fcd1d6 flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document hash:long = BotApp; -messages.botApp#eb50adf5 flags:# inactive:flags.0?true request_write_access:flags.1?true has_settings:flags.2?true app:BotApp = messages.BotApp; -inlineBotWebView#b57295d5 text:string url:string = InlineBotWebView; -readParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate; -inputChatlistDialogFilter#f3e0da33 filter_id:int = InputChatlist; -exportedChatlistInvite#c5181ac flags:# title:string url:string peers:Vector<Peer> = ExportedChatlistInvite; -chatlists.exportedChatlistInvite#10e6e3a6 filter:DialogFilter invite:ExportedChatlistInvite = chatlists.ExportedChatlistInvite; -chatlists.exportedInvites#10ab6dc7 invites:Vector<ExportedChatlistInvite> chats:Vector<Chat> users:Vector<User> = chatlists.ExportedInvites; -chatlists.chatlistInviteAlready#fa87f659 filter_id:int missing_peers:Vector<Peer> already_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite; -chatlists.chatlistInvite#f10ece2f flags:# title_noanimate:flags.1?true title:TextWithEntities emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite; -chatlists.chatlistUpdates#93bd878d missing_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistUpdates; -bots.botInfo#e8a775b0 name:string about:string description:string = bots.BotInfo; -messagePeerVote#b6cc2d5c peer:Peer option:bytes date:int = MessagePeerVote; -messagePeerVoteInputOption#74cda504 peer:Peer date:int = MessagePeerVote; -messagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector<bytes> date:int = MessagePeerVote; -storyViews#8d595cd6 flags:# has_viewers:flags.1?true views_count:int forwards_count:flags.2?int reactions:flags.3?Vector<ReactionCount> reactions_count:flags.4?int recent_viewers:flags.0?Vector<long> = StoryViews; -storyItemDeleted#51e6ee4f id:int = StoryItem; -storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; -stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; -stories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string peer_stories:Vector<PeerStories> chats:Vector<Chat> users:Vector<User> stealth_mode:StoriesStealthMode = stories.AllStories; -stories.stories#63c3dd0a flags:# count:int stories:Vector<StoryItem> pinned_to_top:flags.0?Vector<int> chats:Vector<Chat> users:Vector<User> = stories.Stories; -storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; -storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; -storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; -stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector<StoryView> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryViewsList; -stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews; -inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int = InputReplyTo; -inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; -exportedStoryLink#3fc9053b link:string = ExportedStoryLink; -storiesStealthMode#712e27fd flags:# active_until_date:flags.0?int cooldown_until_date:flags.1?int = StoriesStealthMode; -mediaAreaCoordinates#cfc9e002 flags:# x:double y:double w:double h:double rotation:double radius:flags.0?double = MediaAreaCoordinates; -mediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MediaArea; -inputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea; -mediaAreaGeoPoint#cad5452d flags:# coordinates:MediaAreaCoordinates geo:GeoPoint address:flags.0?GeoPointAddress = MediaArea; -mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; -mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; -inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; -mediaAreaUrl#37381085 coordinates:MediaAreaCoordinates url:string = MediaArea; -mediaAreaWeather#49a6549c coordinates:MediaAreaCoordinates emoji:string temperature_c:double color:int = MediaArea; -mediaAreaStarGift#5787686d coordinates:MediaAreaCoordinates slug:string = MediaArea; -peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector<StoryItem> = PeerStories; -stories.peerStories#cae68768 stories:PeerStories chats:Vector<Chat> users:Vector<User> = stories.PeerStories; -messages.webPage#fd5e12bd webpage:WebPage chats:Vector<Chat> users:Vector<User> = messages.WebPage; -premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; -payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector<Chat> users:Vector<User> = payments.CheckedGiftCode; -payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; -payments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo; -prepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway; -prepaidStarsGiveaway#9a9d77e0 id:long stars:long quantity:int boosts:int date:int = PrepaidGiveaway; -boost#4b3e14d6 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int stars:flags.6?long = Boost; -premium.boostsList#86f8613c flags:# count:int boosts:Vector<Boost> next_offset:flags.0?string users:Vector<User> = premium.BoostsList; -myBoost#c448415c flags:# slot:int peer:flags.0?Peer date:int expires:int cooldown_until_date:flags.1?int = MyBoost; -premium.myBoosts#9ae228e2 my_boosts:Vector<MyBoost> chats:Vector<Chat> users:Vector<User> = premium.MyBoosts; -premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector<PrepaidGiveaway> my_boost_slots:flags.2?Vector<int> = premium.BoostsStatus; -storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; -postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; -postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; -stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; -publicForwardMessage#1f2bf4a message:Message = PublicForward; -publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; -stats.publicForwards#93037e20 flags:# count:int forwards:Vector<PublicForward> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stats.PublicForwards; -peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; -help.peerColorSet#26219a58 colors:Vector<int> = help.PeerColorSet; -help.peerColorProfileSet#767d61eb palette_colors:Vector<int> bg_colors:Vector<int> story_colors:Vector<int> = help.PeerColorSet; -help.peerColorOption#adec6ebe flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int group_min_level:flags.4?int = help.PeerColorOption; -help.peerColorsNotModified#2ba1f5ce = help.PeerColors; -help.peerColors#f8ed08 hash:int colors:Vector<help.PeerColorOption> = help.PeerColors; -storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; -storyReactionPublicForward#bbab2643 message:Message = StoryReaction; -storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; -stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector<StoryReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryReactionsList; -savedDialog#bd87cb6c flags:# pinned:flags.2?true peer:Peer top_message:int = SavedDialog; -messages.savedDialogs#f83ae221 dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs; -messages.savedDialogsSlice#44ba9dd9 count:int dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs; -messages.savedDialogsNotModified#c01f6fe8 count:int = messages.SavedDialogs; -savedReactionTag#cb6ff828 flags:# reaction:Reaction title:flags.0?string count:int = SavedReactionTag; -messages.savedReactionTagsNotModified#889b59ef = messages.SavedReactionTags; -messages.savedReactionTags#3259950a tags:Vector<SavedReactionTag> hash:long = messages.SavedReactionTags; -outboxReadDate#3bb842ac date:int = OutboxReadDate; -smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; -smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; -smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; -businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; -businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector<BusinessWeeklyOpen> = BusinessWorkHours; -businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; -inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> = InputBusinessRecipients; -businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> = BusinessRecipients; -businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; -businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; -businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; -inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; -businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; -inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; -businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; -timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; -help.timezonesListNotModified#970708cc = help.TimezonesList; -help.timezonesList#7b74ed71 timezones:Vector<Timezone> hash:int = help.TimezonesList; -quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; -inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; -inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; -messages.quickReplies#c68d6695 quick_replies:Vector<QuickReply> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.QuickReplies; -messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; -connectedBot#bd068601 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessBotRecipients = ConnectedBot; -account.connectedBots#17d7f87b connected_bots:Vector<ConnectedBot> users:Vector<User> = account.ConnectedBots; -messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector<DialogFilter> = messages.DialogFilters; -birthday#6c8e1e06 flags:# day:int month:int year:flags.0?int = Birthday; -botBusinessConnection#896433b4 flags:# can_reply:flags.0?true disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int = BotBusinessConnection; -inputBusinessIntro#9c469cd flags:# title:string description:string sticker:flags.0?InputDocument = InputBusinessIntro; -businessIntro#5a0a066d flags:# title:string description:string sticker:flags.0?Document = BusinessIntro; -messages.myStickers#faff629d count:int sets:Vector<StickerSetCovered> = messages.MyStickers; -inputCollectibleUsername#e39460a9 username:string = InputCollectible; -inputCollectiblePhone#a2e214a4 phone:string = InputCollectible; -fragment.collectibleInfo#6ebdff91 purchase_date:int currency:string amount:long crypto_currency:string crypto_amount:long url:string = fragment.CollectibleInfo; -inputBusinessBotRecipients#c4e5921e flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> exclude_users:flags.6?Vector<InputUser> = InputBusinessBotRecipients; -businessBotRecipients#b88cf373 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> exclude_users:flags.6?Vector<long> = BusinessBotRecipients; -contactBirthday#1d998733 contact_id:long birthday:Birthday = ContactBirthday; -contacts.contactBirthdays#114ff30d contacts:Vector<ContactBirthday> users:Vector<User> = contacts.ContactBirthdays; -missingInvitee#628c9224 flags:# premium_would_allow_invite:flags.0?true premium_required_for_pm:flags.1?true user_id:long = MissingInvitee; -messages.invitedUsers#7f5defa6 updates:Updates missing_invitees:Vector<MissingInvitee> = messages.InvitedUsers; -inputBusinessChatLink#11679fa7 flags:# message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string = InputBusinessChatLink; -businessChatLink#b4ae666f flags:# link:string message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string views:int = BusinessChatLink; -account.businessChatLinks#ec43a2d1 links:Vector<BusinessChatLink> chats:Vector<Chat> users:Vector<User> = account.BusinessChatLinks; -account.resolvedBusinessChatLinks#9a23af21 flags:# peer:Peer message:string entities:flags.0?Vector<MessageEntity> chats:Vector<Chat> users:Vector<User> = account.ResolvedBusinessChatLinks; -requestedPeerUser#d62ff46a flags:# user_id:long first_name:flags.0?string last_name:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; -requestedPeerChat#7307544f flags:# chat_id:long title:flags.0?string photo:flags.2?Photo = RequestedPeer; -requestedPeerChannel#8ba403e4 flags:# channel_id:long title:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; -sponsoredMessageReportOption#430d3150 text:string option:bytes = SponsoredMessageReportOption; -channels.sponsoredMessageReportResultChooseOption#846f9e42 title:string options:Vector<SponsoredMessageReportOption> = channels.SponsoredMessageReportResult; -channels.sponsoredMessageReportResultAdsHidden#3e3bcf2f = channels.SponsoredMessageReportResult; -channels.sponsoredMessageReportResultReported#ad798849 = channels.SponsoredMessageReportResult; -stats.broadcastRevenueStats#5407e297 top_hours_graph:StatsGraph revenue_graph:StatsGraph balances:BroadcastRevenueBalances usd_rate:double = stats.BroadcastRevenueStats; -stats.broadcastRevenueWithdrawalUrl#ec659737 url:string = stats.BroadcastRevenueWithdrawalUrl; -broadcastRevenueTransactionProceeds#557e2cc4 amount:long from_date:int to_date:int = BroadcastRevenueTransaction; -broadcastRevenueTransactionWithdrawal#5a590978 flags:# pending:flags.0?true failed:flags.2?true amount:long date:int provider:string transaction_date:flags.1?int transaction_url:flags.1?string = BroadcastRevenueTransaction; -broadcastRevenueTransactionRefund#42d30d2e amount:long date:int provider:string = BroadcastRevenueTransaction; -stats.broadcastRevenueTransactions#87158466 count:int transactions:Vector<BroadcastRevenueTransaction> = stats.BroadcastRevenueTransactions; -reactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom; -reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom; -reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings; -broadcastRevenueBalances#c3ff71e7 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances; -availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect; -messages.availableEffectsNotModified#d1ed9a5b = messages.AvailableEffects; -messages.availableEffects#bddb616e hash:int effects:Vector<AvailableEffect> documents:Vector<Document> = messages.AvailableEffects; -factCheck#b89bfccf flags:# need_check:flags.0?true country:flags.1?string text:flags.1?TextWithEntities hash:long = FactCheck; -starsTransactionPeerUnsupported#95f2bfe4 = StarsTransactionPeer; -starsTransactionPeerAppStore#b457b375 = StarsTransactionPeer; -starsTransactionPeerPlayMarket#7b560a0b = StarsTransactionPeer; -starsTransactionPeerPremiumBot#250dbaf8 = StarsTransactionPeer; -starsTransactionPeerFragment#e92fd902 = StarsTransactionPeer; -starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; -starsTransactionPeerAds#60682812 = StarsTransactionPeer; -starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; -starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true id:string stars:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = StarsTransaction; -payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector<StarsSubscription> subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector<StarsTransaction> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.StarsStatus; -foundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory; -stories.foundStories#e2de7737 flags:# count:int stories:Vector<FoundStory> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stories.FoundStories; -geoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress; -starsRevenueStatus#febe5491 flags:# withdrawal_enabled:flags.0?true current_balance:StarsAmount available_balance:StarsAmount overall_revenue:StarsAmount next_withdrawal_at:flags.1?int = StarsRevenueStatus; -payments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats; -payments.starsRevenueWithdrawalUrl#1dab80b7 url:string = payments.StarsRevenueWithdrawalUrl; -payments.starsRevenueAdsAccountUrl#394e7f21 url:string = payments.StarsRevenueAdsAccountUrl; -inputStarsTransaction#206ae6d1 flags:# refund:flags.0?true id:string = InputStarsTransaction; -starsGiftOption#5e0589f1 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsGiftOption; -bots.popularAppBots#1991b13b flags:# next_offset:flags.0?string users:Vector<User> = bots.PopularAppBots; -botPreviewMedia#23e91ba3 date:int media:MessageMedia = BotPreviewMedia; -bots.previewInfo#ca71d64 media:Vector<BotPreviewMedia> lang_codes:Vector<string> = bots.PreviewInfo; -starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; -starsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription; -messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; -starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector<StarsGiveawayWinnersOption> = StarsGiveawayOption; -starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; -starGift#2cc73c8 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long = StarGift; -starGiftUnique#f2fe7e4a flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift; -payments.starGiftsNotModified#a388a368 = payments.StarGifts; -payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts; -messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption; -reportResultChooseOption#f0e4e0b6 title:string options:Vector<MessageReportOption> = ReportResult; -reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = ReportResult; -reportResultReported#8db33c4b = ReportResult; -messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; -messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector<InlineQueryPeerType> cache_time:int users:Vector<User> = messages.PreparedInlineMessage; -botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; -starRefProgram#dd0c66f2 flags:# bot_id:long commission_permille:int duration_months:flags.0?int end_date:flags.1?int daily_revenue_per_user:flags.2?StarsAmount = StarRefProgram; -connectedBotStarRef#19a13f71 flags:# revoked:flags.1?true url:string date:int bot_id:long commission_permille:int duration_months:flags.0?int participants:long revenue:long = ConnectedBotStarRef; -payments.connectedStarRefBots#98d5ea1d count:int connected_bots:Vector<ConnectedBotStarRef> users:Vector<User> = payments.ConnectedStarRefBots; -payments.suggestedStarRefBots#b4d5d859 flags:# count:int suggested_bots:Vector<StarRefProgram> users:Vector<User> next_offset:flags.0?string = payments.SuggestedStarRefBots; -starsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount; -messages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers; -messages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector<Document> = messages.FoundStickers; -botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true icon:long company:string custom_description:flags.0?string = BotVerifierSettings; -botVerification#f93cd45c bot_id:long icon:long description:string = BotVerification; -starGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute; -starGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute; -starGiftAttributeBackdrop#94271762 name:string center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute; -starGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute; -payments.starGiftUpgradePreview#167bd90b sample_attributes:Vector<StarGiftAttribute> = payments.StarGiftUpgradePreview; -users.users#62d706b8 users:Vector<User> = users.Users; -users.usersSlice#315a4974 count:int users:Vector<User> = users.Users; -payments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.UniqueStarGift; -messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview; -savedStarGift#6056dba5 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long = SavedStarGift; -payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector<SavedStarGift> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.SavedStarGifts; -inputSavedStarGiftUser#69279795 msg_id:int = InputSavedStarGift; -inputSavedStarGiftChat#f101aa7f peer:InputPeer saved_id:long = InputSavedStarGift; -payments.starGiftWithdrawalUrl#84aa3a9c url:string = payments.StarGiftWithdrawalUrl; ----functions--- -invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; -invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; -initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X; -invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; -invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; -invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; -invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; -invokeWithBusinessConnection#dd289f8e {X:Type} connection_id:string query:!X = X; -invokeWithGooglePlayIntegrity#1df92984 {X:Type} nonce:string token:string query:!X = X; -invokeWithApnsSecret#0dae54f8 {X:Type} nonce:string secret:string query:!X = X; -auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode; -auth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization; -auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization; -auth.logOut#3e72ba19 = auth.LoggedOut; -auth.resetAuthorizations#9fab0d1a = Bool; -auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; -auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization; -auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; -auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; -auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; -auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; -auth.recoverPassword#37096c70 flags:# code:string new_settings:flags.0?account.PasswordInputSettings = auth.Authorization; -auth.resendCode#cae47523 flags:# phone_number:string phone_code_hash:string reason:flags.0?string = auth.SentCode; -auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; -auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool; -auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long> = auth.LoginToken; -auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken; -auth.acceptLoginToken#e894ad4d token:bytes = Authorization; -auth.checkRecoveryPassword#d36bf79 code:string = Bool; -auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; -auth.requestFirebaseSms#8e39261e flags:# phone_number:string phone_code_hash:string safety_net_token:flags.0?string play_integrity_token:flags.2?string ios_push_secret:flags.1?string = Bool; -auth.resetLoginEmail#7e960193 phone_number:string phone_code_hash:string = auth.SentCode; -auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:string = Bool; -account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool; -account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool; -account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; -account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; -account.resetNotifySettings#db7e1747 = Bool; -account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; -account.updateStatus#6628562c offline:Bool = Bool; -account.getWallPapers#7967d36 hash:long = account.WallPapers; -account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool; -account.checkUsername#2714d86c username:string = Bool; -account.updateUsername#3e0bdd7c username:string = User; -account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; -account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules; -account.deleteAccount#a2c0cf74 flags:# reason:string password:flags.0?InputCheckPasswordSRP = Bool; -account.getAccountTTL#8fc711d = AccountDaysTTL; -account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; -account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode; -account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; -account.updateDeviceLocked#38df3532 period:int = Bool; -account.getAuthorizations#e320c158 = account.Authorizations; -account.resetAuthorization#df77f3bc hash:long = Bool; -account.getPassword#548a30f5 = account.Password; -account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; -account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; -account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode; -account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; -account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; -account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; -account.resetWebAuthorization#2d01b9ef hash:long = Bool; -account.resetWebAuthorizations#682d2594 = Bool; -account.getAllSecureValues#b288bc7d = Vector<SecureValue>; -account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>; -account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; -account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool; -account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string = account.AuthorizationForm; -account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool; -account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode; -account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; -account.sendVerifyEmailCode#98e037bb purpose:EmailVerifyPurpose email:string = account.SentEmailCode; -account.verifyEmail#32da4cf purpose:EmailVerifyPurpose verification:EmailVerification = account.EmailVerified; -account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout; -account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; -account.confirmPasswordEmail#8fdf1920 code:string = Bool; -account.resendPasswordEmail#7a7f2a15 = Bool; -account.cancelPasswordEmail#c1cbd5b6 = Bool; -account.getContactSignUpNotification#9f07c728 = Bool; -account.setContactSignUpNotification#cff43f61 silent:Bool = Bool; -account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true compare_stories:flags.2?true peer:flags.0?InputNotifyPeer = Updates; -account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper; -account.uploadWallPaper#e39a8f03 flags:# for_chat:flags.0?true file:InputFile mime_type:string settings:WallPaperSettings = WallPaper; -account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool; -account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; -account.resetWallPapers#bb3b9804 = Bool; -account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings; -account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool; -account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document; -account.createTheme#652e4400 flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?Vector<InputThemeSettings> = Theme; -account.updateTheme#2bf40ccc flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?Vector<InputThemeSettings> = Theme; -account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; -account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; -account.getTheme#3a5869ec format:string theme:InputTheme = Theme; -account.getThemes#7206e458 format:string hash:long = account.Themes; -account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool; -account.getContentSettings#8b9b4dae = account.ContentSettings; -account.getMultiWallPapers#65ad71dc wallpapers:Vector<InputWallPaper> = Vector<WallPaper>; -account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings; -account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings; -account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool; -account.resetPassword#9308ce1b = account.ResetPasswordResult; -account.declinePasswordReset#4c9409f6 = Bool; -account.getChatThemes#d638de89 hash:long = account.Themes; -account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool; -account.changeAuthorizationSettings#40f48462 flags:# confirmed:flags.3?true hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool; -account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones; -account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone; -account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document; -account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool; -account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses; -account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses; -account.clearRecentEmojiStatuses#18201aae = Bool; -account.reorderUsernames#ef500eab order:Vector<string> = Bool; -account.toggleUsername#58d6b376 username:string active:Bool = Bool; -account.getDefaultProfilePhotoEmojis#e2750328 hash:long = EmojiList; -account.getDefaultGroupPhotoEmojis#915860ae hash:long = EmojiList; -account.getAutoSaveSettings#adcbbcda = account.AutoSaveSettings; -account.saveAutoSaveSettings#d69b8361 flags:# users:flags.0?true chats:flags.1?true broadcasts:flags.2?true peer:flags.3?InputPeer settings:AutoSaveSettings = Bool; -account.deleteAutoSaveExceptions#53bc0020 = Bool; -account.invalidateSignInCodes#ca8ae8ba codes:Vector<string> = Bool; -account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; -account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; -account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; -account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; -account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; -account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; -account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; -account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; -account.updateConnectedBot#43d8521d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessBotRecipients = Updates; -account.getConnectedBots#4ea4c80f = account.ConnectedBots; -account.getBotBusinessConnection#76a86270 connection_id:string = Updates; -account.updateBusinessIntro#a614d034 flags:# intro:flags.0?InputBusinessIntro = Bool; -account.toggleConnectedBotPaused#646e1097 peer:InputPeer paused:Bool = Bool; -account.disablePeerConnectedBot#5e437ed9 peer:InputPeer = Bool; -account.updateBirthday#cc6e0c11 flags:# birthday:flags.0?Birthday = Bool; -account.createBusinessChatLink#8851e68e link:InputBusinessChatLink = BusinessChatLink; -account.editBusinessChatLink#8c3410af slug:string link:InputBusinessChatLink = BusinessChatLink; -account.deleteBusinessChatLink#60073674 slug:string = Bool; -account.getBusinessChatLinks#6f70dde1 = account.BusinessChatLinks; -account.resolveBusinessChatLink#5492e5ee slug:string = account.ResolvedBusinessChatLinks; -account.updatePersonalChannel#d94305e0 channel:InputChannel = Bool; -account.toggleSponsoredMessages#b9d9a38d enabled:Bool = Bool; -account.getReactionsNotifySettings#6dd654c = ReactionsNotifySettings; -account.setReactionsNotifySettings#316ce548 settings:ReactionsNotifySettings = ReactionsNotifySettings; -account.getCollectibleEmojiStatuses#2e7b4543 hash:long = account.EmojiStatuses; -users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; -users.getFullUser#b60f5918 id:InputUser = users.UserFull; -users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool; -users.getIsPremiumRequiredToContact#a622aa10 id:Vector<InputUser> = Vector<Bool>; -contacts.getContactIDs#7adc669d hash:long = Vector<int>; -contacts.getStatuses#c4a353ee = Vector<ContactStatus>; -contacts.getContacts#5dd69e12 hash:long = contacts.Contacts; -contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts; -contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates; -contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool; -contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; -contacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; -contacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true offset:int limit:int = contacts.Blocked; -contacts.search#11f812d8 q:string limit:int = contacts.Found; -contacts.resolveUsername#725afbbc flags:# username:string referer:flags.0?string = contacts.ResolvedPeer; -contacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers; -contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; -contacts.resetSaved#879537f1 = Bool; -contacts.getSaved#82f1e39f = Vector<SavedContact>; -contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; -contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates; -contacts.acceptContact#f831a20f id:InputUser = Updates; -contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates; -contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates; -contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; -contacts.exportContactToken#f8654027 = ExportedContactToken; -contacts.importContactToken#13005788 token:string = User; -contacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool; -contacts.setBlocked#94c65c76 flags:# my_stories_from:flags.0?true id:Vector<InputPeer> limit:int = Bool; -contacts.getBirthdays#daeda864 = contacts.ContactBirthdays; -messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages; -messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; -messages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; -messages.search#29ee847a flags:# peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector<Reaction> top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; -messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; -messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; -messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; -messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; -messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.forwardMessages#6d74da08 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int = Updates; -messages.reportSpam#cf1592db peer:InputPeer = Bool; -messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; -messages.report#fc78af9b peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult; -messages.getChats#49e9528f id:Vector<long> = messages.Chats; -messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull; -messages.editChatTitle#73783ffd chat_id:long title:string = Updates; -messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates; -messages.addChatUser#cbc6d107 chat_id:long user_id:InputUser fwd_limit:int = messages.InvitedUsers; -messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; -messages.createChat#92ceddd4 flags:# users:Vector<InputUser> title:string ttl_period:flags.0?int = messages.InvitedUsers; -messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; -messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; -messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; -messages.discardEncryption#f393aea0 flags:# delete_history:flags.0?true chat_id:int = Bool; -messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; -messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; -messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; -messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; -messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; -messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; -messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; -messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages; -messages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers; -messages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers; -messages.getWebPagePreview#570d6f6f flags:# message:string entities:flags.3?Vector<MessageEntity> = messages.WebPagePreview; -messages.exportChatInvite#a455de90 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string subscription_pricing:flags.5?StarsSubscriptionPricing = ExportedChatInvite; -messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; -messages.importChatInvite#6c50051c hash:string = Updates; -messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet; -messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; -messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; -messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; -messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews; -messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool; -messages.migrateChat#a2875319 chat_id:long = Updates; -messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; -messages.reorderStickerSets#78337739 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Bool; -messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document; -messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs; -messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; -messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; -messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; -messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; -messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; -messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool; -messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer; -messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; -messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs; -messages.saveDraft#d372c5ce flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia effect:flags.7?long = Bool; -messages.getAllDrafts#6a3f8d65 = Updates; -messages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers; -messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool; -messages.getRecentStickers#9da9403b flags:# attached:flags.0?true hash:long = messages.RecentStickers; -messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; -messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; -messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true emojis:flags.1?true offset_id:long limit:int = messages.ArchivedStickers; -messages.getMaskStickers#640f82b8 hash:long = messages.AllStickers; -messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>; -messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; -messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; -messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; -messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; -messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats; -messages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage; -messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; -messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector<InputDialogPeer> = Bool; -messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs; -messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool; -messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; -messages.uploadMedia#14967978 flags:# business_connection_id:flags.0?string peer:InputPeer media:InputMedia = MessageMedia; -messages.sendScreenshotNotification#a1405817 peer:InputPeer reply_to:InputReplyTo random_id:long = Updates; -messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers; -messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; -messages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; -messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; -messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; -messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; -messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; -messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; -messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; -messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>; -messages.clearAllDrafts#7e58ee9c = Bool; -messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates; -messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates; -messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates; -messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines; -messages.editChatAbout#def60797 peer:InputPeer about:string = Bool; -messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates; -messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference; -messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference; -messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector<string> = Vector<EmojiLanguage>; -messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; -messages.getSearchCounters#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector<MessagesFilter> = Vector<messages.SearchCounter>; -messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; -messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; -messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; -messages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages; -messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector<int> = messages.Messages; -messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates; -messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates; -messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList; -messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector<InputStickerSet> = Bool; -messages.getDialogFilters#efd48c89 = messages.DialogFilters; -messages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>; -messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool; -messages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool; -messages.getOldFeaturedStickers#7ed094a1 offset:int limit:int hash:long = messages.FeaturedStickers; -messages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; -messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage; -messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool; -messages.unpinAllMessages#ee22b9a8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; -messages.deleteChat#5bd0ee50 chat_id:long = Bool; -messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages; -messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed; -messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport; -messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia; -messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool; -messages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites; -messages.getExportedChatInvite#73746f5c peer:InputPeer link:string = messages.ExportedChatInvite; -messages.editExportedChatInvite#bdca2f75 flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int request_needed:flags.3?Bool title:flags.4?string = messages.ExportedChatInvite; -messages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool; -messages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool; -messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithInvites; -messages.getChatInviteImporters#df04dd4e flags:# requested:flags.0?true subscription_expired:flags.3?true peer:InputPeer link:flags.1?string q:flags.2?string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters; -messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates; -messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer; -messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates; -messages.getMessageReadParticipants#31c1c44f peer:InputPeer msg_id:int = Vector<ReadParticipantDate>; -messages.getSearchResultsCalendar#6aa3f6bd flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int offset_date:int = messages.SearchResultsCalendar; -messages.getSearchResultsPositions#9c7f2f10 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int limit:int = messages.SearchResultsPositions; -messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPeer user_id:InputUser = Updates; -messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; -messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; -messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; -messages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates; -messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates; -messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList; -messages.setChatAvailableReactions#864b2581 flags:# peer:InputPeer available_reactions:ChatReactions reactions_limit:flags.0?int paid_enabled:flags.1?Bool = Updates; -messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions; -messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool; -messages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string = messages.TranslatedText; -messages.getUnreadReactions#3223495b flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; -messages.readReactions#54aa7f8e flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; -messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = messages.Messages; -messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots; -messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; -messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; -messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; -messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; -messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; -messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; -messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; -messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio; -messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_id:long good:Bool = Bool; -messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>; -messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers; -messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers; -messages.reportReaction#3f64c076 peer:InputPeer id:int reaction_peer:InputPeer = Bool; -messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions; -messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions; -messages.clearRecentReactions#9dfeefb4 = Bool; -messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates; -messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; -messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; -messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector<InputPeer> = Updates; -messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; -messages.getEmojiStatusGroups#2ecd56cd hash:int = messages.EmojiGroups; -messages.getEmojiProfilePhotoGroups#21a548f3 hash:int = messages.EmojiGroups; -messages.searchCustomEmoji#2c11c0d7 emoticon:string hash:long = EmojiList; -messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool; -messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; -messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; -messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; -messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; -messages.getSavedDialogs#5381d21a flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.SavedDialogs; -messages.getSavedHistory#3d9a414d peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; -messages.deleteSavedHistory#6e98102b flags:# peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; -messages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs; -messages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; -messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vector<InputDialogPeer> = Bool; -messages.getSavedReactionTags#3637e05b flags:# peer:flags.0?InputPeer hash:long = messages.SavedReactionTags; -messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool; -messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; -messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; -messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; -messages.reorderQuickReplies#60331907 order:Vector<int> = Bool; -messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; -messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; -messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; -messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector<int> hash:long = messages.Messages; -messages.sendQuickReplyMessages#6c750de1 peer:InputPeer shortcut_id:int id:Vector<int> random_id:Vector<long> = Updates; -messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector<int> = Updates; -messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; -messages.getMyStickers#d0b5e1fc offset_id:long limit:int = messages.MyStickers; -messages.getEmojiStickerGroups#1dd840f5 hash:int = messages.EmojiGroups; -messages.getAvailableEffects#dea20a39 hash:int = messages.AvailableEffects; -messages.editFactCheck#589ee75 peer:InputPeer msg_id:int text:TextWithEntities = Updates; -messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; -messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector<int> = Vector<FactCheck>; -messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; -messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; -messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bool = Bool; -messages.getPaidReactionPrivacy#472455aa = Updates; -messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool; -messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool; -messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult; -messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; -messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector<InlineQueryPeerType> = messages.BotPreparedInlineMessage; -messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; -messages.searchStickers#29b1c66a flags:# emojis:flags.0?true q:string emoticon:string lang_code:Vector<string> offset:int limit:int hash:long = messages.FoundStickers; -messages.reportMessagesDelivery#5a6d7395 flags:# push:flags.0?true peer:InputPeer id:Vector<int> = Bool; -updates.getState#edd4882a = updates.State; -updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; -updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; -photos.updateProfilePhoto#9e82039 flags:# fallback:flags.0?true bot:flags.1?InputUser id:InputPhoto = photos.Photo; -photos.uploadProfilePhoto#388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo; -photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>; -photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; -photos.uploadContactProfilePhoto#e14c4a71 flags:# suggest:flags.3?true save:flags.4?true user_id:InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.5?VideoSize = photos.Photo; -upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; -upload.getFile#be5335be flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:long limit:int = upload.File; -upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; -upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; -upload.getCdnFile#395f69da file_token:bytes offset:long limit:int = upload.CdnFile; -upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>; -upload.getCdnFileHashes#91dc3f31 file_token:bytes offset:long = Vector<FileHash>; -upload.getFileHashes#9156982a location:InputFileLocation offset:long = Vector<FileHash>; -help.getConfig#c4f9186b = Config; -help.getNearestDc#1fb33026 = NearestDc; -help.getAppUpdate#522d5a7d source:string = help.AppUpdate; -help.getInviteText#4d392343 = help.InviteText; -help.getSupport#9cdf08cd = help.Support; -help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; -help.getCdnConfig#52029342 = CdnConfig; -help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; -help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; -help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; -help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; -help.getAppConfig#61e3f854 hash:int = help.AppConfig; -help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; -help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; -help.getSupportName#d360e72c = help.SupportName; -help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo; -help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo; -help.getPromoData#c0977421 = help.PromoData; -help.hidePromoData#1e251c95 peer:InputPeer = Bool; -help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool; -help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; -help.getPremiumPromo#b81b93d4 = help.PremiumPromo; -help.getPeerColors#da80f42f hash:int = help.PeerColors; -help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; -help.getTimezonesList#49b30240 hash:int = help.TimezonesList; -channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; -channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; -channels.reportSpam#f44a8315 channel:InputChannel participant:InputPeer id:Vector<int> = Bool; -channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages; -channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants; -channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant; -channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; -channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; -channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; -channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; -channels.editTitle#566decd0 channel:InputChannel title:string = Updates; -channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; -channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; -channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; -channels.joinChannel#24b524c5 channel:InputChannel = Updates; -channels.leaveChannel#f836aa95 channel:InputChannel = Updates; -channels.inviteToChannel#c9e33d54 channel:InputChannel users:Vector<InputUser> = messages.InvitedUsers; -channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; -channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink; -channels.toggleSignatures#418d549c flags:# signatures_enabled:flags.0?true profiles_enabled:flags.1?true channel:InputChannel = Updates; -channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true for_personal:flags.2?true = messages.Chats; -channels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates; -channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults; -channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; -channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool; -channels.deleteHistory#9baa9647 flags:# for_everyone:flags.0?true channel:InputChannel max_id:int = Updates; -channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; -channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; -channels.getGroupsForDiscussion#f5dad378 = messages.Chats; -channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; -channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; -channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; -channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; -channels.getInactiveChannels#11e831ee = messages.InactiveChats; -channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; -channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; -channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; -channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates; -channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates; -channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector<string> = Bool; -channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool; -channels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool; -channels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates; -channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; -channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; -channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector<int> = messages.ForumTopics; -channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; -channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; -channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; -channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector<int> = Updates; -channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; -channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; -channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; -channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; -channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; -channels.getChannelRecommendations#25a71742 flags:# channel:flags.0?InputChannel = messages.Chats; -channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; -channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int = Updates; -channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; -channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; -channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; -bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; -bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; -bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool; -bots.resetBotCommands#3d8de0f9 scope:BotCommandScope lang_code:string = Bool; -bots.getBotCommands#e34c0dd6 scope:BotCommandScope lang_code:string = Vector<BotCommand>; -bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool; -bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton; -bots.setBotBroadcastDefaultAdminRights#788464e1 admin_rights:ChatAdminRights = Bool; -bots.setBotGroupDefaultAdminRights#925ec9ea admin_rights:ChatAdminRights = Bool; -bots.setBotInfo#10cf3123 flags:# bot:flags.2?InputUser lang_code:string name:flags.3?string about:flags.0?string description:flags.1?string = Bool; -bots.getBotInfo#dcd914fd flags:# bot:flags.0?InputUser lang_code:string = bots.BotInfo; -bots.reorderUsernames#9709b1c2 bot:InputUser order:Vector<string> = Bool; -bots.toggleUsername#53ca973 bot:InputUser username:string active:Bool = Bool; -bots.canSendMessage#1359f4e6 bot:InputUser = Bool; -bots.allowSendMessage#f132e3ef bot:InputUser = Updates; -bots.invokeWebViewCustomMethod#87fc5e7 bot:InputUser custom_method:string params:DataJSON = DataJSON; -bots.getPopularAppBots#c2510192 offset:string limit:int = bots.PopularAppBots; -bots.addPreviewMedia#17aeb75a bot:InputUser lang_code:string media:InputMedia = BotPreviewMedia; -bots.editPreviewMedia#8525606f bot:InputUser lang_code:string media:InputMedia new_media:InputMedia = BotPreviewMedia; -bots.deletePreviewMedia#2d0135b3 bot:InputUser lang_code:string media:Vector<InputMedia> = Bool; -bots.reorderPreviewMedias#b627f3aa bot:InputUser lang_code:string order:Vector<InputMedia> = Bool; -bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; -bots.getPreviewMedias#a2a5594d bot:InputUser = Vector<BotPreviewMedia>; -bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; -bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; -bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; -bots.getAdminedBots#b0711d83 = Vector<User>; -bots.updateStarRefProgram#778b5ab3 flags:# bot:InputUser commission_permille:int duration_months:flags.0?int = StarRefProgram; -bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?InputUser peer:InputPeer custom_description:flags.2?string = Bool; -bots.getBotRecommendations#a1b70815 bot:InputUser = users.Users; -payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; -payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; -payments.validateRequestedInfo#b6c8f12b flags:# save:flags.0?true invoice:InputInvoice info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; -payments.sendPaymentForm#2d03522f flags:# form_id:long invoice:InputInvoice requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult; -payments.getSavedInfo#227d824b = payments.SavedInfo; -payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; -payments.getBankCardData#2e79d779 number:string = payments.BankCardData; -payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoice; -payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates; -payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates; -payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool; -payments.getPremiumGiftCodeOptions#2757ba54 flags:# boost_peer:flags.0?InputPeer = Vector<PremiumGiftCodeOption>; -payments.checkGiftCode#8e51b4c1 slug:string = payments.CheckedGiftCode; -payments.applyGiftCode#f6e26854 slug:string = Updates; -payments.getGiveawayInfo#f4239425 peer:InputPeer msg_id:int = payments.GiveawayInfo; -payments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose:InputStorePaymentPurpose = Updates; -payments.getStarsTopupOptions#c00ec7d3 = Vector<StarsTopupOption>; -payments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus; -payments.getStarsTransactions#69da4557 flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true subscription_id:flags.3?string peer:InputPeer offset:string limit:int = payments.StarsStatus; -payments.sendStarsForm#7998c914 form_id:long invoice:InputInvoice = payments.PaymentResult; -payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; -payments.getStarsRevenueStats#d91ffad6 flags:# dark:flags.0?true peer:InputPeer = payments.StarsRevenueStats; -payments.getStarsRevenueWithdrawalUrl#13bbe8b3 peer:InputPeer stars:long password:InputCheckPasswordSRP = payments.StarsRevenueWithdrawalUrl; -payments.getStarsRevenueAdsAccountUrl#d1d7efc5 peer:InputPeer = payments.StarsRevenueAdsAccountUrl; -payments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector<InputStarsTransaction> = payments.StarsStatus; -payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector<StarsGiftOption>; -payments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer:InputPeer offset:string = payments.StarsStatus; -payments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool; -payments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool; -payments.getStarsGiveawayOptions#bd1efd3e = Vector<StarsGiveawayOption>; -payments.getStarGifts#c4563590 hash:int = payments.StarGifts; -payments.saveStarGift#2a2a697c flags:# unsave:flags.0?true stargift:InputSavedStarGift = Bool; -payments.convertStarGift#74bf076b stargift:InputSavedStarGift = Bool; -payments.botCancelStarsSubscription#6dfa0622 flags:# restore:flags.0?true user_id:InputUser charge_id:string = Bool; -payments.getConnectedStarRefBots#5869a553 flags:# peer:InputPeer offset_date:flags.2?int offset_link:flags.2?string limit:int = payments.ConnectedStarRefBots; -payments.getConnectedStarRefBot#b7d998f0 peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; -payments.getSuggestedStarRefBots#d6b48f7 flags:# order_by_revenue:flags.0?true order_by_date:flags.1?true peer:InputPeer offset:string limit:int = payments.SuggestedStarRefBots; -payments.connectStarRefBot#7ed5348a peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; -payments.editConnectedStarRefBot#e4fca4a3 flags:# revoked:flags.0?true peer:InputPeer link:string = payments.ConnectedStarRefBots; -payments.getStarGiftUpgradePreview#9c9abcb1 gift_id:long = payments.StarGiftUpgradePreview; -payments.upgradeStarGift#aed6e4f5 flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = Updates; -payments.transferStarGift#7f18176a stargift:InputSavedStarGift to_id:InputPeer = Updates; -payments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift; -payments.getSavedStarGifts#23830de9 flags:# exclude_unsaved:flags.0?true exclude_saved:flags.1?true exclude_unlimited:flags.2?true exclude_limited:flags.3?true exclude_unique:flags.4?true sort_by_value:flags.5?true peer:InputPeer offset:string limit:int = payments.SavedStarGifts; -payments.getSavedStarGift#b455a106 stargift:Vector<InputSavedStarGift> = payments.SavedStarGifts; -payments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl; -payments.toggleChatStarGiftNotifications#60eaefa1 flags:# enabled:flags.0?true peer:InputPeer = Bool; -stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet; -stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; -stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; -stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; -stickers.setStickerSetThumb#a76a5392 flags:# stickerset:InputStickerSet thumb:flags.0?InputDocument thumb_document_id:flags.1?long = messages.StickerSet; -stickers.checkShortName#284b3639 short_name:string = Bool; -stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName; -stickers.changeSticker#f5537ebc flags:# sticker:InputDocument emoji:flags.0?string mask_coords:flags.1?MaskCoords keywords:flags.2?string = messages.StickerSet; -stickers.renameStickerSet#124b1c00 stickerset:InputStickerSet title:string = messages.StickerSet; -stickers.deleteStickerSet#87704394 stickerset:InputStickerSet = Bool; -stickers.replaceSticker#4696459a sticker:InputDocument new_sticker:InputStickerSetItem = messages.StickerSet; -phone.getCallConfig#55451fa9 = DataJSON; -phone.requestCall#a6c4600c flags:# video:flags.0?true user_id:InputUser conference_call:flags.1?InputGroupCall random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; -phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; -phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; -phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; -phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; -phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates; -phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; -phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool; -phone.createGroupCall#48cdc6d8 flags:# rtmp_stream:flags.2?true peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates; -phone.joinGroupCall#d61e1df3 flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string key_fingerprint:flags.3?long params:DataJSON = Updates; -phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates; -phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates; -phone.discardGroupCall#7a777135 call:InputGroupCall = Updates; -phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates; -phone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall; -phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants; -phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector<int> = Vector<int>; -phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates; -phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates; -phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates; -phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers; -phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite; -phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates; -phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates; -phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool; -phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates; -phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates; -phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels; -phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl; -phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool; -phone.createConferenceCall#dfc909ab peer:InputPhoneCall key_fingerprint:long = phone.PhoneCall; -langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; -langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>; -langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference; -langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>; -langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; -folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates; -stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; -stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; -stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; -stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; -stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; -stats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats; -stats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; -stats.getBroadcastRevenueTransactions#70990b6d peer:InputPeer offset:int limit:int = stats.BroadcastRevenueTransactions; -chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector<InputPeer> = chatlists.ExportedChatlistInvite; -chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; -chatlists.editExportedInvite#653db63d flags:# chatlist:InputChatlist slug:string title:flags.1?string peers:flags.2?Vector<InputPeer> = ExportedChatlistInvite; -chatlists.getExportedInvites#ce03da83 chatlist:InputChatlist = chatlists.ExportedInvites; -chatlists.checkChatlistInvite#41c10fff slug:string = chatlists.ChatlistInvite; -chatlists.joinChatlistInvite#a6b1e39a slug:string peers:Vector<InputPeer> = Updates; -chatlists.getChatlistUpdates#89419521 chatlist:InputChatlist = chatlists.ChatlistUpdates; -chatlists.joinChatlistUpdates#e089f8f5 chatlist:InputChatlist peers:Vector<InputPeer> = Updates; -chatlists.hideChatlistUpdates#66e486fb chatlist:InputChatlist = Bool; -chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>; -chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates; -stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; -stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; -stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates; -stories.deleteStories#ae59db5f peer:InputPeer id:Vector<int> = Vector<int>; -stories.togglePinned#9a75a1ef peer:InputPeer id:Vector<int> pinned:Bool = Vector<int>; -stories.getAllStories#eeb0d625 flags:# next:flags.1?true hidden:flags.2?true state:flags.0?string = stories.AllStories; -stories.getPinnedStories#5821a5dc peer:InputPeer offset_id:int limit:int = stories.Stories; -stories.getStoriesArchive#b4352016 peer:InputPeer offset_id:int limit:int = stories.Stories; -stories.getStoriesByID#5774ca74 peer:InputPeer id:Vector<int> = stories.Stories; -stories.toggleAllStoriesHidden#7c2557c4 hidden:Bool = Bool; -stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector<int>; -stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector<int> = Bool; -stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; -stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector<int> = stories.StoryViews; -stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; -stories.report#19d8eb45 peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult; -stories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates; -stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates; -stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories; -stories.getAllReadPeerStories#9b5ae7f9 = Updates; -stories.getPeerMaxIDs#535983c3 id:Vector<InputPeer> = Vector<int>; -stories.getChatsToSend#a56a8b60 = messages.Chats; -stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; -stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; -stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector<int> = Bool; -stories.searchPosts#d1810907 flags:# hashtag:flags.0?string area:flags.1?MediaArea peer:flags.2?InputPeer offset:string limit:int = stories.FoundStories; -premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; -premium.getMyBoosts#be77b4a = premium.MyBoosts; -premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector<int> peer:InputPeer = premium.MyBoosts; -premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; -premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; -smsjobs.join#a74ece2d = Bool; -smsjobs.leave#9898ad73 = Bool; -smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; -smsjobs.getStatus#10a698e8 = smsjobs.Status; -smsjobs.getSmsJob#778d902f job_id:string = SmsJob; -smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; -fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -`; - } -}); - -// node_modules/telegram/tl/schemaTl.js -var require_schemaTl = __commonJS({ - "node_modules/telegram/tl/schemaTl.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - module2.exports = ` -resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ; -p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; -p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data; -p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data; -p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data; -bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner; -server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; -server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; -server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; -client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; -dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; -dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; -dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; -destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; -destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; -destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ----functions--- -req_pq#60469778 nonce:int128 = ResPQ; -req_pq_multi#be7e8ef1 nonce:int128 = ResPQ; -req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; -set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; -destroy_auth_key#d1435160 = DestroyAuthKeyRes; ----types--- -msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck; -bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; -bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; -msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq; -msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; -msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo; -msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; -msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; -msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq; -rpc_error#2144ca19 error_code:int error_message:string = RpcError; -rpc_answer_unknown#5e2ad36e = RpcDropAnswer; -rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; -rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; -future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; -future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts; -pong#347773c5 msg_id:long ping_id:long = Pong; -destroy_session_ok#e22045fc session_id:long = DestroySessionRes; -destroy_session_none#62d350c9 session_id:long = DestroySessionRes; -new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; -http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; -ipPort#d433ad73 ipv4:int port:int = IpPort; -ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; -accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule; -help.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple; -tlsClientHello blocks:vector<TlsBlock> = TlsClientHello; -tlsBlockString data:string = TlsBlock; -tlsBlockRandom length:int = TlsBlock; -tlsBlockZero length:int = TlsBlock; -tlsBlockDomain = TlsBlock; -tlsBlockGrease seed:int = TlsBlock; -tlsBlockPublicKey = TlsBlock; -tlsBlockScope entries:Vector<TlsBlock> = TlsBlock; -tlsBlockPermutation entries:Vector<Vector<TlsBlock>> = TlsBlock; ----functions--- -rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; -get_future_salts#b921bd04 num:int = FutureSalts; -ping#7abe77ec ping_id:long = Pong; -ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; -destroy_session#e7512126 session_id:long = DestroySessionRes; -`; - } -}); - -// node_modules/telegram/tl/generationHelpers.js -var require_generationHelpers = __commonJS({ - "node_modules/telegram/tl/generationHelpers.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.variableSnakeToCamelCase = exports2.snakeToCamelCase = exports2.CORE_TYPES = exports2.fromLine = exports2.parseTl = exports2.findAll = void 0; - exports2.serializeBytes = serializeBytes; - exports2.serializeDate = serializeDate; - exports2.buildArgConfig = buildArgConfig; - var Helpers_1 = require_Helpers(); - var snakeToCamelCase = (name) => { - const result = name.replace(/(?:^|_)([a-z])/g, (_, g) => g.toUpperCase()); - return result.replace(/_/g, ""); - }; - exports2.snakeToCamelCase = snakeToCamelCase; - var variableSnakeToCamelCase = (str) => str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace("-", "").replace("_", "")); - exports2.variableSnakeToCamelCase = variableSnakeToCamelCase; - var CORE_TYPES = /* @__PURE__ */ new Set([ - 3162085175, - // boolFalse#bc799737 = Bool; - 2574415285, - // boolTrue#997275b5 = Bool; - 1072550713, - // true#3fedd339 = True; - 3300522427, - // error#c4b9f9bb code:int text:string = Error; - 1450380236 - // null#56730bcc = Null; - ]); - exports2.CORE_TYPES = CORE_TYPES; - var AUTH_KEY_TYPES = /* @__PURE__ */ new Set([ - 85337187, - // resPQ, - 2211011308, - // p_q_inner_data - 2851430293, - // p_q_inner_data_dc - 1013613780, - // p_q_inner_data_temp - 1459478408, - // p_q_inner_data_temp_dc - 3504867164, - // server_DH_params_ok - 3045658042, - // server_DH_inner_data - 1715713620, - // client_DH_inner_data - 3608339646, - // req_DH_params - 4110704415, - // set_client_DH_params - 812830625 - // gzip_packed - ]); - var fromLine = (line, isFunction) => { - const match = line.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/); - if (!match) { - throw new Error(`Cannot parse TLObject ${line}`); - } - const argsMatch = findAll5(/({)?(\w+):([\w\d<>#.?!]+)}?/, line); - const currentConfig = { - name: match[1], - constructorId: parseInt(match[2], 16), - argsConfig: {}, - subclassOfId: (0, Helpers_1.crc32)(match[3]), - result: match[3], - isFunction, - namespace: void 0 - }; - if (!currentConfig.constructorId) { - const hexId = ""; - let args; - if (Object.values(currentConfig.argsConfig).length) { - args = ` ${Object.keys(currentConfig.argsConfig).map((arg) => arg.toString()).join(" ")}`; - } else { - args = ""; - } - const representation = `${currentConfig.name}${hexId}${args} = ${currentConfig.result}`.replace(/(:|\?)bytes /g, "$1string ").replace(/</g, " ").replace(/>|{|}/g, "").replace(/ \w+:flags(\d+)?\.\d+\?true/g, ""); - if (currentConfig.name === "inputMediaInvoice") { - if (currentConfig.name === "inputMediaInvoice") { - } - } - currentConfig.constructorId = (0, Helpers_1.crc32)(Buffer.from(representation, "utf8")); - } - for (const [brace, name, argType] of argsMatch) { - if (brace === void 0) { - currentConfig.argsConfig[variableSnakeToCamelCase(name)] = buildArgConfig(name, argType); - } - } - if (currentConfig.name.includes(".")) { - [currentConfig.namespace, currentConfig.name] = currentConfig.name.split(/\.(.+)/); - } - currentConfig.name = snakeToCamelCase(currentConfig.name); - return currentConfig; - }; - exports2.fromLine = fromLine; - function buildArgConfig(name, argType) { - name = name === "self" ? "is_self" : name; - const currentConfig = { - isVector: false, - isFlag: false, - skipConstructorId: false, - flagName: null, - flagIndex: -1, - flagIndicator: true, - type: null, - useVectorId: null - }; - const canBeInferred = name === "random_id"; - if (argType !== "#") { - currentConfig.flagIndicator = false; - currentConfig.type = argType.replace(/^!+/, ""); - const flagMatch = currentConfig.type.match(/(flags(?:\d+)?).(\d+)\?([\w<>.]+)/); - if (flagMatch) { - currentConfig.isFlag = true; - currentConfig.flagName = flagMatch[1]; - currentConfig.flagIndex = Number(flagMatch[2]); - currentConfig.type = flagMatch[3]; - } - const vectorMatch = currentConfig.type.match(/[Vv]ector<([\w\d.]+)>/); - if (vectorMatch) { - currentConfig.isVector = true; - currentConfig.useVectorId = currentConfig.type.charAt(0) === "V"; - [, currentConfig.type] = vectorMatch; - } - if (/^[a-z]$/.test(currentConfig.type.split(".").pop().charAt(0))) { - currentConfig.skipConstructorId = true; - } - } - if (currentConfig.type == "future_salt") { - currentConfig.type = "FutureSalt"; - } - return currentConfig; - } - var parseTl = function* (content, layer, methods = [], ignoreIds = CORE_TYPES) { - const methodInfo = (methods || []).reduce((o, m) => Object.assign(Object.assign({}, o), { [m.name]: m }), {}); - const objAll = []; - const objByName = {}; - const objByType = {}; - const file = content; - let isFunction = false; - for (let line of file.split("\n")) { - const commentIndex = line.indexOf("//"); - if (commentIndex !== -1) { - line = line.slice(0, commentIndex); - } - line = line.trim(); - if (!line) { - continue; - } - const match = line.match(/---(\w+)---/); - if (match) { - const [, followingTypes] = match; - isFunction = followingTypes === "functions"; - continue; - } - try { - const result = fromLine(line, isFunction); - if (ignoreIds.has(result.constructorId)) { - continue; - } - objAll.push(result); - if (!result.isFunction) { - if (!objByType[result.result]) { - objByType[result.result] = []; - } - objByName[result.name] = result; - objByType[result.result].push(result); - } - } catch (e) { - if (!e.toString().includes("vector#1cb5c415")) { - throw e; - } - } - } - for (const obj of objAll) { - if (AUTH_KEY_TYPES.has(obj.constructorId)) { - for (const arg in obj.argsConfig) { - if (obj.argsConfig[arg].type === "string") { - obj.argsConfig[arg].type = "bytes"; - } - } - } - } - for (const obj of objAll) { - yield obj; - } - }; - exports2.parseTl = parseTl; - var findAll5 = (regex, str, matches2 = []) => { - if (!regex.flags.includes("g")) { - regex = new RegExp(regex.source, "g"); - } - const res = regex.exec(str); - if (res) { - matches2.push(res.slice(1)); - findAll5(regex, str, matches2); - } - return matches2; - }; - exports2.findAll = findAll5; - function serializeBytes(data) { - if (!(data instanceof Buffer)) { - if (typeof data == "string") { - data = Buffer.from(data); - } else { - throw Error(`Bytes or str expected, not ${data.constructor.name}`); - } - } - const r = []; - let padding; - if (data.length < 254) { - padding = (data.length + 1) % 4; - if (padding !== 0) { - padding = 4 - padding; - } - r.push(Buffer.from([data.length])); - r.push(data); - } else { - padding = data.length % 4; - if (padding !== 0) { - padding = 4 - padding; - } - r.push(Buffer.from([ - 254, - data.length % 256, - (data.length >> 8) % 256, - (data.length >> 16) % 256 - ])); - r.push(data); - } - r.push(Buffer.alloc(padding).fill(0)); - return Buffer.concat(r); - } - function serializeDate(dt) { - if (!dt) { - return Buffer.alloc(4).fill(0); - } - if (dt instanceof Date) { - dt = Math.floor((Date.now() - dt.getTime()) / 1e3); - } - if (typeof dt == "number") { - const t = Buffer.alloc(4); - t.writeInt32LE(dt, 0); - return t; - } - throw Error(`Cannot interpret "${dt}" as a date`); - } - } -}); - -// node_modules/telegram/tl/api.js -var require_api = __commonJS({ - "node_modules/telegram/tl/api.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - var { inspect } = require_inspect(); - var bigInt = require_BigInteger(); - var { generateRandomBytes, readBigIntFromBuffer, isArrayLike, betterConsoleLog } = require_Helpers(); - var tlContent = require_apiTl(); - var schemeContent = require_schemaTl(); - function generateRandomBigInt() { - return readBigIntFromBuffer(generateRandomBytes(8), false, true); - } - var { parseTl, serializeBytes, serializeDate } = require_generationHelpers(); - var { toSignedLittleBuffer } = require_Helpers(); - var NAMED_AUTO_CASTS = /* @__PURE__ */ new Set(["chatId,int"]); - var AUTO_CASTS = /* @__PURE__ */ new Set([ - "InputPeer", - "InputChannel", - "InputUser", - "InputDialogPeer", - "InputNotifyPeer", - "InputMedia", - "InputPhoto", - "InputMessage", - "InputDocument", - "InputChatPhoto" - ]); - var CastError = class _CastError extends Error { - constructor(objectName, expected, actual, ...params) { - const message = "Found wrong type for " + objectName + ". expected " + expected + " but received " + actual + ".If you think this is a mistake please report it."; - super(message, ...params); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, _CastError); - } - this.name = "CastError"; - } - }; - var CACHING_SUPPORTED = typeof self !== "undefined" && self.localStorage !== void 0; - var CACHE_KEY = "GramJs:apiCache"; - function buildApiFromTlSchema() { - let definitions; - const fromCache = CACHING_SUPPORTED && loadFromCache(); - if (fromCache) { - definitions = fromCache; - } else { - definitions = loadFromTlSchemas(); - if (CACHING_SUPPORTED) { - localStorage.setItem(CACHE_KEY, JSON.stringify(definitions)); - } - } - return createClasses("all", definitions); - } - function loadFromCache() { - const jsonCache = localStorage.getItem(CACHE_KEY); - return jsonCache && JSON.parse(jsonCache); - } - function loadFromTlSchemas() { - const [constructorParamsApi, functionParamsApi] = extractParams(tlContent); - const [constructorParamsSchema, functionParamsSchema] = extractParams(schemeContent); - const constructors = [].concat(constructorParamsApi, constructorParamsSchema); - const requests = [].concat(functionParamsApi, functionParamsSchema); - return [].concat(constructors, requests); - } - function extractParams(fileContent) { - const f = parseTl(fileContent, 109); - const constructors = []; - const functions = []; - for (const d of f) { - d.isFunction ? functions.push(d) : constructors.push(d); - } - return [constructors, functions]; - } - function argToBytes(x, type, argName, requestName) { - switch (type) { - case "int": - const i = Buffer.alloc(4); - i.writeInt32LE(x, 0); - return i; - case "long": - return toSignedLittleBuffer(x, 8); - case "int128": - return toSignedLittleBuffer(x, 16); - case "int256": - return toSignedLittleBuffer(x, 32); - case "double": - const d = Buffer.alloc(8); - d.writeDoubleLE(x, 0); - return d; - case "string": - return serializeBytes(x); - case "Bool": - return x ? Buffer.from("b5757299", "hex") : Buffer.from("379779bc", "hex"); - case "true": - return Buffer.alloc(0); - case "bytes": - return serializeBytes(x); - case "date": - return serializeDate(x); - default: - if (x === void 0 || typeof x.getBytes !== "function") { - throw new Error(`Required object ${argName} of ${requestName} is undefined`); - } - return x.getBytes(); - } - } - async function getInputFromResolve(utils, client2, peer, peerType) { - switch (peerType) { - case "InputPeer": - return utils.getInputPeer(await client2.getInputEntity(peer)); - case "InputChannel": - return utils.getInputChannel(await client2.getInputEntity(peer)); - case "InputUser": - return utils.getInputUser(await client2.getInputEntity(peer)); - case "InputDialogPeer": - return await client2._getInputDialog(peer); - case "InputNotifyPeer": - return await client2._getInputNotify(peer); - case "InputMedia": - return utils.getInputMedia(peer); - case "InputPhoto": - return utils.getInputPhoto(peer); - case "InputMessage": - return utils.getInputMessage(peer); - case "InputDocument": - return utils.getInputDocument(peer); - case "InputChatPhoto": - return utils.getInputChatPhoto(peer); - case "chatId,int": - return await client2.getPeerId(peer, false); - default: - throw new Error("unsupported peer type : " + peerType); - } - } - function getArgFromReader(reader, arg) { - if (arg.isVector) { - if (arg.useVectorId) { - reader.readInt(); - } - const temp = []; - const len = reader.readInt(); - arg.isVector = false; - for (let i = 0; i < len; i++) { - temp.push(getArgFromReader(reader, arg)); - } - arg.isVector = true; - return temp; - } else if (arg.flagIndicator) { - return reader.readInt(); - } else { - switch (arg.type) { - case "int": - return reader.readInt(); - case "long": - return reader.readLong(); - case "int128": - return reader.readLargeInt(128); - case "int256": - return reader.readLargeInt(256); - case "double": - return reader.readDouble(); - case "string": - return reader.tgReadString(); - case "Bool": - return reader.tgReadBool(); - case "true": - return true; - case "bytes": - return reader.tgReadBytes(); - case "date": - return reader.tgReadDate(); - default: - if (!arg.skipConstructorId) { - return reader.tgReadObject(); - } else { - return api.constructors[arg.type].fromReader(reader); - } - } - } - } - function compareType(value, type) { - let correct = true; - switch (type) { - case "number": - correct = typeof value === "number" || value === void 0; - break; - case "string": - case "boolean": - correct = typeof value === type; - break; - case "bigInt": - correct = bigInt.isInstance(value) || typeof value === "bigint" || typeof value === "number" || typeof value === "string" || value === void 0; - break; - case "true": - break; - case "buffer": - correct = Buffer.isBuffer(value); - break; - case "date": - correct = value && Object.prototype.toString.call(value) === "[object Date]" && !isNaN(value) || typeof value === "number"; - break; - default: - console.error(new Error("Unknown type." + type)); - } - return correct; - } - function createClasses(classesType, params) { - const classes = {}; - for (const classParams of params) { - const { name, constructorId, subclassOfId, argsConfig, namespace, isFunction, result } = classParams; - const fullName = [namespace, name].join(".").replace(/^\./, ""); - class VirtualClass { - constructor(args) { - this.CONSTRUCTOR_ID = constructorId; - this.SUBCLASS_OF_ID = subclassOfId; - this.className = fullName; - this.classType = isFunction ? "request" : "constructor"; - args = args || {}; - this.originalArgs = args; - this.init(args); - for (const argName in argsConfig) { - if (argName === "randomId" && !args[argName]) { - if (argsConfig[argName].isVector) { - const rands = []; - for (let i = 0; i < args["id"].length; i++) { - rands.push(generateRandomBigInt()); - } - this[argName] = rands; - } else { - this[argName] = generateRandomBigInt(); - } - } else { - this[argName] = args[argName]; - } - } - } - init(args) { - } - static fromReader(reader) { - const args = {}; - for (const argName in argsConfig) { - if (argsConfig.hasOwnProperty(argName)) { - const arg = argsConfig[argName]; - if (arg.isFlag) { - if (arg.type === "true") { - args[argName] = Boolean(args[arg.flagName] & 1 << arg.flagIndex); - continue; - } - if (args[arg.flagName] & 1 << arg.flagIndex) { - args[argName] = getArgFromReader(reader, arg); - } else { - args[argName] = null; - } - } else { - if (arg.flagIndicator) { - arg.name = argName; - } - args[argName] = getArgFromReader(reader, arg); - } - } - } - return new this(args); - } - validate() { - for (const arg in argsConfig) { - if (argsConfig.hasOwnProperty(arg)) { - if (argsConfig[arg].flagIndicator || argsConfig[arg].isFlag) { - continue; - } - const currentValue = this[arg]; - this.assertType(arg, argsConfig[arg], currentValue); - } - } - } - assertType(objectName, object, value) { - let expected; - if (object["isVector"]) { - if (!isArrayLike(value)) { - console.error(new CastError(objectName, "array", value)); - } - if (value == void 0) { - value = []; - } - for (const o of value) { - this.assertType(objectName, Object.assign(Object.assign({}, object), { isVector: false }), o); - } - } else { - switch (object["type"]) { - case "int": - expected = "number"; - break; - case "long": - case "int128": - case "int256": - expected = "bigInt"; - break; - case "double": - expected = "number"; - break; - case "string": - expected = "string"; - break; - case "Bool": - expected = "boolean"; - break; - case "true": - expected = "true"; - break; - case "bytes": - expected = "buffer"; - break; - case "date": - expected = "date"; - break; - default: - expected = "object"; - } - if (expected === "object") { - } else { - const isCorrectType = compareType(value, expected); - if (isCorrectType !== true) { - console.error(new CastError(objectName, expected, value)); - } - } - } - } - getBytes() { - try { - this.validate(); - } catch (e) { - } - const idForBytes = this.CONSTRUCTOR_ID; - const c = Buffer.alloc(4); - c.writeUInt32LE(idForBytes, 0); - const buffers = [c]; - for (const arg in argsConfig) { - if (argsConfig.hasOwnProperty(arg)) { - if (argsConfig[arg].isFlag) { - if (this[arg] === false && argsConfig[arg].type !== "Bool" || this[arg] === null || this[arg] === void 0 || argsConfig[arg].type === "true") { - continue; - } - } - if (argsConfig[arg].isVector) { - if (argsConfig[arg].useVectorId) { - buffers.push(Buffer.from("15c4b51c", "hex")); - } - const l = Buffer.alloc(4); - l.writeInt32LE(this[arg].length, 0); - buffers.push(l, Buffer.concat(this[arg].map((x) => argToBytes(x, argsConfig[arg].type, fullName)))); - } else if (argsConfig[arg].flagIndicator) { - if (!Object.values(argsConfig).some((f) => f.isFlag)) { - buffers.push(Buffer.alloc(4)); - } else { - let flagCalculate = 0; - for (const f2 in argsConfig) { - if (argsConfig[f2].isFlag && arg === argsConfig[f2].flagName) { - if (this[f2] === false && argsConfig[f2].type !== "Bool" || this[f2] === void 0 || this[f2] === null) { - flagCalculate |= 0; - } else { - flagCalculate |= 1 << argsConfig[f2].flagIndex; - } - } - } - const f = Buffer.alloc(4); - f.writeUInt32LE(flagCalculate, 0); - buffers.push(f); - } - } else { - buffers.push(argToBytes(this[arg], argsConfig[arg].type, arg, fullName)); - if (this[arg] && typeof this[arg].getBytes === "function") { - let boxed = argsConfig[arg].type.charAt(argsConfig[arg].type.indexOf(".") + 1); - boxed = boxed === boxed.toUpperCase(); - if (!boxed) { - buffers.shift(); - } - } - } - } - } - return Buffer.concat(buffers); - } - readResult(reader) { - if (!isFunction) { - throw new Error("`readResult()` called for non-request instance"); - } - const m = result.match(/Vector<(int|long)>/); - if (m) { - reader.readInt(); - const temp = []; - const len = reader.readInt(); - if (m[1] === "int") { - for (let i = 0; i < len; i++) { - temp.push(reader.readInt()); - } - } else { - for (let i = 0; i < len; i++) { - temp.push(reader.readLong()); - } - } - return temp; - } else { - return reader.tgReadObject(); - } - } - async resolve(client2, utils) { - if (!isFunction) { - throw new Error("`resolve()` called for non-request instance"); - } - for (const arg in argsConfig) { - if (argsConfig.hasOwnProperty(arg)) { - if (!AUTO_CASTS.has(argsConfig[arg].type)) { - if (!NAMED_AUTO_CASTS.has(`${argsConfig[arg].name},${argsConfig[arg].type}`)) { - continue; - } - } - if (argsConfig[arg].isFlag) { - if (!this[arg]) { - continue; - } - } - if (argsConfig[arg].isVector) { - const temp = []; - for (const x of this[arg]) { - temp.push(await getInputFromResolve(utils, client2, x, argsConfig[arg].type)); - } - this[arg] = temp; - } else { - this[arg] = await getInputFromResolve(utils, client2, this[arg], argsConfig[arg].type); - } - } - } - } - [inspect.custom]() { - return betterConsoleLog(this); - } - toJSON() { - return Object.assign(Object.assign({}, this.originalArgs), { className: fullName }); - } - } - VirtualClass.CONSTRUCTOR_ID = constructorId; - VirtualClass.SUBCLASS_OF_ID = subclassOfId; - VirtualClass.className = fullName; - VirtualClass.classType = isFunction ? "request" : "constructor"; - if (namespace) { - if (!classes[namespace]) { - classes[namespace] = {}; - } - classes[namespace][name] = VirtualClass; - } else { - classes[name] = VirtualClass; - } - } - return classes; - } - var api = buildApiFromTlSchema(); - module2.exports = { Api: api }; - } -}); - -// node_modules/telegram/tl/custom/chatGetter.js -var require_chatGetter = __commonJS({ - "node_modules/telegram/tl/custom/chatGetter.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ChatGetter = void 0; - var __1 = require_telegram(); - var api_1 = require_api(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var ChatGetter = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - static initChatClass(c, { chatPeer, inputChat, chat, broadcast }) { - c._chatPeer = chatPeer; - c._inputChat = inputChat; - c._chat = chat; - c._broadcast = broadcast; - c._client = void 0; - } - get chat() { - return this._chat; - } - async getChat() { - var _a3; - if (!this._chat || "min" in this._chat && await this.getInputChat()) { - try { - if (this._inputChat) { - this._chat = await ((_a3 = this._client) === null || _a3 === void 0 ? void 0 : _a3.getEntity(this._inputChat)); - } - } catch (e) { - await this._refetchChat(); - } - } - return this._chat; - } - get inputChat() { - if (!this._inputChat && this._chatPeer && this._client) { - try { - this._inputChat = this._client._entityCache.get(__1.utils.getPeerId(this._chatPeer)); - } catch (e) { - } - } - return this._inputChat; - } - async getInputChat() { - var _a3, e_1, _b, _c; - if (!this.inputChat && this.chatId && this._client) { - try { - const target = this.chatId; - try { - for (var _d = true, _e = __asyncValues2(this._client.iterDialogs({ - limit: 100 - })), _f; _f = await _e.next(), _a3 = _f.done, !_a3; _d = true) { - _c = _f.value; - _d = false; - const dialog = _c; - if (dialog.id.eq(target)) { - this._chat = dialog.entity; - this._inputChat = dialog.inputEntity; - break; - } - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a3 && (_b = _e.return)) await _b.call(_e); - } finally { - if (e_1) throw e_1.error; - } - } - } catch (e) { - } - return this._inputChat; - } - return this._inputChat; - } - get chatId() { - return this._chatPeer ? (0, Helpers_1.returnBigInt)(__1.utils.getPeerId(this._chatPeer)) : void 0; - } - get isPrivate() { - return this._chatPeer ? this._chatPeer instanceof api_1.Api.PeerUser : void 0; - } - get isGroup() { - if (!this._broadcast && this.chat && "broadcast" in this.chat) { - this._broadcast = Boolean(this.chat.broadcast); - } - if (this._chatPeer instanceof api_1.Api.PeerChannel) { - if (this._broadcast === void 0) { - return void 0; - } else { - return !this._broadcast; - } - } - return this._chatPeer instanceof api_1.Api.PeerChat; - } - get isChannel() { - return this._chatPeer instanceof api_1.Api.PeerChannel; - } - async _refetchChat() { - } - }; - exports2.ChatGetter = ChatGetter; - } -}); - -// node_modules/telegram/tl/custom/senderGetter.js -var require_senderGetter = __commonJS({ - "node_modules/telegram/tl/custom/senderGetter.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SenderGetter = void 0; - var api_1 = require_api(); - var Helpers_1 = require_Helpers(); - var chatGetter_1 = require_chatGetter(); - var inspect_1 = require_inspect(); - var SenderGetter = class extends chatGetter_1.ChatGetter { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - static initSenderClass(c, { senderId, sender, inputSender }) { - c._senderId = senderId; - c._sender = sender; - c._inputSender = inputSender; - c._client = void 0; - } - get sender() { - return this._sender; - } - async getSender() { - if (this._client && (!this._sender || this._sender instanceof api_1.Api.Channel && this._sender.min) && await this.getInputSender()) { - try { - this._sender = await this._client.getEntity(this._inputSender); - } catch (e) { - await this._refetchSender(); - } - } - return this._sender; - } - get inputSender() { - if (!this._inputSender && this._senderId && this._client) { - try { - this._inputSender = this._client._entityCache.get(this._senderId); - } catch (e) { - } - } - return this._inputSender; - } - async getInputSender() { - if (!this.inputSender && this._senderId && this._client) { - await this._refetchSender(); - } - return this._inputSender; - } - get senderId() { - return this._senderId; - } - async _refetchSender() { - } - }; - exports2.SenderGetter = SenderGetter; - } -}); - -// node_modules/mime/Mime.js -var require_Mime = __commonJS({ - "node_modules/mime/Mime.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - function Mime2() { - this._types = /* @__PURE__ */ Object.create(null); - this._extensions = /* @__PURE__ */ Object.create(null); - for (let i = 0; i < arguments.length; i++) { - this.define(arguments[i]); - } - this.define = this.define.bind(this); - this.getType = this.getType.bind(this); - this.getExtension = this.getExtension.bind(this); - } - Mime2.prototype.define = function(typeMap, force) { - for (let type in typeMap) { - let extensions = typeMap[type].map(function(t) { - return t.toLowerCase(); - }); - type = type.toLowerCase(); - for (let i = 0; i < extensions.length; i++) { - const ext = extensions[i]; - if (ext[0] === "*") { - continue; - } - if (!force && ext in this._types) { - throw new Error( - 'Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".' - ); - } - this._types[ext] = type; - } - if (force || !this._extensions[type]) { - const ext = extensions[0]; - this._extensions[type] = ext[0] !== "*" ? ext : ext.substr(1); - } - } - }; - Mime2.prototype.getType = function(path2) { - path2 = String(path2); - let last = path2.replace(/^.*[/\\]/, "").toLowerCase(); - let ext = last.replace(/^.*\./, "").toLowerCase(); - let hasPath = last.length < path2.length; - let hasDot = ext.length < last.length - 1; - return (hasDot || !hasPath) && this._types[ext] || null; - }; - Mime2.prototype.getExtension = function(type) { - type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; - return type && this._extensions[type.toLowerCase()] || null; - }; - module2.exports = Mime2; - } -}); - -// node_modules/mime/types/standard.js -var require_standard = __commonJS({ - "node_modules/mime/types/standard.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] }; - } -}); - -// node_modules/mime/types/other.js -var require_other = __commonJS({ - "node_modules/mime/types/other.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = { "application/prs.cww": ["cww"], "application/vnd.1000minds.decision-model+xml": ["1km"], "application/vnd.3gpp.pic-bw-large": ["plb"], "application/vnd.3gpp.pic-bw-small": ["psb"], "application/vnd.3gpp.pic-bw-var": ["pvb"], "application/vnd.3gpp2.tcap": ["tcap"], "application/vnd.3m.post-it-notes": ["pwn"], "application/vnd.accpac.simply.aso": ["aso"], "application/vnd.accpac.simply.imp": ["imp"], "application/vnd.acucobol": ["acu"], "application/vnd.acucorp": ["atc", "acutc"], "application/vnd.adobe.air-application-installer-package+zip": ["air"], "application/vnd.adobe.formscentral.fcdt": ["fcdt"], "application/vnd.adobe.fxp": ["fxp", "fxpl"], "application/vnd.adobe.xdp+xml": ["xdp"], "application/vnd.adobe.xfdf": ["xfdf"], "application/vnd.ahead.space": ["ahead"], "application/vnd.airzip.filesecure.azf": ["azf"], "application/vnd.airzip.filesecure.azs": ["azs"], "application/vnd.amazon.ebook": ["azw"], "application/vnd.americandynamics.acc": ["acc"], "application/vnd.amiga.ami": ["ami"], "application/vnd.android.package-archive": ["apk"], "application/vnd.anser-web-certificate-issue-initiation": ["cii"], "application/vnd.anser-web-funds-transfer-initiation": ["fti"], "application/vnd.antix.game-component": ["atx"], "application/vnd.apple.installer+xml": ["mpkg"], "application/vnd.apple.keynote": ["key"], "application/vnd.apple.mpegurl": ["m3u8"], "application/vnd.apple.numbers": ["numbers"], "application/vnd.apple.pages": ["pages"], "application/vnd.apple.pkpass": ["pkpass"], "application/vnd.aristanetworks.swi": ["swi"], "application/vnd.astraea-software.iota": ["iota"], "application/vnd.audiograph": ["aep"], "application/vnd.balsamiq.bmml+xml": ["bmml"], "application/vnd.blueice.multipass": ["mpm"], "application/vnd.bmi": ["bmi"], "application/vnd.businessobjects": ["rep"], "application/vnd.chemdraw+xml": ["cdxml"], "application/vnd.chipnuts.karaoke-mmd": ["mmd"], "application/vnd.cinderella": ["cdy"], "application/vnd.citationstyles.style+xml": ["csl"], "application/vnd.claymore": ["cla"], "application/vnd.cloanto.rp9": ["rp9"], "application/vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"], "application/vnd.cluetrust.cartomobile-config": ["c11amc"], "application/vnd.cluetrust.cartomobile-config-pkg": ["c11amz"], "application/vnd.commonspace": ["csp"], "application/vnd.contact.cmsg": ["cdbcmsg"], "application/vnd.cosmocaller": ["cmc"], "application/vnd.crick.clicker": ["clkx"], "application/vnd.crick.clicker.keyboard": ["clkk"], "application/vnd.crick.clicker.palette": ["clkp"], "application/vnd.crick.clicker.template": ["clkt"], "application/vnd.crick.clicker.wordbank": ["clkw"], "application/vnd.criticaltools.wbs+xml": ["wbs"], "application/vnd.ctc-posml": ["pml"], "application/vnd.cups-ppd": ["ppd"], "application/vnd.curl.car": ["car"], "application/vnd.curl.pcurl": ["pcurl"], "application/vnd.dart": ["dart"], "application/vnd.data-vision.rdz": ["rdz"], "application/vnd.dbf": ["dbf"], "application/vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"], "application/vnd.dece.ttml+xml": ["uvt", "uvvt"], "application/vnd.dece.unspecified": ["uvx", "uvvx"], "application/vnd.dece.zip": ["uvz", "uvvz"], "application/vnd.denovo.fcselayout-link": ["fe_launch"], "application/vnd.dna": ["dna"], "application/vnd.dolby.mlp": ["mlp"], "application/vnd.dpgraph": ["dpg"], "application/vnd.dreamfactory": ["dfac"], "application/vnd.ds-keypoint": ["kpxx"], "application/vnd.dvb.ait": ["ait"], "application/vnd.dvb.service": ["svc"], "application/vnd.dynageo": ["geo"], "application/vnd.ecowin.chart": ["mag"], "application/vnd.enliven": ["nml"], "application/vnd.epson.esf": ["esf"], "application/vnd.epson.msf": ["msf"], "application/vnd.epson.quickanime": ["qam"], "application/vnd.epson.salt": ["slt"], "application/vnd.epson.ssf": ["ssf"], "application/vnd.eszigno3+xml": ["es3", "et3"], "application/vnd.ezpix-album": ["ez2"], "application/vnd.ezpix-package": ["ez3"], "application/vnd.fdf": ["fdf"], "application/vnd.fdsn.mseed": ["mseed"], "application/vnd.fdsn.seed": ["seed", "dataless"], "application/vnd.flographit": ["gph"], "application/vnd.fluxtime.clip": ["ftc"], "application/vnd.framemaker": ["fm", "frame", "maker", "book"], "application/vnd.frogans.fnc": ["fnc"], "application/vnd.frogans.ltf": ["ltf"], "application/vnd.fsc.weblaunch": ["fsc"], "application/vnd.fujitsu.oasys": ["oas"], "application/vnd.fujitsu.oasys2": ["oa2"], "application/vnd.fujitsu.oasys3": ["oa3"], "application/vnd.fujitsu.oasysgp": ["fg5"], "application/vnd.fujitsu.oasysprs": ["bh2"], "application/vnd.fujixerox.ddd": ["ddd"], "application/vnd.fujixerox.docuworks": ["xdw"], "application/vnd.fujixerox.docuworks.binder": ["xbd"], "application/vnd.fuzzysheet": ["fzs"], "application/vnd.genomatix.tuxedo": ["txd"], "application/vnd.geogebra.file": ["ggb"], "application/vnd.geogebra.tool": ["ggt"], "application/vnd.geometry-explorer": ["gex", "gre"], "application/vnd.geonext": ["gxt"], "application/vnd.geoplan": ["g2w"], "application/vnd.geospace": ["g3w"], "application/vnd.gmx": ["gmx"], "application/vnd.google-apps.document": ["gdoc"], "application/vnd.google-apps.presentation": ["gslides"], "application/vnd.google-apps.spreadsheet": ["gsheet"], "application/vnd.google-earth.kml+xml": ["kml"], "application/vnd.google-earth.kmz": ["kmz"], "application/vnd.grafeq": ["gqf", "gqs"], "application/vnd.groove-account": ["gac"], "application/vnd.groove-help": ["ghf"], "application/vnd.groove-identity-message": ["gim"], "application/vnd.groove-injector": ["grv"], "application/vnd.groove-tool-message": ["gtm"], "application/vnd.groove-tool-template": ["tpl"], "application/vnd.groove-vcard": ["vcg"], "application/vnd.hal+xml": ["hal"], "application/vnd.handheld-entertainment+xml": ["zmm"], "application/vnd.hbci": ["hbci"], "application/vnd.hhe.lesson-player": ["les"], "application/vnd.hp-hpgl": ["hpgl"], "application/vnd.hp-hpid": ["hpid"], "application/vnd.hp-hps": ["hps"], "application/vnd.hp-jlyt": ["jlt"], "application/vnd.hp-pcl": ["pcl"], "application/vnd.hp-pclxl": ["pclxl"], "application/vnd.hydrostatix.sof-data": ["sfd-hdstx"], "application/vnd.ibm.minipay": ["mpy"], "application/vnd.ibm.modcap": ["afp", "listafp", "list3820"], "application/vnd.ibm.rights-management": ["irm"], "application/vnd.ibm.secure-container": ["sc"], "application/vnd.iccprofile": ["icc", "icm"], "application/vnd.igloader": ["igl"], "application/vnd.immervision-ivp": ["ivp"], "application/vnd.immervision-ivu": ["ivu"], "application/vnd.insors.igm": ["igm"], "application/vnd.intercon.formnet": ["xpw", "xpx"], "application/vnd.intergeo": ["i2g"], "application/vnd.intu.qbo": ["qbo"], "application/vnd.intu.qfx": ["qfx"], "application/vnd.ipunplugged.rcprofile": ["rcprofile"], "application/vnd.irepository.package+xml": ["irp"], "application/vnd.is-xpr": ["xpr"], "application/vnd.isac.fcs": ["fcs"], "application/vnd.jam": ["jam"], "application/vnd.jcp.javame.midlet-rms": ["rms"], "application/vnd.jisp": ["jisp"], "application/vnd.joost.joda-archive": ["joda"], "application/vnd.kahootz": ["ktz", "ktr"], "application/vnd.kde.karbon": ["karbon"], "application/vnd.kde.kchart": ["chrt"], "application/vnd.kde.kformula": ["kfo"], "application/vnd.kde.kivio": ["flw"], "application/vnd.kde.kontour": ["kon"], "application/vnd.kde.kpresenter": ["kpr", "kpt"], "application/vnd.kde.kspread": ["ksp"], "application/vnd.kde.kword": ["kwd", "kwt"], "application/vnd.kenameaapp": ["htke"], "application/vnd.kidspiration": ["kia"], "application/vnd.kinar": ["kne", "knp"], "application/vnd.koan": ["skp", "skd", "skt", "skm"], "application/vnd.kodak-descriptor": ["sse"], "application/vnd.las.las+xml": ["lasxml"], "application/vnd.llamagraphics.life-balance.desktop": ["lbd"], "application/vnd.llamagraphics.life-balance.exchange+xml": ["lbe"], "application/vnd.lotus-1-2-3": ["123"], "application/vnd.lotus-approach": ["apr"], "application/vnd.lotus-freelance": ["pre"], "application/vnd.lotus-notes": ["nsf"], "application/vnd.lotus-organizer": ["org"], "application/vnd.lotus-screencam": ["scm"], "application/vnd.lotus-wordpro": ["lwp"], "application/vnd.macports.portpkg": ["portpkg"], "application/vnd.mapbox-vector-tile": ["mvt"], "application/vnd.mcd": ["mcd"], "application/vnd.medcalcdata": ["mc1"], "application/vnd.mediastation.cdkey": ["cdkey"], "application/vnd.mfer": ["mwf"], "application/vnd.mfmp": ["mfm"], "application/vnd.micrografx.flo": ["flo"], "application/vnd.micrografx.igx": ["igx"], "application/vnd.mif": ["mif"], "application/vnd.mobius.daf": ["daf"], "application/vnd.mobius.dis": ["dis"], "application/vnd.mobius.mbk": ["mbk"], "application/vnd.mobius.mqy": ["mqy"], "application/vnd.mobius.msl": ["msl"], "application/vnd.mobius.plc": ["plc"], "application/vnd.mobius.txf": ["txf"], "application/vnd.mophun.application": ["mpn"], "application/vnd.mophun.certificate": ["mpc"], "application/vnd.mozilla.xul+xml": ["xul"], "application/vnd.ms-artgalry": ["cil"], "application/vnd.ms-cab-compressed": ["cab"], "application/vnd.ms-excel": ["xls", "xlm", "xla", "xlc", "xlt", "xlw"], "application/vnd.ms-excel.addin.macroenabled.12": ["xlam"], "application/vnd.ms-excel.sheet.binary.macroenabled.12": ["xlsb"], "application/vnd.ms-excel.sheet.macroenabled.12": ["xlsm"], "application/vnd.ms-excel.template.macroenabled.12": ["xltm"], "application/vnd.ms-fontobject": ["eot"], "application/vnd.ms-htmlhelp": ["chm"], "application/vnd.ms-ims": ["ims"], "application/vnd.ms-lrm": ["lrm"], "application/vnd.ms-officetheme": ["thmx"], "application/vnd.ms-outlook": ["msg"], "application/vnd.ms-pki.seccat": ["cat"], "application/vnd.ms-pki.stl": ["*stl"], "application/vnd.ms-powerpoint": ["ppt", "pps", "pot"], "application/vnd.ms-powerpoint.addin.macroenabled.12": ["ppam"], "application/vnd.ms-powerpoint.presentation.macroenabled.12": ["pptm"], "application/vnd.ms-powerpoint.slide.macroenabled.12": ["sldm"], "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ["ppsm"], "application/vnd.ms-powerpoint.template.macroenabled.12": ["potm"], "application/vnd.ms-project": ["mpp", "mpt"], "application/vnd.ms-word.document.macroenabled.12": ["docm"], "application/vnd.ms-word.template.macroenabled.12": ["dotm"], "application/vnd.ms-works": ["wps", "wks", "wcm", "wdb"], "application/vnd.ms-wpl": ["wpl"], "application/vnd.ms-xpsdocument": ["xps"], "application/vnd.mseq": ["mseq"], "application/vnd.musician": ["mus"], "application/vnd.muvee.style": ["msty"], "application/vnd.mynfc": ["taglet"], "application/vnd.neurolanguage.nlu": ["nlu"], "application/vnd.nitf": ["ntf", "nitf"], "application/vnd.noblenet-directory": ["nnd"], "application/vnd.noblenet-sealer": ["nns"], "application/vnd.noblenet-web": ["nnw"], "application/vnd.nokia.n-gage.ac+xml": ["*ac"], "application/vnd.nokia.n-gage.data": ["ngdat"], "application/vnd.nokia.n-gage.symbian.install": ["n-gage"], "application/vnd.nokia.radio-preset": ["rpst"], "application/vnd.nokia.radio-presets": ["rpss"], "application/vnd.novadigm.edm": ["edm"], "application/vnd.novadigm.edx": ["edx"], "application/vnd.novadigm.ext": ["ext"], "application/vnd.oasis.opendocument.chart": ["odc"], "application/vnd.oasis.opendocument.chart-template": ["otc"], "application/vnd.oasis.opendocument.database": ["odb"], "application/vnd.oasis.opendocument.formula": ["odf"], "application/vnd.oasis.opendocument.formula-template": ["odft"], "application/vnd.oasis.opendocument.graphics": ["odg"], "application/vnd.oasis.opendocument.graphics-template": ["otg"], "application/vnd.oasis.opendocument.image": ["odi"], "application/vnd.oasis.opendocument.image-template": ["oti"], "application/vnd.oasis.opendocument.presentation": ["odp"], "application/vnd.oasis.opendocument.presentation-template": ["otp"], "application/vnd.oasis.opendocument.spreadsheet": ["ods"], "application/vnd.oasis.opendocument.spreadsheet-template": ["ots"], "application/vnd.oasis.opendocument.text": ["odt"], "application/vnd.oasis.opendocument.text-master": ["odm"], "application/vnd.oasis.opendocument.text-template": ["ott"], "application/vnd.oasis.opendocument.text-web": ["oth"], "application/vnd.olpc-sugar": ["xo"], "application/vnd.oma.dd2+xml": ["dd2"], "application/vnd.openblox.game+xml": ["obgx"], "application/vnd.openofficeorg.extension": ["oxt"], "application/vnd.openstreetmap.data+xml": ["osm"], "application/vnd.openxmlformats-officedocument.presentationml.presentation": ["pptx"], "application/vnd.openxmlformats-officedocument.presentationml.slide": ["sldx"], "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ["ppsx"], "application/vnd.openxmlformats-officedocument.presentationml.template": ["potx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ["xltx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ["dotx"], "application/vnd.osgeo.mapguide.package": ["mgp"], "application/vnd.osgi.dp": ["dp"], "application/vnd.osgi.subsystem": ["esa"], "application/vnd.palm": ["pdb", "pqa", "oprc"], "application/vnd.pawaafile": ["paw"], "application/vnd.pg.format": ["str"], "application/vnd.pg.osasli": ["ei6"], "application/vnd.picsel": ["efif"], "application/vnd.pmi.widget": ["wg"], "application/vnd.pocketlearn": ["plf"], "application/vnd.powerbuilder6": ["pbd"], "application/vnd.previewsystems.box": ["box"], "application/vnd.proteus.magazine": ["mgz"], "application/vnd.publishare-delta-tree": ["qps"], "application/vnd.pvi.ptid1": ["ptid"], "application/vnd.quark.quarkxpress": ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"], "application/vnd.rar": ["rar"], "application/vnd.realvnc.bed": ["bed"], "application/vnd.recordare.musicxml": ["mxl"], "application/vnd.recordare.musicxml+xml": ["musicxml"], "application/vnd.rig.cryptonote": ["cryptonote"], "application/vnd.rim.cod": ["cod"], "application/vnd.rn-realmedia": ["rm"], "application/vnd.rn-realmedia-vbr": ["rmvb"], "application/vnd.route66.link66+xml": ["link66"], "application/vnd.sailingtracker.track": ["st"], "application/vnd.seemail": ["see"], "application/vnd.sema": ["sema"], "application/vnd.semd": ["semd"], "application/vnd.semf": ["semf"], "application/vnd.shana.informed.formdata": ["ifm"], "application/vnd.shana.informed.formtemplate": ["itp"], "application/vnd.shana.informed.interchange": ["iif"], "application/vnd.shana.informed.package": ["ipk"], "application/vnd.simtech-mindmapper": ["twd", "twds"], "application/vnd.smaf": ["mmf"], "application/vnd.smart.teacher": ["teacher"], "application/vnd.software602.filler.form+xml": ["fo"], "application/vnd.solent.sdkm+xml": ["sdkm", "sdkd"], "application/vnd.spotfire.dxp": ["dxp"], "application/vnd.spotfire.sfs": ["sfs"], "application/vnd.stardivision.calc": ["sdc"], "application/vnd.stardivision.draw": ["sda"], "application/vnd.stardivision.impress": ["sdd"], "application/vnd.stardivision.math": ["smf"], "application/vnd.stardivision.writer": ["sdw", "vor"], "application/vnd.stardivision.writer-global": ["sgl"], "application/vnd.stepmania.package": ["smzip"], "application/vnd.stepmania.stepchart": ["sm"], "application/vnd.sun.wadl+xml": ["wadl"], "application/vnd.sun.xml.calc": ["sxc"], "application/vnd.sun.xml.calc.template": ["stc"], "application/vnd.sun.xml.draw": ["sxd"], "application/vnd.sun.xml.draw.template": ["std"], "application/vnd.sun.xml.impress": ["sxi"], "application/vnd.sun.xml.impress.template": ["sti"], "application/vnd.sun.xml.math": ["sxm"], "application/vnd.sun.xml.writer": ["sxw"], "application/vnd.sun.xml.writer.global": ["sxg"], "application/vnd.sun.xml.writer.template": ["stw"], "application/vnd.sus-calendar": ["sus", "susp"], "application/vnd.svd": ["svd"], "application/vnd.symbian.install": ["sis", "sisx"], "application/vnd.syncml+xml": ["xsm"], "application/vnd.syncml.dm+wbxml": ["bdm"], "application/vnd.syncml.dm+xml": ["xdm"], "application/vnd.syncml.dmddf+xml": ["ddf"], "application/vnd.tao.intent-module-archive": ["tao"], "application/vnd.tcpdump.pcap": ["pcap", "cap", "dmp"], "application/vnd.tmobile-livetv": ["tmo"], "application/vnd.trid.tpt": ["tpt"], "application/vnd.triscape.mxs": ["mxs"], "application/vnd.trueapp": ["tra"], "application/vnd.ufdl": ["ufd", "ufdl"], "application/vnd.uiq.theme": ["utz"], "application/vnd.umajin": ["umj"], "application/vnd.unity": ["unityweb"], "application/vnd.uoml+xml": ["uoml"], "application/vnd.vcx": ["vcx"], "application/vnd.visio": ["vsd", "vst", "vss", "vsw"], "application/vnd.visionary": ["vis"], "application/vnd.vsf": ["vsf"], "application/vnd.wap.wbxml": ["wbxml"], "application/vnd.wap.wmlc": ["wmlc"], "application/vnd.wap.wmlscriptc": ["wmlsc"], "application/vnd.webturbo": ["wtb"], "application/vnd.wolfram.player": ["nbp"], "application/vnd.wordperfect": ["wpd"], "application/vnd.wqd": ["wqd"], "application/vnd.wt.stf": ["stf"], "application/vnd.xara": ["xar"], "application/vnd.xfdl": ["xfdl"], "application/vnd.yamaha.hv-dic": ["hvd"], "application/vnd.yamaha.hv-script": ["hvs"], "application/vnd.yamaha.hv-voice": ["hvp"], "application/vnd.yamaha.openscoreformat": ["osf"], "application/vnd.yamaha.openscoreformat.osfpvg+xml": ["osfpvg"], "application/vnd.yamaha.smaf-audio": ["saf"], "application/vnd.yamaha.smaf-phrase": ["spf"], "application/vnd.yellowriver-custom-menu": ["cmp"], "application/vnd.zul": ["zir", "zirz"], "application/vnd.zzazz.deck+xml": ["zaz"], "application/x-7z-compressed": ["7z"], "application/x-abiword": ["abw"], "application/x-ace-compressed": ["ace"], "application/x-apple-diskimage": ["*dmg"], "application/x-arj": ["arj"], "application/x-authorware-bin": ["aab", "x32", "u32", "vox"], "application/x-authorware-map": ["aam"], "application/x-authorware-seg": ["aas"], "application/x-bcpio": ["bcpio"], "application/x-bdoc": ["*bdoc"], "application/x-bittorrent": ["torrent"], "application/x-blorb": ["blb", "blorb"], "application/x-bzip": ["bz"], "application/x-bzip2": ["bz2", "boz"], "application/x-cbr": ["cbr", "cba", "cbt", "cbz", "cb7"], "application/x-cdlink": ["vcd"], "application/x-cfs-compressed": ["cfs"], "application/x-chat": ["chat"], "application/x-chess-pgn": ["pgn"], "application/x-chrome-extension": ["crx"], "application/x-cocoa": ["cco"], "application/x-conference": ["nsc"], "application/x-cpio": ["cpio"], "application/x-csh": ["csh"], "application/x-debian-package": ["*deb", "udeb"], "application/x-dgc-compressed": ["dgc"], "application/x-director": ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"], "application/x-doom": ["wad"], "application/x-dtbncx+xml": ["ncx"], "application/x-dtbook+xml": ["dtb"], "application/x-dtbresource+xml": ["res"], "application/x-dvi": ["dvi"], "application/x-envoy": ["evy"], "application/x-eva": ["eva"], "application/x-font-bdf": ["bdf"], "application/x-font-ghostscript": ["gsf"], "application/x-font-linux-psf": ["psf"], "application/x-font-pcf": ["pcf"], "application/x-font-snf": ["snf"], "application/x-font-type1": ["pfa", "pfb", "pfm", "afm"], "application/x-freearc": ["arc"], "application/x-futuresplash": ["spl"], "application/x-gca-compressed": ["gca"], "application/x-glulx": ["ulx"], "application/x-gnumeric": ["gnumeric"], "application/x-gramps-xml": ["gramps"], "application/x-gtar": ["gtar"], "application/x-hdf": ["hdf"], "application/x-httpd-php": ["php"], "application/x-install-instructions": ["install"], "application/x-iso9660-image": ["*iso"], "application/x-iwork-keynote-sffkey": ["*key"], "application/x-iwork-numbers-sffnumbers": ["*numbers"], "application/x-iwork-pages-sffpages": ["*pages"], "application/x-java-archive-diff": ["jardiff"], "application/x-java-jnlp-file": ["jnlp"], "application/x-keepass2": ["kdbx"], "application/x-latex": ["latex"], "application/x-lua-bytecode": ["luac"], "application/x-lzh-compressed": ["lzh", "lha"], "application/x-makeself": ["run"], "application/x-mie": ["mie"], "application/x-mobipocket-ebook": ["prc", "mobi"], "application/x-ms-application": ["application"], "application/x-ms-shortcut": ["lnk"], "application/x-ms-wmd": ["wmd"], "application/x-ms-wmz": ["wmz"], "application/x-ms-xbap": ["xbap"], "application/x-msaccess": ["mdb"], "application/x-msbinder": ["obd"], "application/x-mscardfile": ["crd"], "application/x-msclip": ["clp"], "application/x-msdos-program": ["*exe"], "application/x-msdownload": ["*exe", "*dll", "com", "bat", "*msi"], "application/x-msmediaview": ["mvb", "m13", "m14"], "application/x-msmetafile": ["*wmf", "*wmz", "*emf", "emz"], "application/x-msmoney": ["mny"], "application/x-mspublisher": ["pub"], "application/x-msschedule": ["scd"], "application/x-msterminal": ["trm"], "application/x-mswrite": ["wri"], "application/x-netcdf": ["nc", "cdf"], "application/x-ns-proxy-autoconfig": ["pac"], "application/x-nzb": ["nzb"], "application/x-perl": ["pl", "pm"], "application/x-pilot": ["*prc", "*pdb"], "application/x-pkcs12": ["p12", "pfx"], "application/x-pkcs7-certificates": ["p7b", "spc"], "application/x-pkcs7-certreqresp": ["p7r"], "application/x-rar-compressed": ["*rar"], "application/x-redhat-package-manager": ["rpm"], "application/x-research-info-systems": ["ris"], "application/x-sea": ["sea"], "application/x-sh": ["sh"], "application/x-shar": ["shar"], "application/x-shockwave-flash": ["swf"], "application/x-silverlight-app": ["xap"], "application/x-sql": ["sql"], "application/x-stuffit": ["sit"], "application/x-stuffitx": ["sitx"], "application/x-subrip": ["srt"], "application/x-sv4cpio": ["sv4cpio"], "application/x-sv4crc": ["sv4crc"], "application/x-t3vm-image": ["t3"], "application/x-tads": ["gam"], "application/x-tar": ["tar"], "application/x-tcl": ["tcl", "tk"], "application/x-tex": ["tex"], "application/x-tex-tfm": ["tfm"], "application/x-texinfo": ["texinfo", "texi"], "application/x-tgif": ["*obj"], "application/x-ustar": ["ustar"], "application/x-virtualbox-hdd": ["hdd"], "application/x-virtualbox-ova": ["ova"], "application/x-virtualbox-ovf": ["ovf"], "application/x-virtualbox-vbox": ["vbox"], "application/x-virtualbox-vbox-extpack": ["vbox-extpack"], "application/x-virtualbox-vdi": ["vdi"], "application/x-virtualbox-vhd": ["vhd"], "application/x-virtualbox-vmdk": ["vmdk"], "application/x-wais-source": ["src"], "application/x-web-app-manifest+json": ["webapp"], "application/x-x509-ca-cert": ["der", "crt", "pem"], "application/x-xfig": ["fig"], "application/x-xliff+xml": ["*xlf"], "application/x-xpinstall": ["xpi"], "application/x-xz": ["xz"], "application/x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"], "audio/vnd.dece.audio": ["uva", "uvva"], "audio/vnd.digital-winds": ["eol"], "audio/vnd.dra": ["dra"], "audio/vnd.dts": ["dts"], "audio/vnd.dts.hd": ["dtshd"], "audio/vnd.lucent.voice": ["lvp"], "audio/vnd.ms-playready.media.pya": ["pya"], "audio/vnd.nuera.ecelp4800": ["ecelp4800"], "audio/vnd.nuera.ecelp7470": ["ecelp7470"], "audio/vnd.nuera.ecelp9600": ["ecelp9600"], "audio/vnd.rip": ["rip"], "audio/x-aac": ["aac"], "audio/x-aiff": ["aif", "aiff", "aifc"], "audio/x-caf": ["caf"], "audio/x-flac": ["flac"], "audio/x-m4a": ["*m4a"], "audio/x-matroska": ["mka"], "audio/x-mpegurl": ["m3u"], "audio/x-ms-wax": ["wax"], "audio/x-ms-wma": ["wma"], "audio/x-pn-realaudio": ["ram", "ra"], "audio/x-pn-realaudio-plugin": ["rmp"], "audio/x-realaudio": ["*ra"], "audio/x-wav": ["*wav"], "chemical/x-cdx": ["cdx"], "chemical/x-cif": ["cif"], "chemical/x-cmdf": ["cmdf"], "chemical/x-cml": ["cml"], "chemical/x-csml": ["csml"], "chemical/x-xyz": ["xyz"], "image/prs.btif": ["btif"], "image/prs.pti": ["pti"], "image/vnd.adobe.photoshop": ["psd"], "image/vnd.airzip.accelerator.azv": ["azv"], "image/vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"], "image/vnd.djvu": ["djvu", "djv"], "image/vnd.dvb.subtitle": ["*sub"], "image/vnd.dwg": ["dwg"], "image/vnd.dxf": ["dxf"], "image/vnd.fastbidsheet": ["fbs"], "image/vnd.fpx": ["fpx"], "image/vnd.fst": ["fst"], "image/vnd.fujixerox.edmics-mmr": ["mmr"], "image/vnd.fujixerox.edmics-rlc": ["rlc"], "image/vnd.microsoft.icon": ["ico"], "image/vnd.ms-dds": ["dds"], "image/vnd.ms-modi": ["mdi"], "image/vnd.ms-photo": ["wdp"], "image/vnd.net-fpx": ["npx"], "image/vnd.pco.b16": ["b16"], "image/vnd.tencent.tap": ["tap"], "image/vnd.valve.source.texture": ["vtf"], "image/vnd.wap.wbmp": ["wbmp"], "image/vnd.xiff": ["xif"], "image/vnd.zbrush.pcx": ["pcx"], "image/x-3ds": ["3ds"], "image/x-cmu-raster": ["ras"], "image/x-cmx": ["cmx"], "image/x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"], "image/x-icon": ["*ico"], "image/x-jng": ["jng"], "image/x-mrsid-image": ["sid"], "image/x-ms-bmp": ["*bmp"], "image/x-pcx": ["*pcx"], "image/x-pict": ["pic", "pct"], "image/x-portable-anymap": ["pnm"], "image/x-portable-bitmap": ["pbm"], "image/x-portable-graymap": ["pgm"], "image/x-portable-pixmap": ["ppm"], "image/x-rgb": ["rgb"], "image/x-tga": ["tga"], "image/x-xbitmap": ["xbm"], "image/x-xpixmap": ["xpm"], "image/x-xwindowdump": ["xwd"], "message/vnd.wfa.wsc": ["wsc"], "model/vnd.collada+xml": ["dae"], "model/vnd.dwf": ["dwf"], "model/vnd.gdl": ["gdl"], "model/vnd.gtw": ["gtw"], "model/vnd.mts": ["mts"], "model/vnd.opengex": ["ogex"], "model/vnd.parasolid.transmit.binary": ["x_b"], "model/vnd.parasolid.transmit.text": ["x_t"], "model/vnd.sap.vds": ["vds"], "model/vnd.usdz+zip": ["usdz"], "model/vnd.valve.source.compiled-map": ["bsp"], "model/vnd.vtu": ["vtu"], "text/prs.lines.tag": ["dsc"], "text/vnd.curl": ["curl"], "text/vnd.curl.dcurl": ["dcurl"], "text/vnd.curl.mcurl": ["mcurl"], "text/vnd.curl.scurl": ["scurl"], "text/vnd.dvb.subtitle": ["sub"], "text/vnd.fly": ["fly"], "text/vnd.fmi.flexstor": ["flx"], "text/vnd.graphviz": ["gv"], "text/vnd.in3d.3dml": ["3dml"], "text/vnd.in3d.spot": ["spot"], "text/vnd.sun.j2me.app-descriptor": ["jad"], "text/vnd.wap.wml": ["wml"], "text/vnd.wap.wmlscript": ["wmls"], "text/x-asm": ["s", "asm"], "text/x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"], "text/x-component": ["htc"], "text/x-fortran": ["f", "for", "f77", "f90"], "text/x-handlebars-template": ["hbs"], "text/x-java-source": ["java"], "text/x-lua": ["lua"], "text/x-markdown": ["mkd"], "text/x-nfo": ["nfo"], "text/x-opml": ["opml"], "text/x-org": ["*org"], "text/x-pascal": ["p", "pas"], "text/x-processing": ["pde"], "text/x-sass": ["sass"], "text/x-scss": ["scss"], "text/x-setext": ["etx"], "text/x-sfv": ["sfv"], "text/x-suse-ymp": ["ymp"], "text/x-uuencode": ["uu"], "text/x-vcalendar": ["vcs"], "text/x-vcard": ["vcf"], "video/vnd.dece.hd": ["uvh", "uvvh"], "video/vnd.dece.mobile": ["uvm", "uvvm"], "video/vnd.dece.pd": ["uvp", "uvvp"], "video/vnd.dece.sd": ["uvs", "uvvs"], "video/vnd.dece.video": ["uvv", "uvvv"], "video/vnd.dvb.file": ["dvb"], "video/vnd.fvt": ["fvt"], "video/vnd.mpegurl": ["mxu", "m4u"], "video/vnd.ms-playready.media.pyv": ["pyv"], "video/vnd.uvvu.mp4": ["uvu", "uvvu"], "video/vnd.vivo": ["viv"], "video/x-f4v": ["f4v"], "video/x-fli": ["fli"], "video/x-flv": ["flv"], "video/x-m4v": ["m4v"], "video/x-matroska": ["mkv", "mk3d", "mks"], "video/x-mng": ["mng"], "video/x-ms-asf": ["asf", "asx"], "video/x-ms-vob": ["vob"], "video/x-ms-wm": ["wm"], "video/x-ms-wmv": ["wmv"], "video/x-ms-wmx": ["wmx"], "video/x-ms-wvx": ["wvx"], "video/x-msvideo": ["avi"], "video/x-sgi-movie": ["movie"], "video/x-smv": ["smv"], "x-conference/x-cooltalk": ["ice"] }; - } -}); - -// node_modules/mime/index.js -var require_mime2 = __commonJS({ - "node_modules/mime/index.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - var Mime2 = require_Mime(); - module2.exports = new Mime2(require_standard(), require_other()); - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/decode.json -var require_decode = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/decode.json"(exports2, module2) { - module2.exports = { "0": 65533, "128": 8364, "130": 8218, "131": 402, "132": 8222, "133": 8230, "134": 8224, "135": 8225, "136": 710, "137": 8240, "138": 352, "139": 8249, "140": 338, "142": 381, "145": 8216, "146": 8217, "147": 8220, "148": 8221, "149": 8226, "150": 8211, "151": 8212, "152": 732, "153": 8482, "154": 353, "155": 8250, "156": 339, "158": 382, "159": 376 }; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js -var require_decode_codepoint = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var decode_json_1 = __importDefault2(require_decode()); - var fromCodePoint3 = ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - String.fromCodePoint || function(codePoint) { - var output = ""; - if (codePoint > 65535) { - codePoint -= 65536; - output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - output += String.fromCharCode(codePoint); - return output; - } - ); - function decodeCodePoint3(codePoint) { - if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { - return "\uFFFD"; - } - if (codePoint in decode_json_1.default) { - codePoint = decode_json_1.default[codePoint]; - } - return fromCodePoint3(codePoint); - } - exports2.default = decodeCodePoint3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/entities.json -var require_entities = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/entities.json"(exports2, module2) { - module2.exports = { Aacute: "\xC1", aacute: "\xE1", Abreve: "\u0102", abreve: "\u0103", ac: "\u223E", acd: "\u223F", acE: "\u223E\u0333", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", Acy: "\u0410", acy: "\u0430", AElig: "\xC6", aelig: "\xE6", af: "\u2061", Afr: "\u{1D504}", afr: "\u{1D51E}", Agrave: "\xC0", agrave: "\xE0", alefsym: "\u2135", aleph: "\u2135", Alpha: "\u0391", alpha: "\u03B1", Amacr: "\u0100", amacr: "\u0101", amalg: "\u2A3F", amp: "&", AMP: "&", andand: "\u2A55", And: "\u2A53", and: "\u2227", andd: "\u2A5C", andslope: "\u2A58", andv: "\u2A5A", ang: "\u2220", ange: "\u29A4", angle: "\u2220", angmsdaa: "\u29A8", angmsdab: "\u29A9", angmsdac: "\u29AA", angmsdad: "\u29AB", angmsdae: "\u29AC", angmsdaf: "\u29AD", angmsdag: "\u29AE", angmsdah: "\u29AF", angmsd: "\u2221", angrt: "\u221F", angrtvb: "\u22BE", angrtvbd: "\u299D", angsph: "\u2222", angst: "\xC5", angzarr: "\u237C", Aogon: "\u0104", aogon: "\u0105", Aopf: "\u{1D538}", aopf: "\u{1D552}", apacir: "\u2A6F", ap: "\u2248", apE: "\u2A70", ape: "\u224A", apid: "\u224B", apos: "'", ApplyFunction: "\u2061", approx: "\u2248", approxeq: "\u224A", Aring: "\xC5", aring: "\xE5", Ascr: "\u{1D49C}", ascr: "\u{1D4B6}", Assign: "\u2254", ast: "*", asymp: "\u2248", asympeq: "\u224D", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", awconint: "\u2233", awint: "\u2A11", backcong: "\u224C", backepsilon: "\u03F6", backprime: "\u2035", backsim: "\u223D", backsimeq: "\u22CD", Backslash: "\u2216", Barv: "\u2AE7", barvee: "\u22BD", barwed: "\u2305", Barwed: "\u2306", barwedge: "\u2305", bbrk: "\u23B5", bbrktbrk: "\u23B6", bcong: "\u224C", Bcy: "\u0411", bcy: "\u0431", bdquo: "\u201E", becaus: "\u2235", because: "\u2235", Because: "\u2235", bemptyv: "\u29B0", bepsi: "\u03F6", bernou: "\u212C", Bernoullis: "\u212C", Beta: "\u0392", beta: "\u03B2", beth: "\u2136", between: "\u226C", Bfr: "\u{1D505}", bfr: "\u{1D51F}", bigcap: "\u22C2", bigcirc: "\u25EF", bigcup: "\u22C3", bigodot: "\u2A00", bigoplus: "\u2A01", bigotimes: "\u2A02", bigsqcup: "\u2A06", bigstar: "\u2605", bigtriangledown: "\u25BD", bigtriangleup: "\u25B3", biguplus: "\u2A04", bigvee: "\u22C1", bigwedge: "\u22C0", bkarow: "\u290D", blacklozenge: "\u29EB", blacksquare: "\u25AA", blacktriangle: "\u25B4", blacktriangledown: "\u25BE", blacktriangleleft: "\u25C2", blacktriangleright: "\u25B8", blank: "\u2423", blk12: "\u2592", blk14: "\u2591", blk34: "\u2593", block: "\u2588", bne: "=\u20E5", bnequiv: "\u2261\u20E5", bNot: "\u2AED", bnot: "\u2310", Bopf: "\u{1D539}", bopf: "\u{1D553}", bot: "\u22A5", bottom: "\u22A5", bowtie: "\u22C8", boxbox: "\u29C9", boxdl: "\u2510", boxdL: "\u2555", boxDl: "\u2556", boxDL: "\u2557", boxdr: "\u250C", boxdR: "\u2552", boxDr: "\u2553", boxDR: "\u2554", boxh: "\u2500", boxH: "\u2550", boxhd: "\u252C", boxHd: "\u2564", boxhD: "\u2565", boxHD: "\u2566", boxhu: "\u2534", boxHu: "\u2567", boxhU: "\u2568", boxHU: "\u2569", boxminus: "\u229F", boxplus: "\u229E", boxtimes: "\u22A0", boxul: "\u2518", boxuL: "\u255B", boxUl: "\u255C", boxUL: "\u255D", boxur: "\u2514", boxuR: "\u2558", boxUr: "\u2559", boxUR: "\u255A", boxv: "\u2502", boxV: "\u2551", boxvh: "\u253C", boxvH: "\u256A", boxVh: "\u256B", boxVH: "\u256C", boxvl: "\u2524", boxvL: "\u2561", boxVl: "\u2562", boxVL: "\u2563", boxvr: "\u251C", boxvR: "\u255E", boxVr: "\u255F", boxVR: "\u2560", bprime: "\u2035", breve: "\u02D8", Breve: "\u02D8", brvbar: "\xA6", bscr: "\u{1D4B7}", Bscr: "\u212C", bsemi: "\u204F", bsim: "\u223D", bsime: "\u22CD", bsolb: "\u29C5", bsol: "\\", bsolhsub: "\u27C8", bull: "\u2022", bullet: "\u2022", bump: "\u224E", bumpE: "\u2AAE", bumpe: "\u224F", Bumpeq: "\u224E", bumpeq: "\u224F", Cacute: "\u0106", cacute: "\u0107", capand: "\u2A44", capbrcup: "\u2A49", capcap: "\u2A4B", cap: "\u2229", Cap: "\u22D2", capcup: "\u2A47", capdot: "\u2A40", CapitalDifferentialD: "\u2145", caps: "\u2229\uFE00", caret: "\u2041", caron: "\u02C7", Cayleys: "\u212D", ccaps: "\u2A4D", Ccaron: "\u010C", ccaron: "\u010D", Ccedil: "\xC7", ccedil: "\xE7", Ccirc: "\u0108", ccirc: "\u0109", Cconint: "\u2230", ccups: "\u2A4C", ccupssm: "\u2A50", Cdot: "\u010A", cdot: "\u010B", cedil: "\xB8", Cedilla: "\xB8", cemptyv: "\u29B2", cent: "\xA2", centerdot: "\xB7", CenterDot: "\xB7", cfr: "\u{1D520}", Cfr: "\u212D", CHcy: "\u0427", chcy: "\u0447", check: "\u2713", checkmark: "\u2713", Chi: "\u03A7", chi: "\u03C7", circ: "\u02C6", circeq: "\u2257", circlearrowleft: "\u21BA", circlearrowright: "\u21BB", circledast: "\u229B", circledcirc: "\u229A", circleddash: "\u229D", CircleDot: "\u2299", circledR: "\xAE", circledS: "\u24C8", CircleMinus: "\u2296", CirclePlus: "\u2295", CircleTimes: "\u2297", cir: "\u25CB", cirE: "\u29C3", cire: "\u2257", cirfnint: "\u2A10", cirmid: "\u2AEF", cirscir: "\u29C2", ClockwiseContourIntegral: "\u2232", CloseCurlyDoubleQuote: "\u201D", CloseCurlyQuote: "\u2019", clubs: "\u2663", clubsuit: "\u2663", colon: ":", Colon: "\u2237", Colone: "\u2A74", colone: "\u2254", coloneq: "\u2254", comma: ",", commat: "@", comp: "\u2201", compfn: "\u2218", complement: "\u2201", complexes: "\u2102", cong: "\u2245", congdot: "\u2A6D", Congruent: "\u2261", conint: "\u222E", Conint: "\u222F", ContourIntegral: "\u222E", copf: "\u{1D554}", Copf: "\u2102", coprod: "\u2210", Coproduct: "\u2210", copy: "\xA9", COPY: "\xA9", copysr: "\u2117", CounterClockwiseContourIntegral: "\u2233", crarr: "\u21B5", cross: "\u2717", Cross: "\u2A2F", Cscr: "\u{1D49E}", cscr: "\u{1D4B8}", csub: "\u2ACF", csube: "\u2AD1", csup: "\u2AD0", csupe: "\u2AD2", ctdot: "\u22EF", cudarrl: "\u2938", cudarrr: "\u2935", cuepr: "\u22DE", cuesc: "\u22DF", cularr: "\u21B6", cularrp: "\u293D", cupbrcap: "\u2A48", cupcap: "\u2A46", CupCap: "\u224D", cup: "\u222A", Cup: "\u22D3", cupcup: "\u2A4A", cupdot: "\u228D", cupor: "\u2A45", cups: "\u222A\uFE00", curarr: "\u21B7", curarrm: "\u293C", curlyeqprec: "\u22DE", curlyeqsucc: "\u22DF", curlyvee: "\u22CE", curlywedge: "\u22CF", curren: "\xA4", curvearrowleft: "\u21B6", curvearrowright: "\u21B7", cuvee: "\u22CE", cuwed: "\u22CF", cwconint: "\u2232", cwint: "\u2231", cylcty: "\u232D", dagger: "\u2020", Dagger: "\u2021", daleth: "\u2138", darr: "\u2193", Darr: "\u21A1", dArr: "\u21D3", dash: "\u2010", Dashv: "\u2AE4", dashv: "\u22A3", dbkarow: "\u290F", dblac: "\u02DD", Dcaron: "\u010E", dcaron: "\u010F", Dcy: "\u0414", dcy: "\u0434", ddagger: "\u2021", ddarr: "\u21CA", DD: "\u2145", dd: "\u2146", DDotrahd: "\u2911", ddotseq: "\u2A77", deg: "\xB0", Del: "\u2207", Delta: "\u0394", delta: "\u03B4", demptyv: "\u29B1", dfisht: "\u297F", Dfr: "\u{1D507}", dfr: "\u{1D521}", dHar: "\u2965", dharl: "\u21C3", dharr: "\u21C2", DiacriticalAcute: "\xB4", DiacriticalDot: "\u02D9", DiacriticalDoubleAcute: "\u02DD", DiacriticalGrave: "`", DiacriticalTilde: "\u02DC", diam: "\u22C4", diamond: "\u22C4", Diamond: "\u22C4", diamondsuit: "\u2666", diams: "\u2666", die: "\xA8", DifferentialD: "\u2146", digamma: "\u03DD", disin: "\u22F2", div: "\xF7", divide: "\xF7", divideontimes: "\u22C7", divonx: "\u22C7", DJcy: "\u0402", djcy: "\u0452", dlcorn: "\u231E", dlcrop: "\u230D", dollar: "$", Dopf: "\u{1D53B}", dopf: "\u{1D555}", Dot: "\xA8", dot: "\u02D9", DotDot: "\u20DC", doteq: "\u2250", doteqdot: "\u2251", DotEqual: "\u2250", dotminus: "\u2238", dotplus: "\u2214", dotsquare: "\u22A1", doublebarwedge: "\u2306", DoubleContourIntegral: "\u222F", DoubleDot: "\xA8", DoubleDownArrow: "\u21D3", DoubleLeftArrow: "\u21D0", DoubleLeftRightArrow: "\u21D4", DoubleLeftTee: "\u2AE4", DoubleLongLeftArrow: "\u27F8", DoubleLongLeftRightArrow: "\u27FA", DoubleLongRightArrow: "\u27F9", DoubleRightArrow: "\u21D2", DoubleRightTee: "\u22A8", DoubleUpArrow: "\u21D1", DoubleUpDownArrow: "\u21D5", DoubleVerticalBar: "\u2225", DownArrowBar: "\u2913", downarrow: "\u2193", DownArrow: "\u2193", Downarrow: "\u21D3", DownArrowUpArrow: "\u21F5", DownBreve: "\u0311", downdownarrows: "\u21CA", downharpoonleft: "\u21C3", downharpoonright: "\u21C2", DownLeftRightVector: "\u2950", DownLeftTeeVector: "\u295E", DownLeftVectorBar: "\u2956", DownLeftVector: "\u21BD", DownRightTeeVector: "\u295F", DownRightVectorBar: "\u2957", DownRightVector: "\u21C1", DownTeeArrow: "\u21A7", DownTee: "\u22A4", drbkarow: "\u2910", drcorn: "\u231F", drcrop: "\u230C", Dscr: "\u{1D49F}", dscr: "\u{1D4B9}", DScy: "\u0405", dscy: "\u0455", dsol: "\u29F6", Dstrok: "\u0110", dstrok: "\u0111", dtdot: "\u22F1", dtri: "\u25BF", dtrif: "\u25BE", duarr: "\u21F5", duhar: "\u296F", dwangle: "\u29A6", DZcy: "\u040F", dzcy: "\u045F", dzigrarr: "\u27FF", Eacute: "\xC9", eacute: "\xE9", easter: "\u2A6E", Ecaron: "\u011A", ecaron: "\u011B", Ecirc: "\xCA", ecirc: "\xEA", ecir: "\u2256", ecolon: "\u2255", Ecy: "\u042D", ecy: "\u044D", eDDot: "\u2A77", Edot: "\u0116", edot: "\u0117", eDot: "\u2251", ee: "\u2147", efDot: "\u2252", Efr: "\u{1D508}", efr: "\u{1D522}", eg: "\u2A9A", Egrave: "\xC8", egrave: "\xE8", egs: "\u2A96", egsdot: "\u2A98", el: "\u2A99", Element: "\u2208", elinters: "\u23E7", ell: "\u2113", els: "\u2A95", elsdot: "\u2A97", Emacr: "\u0112", emacr: "\u0113", empty: "\u2205", emptyset: "\u2205", EmptySmallSquare: "\u25FB", emptyv: "\u2205", EmptyVerySmallSquare: "\u25AB", emsp13: "\u2004", emsp14: "\u2005", emsp: "\u2003", ENG: "\u014A", eng: "\u014B", ensp: "\u2002", Eogon: "\u0118", eogon: "\u0119", Eopf: "\u{1D53C}", eopf: "\u{1D556}", epar: "\u22D5", eparsl: "\u29E3", eplus: "\u2A71", epsi: "\u03B5", Epsilon: "\u0395", epsilon: "\u03B5", epsiv: "\u03F5", eqcirc: "\u2256", eqcolon: "\u2255", eqsim: "\u2242", eqslantgtr: "\u2A96", eqslantless: "\u2A95", Equal: "\u2A75", equals: "=", EqualTilde: "\u2242", equest: "\u225F", Equilibrium: "\u21CC", equiv: "\u2261", equivDD: "\u2A78", eqvparsl: "\u29E5", erarr: "\u2971", erDot: "\u2253", escr: "\u212F", Escr: "\u2130", esdot: "\u2250", Esim: "\u2A73", esim: "\u2242", Eta: "\u0397", eta: "\u03B7", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", euro: "\u20AC", excl: "!", exist: "\u2203", Exists: "\u2203", expectation: "\u2130", exponentiale: "\u2147", ExponentialE: "\u2147", fallingdotseq: "\u2252", Fcy: "\u0424", fcy: "\u0444", female: "\u2640", ffilig: "\uFB03", fflig: "\uFB00", ffllig: "\uFB04", Ffr: "\u{1D509}", ffr: "\u{1D523}", filig: "\uFB01", FilledSmallSquare: "\u25FC", FilledVerySmallSquare: "\u25AA", fjlig: "fj", flat: "\u266D", fllig: "\uFB02", fltns: "\u25B1", fnof: "\u0192", Fopf: "\u{1D53D}", fopf: "\u{1D557}", forall: "\u2200", ForAll: "\u2200", fork: "\u22D4", forkv: "\u2AD9", Fouriertrf: "\u2131", fpartint: "\u2A0D", frac12: "\xBD", frac13: "\u2153", frac14: "\xBC", frac15: "\u2155", frac16: "\u2159", frac18: "\u215B", frac23: "\u2154", frac25: "\u2156", frac34: "\xBE", frac35: "\u2157", frac38: "\u215C", frac45: "\u2158", frac56: "\u215A", frac58: "\u215D", frac78: "\u215E", frasl: "\u2044", frown: "\u2322", fscr: "\u{1D4BB}", Fscr: "\u2131", gacute: "\u01F5", Gamma: "\u0393", gamma: "\u03B3", Gammad: "\u03DC", gammad: "\u03DD", gap: "\u2A86", Gbreve: "\u011E", gbreve: "\u011F", Gcedil: "\u0122", Gcirc: "\u011C", gcirc: "\u011D", Gcy: "\u0413", gcy: "\u0433", Gdot: "\u0120", gdot: "\u0121", ge: "\u2265", gE: "\u2267", gEl: "\u2A8C", gel: "\u22DB", geq: "\u2265", geqq: "\u2267", geqslant: "\u2A7E", gescc: "\u2AA9", ges: "\u2A7E", gesdot: "\u2A80", gesdoto: "\u2A82", gesdotol: "\u2A84", gesl: "\u22DB\uFE00", gesles: "\u2A94", Gfr: "\u{1D50A}", gfr: "\u{1D524}", gg: "\u226B", Gg: "\u22D9", ggg: "\u22D9", gimel: "\u2137", GJcy: "\u0403", gjcy: "\u0453", gla: "\u2AA5", gl: "\u2277", glE: "\u2A92", glj: "\u2AA4", gnap: "\u2A8A", gnapprox: "\u2A8A", gne: "\u2A88", gnE: "\u2269", gneq: "\u2A88", gneqq: "\u2269", gnsim: "\u22E7", Gopf: "\u{1D53E}", gopf: "\u{1D558}", grave: "`", GreaterEqual: "\u2265", GreaterEqualLess: "\u22DB", GreaterFullEqual: "\u2267", GreaterGreater: "\u2AA2", GreaterLess: "\u2277", GreaterSlantEqual: "\u2A7E", GreaterTilde: "\u2273", Gscr: "\u{1D4A2}", gscr: "\u210A", gsim: "\u2273", gsime: "\u2A8E", gsiml: "\u2A90", gtcc: "\u2AA7", gtcir: "\u2A7A", gt: ">", GT: ">", Gt: "\u226B", gtdot: "\u22D7", gtlPar: "\u2995", gtquest: "\u2A7C", gtrapprox: "\u2A86", gtrarr: "\u2978", gtrdot: "\u22D7", gtreqless: "\u22DB", gtreqqless: "\u2A8C", gtrless: "\u2277", gtrsim: "\u2273", gvertneqq: "\u2269\uFE00", gvnE: "\u2269\uFE00", Hacek: "\u02C7", hairsp: "\u200A", half: "\xBD", hamilt: "\u210B", HARDcy: "\u042A", hardcy: "\u044A", harrcir: "\u2948", harr: "\u2194", hArr: "\u21D4", harrw: "\u21AD", Hat: "^", hbar: "\u210F", Hcirc: "\u0124", hcirc: "\u0125", hearts: "\u2665", heartsuit: "\u2665", hellip: "\u2026", hercon: "\u22B9", hfr: "\u{1D525}", Hfr: "\u210C", HilbertSpace: "\u210B", hksearow: "\u2925", hkswarow: "\u2926", hoarr: "\u21FF", homtht: "\u223B", hookleftarrow: "\u21A9", hookrightarrow: "\u21AA", hopf: "\u{1D559}", Hopf: "\u210D", horbar: "\u2015", HorizontalLine: "\u2500", hscr: "\u{1D4BD}", Hscr: "\u210B", hslash: "\u210F", Hstrok: "\u0126", hstrok: "\u0127", HumpDownHump: "\u224E", HumpEqual: "\u224F", hybull: "\u2043", hyphen: "\u2010", Iacute: "\xCD", iacute: "\xED", ic: "\u2063", Icirc: "\xCE", icirc: "\xEE", Icy: "\u0418", icy: "\u0438", Idot: "\u0130", IEcy: "\u0415", iecy: "\u0435", iexcl: "\xA1", iff: "\u21D4", ifr: "\u{1D526}", Ifr: "\u2111", Igrave: "\xCC", igrave: "\xEC", ii: "\u2148", iiiint: "\u2A0C", iiint: "\u222D", iinfin: "\u29DC", iiota: "\u2129", IJlig: "\u0132", ijlig: "\u0133", Imacr: "\u012A", imacr: "\u012B", image: "\u2111", ImaginaryI: "\u2148", imagline: "\u2110", imagpart: "\u2111", imath: "\u0131", Im: "\u2111", imof: "\u22B7", imped: "\u01B5", Implies: "\u21D2", incare: "\u2105", in: "\u2208", infin: "\u221E", infintie: "\u29DD", inodot: "\u0131", intcal: "\u22BA", int: "\u222B", Int: "\u222C", integers: "\u2124", Integral: "\u222B", intercal: "\u22BA", Intersection: "\u22C2", intlarhk: "\u2A17", intprod: "\u2A3C", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "\u0401", iocy: "\u0451", Iogon: "\u012E", iogon: "\u012F", Iopf: "\u{1D540}", iopf: "\u{1D55A}", Iota: "\u0399", iota: "\u03B9", iprod: "\u2A3C", iquest: "\xBF", iscr: "\u{1D4BE}", Iscr: "\u2110", isin: "\u2208", isindot: "\u22F5", isinE: "\u22F9", isins: "\u22F4", isinsv: "\u22F3", isinv: "\u2208", it: "\u2062", Itilde: "\u0128", itilde: "\u0129", Iukcy: "\u0406", iukcy: "\u0456", Iuml: "\xCF", iuml: "\xEF", Jcirc: "\u0134", jcirc: "\u0135", Jcy: "\u0419", jcy: "\u0439", Jfr: "\u{1D50D}", jfr: "\u{1D527}", jmath: "\u0237", Jopf: "\u{1D541}", jopf: "\u{1D55B}", Jscr: "\u{1D4A5}", jscr: "\u{1D4BF}", Jsercy: "\u0408", jsercy: "\u0458", Jukcy: "\u0404", jukcy: "\u0454", Kappa: "\u039A", kappa: "\u03BA", kappav: "\u03F0", Kcedil: "\u0136", kcedil: "\u0137", Kcy: "\u041A", kcy: "\u043A", Kfr: "\u{1D50E}", kfr: "\u{1D528}", kgreen: "\u0138", KHcy: "\u0425", khcy: "\u0445", KJcy: "\u040C", kjcy: "\u045C", Kopf: "\u{1D542}", kopf: "\u{1D55C}", Kscr: "\u{1D4A6}", kscr: "\u{1D4C0}", lAarr: "\u21DA", Lacute: "\u0139", lacute: "\u013A", laemptyv: "\u29B4", lagran: "\u2112", Lambda: "\u039B", lambda: "\u03BB", lang: "\u27E8", Lang: "\u27EA", langd: "\u2991", langle: "\u27E8", lap: "\u2A85", Laplacetrf: "\u2112", laquo: "\xAB", larrb: "\u21E4", larrbfs: "\u291F", larr: "\u2190", Larr: "\u219E", lArr: "\u21D0", larrfs: "\u291D", larrhk: "\u21A9", larrlp: "\u21AB", larrpl: "\u2939", larrsim: "\u2973", larrtl: "\u21A2", latail: "\u2919", lAtail: "\u291B", lat: "\u2AAB", late: "\u2AAD", lates: "\u2AAD\uFE00", lbarr: "\u290C", lBarr: "\u290E", lbbrk: "\u2772", lbrace: "{", lbrack: "[", lbrke: "\u298B", lbrksld: "\u298F", lbrkslu: "\u298D", Lcaron: "\u013D", lcaron: "\u013E", Lcedil: "\u013B", lcedil: "\u013C", lceil: "\u2308", lcub: "{", Lcy: "\u041B", lcy: "\u043B", ldca: "\u2936", ldquo: "\u201C", ldquor: "\u201E", ldrdhar: "\u2967", ldrushar: "\u294B", ldsh: "\u21B2", le: "\u2264", lE: "\u2266", LeftAngleBracket: "\u27E8", LeftArrowBar: "\u21E4", leftarrow: "\u2190", LeftArrow: "\u2190", Leftarrow: "\u21D0", LeftArrowRightArrow: "\u21C6", leftarrowtail: "\u21A2", LeftCeiling: "\u2308", LeftDoubleBracket: "\u27E6", LeftDownTeeVector: "\u2961", LeftDownVectorBar: "\u2959", LeftDownVector: "\u21C3", LeftFloor: "\u230A", leftharpoondown: "\u21BD", leftharpoonup: "\u21BC", leftleftarrows: "\u21C7", leftrightarrow: "\u2194", LeftRightArrow: "\u2194", Leftrightarrow: "\u21D4", leftrightarrows: "\u21C6", leftrightharpoons: "\u21CB", leftrightsquigarrow: "\u21AD", LeftRightVector: "\u294E", LeftTeeArrow: "\u21A4", LeftTee: "\u22A3", LeftTeeVector: "\u295A", leftthreetimes: "\u22CB", LeftTriangleBar: "\u29CF", LeftTriangle: "\u22B2", LeftTriangleEqual: "\u22B4", LeftUpDownVector: "\u2951", LeftUpTeeVector: "\u2960", LeftUpVectorBar: "\u2958", LeftUpVector: "\u21BF", LeftVectorBar: "\u2952", LeftVector: "\u21BC", lEg: "\u2A8B", leg: "\u22DA", leq: "\u2264", leqq: "\u2266", leqslant: "\u2A7D", lescc: "\u2AA8", les: "\u2A7D", lesdot: "\u2A7F", lesdoto: "\u2A81", lesdotor: "\u2A83", lesg: "\u22DA\uFE00", lesges: "\u2A93", lessapprox: "\u2A85", lessdot: "\u22D6", lesseqgtr: "\u22DA", lesseqqgtr: "\u2A8B", LessEqualGreater: "\u22DA", LessFullEqual: "\u2266", LessGreater: "\u2276", lessgtr: "\u2276", LessLess: "\u2AA1", lesssim: "\u2272", LessSlantEqual: "\u2A7D", LessTilde: "\u2272", lfisht: "\u297C", lfloor: "\u230A", Lfr: "\u{1D50F}", lfr: "\u{1D529}", lg: "\u2276", lgE: "\u2A91", lHar: "\u2962", lhard: "\u21BD", lharu: "\u21BC", lharul: "\u296A", lhblk: "\u2584", LJcy: "\u0409", ljcy: "\u0459", llarr: "\u21C7", ll: "\u226A", Ll: "\u22D8", llcorner: "\u231E", Lleftarrow: "\u21DA", llhard: "\u296B", lltri: "\u25FA", Lmidot: "\u013F", lmidot: "\u0140", lmoustache: "\u23B0", lmoust: "\u23B0", lnap: "\u2A89", lnapprox: "\u2A89", lne: "\u2A87", lnE: "\u2268", lneq: "\u2A87", lneqq: "\u2268", lnsim: "\u22E6", loang: "\u27EC", loarr: "\u21FD", lobrk: "\u27E6", longleftarrow: "\u27F5", LongLeftArrow: "\u27F5", Longleftarrow: "\u27F8", longleftrightarrow: "\u27F7", LongLeftRightArrow: "\u27F7", Longleftrightarrow: "\u27FA", longmapsto: "\u27FC", longrightarrow: "\u27F6", LongRightArrow: "\u27F6", Longrightarrow: "\u27F9", looparrowleft: "\u21AB", looparrowright: "\u21AC", lopar: "\u2985", Lopf: "\u{1D543}", lopf: "\u{1D55D}", loplus: "\u2A2D", lotimes: "\u2A34", lowast: "\u2217", lowbar: "_", LowerLeftArrow: "\u2199", LowerRightArrow: "\u2198", loz: "\u25CA", lozenge: "\u25CA", lozf: "\u29EB", lpar: "(", lparlt: "\u2993", lrarr: "\u21C6", lrcorner: "\u231F", lrhar: "\u21CB", lrhard: "\u296D", lrm: "\u200E", lrtri: "\u22BF", lsaquo: "\u2039", lscr: "\u{1D4C1}", Lscr: "\u2112", lsh: "\u21B0", Lsh: "\u21B0", lsim: "\u2272", lsime: "\u2A8D", lsimg: "\u2A8F", lsqb: "[", lsquo: "\u2018", lsquor: "\u201A", Lstrok: "\u0141", lstrok: "\u0142", ltcc: "\u2AA6", ltcir: "\u2A79", lt: "<", LT: "<", Lt: "\u226A", ltdot: "\u22D6", lthree: "\u22CB", ltimes: "\u22C9", ltlarr: "\u2976", ltquest: "\u2A7B", ltri: "\u25C3", ltrie: "\u22B4", ltrif: "\u25C2", ltrPar: "\u2996", lurdshar: "\u294A", luruhar: "\u2966", lvertneqq: "\u2268\uFE00", lvnE: "\u2268\uFE00", macr: "\xAF", male: "\u2642", malt: "\u2720", maltese: "\u2720", Map: "\u2905", map: "\u21A6", mapsto: "\u21A6", mapstodown: "\u21A7", mapstoleft: "\u21A4", mapstoup: "\u21A5", marker: "\u25AE", mcomma: "\u2A29", Mcy: "\u041C", mcy: "\u043C", mdash: "\u2014", mDDot: "\u223A", measuredangle: "\u2221", MediumSpace: "\u205F", Mellintrf: "\u2133", Mfr: "\u{1D510}", mfr: "\u{1D52A}", mho: "\u2127", micro: "\xB5", midast: "*", midcir: "\u2AF0", mid: "\u2223", middot: "\xB7", minusb: "\u229F", minus: "\u2212", minusd: "\u2238", minusdu: "\u2A2A", MinusPlus: "\u2213", mlcp: "\u2ADB", mldr: "\u2026", mnplus: "\u2213", models: "\u22A7", Mopf: "\u{1D544}", mopf: "\u{1D55E}", mp: "\u2213", mscr: "\u{1D4C2}", Mscr: "\u2133", mstpos: "\u223E", Mu: "\u039C", mu: "\u03BC", multimap: "\u22B8", mumap: "\u22B8", nabla: "\u2207", Nacute: "\u0143", nacute: "\u0144", nang: "\u2220\u20D2", nap: "\u2249", napE: "\u2A70\u0338", napid: "\u224B\u0338", napos: "\u0149", napprox: "\u2249", natural: "\u266E", naturals: "\u2115", natur: "\u266E", nbsp: "\xA0", nbump: "\u224E\u0338", nbumpe: "\u224F\u0338", ncap: "\u2A43", Ncaron: "\u0147", ncaron: "\u0148", Ncedil: "\u0145", ncedil: "\u0146", ncong: "\u2247", ncongdot: "\u2A6D\u0338", ncup: "\u2A42", Ncy: "\u041D", ncy: "\u043D", ndash: "\u2013", nearhk: "\u2924", nearr: "\u2197", neArr: "\u21D7", nearrow: "\u2197", ne: "\u2260", nedot: "\u2250\u0338", NegativeMediumSpace: "\u200B", NegativeThickSpace: "\u200B", NegativeThinSpace: "\u200B", NegativeVeryThinSpace: "\u200B", nequiv: "\u2262", nesear: "\u2928", nesim: "\u2242\u0338", NestedGreaterGreater: "\u226B", NestedLessLess: "\u226A", NewLine: "\n", nexist: "\u2204", nexists: "\u2204", Nfr: "\u{1D511}", nfr: "\u{1D52B}", ngE: "\u2267\u0338", nge: "\u2271", ngeq: "\u2271", ngeqq: "\u2267\u0338", ngeqslant: "\u2A7E\u0338", nges: "\u2A7E\u0338", nGg: "\u22D9\u0338", ngsim: "\u2275", nGt: "\u226B\u20D2", ngt: "\u226F", ngtr: "\u226F", nGtv: "\u226B\u0338", nharr: "\u21AE", nhArr: "\u21CE", nhpar: "\u2AF2", ni: "\u220B", nis: "\u22FC", nisd: "\u22FA", niv: "\u220B", NJcy: "\u040A", njcy: "\u045A", nlarr: "\u219A", nlArr: "\u21CD", nldr: "\u2025", nlE: "\u2266\u0338", nle: "\u2270", nleftarrow: "\u219A", nLeftarrow: "\u21CD", nleftrightarrow: "\u21AE", nLeftrightarrow: "\u21CE", nleq: "\u2270", nleqq: "\u2266\u0338", nleqslant: "\u2A7D\u0338", nles: "\u2A7D\u0338", nless: "\u226E", nLl: "\u22D8\u0338", nlsim: "\u2274", nLt: "\u226A\u20D2", nlt: "\u226E", nltri: "\u22EA", nltrie: "\u22EC", nLtv: "\u226A\u0338", nmid: "\u2224", NoBreak: "\u2060", NonBreakingSpace: "\xA0", nopf: "\u{1D55F}", Nopf: "\u2115", Not: "\u2AEC", not: "\xAC", NotCongruent: "\u2262", NotCupCap: "\u226D", NotDoubleVerticalBar: "\u2226", NotElement: "\u2209", NotEqual: "\u2260", NotEqualTilde: "\u2242\u0338", NotExists: "\u2204", NotGreater: "\u226F", NotGreaterEqual: "\u2271", NotGreaterFullEqual: "\u2267\u0338", NotGreaterGreater: "\u226B\u0338", NotGreaterLess: "\u2279", NotGreaterSlantEqual: "\u2A7E\u0338", NotGreaterTilde: "\u2275", NotHumpDownHump: "\u224E\u0338", NotHumpEqual: "\u224F\u0338", notin: "\u2209", notindot: "\u22F5\u0338", notinE: "\u22F9\u0338", notinva: "\u2209", notinvb: "\u22F7", notinvc: "\u22F6", NotLeftTriangleBar: "\u29CF\u0338", NotLeftTriangle: "\u22EA", NotLeftTriangleEqual: "\u22EC", NotLess: "\u226E", NotLessEqual: "\u2270", NotLessGreater: "\u2278", NotLessLess: "\u226A\u0338", NotLessSlantEqual: "\u2A7D\u0338", NotLessTilde: "\u2274", NotNestedGreaterGreater: "\u2AA2\u0338", NotNestedLessLess: "\u2AA1\u0338", notni: "\u220C", notniva: "\u220C", notnivb: "\u22FE", notnivc: "\u22FD", NotPrecedes: "\u2280", NotPrecedesEqual: "\u2AAF\u0338", NotPrecedesSlantEqual: "\u22E0", NotReverseElement: "\u220C", NotRightTriangleBar: "\u29D0\u0338", NotRightTriangle: "\u22EB", NotRightTriangleEqual: "\u22ED", NotSquareSubset: "\u228F\u0338", NotSquareSubsetEqual: "\u22E2", NotSquareSuperset: "\u2290\u0338", NotSquareSupersetEqual: "\u22E3", NotSubset: "\u2282\u20D2", NotSubsetEqual: "\u2288", NotSucceeds: "\u2281", NotSucceedsEqual: "\u2AB0\u0338", NotSucceedsSlantEqual: "\u22E1", NotSucceedsTilde: "\u227F\u0338", NotSuperset: "\u2283\u20D2", NotSupersetEqual: "\u2289", NotTilde: "\u2241", NotTildeEqual: "\u2244", NotTildeFullEqual: "\u2247", NotTildeTilde: "\u2249", NotVerticalBar: "\u2224", nparallel: "\u2226", npar: "\u2226", nparsl: "\u2AFD\u20E5", npart: "\u2202\u0338", npolint: "\u2A14", npr: "\u2280", nprcue: "\u22E0", nprec: "\u2280", npreceq: "\u2AAF\u0338", npre: "\u2AAF\u0338", nrarrc: "\u2933\u0338", nrarr: "\u219B", nrArr: "\u21CF", nrarrw: "\u219D\u0338", nrightarrow: "\u219B", nRightarrow: "\u21CF", nrtri: "\u22EB", nrtrie: "\u22ED", nsc: "\u2281", nsccue: "\u22E1", nsce: "\u2AB0\u0338", Nscr: "\u{1D4A9}", nscr: "\u{1D4C3}", nshortmid: "\u2224", nshortparallel: "\u2226", nsim: "\u2241", nsime: "\u2244", nsimeq: "\u2244", nsmid: "\u2224", nspar: "\u2226", nsqsube: "\u22E2", nsqsupe: "\u22E3", nsub: "\u2284", nsubE: "\u2AC5\u0338", nsube: "\u2288", nsubset: "\u2282\u20D2", nsubseteq: "\u2288", nsubseteqq: "\u2AC5\u0338", nsucc: "\u2281", nsucceq: "\u2AB0\u0338", nsup: "\u2285", nsupE: "\u2AC6\u0338", nsupe: "\u2289", nsupset: "\u2283\u20D2", nsupseteq: "\u2289", nsupseteqq: "\u2AC6\u0338", ntgl: "\u2279", Ntilde: "\xD1", ntilde: "\xF1", ntlg: "\u2278", ntriangleleft: "\u22EA", ntrianglelefteq: "\u22EC", ntriangleright: "\u22EB", ntrianglerighteq: "\u22ED", Nu: "\u039D", nu: "\u03BD", num: "#", numero: "\u2116", numsp: "\u2007", nvap: "\u224D\u20D2", nvdash: "\u22AC", nvDash: "\u22AD", nVdash: "\u22AE", nVDash: "\u22AF", nvge: "\u2265\u20D2", nvgt: ">\u20D2", nvHarr: "\u2904", nvinfin: "\u29DE", nvlArr: "\u2902", nvle: "\u2264\u20D2", nvlt: "<\u20D2", nvltrie: "\u22B4\u20D2", nvrArr: "\u2903", nvrtrie: "\u22B5\u20D2", nvsim: "\u223C\u20D2", nwarhk: "\u2923", nwarr: "\u2196", nwArr: "\u21D6", nwarrow: "\u2196", nwnear: "\u2927", Oacute: "\xD3", oacute: "\xF3", oast: "\u229B", Ocirc: "\xD4", ocirc: "\xF4", ocir: "\u229A", Ocy: "\u041E", ocy: "\u043E", odash: "\u229D", Odblac: "\u0150", odblac: "\u0151", odiv: "\u2A38", odot: "\u2299", odsold: "\u29BC", OElig: "\u0152", oelig: "\u0153", ofcir: "\u29BF", Ofr: "\u{1D512}", ofr: "\u{1D52C}", ogon: "\u02DB", Ograve: "\xD2", ograve: "\xF2", ogt: "\u29C1", ohbar: "\u29B5", ohm: "\u03A9", oint: "\u222E", olarr: "\u21BA", olcir: "\u29BE", olcross: "\u29BB", oline: "\u203E", olt: "\u29C0", Omacr: "\u014C", omacr: "\u014D", Omega: "\u03A9", omega: "\u03C9", Omicron: "\u039F", omicron: "\u03BF", omid: "\u29B6", ominus: "\u2296", Oopf: "\u{1D546}", oopf: "\u{1D560}", opar: "\u29B7", OpenCurlyDoubleQuote: "\u201C", OpenCurlyQuote: "\u2018", operp: "\u29B9", oplus: "\u2295", orarr: "\u21BB", Or: "\u2A54", or: "\u2228", ord: "\u2A5D", order: "\u2134", orderof: "\u2134", ordf: "\xAA", ordm: "\xBA", origof: "\u22B6", oror: "\u2A56", orslope: "\u2A57", orv: "\u2A5B", oS: "\u24C8", Oscr: "\u{1D4AA}", oscr: "\u2134", Oslash: "\xD8", oslash: "\xF8", osol: "\u2298", Otilde: "\xD5", otilde: "\xF5", otimesas: "\u2A36", Otimes: "\u2A37", otimes: "\u2297", Ouml: "\xD6", ouml: "\xF6", ovbar: "\u233D", OverBar: "\u203E", OverBrace: "\u23DE", OverBracket: "\u23B4", OverParenthesis: "\u23DC", para: "\xB6", parallel: "\u2225", par: "\u2225", parsim: "\u2AF3", parsl: "\u2AFD", part: "\u2202", PartialD: "\u2202", Pcy: "\u041F", pcy: "\u043F", percnt: "%", period: ".", permil: "\u2030", perp: "\u22A5", pertenk: "\u2031", Pfr: "\u{1D513}", pfr: "\u{1D52D}", Phi: "\u03A6", phi: "\u03C6", phiv: "\u03D5", phmmat: "\u2133", phone: "\u260E", Pi: "\u03A0", pi: "\u03C0", pitchfork: "\u22D4", piv: "\u03D6", planck: "\u210F", planckh: "\u210E", plankv: "\u210F", plusacir: "\u2A23", plusb: "\u229E", pluscir: "\u2A22", plus: "+", plusdo: "\u2214", plusdu: "\u2A25", pluse: "\u2A72", PlusMinus: "\xB1", plusmn: "\xB1", plussim: "\u2A26", plustwo: "\u2A27", pm: "\xB1", Poincareplane: "\u210C", pointint: "\u2A15", popf: "\u{1D561}", Popf: "\u2119", pound: "\xA3", prap: "\u2AB7", Pr: "\u2ABB", pr: "\u227A", prcue: "\u227C", precapprox: "\u2AB7", prec: "\u227A", preccurlyeq: "\u227C", Precedes: "\u227A", PrecedesEqual: "\u2AAF", PrecedesSlantEqual: "\u227C", PrecedesTilde: "\u227E", preceq: "\u2AAF", precnapprox: "\u2AB9", precneqq: "\u2AB5", precnsim: "\u22E8", pre: "\u2AAF", prE: "\u2AB3", precsim: "\u227E", prime: "\u2032", Prime: "\u2033", primes: "\u2119", prnap: "\u2AB9", prnE: "\u2AB5", prnsim: "\u22E8", prod: "\u220F", Product: "\u220F", profalar: "\u232E", profline: "\u2312", profsurf: "\u2313", prop: "\u221D", Proportional: "\u221D", Proportion: "\u2237", propto: "\u221D", prsim: "\u227E", prurel: "\u22B0", Pscr: "\u{1D4AB}", pscr: "\u{1D4C5}", Psi: "\u03A8", psi: "\u03C8", puncsp: "\u2008", Qfr: "\u{1D514}", qfr: "\u{1D52E}", qint: "\u2A0C", qopf: "\u{1D562}", Qopf: "\u211A", qprime: "\u2057", Qscr: "\u{1D4AC}", qscr: "\u{1D4C6}", quaternions: "\u210D", quatint: "\u2A16", quest: "?", questeq: "\u225F", quot: '"', QUOT: '"', rAarr: "\u21DB", race: "\u223D\u0331", Racute: "\u0154", racute: "\u0155", radic: "\u221A", raemptyv: "\u29B3", rang: "\u27E9", Rang: "\u27EB", rangd: "\u2992", range: "\u29A5", rangle: "\u27E9", raquo: "\xBB", rarrap: "\u2975", rarrb: "\u21E5", rarrbfs: "\u2920", rarrc: "\u2933", rarr: "\u2192", Rarr: "\u21A0", rArr: "\u21D2", rarrfs: "\u291E", rarrhk: "\u21AA", rarrlp: "\u21AC", rarrpl: "\u2945", rarrsim: "\u2974", Rarrtl: "\u2916", rarrtl: "\u21A3", rarrw: "\u219D", ratail: "\u291A", rAtail: "\u291C", ratio: "\u2236", rationals: "\u211A", rbarr: "\u290D", rBarr: "\u290F", RBarr: "\u2910", rbbrk: "\u2773", rbrace: "}", rbrack: "]", rbrke: "\u298C", rbrksld: "\u298E", rbrkslu: "\u2990", Rcaron: "\u0158", rcaron: "\u0159", Rcedil: "\u0156", rcedil: "\u0157", rceil: "\u2309", rcub: "}", Rcy: "\u0420", rcy: "\u0440", rdca: "\u2937", rdldhar: "\u2969", rdquo: "\u201D", rdquor: "\u201D", rdsh: "\u21B3", real: "\u211C", realine: "\u211B", realpart: "\u211C", reals: "\u211D", Re: "\u211C", rect: "\u25AD", reg: "\xAE", REG: "\xAE", ReverseElement: "\u220B", ReverseEquilibrium: "\u21CB", ReverseUpEquilibrium: "\u296F", rfisht: "\u297D", rfloor: "\u230B", rfr: "\u{1D52F}", Rfr: "\u211C", rHar: "\u2964", rhard: "\u21C1", rharu: "\u21C0", rharul: "\u296C", Rho: "\u03A1", rho: "\u03C1", rhov: "\u03F1", RightAngleBracket: "\u27E9", RightArrowBar: "\u21E5", rightarrow: "\u2192", RightArrow: "\u2192", Rightarrow: "\u21D2", RightArrowLeftArrow: "\u21C4", rightarrowtail: "\u21A3", RightCeiling: "\u2309", RightDoubleBracket: "\u27E7", RightDownTeeVector: "\u295D", RightDownVectorBar: "\u2955", RightDownVector: "\u21C2", RightFloor: "\u230B", rightharpoondown: "\u21C1", rightharpoonup: "\u21C0", rightleftarrows: "\u21C4", rightleftharpoons: "\u21CC", rightrightarrows: "\u21C9", rightsquigarrow: "\u219D", RightTeeArrow: "\u21A6", RightTee: "\u22A2", RightTeeVector: "\u295B", rightthreetimes: "\u22CC", RightTriangleBar: "\u29D0", RightTriangle: "\u22B3", RightTriangleEqual: "\u22B5", RightUpDownVector: "\u294F", RightUpTeeVector: "\u295C", RightUpVectorBar: "\u2954", RightUpVector: "\u21BE", RightVectorBar: "\u2953", RightVector: "\u21C0", ring: "\u02DA", risingdotseq: "\u2253", rlarr: "\u21C4", rlhar: "\u21CC", rlm: "\u200F", rmoustache: "\u23B1", rmoust: "\u23B1", rnmid: "\u2AEE", roang: "\u27ED", roarr: "\u21FE", robrk: "\u27E7", ropar: "\u2986", ropf: "\u{1D563}", Ropf: "\u211D", roplus: "\u2A2E", rotimes: "\u2A35", RoundImplies: "\u2970", rpar: ")", rpargt: "\u2994", rppolint: "\u2A12", rrarr: "\u21C9", Rrightarrow: "\u21DB", rsaquo: "\u203A", rscr: "\u{1D4C7}", Rscr: "\u211B", rsh: "\u21B1", Rsh: "\u21B1", rsqb: "]", rsquo: "\u2019", rsquor: "\u2019", rthree: "\u22CC", rtimes: "\u22CA", rtri: "\u25B9", rtrie: "\u22B5", rtrif: "\u25B8", rtriltri: "\u29CE", RuleDelayed: "\u29F4", ruluhar: "\u2968", rx: "\u211E", Sacute: "\u015A", sacute: "\u015B", sbquo: "\u201A", scap: "\u2AB8", Scaron: "\u0160", scaron: "\u0161", Sc: "\u2ABC", sc: "\u227B", sccue: "\u227D", sce: "\u2AB0", scE: "\u2AB4", Scedil: "\u015E", scedil: "\u015F", Scirc: "\u015C", scirc: "\u015D", scnap: "\u2ABA", scnE: "\u2AB6", scnsim: "\u22E9", scpolint: "\u2A13", scsim: "\u227F", Scy: "\u0421", scy: "\u0441", sdotb: "\u22A1", sdot: "\u22C5", sdote: "\u2A66", searhk: "\u2925", searr: "\u2198", seArr: "\u21D8", searrow: "\u2198", sect: "\xA7", semi: ";", seswar: "\u2929", setminus: "\u2216", setmn: "\u2216", sext: "\u2736", Sfr: "\u{1D516}", sfr: "\u{1D530}", sfrown: "\u2322", sharp: "\u266F", SHCHcy: "\u0429", shchcy: "\u0449", SHcy: "\u0428", shcy: "\u0448", ShortDownArrow: "\u2193", ShortLeftArrow: "\u2190", shortmid: "\u2223", shortparallel: "\u2225", ShortRightArrow: "\u2192", ShortUpArrow: "\u2191", shy: "\xAD", Sigma: "\u03A3", sigma: "\u03C3", sigmaf: "\u03C2", sigmav: "\u03C2", sim: "\u223C", simdot: "\u2A6A", sime: "\u2243", simeq: "\u2243", simg: "\u2A9E", simgE: "\u2AA0", siml: "\u2A9D", simlE: "\u2A9F", simne: "\u2246", simplus: "\u2A24", simrarr: "\u2972", slarr: "\u2190", SmallCircle: "\u2218", smallsetminus: "\u2216", smashp: "\u2A33", smeparsl: "\u29E4", smid: "\u2223", smile: "\u2323", smt: "\u2AAA", smte: "\u2AAC", smtes: "\u2AAC\uFE00", SOFTcy: "\u042C", softcy: "\u044C", solbar: "\u233F", solb: "\u29C4", sol: "/", Sopf: "\u{1D54A}", sopf: "\u{1D564}", spades: "\u2660", spadesuit: "\u2660", spar: "\u2225", sqcap: "\u2293", sqcaps: "\u2293\uFE00", sqcup: "\u2294", sqcups: "\u2294\uFE00", Sqrt: "\u221A", sqsub: "\u228F", sqsube: "\u2291", sqsubset: "\u228F", sqsubseteq: "\u2291", sqsup: "\u2290", sqsupe: "\u2292", sqsupset: "\u2290", sqsupseteq: "\u2292", square: "\u25A1", Square: "\u25A1", SquareIntersection: "\u2293", SquareSubset: "\u228F", SquareSubsetEqual: "\u2291", SquareSuperset: "\u2290", SquareSupersetEqual: "\u2292", SquareUnion: "\u2294", squarf: "\u25AA", squ: "\u25A1", squf: "\u25AA", srarr: "\u2192", Sscr: "\u{1D4AE}", sscr: "\u{1D4C8}", ssetmn: "\u2216", ssmile: "\u2323", sstarf: "\u22C6", Star: "\u22C6", star: "\u2606", starf: "\u2605", straightepsilon: "\u03F5", straightphi: "\u03D5", strns: "\xAF", sub: "\u2282", Sub: "\u22D0", subdot: "\u2ABD", subE: "\u2AC5", sube: "\u2286", subedot: "\u2AC3", submult: "\u2AC1", subnE: "\u2ACB", subne: "\u228A", subplus: "\u2ABF", subrarr: "\u2979", subset: "\u2282", Subset: "\u22D0", subseteq: "\u2286", subseteqq: "\u2AC5", SubsetEqual: "\u2286", subsetneq: "\u228A", subsetneqq: "\u2ACB", subsim: "\u2AC7", subsub: "\u2AD5", subsup: "\u2AD3", succapprox: "\u2AB8", succ: "\u227B", succcurlyeq: "\u227D", Succeeds: "\u227B", SucceedsEqual: "\u2AB0", SucceedsSlantEqual: "\u227D", SucceedsTilde: "\u227F", succeq: "\u2AB0", succnapprox: "\u2ABA", succneqq: "\u2AB6", succnsim: "\u22E9", succsim: "\u227F", SuchThat: "\u220B", sum: "\u2211", Sum: "\u2211", sung: "\u266A", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", sup: "\u2283", Sup: "\u22D1", supdot: "\u2ABE", supdsub: "\u2AD8", supE: "\u2AC6", supe: "\u2287", supedot: "\u2AC4", Superset: "\u2283", SupersetEqual: "\u2287", suphsol: "\u27C9", suphsub: "\u2AD7", suplarr: "\u297B", supmult: "\u2AC2", supnE: "\u2ACC", supne: "\u228B", supplus: "\u2AC0", supset: "\u2283", Supset: "\u22D1", supseteq: "\u2287", supseteqq: "\u2AC6", supsetneq: "\u228B", supsetneqq: "\u2ACC", supsim: "\u2AC8", supsub: "\u2AD4", supsup: "\u2AD6", swarhk: "\u2926", swarr: "\u2199", swArr: "\u21D9", swarrow: "\u2199", swnwar: "\u292A", szlig: "\xDF", Tab: " ", target: "\u2316", Tau: "\u03A4", tau: "\u03C4", tbrk: "\u23B4", Tcaron: "\u0164", tcaron: "\u0165", Tcedil: "\u0162", tcedil: "\u0163", Tcy: "\u0422", tcy: "\u0442", tdot: "\u20DB", telrec: "\u2315", Tfr: "\u{1D517}", tfr: "\u{1D531}", there4: "\u2234", therefore: "\u2234", Therefore: "\u2234", Theta: "\u0398", theta: "\u03B8", thetasym: "\u03D1", thetav: "\u03D1", thickapprox: "\u2248", thicksim: "\u223C", ThickSpace: "\u205F\u200A", ThinSpace: "\u2009", thinsp: "\u2009", thkap: "\u2248", thksim: "\u223C", THORN: "\xDE", thorn: "\xFE", tilde: "\u02DC", Tilde: "\u223C", TildeEqual: "\u2243", TildeFullEqual: "\u2245", TildeTilde: "\u2248", timesbar: "\u2A31", timesb: "\u22A0", times: "\xD7", timesd: "\u2A30", tint: "\u222D", toea: "\u2928", topbot: "\u2336", topcir: "\u2AF1", top: "\u22A4", Topf: "\u{1D54B}", topf: "\u{1D565}", topfork: "\u2ADA", tosa: "\u2929", tprime: "\u2034", trade: "\u2122", TRADE: "\u2122", triangle: "\u25B5", triangledown: "\u25BF", triangleleft: "\u25C3", trianglelefteq: "\u22B4", triangleq: "\u225C", triangleright: "\u25B9", trianglerighteq: "\u22B5", tridot: "\u25EC", trie: "\u225C", triminus: "\u2A3A", TripleDot: "\u20DB", triplus: "\u2A39", trisb: "\u29CD", tritime: "\u2A3B", trpezium: "\u23E2", Tscr: "\u{1D4AF}", tscr: "\u{1D4C9}", TScy: "\u0426", tscy: "\u0446", TSHcy: "\u040B", tshcy: "\u045B", Tstrok: "\u0166", tstrok: "\u0167", twixt: "\u226C", twoheadleftarrow: "\u219E", twoheadrightarrow: "\u21A0", Uacute: "\xDA", uacute: "\xFA", uarr: "\u2191", Uarr: "\u219F", uArr: "\u21D1", Uarrocir: "\u2949", Ubrcy: "\u040E", ubrcy: "\u045E", Ubreve: "\u016C", ubreve: "\u016D", Ucirc: "\xDB", ucirc: "\xFB", Ucy: "\u0423", ucy: "\u0443", udarr: "\u21C5", Udblac: "\u0170", udblac: "\u0171", udhar: "\u296E", ufisht: "\u297E", Ufr: "\u{1D518}", ufr: "\u{1D532}", Ugrave: "\xD9", ugrave: "\xF9", uHar: "\u2963", uharl: "\u21BF", uharr: "\u21BE", uhblk: "\u2580", ulcorn: "\u231C", ulcorner: "\u231C", ulcrop: "\u230F", ultri: "\u25F8", Umacr: "\u016A", umacr: "\u016B", uml: "\xA8", UnderBar: "_", UnderBrace: "\u23DF", UnderBracket: "\u23B5", UnderParenthesis: "\u23DD", Union: "\u22C3", UnionPlus: "\u228E", Uogon: "\u0172", uogon: "\u0173", Uopf: "\u{1D54C}", uopf: "\u{1D566}", UpArrowBar: "\u2912", uparrow: "\u2191", UpArrow: "\u2191", Uparrow: "\u21D1", UpArrowDownArrow: "\u21C5", updownarrow: "\u2195", UpDownArrow: "\u2195", Updownarrow: "\u21D5", UpEquilibrium: "\u296E", upharpoonleft: "\u21BF", upharpoonright: "\u21BE", uplus: "\u228E", UpperLeftArrow: "\u2196", UpperRightArrow: "\u2197", upsi: "\u03C5", Upsi: "\u03D2", upsih: "\u03D2", Upsilon: "\u03A5", upsilon: "\u03C5", UpTeeArrow: "\u21A5", UpTee: "\u22A5", upuparrows: "\u21C8", urcorn: "\u231D", urcorner: "\u231D", urcrop: "\u230E", Uring: "\u016E", uring: "\u016F", urtri: "\u25F9", Uscr: "\u{1D4B0}", uscr: "\u{1D4CA}", utdot: "\u22F0", Utilde: "\u0168", utilde: "\u0169", utri: "\u25B5", utrif: "\u25B4", uuarr: "\u21C8", Uuml: "\xDC", uuml: "\xFC", uwangle: "\u29A7", vangrt: "\u299C", varepsilon: "\u03F5", varkappa: "\u03F0", varnothing: "\u2205", varphi: "\u03D5", varpi: "\u03D6", varpropto: "\u221D", varr: "\u2195", vArr: "\u21D5", varrho: "\u03F1", varsigma: "\u03C2", varsubsetneq: "\u228A\uFE00", varsubsetneqq: "\u2ACB\uFE00", varsupsetneq: "\u228B\uFE00", varsupsetneqq: "\u2ACC\uFE00", vartheta: "\u03D1", vartriangleleft: "\u22B2", vartriangleright: "\u22B3", vBar: "\u2AE8", Vbar: "\u2AEB", vBarv: "\u2AE9", Vcy: "\u0412", vcy: "\u0432", vdash: "\u22A2", vDash: "\u22A8", Vdash: "\u22A9", VDash: "\u22AB", Vdashl: "\u2AE6", veebar: "\u22BB", vee: "\u2228", Vee: "\u22C1", veeeq: "\u225A", vellip: "\u22EE", verbar: "|", Verbar: "\u2016", vert: "|", Vert: "\u2016", VerticalBar: "\u2223", VerticalLine: "|", VerticalSeparator: "\u2758", VerticalTilde: "\u2240", VeryThinSpace: "\u200A", Vfr: "\u{1D519}", vfr: "\u{1D533}", vltri: "\u22B2", vnsub: "\u2282\u20D2", vnsup: "\u2283\u20D2", Vopf: "\u{1D54D}", vopf: "\u{1D567}", vprop: "\u221D", vrtri: "\u22B3", Vscr: "\u{1D4B1}", vscr: "\u{1D4CB}", vsubnE: "\u2ACB\uFE00", vsubne: "\u228A\uFE00", vsupnE: "\u2ACC\uFE00", vsupne: "\u228B\uFE00", Vvdash: "\u22AA", vzigzag: "\u299A", Wcirc: "\u0174", wcirc: "\u0175", wedbar: "\u2A5F", wedge: "\u2227", Wedge: "\u22C0", wedgeq: "\u2259", weierp: "\u2118", Wfr: "\u{1D51A}", wfr: "\u{1D534}", Wopf: "\u{1D54E}", wopf: "\u{1D568}", wp: "\u2118", wr: "\u2240", wreath: "\u2240", Wscr: "\u{1D4B2}", wscr: "\u{1D4CC}", xcap: "\u22C2", xcirc: "\u25EF", xcup: "\u22C3", xdtri: "\u25BD", Xfr: "\u{1D51B}", xfr: "\u{1D535}", xharr: "\u27F7", xhArr: "\u27FA", Xi: "\u039E", xi: "\u03BE", xlarr: "\u27F5", xlArr: "\u27F8", xmap: "\u27FC", xnis: "\u22FB", xodot: "\u2A00", Xopf: "\u{1D54F}", xopf: "\u{1D569}", xoplus: "\u2A01", xotime: "\u2A02", xrarr: "\u27F6", xrArr: "\u27F9", Xscr: "\u{1D4B3}", xscr: "\u{1D4CD}", xsqcup: "\u2A06", xuplus: "\u2A04", xutri: "\u25B3", xvee: "\u22C1", xwedge: "\u22C0", Yacute: "\xDD", yacute: "\xFD", YAcy: "\u042F", yacy: "\u044F", Ycirc: "\u0176", ycirc: "\u0177", Ycy: "\u042B", ycy: "\u044B", yen: "\xA5", Yfr: "\u{1D51C}", yfr: "\u{1D536}", YIcy: "\u0407", yicy: "\u0457", Yopf: "\u{1D550}", yopf: "\u{1D56A}", Yscr: "\u{1D4B4}", yscr: "\u{1D4CE}", YUcy: "\u042E", yucy: "\u044E", yuml: "\xFF", Yuml: "\u0178", Zacute: "\u0179", zacute: "\u017A", Zcaron: "\u017D", zcaron: "\u017E", Zcy: "\u0417", zcy: "\u0437", Zdot: "\u017B", zdot: "\u017C", zeetrf: "\u2128", ZeroWidthSpace: "\u200B", Zeta: "\u0396", zeta: "\u03B6", zfr: "\u{1D537}", Zfr: "\u2128", ZHcy: "\u0416", zhcy: "\u0436", zigrarr: "\u21DD", zopf: "\u{1D56B}", Zopf: "\u2124", Zscr: "\u{1D4B5}", zscr: "\u{1D4CF}", zwj: "\u200D", zwnj: "\u200C" }; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/legacy.json -var require_legacy = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/legacy.json"(exports2, module2) { - module2.exports = { Aacute: "\xC1", aacute: "\xE1", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", AElig: "\xC6", aelig: "\xE6", Agrave: "\xC0", agrave: "\xE0", amp: "&", AMP: "&", Aring: "\xC5", aring: "\xE5", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", brvbar: "\xA6", Ccedil: "\xC7", ccedil: "\xE7", cedil: "\xB8", cent: "\xA2", copy: "\xA9", COPY: "\xA9", curren: "\xA4", deg: "\xB0", divide: "\xF7", Eacute: "\xC9", eacute: "\xE9", Ecirc: "\xCA", ecirc: "\xEA", Egrave: "\xC8", egrave: "\xE8", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", frac12: "\xBD", frac14: "\xBC", frac34: "\xBE", gt: ">", GT: ">", Iacute: "\xCD", iacute: "\xED", Icirc: "\xCE", icirc: "\xEE", iexcl: "\xA1", Igrave: "\xCC", igrave: "\xEC", iquest: "\xBF", Iuml: "\xCF", iuml: "\xEF", laquo: "\xAB", lt: "<", LT: "<", macr: "\xAF", micro: "\xB5", middot: "\xB7", nbsp: "\xA0", not: "\xAC", Ntilde: "\xD1", ntilde: "\xF1", Oacute: "\xD3", oacute: "\xF3", Ocirc: "\xD4", ocirc: "\xF4", Ograve: "\xD2", ograve: "\xF2", ordf: "\xAA", ordm: "\xBA", Oslash: "\xD8", oslash: "\xF8", Otilde: "\xD5", otilde: "\xF5", Ouml: "\xD6", ouml: "\xF6", para: "\xB6", plusmn: "\xB1", pound: "\xA3", quot: '"', QUOT: '"', raquo: "\xBB", reg: "\xAE", REG: "\xAE", sect: "\xA7", shy: "\xAD", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", szlig: "\xDF", THORN: "\xDE", thorn: "\xFE", times: "\xD7", Uacute: "\xDA", uacute: "\xFA", Ucirc: "\xDB", ucirc: "\xFB", Ugrave: "\xD9", ugrave: "\xF9", uml: "\xA8", Uuml: "\xDC", uuml: "\xFC", Yacute: "\xDD", yacute: "\xFD", yen: "\xA5", yuml: "\xFF" }; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/xml.json -var require_xml = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/xml.json"(exports2, module2) { - module2.exports = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/lib/Tokenizer.js -var require_Tokenizer = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/lib/Tokenizer.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var decode_codepoint_1 = __importDefault2(require_decode_codepoint()); - var entities_json_1 = __importDefault2(require_entities()); - var legacy_json_1 = __importDefault2(require_legacy()); - var xml_json_1 = __importDefault2(require_xml()); - function whitespace2(c) { - return c === " " || c === "\n" || c === " " || c === "\f" || c === "\r"; - } - function isASCIIAlpha2(c) { - return c >= "a" && c <= "z" || c >= "A" && c <= "Z"; - } - function ifElseState(upper, SUCCESS, FAILURE) { - var lower = upper.toLowerCase(); - if (upper === lower) { - return function(t, c) { - if (c === lower) { - t._state = SUCCESS; - } else { - t._state = FAILURE; - t._index--; - } - }; - } - return function(t, c) { - if (c === lower || c === upper) { - t._state = SUCCESS; - } else { - t._state = FAILURE; - t._index--; - } - }; - } - function consumeSpecialNameChar(upper, NEXT_STATE) { - var lower = upper.toLowerCase(); - return function(t, c) { - if (c === lower || c === upper) { - t._state = NEXT_STATE; - } else { - t._state = 3; - t._index--; - } - }; - } - var stateBeforeCdata1 = ifElseState( - "C", - 24, - 16 - /* InDeclaration */ - ); - var stateBeforeCdata2 = ifElseState( - "D", - 25, - 16 - /* InDeclaration */ - ); - var stateBeforeCdata3 = ifElseState( - "A", - 26, - 16 - /* InDeclaration */ - ); - var stateBeforeCdata4 = ifElseState( - "T", - 27, - 16 - /* InDeclaration */ - ); - var stateBeforeCdata5 = ifElseState( - "A", - 28, - 16 - /* InDeclaration */ - ); - var stateBeforeScript1 = consumeSpecialNameChar( - "R", - 35 - /* BeforeScript2 */ - ); - var stateBeforeScript2 = consumeSpecialNameChar( - "I", - 36 - /* BeforeScript3 */ - ); - var stateBeforeScript3 = consumeSpecialNameChar( - "P", - 37 - /* BeforeScript4 */ - ); - var stateBeforeScript4 = consumeSpecialNameChar( - "T", - 38 - /* BeforeScript5 */ - ); - var stateAfterScript1 = ifElseState( - "R", - 40, - 1 - /* Text */ - ); - var stateAfterScript2 = ifElseState( - "I", - 41, - 1 - /* Text */ - ); - var stateAfterScript3 = ifElseState( - "P", - 42, - 1 - /* Text */ - ); - var stateAfterScript4 = ifElseState( - "T", - 43, - 1 - /* Text */ - ); - var stateBeforeStyle1 = consumeSpecialNameChar( - "Y", - 45 - /* BeforeStyle2 */ - ); - var stateBeforeStyle2 = consumeSpecialNameChar( - "L", - 46 - /* BeforeStyle3 */ - ); - var stateBeforeStyle3 = consumeSpecialNameChar( - "E", - 47 - /* BeforeStyle4 */ - ); - var stateAfterStyle1 = ifElseState( - "Y", - 49, - 1 - /* Text */ - ); - var stateAfterStyle2 = ifElseState( - "L", - 50, - 1 - /* Text */ - ); - var stateAfterStyle3 = ifElseState( - "E", - 51, - 1 - /* Text */ - ); - var stateBeforeSpecialT = consumeSpecialNameChar( - "I", - 54 - /* BeforeTitle1 */ - ); - var stateBeforeTitle1 = consumeSpecialNameChar( - "T", - 55 - /* BeforeTitle2 */ - ); - var stateBeforeTitle2 = consumeSpecialNameChar( - "L", - 56 - /* BeforeTitle3 */ - ); - var stateBeforeTitle3 = consumeSpecialNameChar( - "E", - 57 - /* BeforeTitle4 */ - ); - var stateAfterSpecialTEnd = ifElseState( - "I", - 58, - 1 - /* Text */ - ); - var stateAfterTitle1 = ifElseState( - "T", - 59, - 1 - /* Text */ - ); - var stateAfterTitle2 = ifElseState( - "L", - 60, - 1 - /* Text */ - ); - var stateAfterTitle3 = ifElseState( - "E", - 61, - 1 - /* Text */ - ); - var stateBeforeEntity = ifElseState( - "#", - 63, - 64 - /* InNamedEntity */ - ); - var stateBeforeNumericEntity = ifElseState( - "X", - 66, - 65 - /* InNumericEntity */ - ); - var Tokenizer2 = ( - /** @class */ - (function() { - function Tokenizer3(options, cbs) { - var _a3; - this._state = 1; - this.buffer = ""; - this.sectionStart = 0; - this._index = 0; - this.bufferOffset = 0; - this.baseState = 1; - this.special = 1; - this.running = true; - this.ended = false; - this.cbs = cbs; - this.xmlMode = !!(options === null || options === void 0 ? void 0 : options.xmlMode); - this.decodeEntities = (_a3 = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a3 !== void 0 ? _a3 : true; - } - Tokenizer3.prototype.reset = function() { - this._state = 1; - this.buffer = ""; - this.sectionStart = 0; - this._index = 0; - this.bufferOffset = 0; - this.baseState = 1; - this.special = 1; - this.running = true; - this.ended = false; - }; - Tokenizer3.prototype.write = function(chunk) { - if (this.ended) - this.cbs.onerror(Error(".write() after done!")); - this.buffer += chunk; - this.parse(); - }; - Tokenizer3.prototype.end = function(chunk) { - if (this.ended) - this.cbs.onerror(Error(".end() after done!")); - if (chunk) - this.write(chunk); - this.ended = true; - if (this.running) - this.finish(); - }; - Tokenizer3.prototype.pause = function() { - this.running = false; - }; - Tokenizer3.prototype.resume = function() { - this.running = true; - if (this._index < this.buffer.length) { - this.parse(); - } - if (this.ended) { - this.finish(); - } - }; - Tokenizer3.prototype.getAbsoluteIndex = function() { - return this.bufferOffset + this._index; - }; - Tokenizer3.prototype.stateText = function(c) { - if (c === "<") { - if (this._index > this.sectionStart) { - this.cbs.ontext(this.getSection()); - } - this._state = 2; - this.sectionStart = this._index; - } else if (this.decodeEntities && c === "&" && (this.special === 1 || this.special === 4)) { - if (this._index > this.sectionStart) { - this.cbs.ontext(this.getSection()); - } - this.baseState = 1; - this._state = 62; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.isTagStartChar = function(c) { - return isASCIIAlpha2(c) || this.xmlMode && !whitespace2(c) && c !== "/" && c !== ">"; - }; - Tokenizer3.prototype.stateBeforeTagName = function(c) { - if (c === "/") { - this._state = 5; - } else if (c === "<") { - this.cbs.ontext(this.getSection()); - this.sectionStart = this._index; - } else if (c === ">" || this.special !== 1 || whitespace2(c)) { - this._state = 1; - } else if (c === "!") { - this._state = 15; - this.sectionStart = this._index + 1; - } else if (c === "?") { - this._state = 17; - this.sectionStart = this._index + 1; - } else if (!this.isTagStartChar(c)) { - this._state = 1; - } else { - this._state = !this.xmlMode && (c === "s" || c === "S") ? 32 : !this.xmlMode && (c === "t" || c === "T") ? 52 : 3; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateInTagName = function(c) { - if (c === "/" || c === ">" || whitespace2(c)) { - this.emitToken("onopentagname"); - this._state = 8; - this._index--; - } - }; - Tokenizer3.prototype.stateBeforeClosingTagName = function(c) { - if (whitespace2(c)) { - } else if (c === ">") { - this._state = 1; - } else if (this.special !== 1) { - if (this.special !== 4 && (c === "s" || c === "S")) { - this._state = 33; - } else if (this.special === 4 && (c === "t" || c === "T")) { - this._state = 53; - } else { - this._state = 1; - this._index--; - } - } else if (!this.isTagStartChar(c)) { - this._state = 20; - this.sectionStart = this._index; - } else { - this._state = 6; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateInClosingTagName = function(c) { - if (c === ">" || whitespace2(c)) { - this.emitToken("onclosetag"); - this._state = 7; - this._index--; - } - }; - Tokenizer3.prototype.stateAfterClosingTagName = function(c) { - if (c === ">") { - this._state = 1; - this.sectionStart = this._index + 1; - } - }; - Tokenizer3.prototype.stateBeforeAttributeName = function(c) { - if (c === ">") { - this.cbs.onopentagend(); - this._state = 1; - this.sectionStart = this._index + 1; - } else if (c === "/") { - this._state = 4; - } else if (!whitespace2(c)) { - this._state = 9; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateInSelfClosingTag = function(c) { - if (c === ">") { - this.cbs.onselfclosingtag(); - this._state = 1; - this.sectionStart = this._index + 1; - this.special = 1; - } else if (!whitespace2(c)) { - this._state = 8; - this._index--; - } - }; - Tokenizer3.prototype.stateInAttributeName = function(c) { - if (c === "=" || c === "/" || c === ">" || whitespace2(c)) { - this.cbs.onattribname(this.getSection()); - this.sectionStart = -1; - this._state = 10; - this._index--; - } - }; - Tokenizer3.prototype.stateAfterAttributeName = function(c) { - if (c === "=") { - this._state = 11; - } else if (c === "/" || c === ">") { - this.cbs.onattribend(void 0); - this._state = 8; - this._index--; - } else if (!whitespace2(c)) { - this.cbs.onattribend(void 0); - this._state = 9; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateBeforeAttributeValue = function(c) { - if (c === '"') { - this._state = 12; - this.sectionStart = this._index + 1; - } else if (c === "'") { - this._state = 13; - this.sectionStart = this._index + 1; - } else if (!whitespace2(c)) { - this._state = 14; - this.sectionStart = this._index; - this._index--; - } - }; - Tokenizer3.prototype.handleInAttributeValue = function(c, quote) { - if (c === quote) { - this.emitToken("onattribdata"); - this.cbs.onattribend(quote); - this._state = 8; - } else if (this.decodeEntities && c === "&") { - this.emitToken("onattribdata"); - this.baseState = this._state; - this._state = 62; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateInAttributeValueDoubleQuotes = function(c) { - this.handleInAttributeValue(c, '"'); - }; - Tokenizer3.prototype.stateInAttributeValueSingleQuotes = function(c) { - this.handleInAttributeValue(c, "'"); - }; - Tokenizer3.prototype.stateInAttributeValueNoQuotes = function(c) { - if (whitespace2(c) || c === ">") { - this.emitToken("onattribdata"); - this.cbs.onattribend(null); - this._state = 8; - this._index--; - } else if (this.decodeEntities && c === "&") { - this.emitToken("onattribdata"); - this.baseState = this._state; - this._state = 62; - this.sectionStart = this._index; - } - }; - Tokenizer3.prototype.stateBeforeDeclaration = function(c) { - this._state = c === "[" ? 23 : c === "-" ? 18 : 16; - }; - Tokenizer3.prototype.stateInDeclaration = function(c) { - if (c === ">") { - this.cbs.ondeclaration(this.getSection()); - this._state = 1; - this.sectionStart = this._index + 1; - } - }; - Tokenizer3.prototype.stateInProcessingInstruction = function(c) { - if (c === ">") { - this.cbs.onprocessinginstruction(this.getSection()); - this._state = 1; - this.sectionStart = this._index + 1; - } - }; - Tokenizer3.prototype.stateBeforeComment = function(c) { - if (c === "-") { - this._state = 19; - this.sectionStart = this._index + 1; - } else { - this._state = 16; - } - }; - Tokenizer3.prototype.stateInComment = function(c) { - if (c === "-") - this._state = 21; - }; - Tokenizer3.prototype.stateInSpecialComment = function(c) { - if (c === ">") { - this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index)); - this._state = 1; - this.sectionStart = this._index + 1; - } - }; - Tokenizer3.prototype.stateAfterComment1 = function(c) { - if (c === "-") { - this._state = 22; - } else { - this._state = 19; - } - }; - Tokenizer3.prototype.stateAfterComment2 = function(c) { - if (c === ">") { - this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2)); - this._state = 1; - this.sectionStart = this._index + 1; - } else if (c !== "-") { - this._state = 19; - } - }; - Tokenizer3.prototype.stateBeforeCdata6 = function(c) { - if (c === "[") { - this._state = 29; - this.sectionStart = this._index + 1; - } else { - this._state = 16; - this._index--; - } - }; - Tokenizer3.prototype.stateInCdata = function(c) { - if (c === "]") - this._state = 30; - }; - Tokenizer3.prototype.stateAfterCdata1 = function(c) { - if (c === "]") - this._state = 31; - else - this._state = 29; - }; - Tokenizer3.prototype.stateAfterCdata2 = function(c) { - if (c === ">") { - this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2)); - this._state = 1; - this.sectionStart = this._index + 1; - } else if (c !== "]") { - this._state = 29; - } - }; - Tokenizer3.prototype.stateBeforeSpecialS = function(c) { - if (c === "c" || c === "C") { - this._state = 34; - } else if (c === "t" || c === "T") { - this._state = 44; - } else { - this._state = 3; - this._index--; - } - }; - Tokenizer3.prototype.stateBeforeSpecialSEnd = function(c) { - if (this.special === 2 && (c === "c" || c === "C")) { - this._state = 39; - } else if (this.special === 3 && (c === "t" || c === "T")) { - this._state = 48; - } else - this._state = 1; - }; - Tokenizer3.prototype.stateBeforeSpecialLast = function(c, special) { - if (c === "/" || c === ">" || whitespace2(c)) { - this.special = special; - } - this._state = 3; - this._index--; - }; - Tokenizer3.prototype.stateAfterSpecialLast = function(c, sectionStartOffset) { - if (c === ">" || whitespace2(c)) { - this.special = 1; - this._state = 6; - this.sectionStart = this._index - sectionStartOffset; - this._index--; - } else - this._state = 1; - }; - Tokenizer3.prototype.parseFixedEntity = function(map) { - if (map === void 0) { - map = this.xmlMode ? xml_json_1.default : entities_json_1.default; - } - if (this.sectionStart + 1 < this._index) { - var entity = this.buffer.substring(this.sectionStart + 1, this._index); - if (Object.prototype.hasOwnProperty.call(map, entity)) { - this.emitPartial(map[entity]); - this.sectionStart = this._index + 1; - } - } - }; - Tokenizer3.prototype.parseLegacyEntity = function() { - var start = this.sectionStart + 1; - var limit = Math.min(this._index - start, 6); - while (limit >= 2) { - var entity = this.buffer.substr(start, limit); - if (Object.prototype.hasOwnProperty.call(legacy_json_1.default, entity)) { - this.emitPartial(legacy_json_1.default[entity]); - this.sectionStart += limit + 1; - return; - } - limit--; - } - }; - Tokenizer3.prototype.stateInNamedEntity = function(c) { - if (c === ";") { - this.parseFixedEntity(); - if (this.baseState === 1 && this.sectionStart + 1 < this._index && !this.xmlMode) { - this.parseLegacyEntity(); - } - this._state = this.baseState; - } else if ((c < "0" || c > "9") && !isASCIIAlpha2(c)) { - if (this.xmlMode || this.sectionStart + 1 === this._index) { - } else if (this.baseState !== 1) { - if (c !== "=") { - this.parseFixedEntity(legacy_json_1.default); - } - } else { - this.parseLegacyEntity(); - } - this._state = this.baseState; - this._index--; - } - }; - Tokenizer3.prototype.decodeNumericEntity = function(offset, base, strict) { - var sectionStart = this.sectionStart + offset; - if (sectionStart !== this._index) { - var entity = this.buffer.substring(sectionStart, this._index); - var parsed = parseInt(entity, base); - this.emitPartial(decode_codepoint_1.default(parsed)); - this.sectionStart = strict ? this._index + 1 : this._index; - } - this._state = this.baseState; - }; - Tokenizer3.prototype.stateInNumericEntity = function(c) { - if (c === ";") { - this.decodeNumericEntity(2, 10, true); - } else if (c < "0" || c > "9") { - if (!this.xmlMode) { - this.decodeNumericEntity(2, 10, false); - } else { - this._state = this.baseState; - } - this._index--; - } - }; - Tokenizer3.prototype.stateInHexEntity = function(c) { - if (c === ";") { - this.decodeNumericEntity(3, 16, true); - } else if ((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")) { - if (!this.xmlMode) { - this.decodeNumericEntity(3, 16, false); - } else { - this._state = this.baseState; - } - this._index--; - } - }; - Tokenizer3.prototype.cleanup = function() { - if (this.sectionStart < 0) { - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } else if (this.running) { - if (this._state === 1) { - if (this.sectionStart !== this._index) { - this.cbs.ontext(this.buffer.substr(this.sectionStart)); - } - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } else if (this.sectionStart === this._index) { - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } else { - this.buffer = this.buffer.substr(this.sectionStart); - this._index -= this.sectionStart; - this.bufferOffset += this.sectionStart; - } - this.sectionStart = 0; - } - }; - Tokenizer3.prototype.parse = function() { - while (this._index < this.buffer.length && this.running) { - var c = this.buffer.charAt(this._index); - if (this._state === 1) { - this.stateText(c); - } else if (this._state === 12) { - this.stateInAttributeValueDoubleQuotes(c); - } else if (this._state === 9) { - this.stateInAttributeName(c); - } else if (this._state === 19) { - this.stateInComment(c); - } else if (this._state === 20) { - this.stateInSpecialComment(c); - } else if (this._state === 8) { - this.stateBeforeAttributeName(c); - } else if (this._state === 3) { - this.stateInTagName(c); - } else if (this._state === 6) { - this.stateInClosingTagName(c); - } else if (this._state === 2) { - this.stateBeforeTagName(c); - } else if (this._state === 10) { - this.stateAfterAttributeName(c); - } else if (this._state === 13) { - this.stateInAttributeValueSingleQuotes(c); - } else if (this._state === 11) { - this.stateBeforeAttributeValue(c); - } else if (this._state === 5) { - this.stateBeforeClosingTagName(c); - } else if (this._state === 7) { - this.stateAfterClosingTagName(c); - } else if (this._state === 32) { - this.stateBeforeSpecialS(c); - } else if (this._state === 21) { - this.stateAfterComment1(c); - } else if (this._state === 14) { - this.stateInAttributeValueNoQuotes(c); - } else if (this._state === 4) { - this.stateInSelfClosingTag(c); - } else if (this._state === 16) { - this.stateInDeclaration(c); - } else if (this._state === 15) { - this.stateBeforeDeclaration(c); - } else if (this._state === 22) { - this.stateAfterComment2(c); - } else if (this._state === 18) { - this.stateBeforeComment(c); - } else if (this._state === 33) { - this.stateBeforeSpecialSEnd(c); - } else if (this._state === 53) { - stateAfterSpecialTEnd(this, c); - } else if (this._state === 39) { - stateAfterScript1(this, c); - } else if (this._state === 40) { - stateAfterScript2(this, c); - } else if (this._state === 41) { - stateAfterScript3(this, c); - } else if (this._state === 34) { - stateBeforeScript1(this, c); - } else if (this._state === 35) { - stateBeforeScript2(this, c); - } else if (this._state === 36) { - stateBeforeScript3(this, c); - } else if (this._state === 37) { - stateBeforeScript4(this, c); - } else if (this._state === 38) { - this.stateBeforeSpecialLast( - c, - 2 - /* Script */ - ); - } else if (this._state === 42) { - stateAfterScript4(this, c); - } else if (this._state === 43) { - this.stateAfterSpecialLast(c, 6); - } else if (this._state === 44) { - stateBeforeStyle1(this, c); - } else if (this._state === 29) { - this.stateInCdata(c); - } else if (this._state === 45) { - stateBeforeStyle2(this, c); - } else if (this._state === 46) { - stateBeforeStyle3(this, c); - } else if (this._state === 47) { - this.stateBeforeSpecialLast( - c, - 3 - /* Style */ - ); - } else if (this._state === 48) { - stateAfterStyle1(this, c); - } else if (this._state === 49) { - stateAfterStyle2(this, c); - } else if (this._state === 50) { - stateAfterStyle3(this, c); - } else if (this._state === 51) { - this.stateAfterSpecialLast(c, 5); - } else if (this._state === 52) { - stateBeforeSpecialT(this, c); - } else if (this._state === 54) { - stateBeforeTitle1(this, c); - } else if (this._state === 55) { - stateBeforeTitle2(this, c); - } else if (this._state === 56) { - stateBeforeTitle3(this, c); - } else if (this._state === 57) { - this.stateBeforeSpecialLast( - c, - 4 - /* Title */ - ); - } else if (this._state === 58) { - stateAfterTitle1(this, c); - } else if (this._state === 59) { - stateAfterTitle2(this, c); - } else if (this._state === 60) { - stateAfterTitle3(this, c); - } else if (this._state === 61) { - this.stateAfterSpecialLast(c, 5); - } else if (this._state === 17) { - this.stateInProcessingInstruction(c); - } else if (this._state === 64) { - this.stateInNamedEntity(c); - } else if (this._state === 23) { - stateBeforeCdata1(this, c); - } else if (this._state === 62) { - stateBeforeEntity(this, c); - } else if (this._state === 24) { - stateBeforeCdata2(this, c); - } else if (this._state === 25) { - stateBeforeCdata3(this, c); - } else if (this._state === 30) { - this.stateAfterCdata1(c); - } else if (this._state === 31) { - this.stateAfterCdata2(c); - } else if (this._state === 26) { - stateBeforeCdata4(this, c); - } else if (this._state === 27) { - stateBeforeCdata5(this, c); - } else if (this._state === 28) { - this.stateBeforeCdata6(c); - } else if (this._state === 66) { - this.stateInHexEntity(c); - } else if (this._state === 65) { - this.stateInNumericEntity(c); - } else if (this._state === 63) { - stateBeforeNumericEntity(this, c); - } else { - this.cbs.onerror(Error("unknown _state"), this._state); - } - this._index++; - } - this.cleanup(); - }; - Tokenizer3.prototype.finish = function() { - if (this.sectionStart < this._index) { - this.handleTrailingData(); - } - this.cbs.onend(); - }; - Tokenizer3.prototype.handleTrailingData = function() { - var data = this.buffer.substr(this.sectionStart); - if (this._state === 29 || this._state === 30 || this._state === 31) { - this.cbs.oncdata(data); - } else if (this._state === 19 || this._state === 21 || this._state === 22) { - this.cbs.oncomment(data); - } else if (this._state === 64 && !this.xmlMode) { - this.parseLegacyEntity(); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); - } - } else if (this._state === 65 && !this.xmlMode) { - this.decodeNumericEntity(2, 10, false); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); - } - } else if (this._state === 66 && !this.xmlMode) { - this.decodeNumericEntity(3, 16, false); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); - } - } else if (this._state !== 3 && this._state !== 8 && this._state !== 11 && this._state !== 10 && this._state !== 9 && this._state !== 13 && this._state !== 12 && this._state !== 14 && this._state !== 6) { - this.cbs.ontext(data); - } - }; - Tokenizer3.prototype.getSection = function() { - return this.buffer.substring(this.sectionStart, this._index); - }; - Tokenizer3.prototype.emitToken = function(name) { - this.cbs[name](this.getSection()); - this.sectionStart = -1; - }; - Tokenizer3.prototype.emitPartial = function(value) { - if (this.baseState !== 1) { - this.cbs.onattribdata(value); - } else { - this.cbs.ontext(value); - } - }; - return Tokenizer3; - })() - ); - exports2.default = Tokenizer2; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/lib/Parser.js -var require_Parser = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/lib/Parser.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Parser = void 0; - var Tokenizer_1 = __importDefault2(require_Tokenizer()); - var formTags2 = /* @__PURE__ */ new Set([ - "input", - "option", - "optgroup", - "select", - "button", - "datalist", - "textarea" - ]); - var pTag2 = /* @__PURE__ */ new Set(["p"]); - var openImpliesClose2 = { - tr: /* @__PURE__ */ new Set(["tr", "th", "td"]), - th: /* @__PURE__ */ new Set(["th"]), - td: /* @__PURE__ */ new Set(["thead", "th", "td"]), - body: /* @__PURE__ */ new Set(["head", "link", "script"]), - li: /* @__PURE__ */ new Set(["li"]), - p: pTag2, - h1: pTag2, - h2: pTag2, - h3: pTag2, - h4: pTag2, - h5: pTag2, - h6: pTag2, - select: formTags2, - input: formTags2, - output: formTags2, - button: formTags2, - datalist: formTags2, - textarea: formTags2, - option: /* @__PURE__ */ new Set(["option"]), - optgroup: /* @__PURE__ */ new Set(["optgroup", "option"]), - dd: /* @__PURE__ */ new Set(["dt", "dd"]), - dt: /* @__PURE__ */ new Set(["dt", "dd"]), - address: pTag2, - article: pTag2, - aside: pTag2, - blockquote: pTag2, - details: pTag2, - div: pTag2, - dl: pTag2, - fieldset: pTag2, - figcaption: pTag2, - figure: pTag2, - footer: pTag2, - form: pTag2, - header: pTag2, - hr: pTag2, - main: pTag2, - nav: pTag2, - ol: pTag2, - pre: pTag2, - section: pTag2, - table: pTag2, - ul: pTag2, - rt: /* @__PURE__ */ new Set(["rt", "rp"]), - rp: /* @__PURE__ */ new Set(["rt", "rp"]), - tbody: /* @__PURE__ */ new Set(["thead", "tbody"]), - tfoot: /* @__PURE__ */ new Set(["thead", "tbody"]) - }; - var voidElements4 = /* @__PURE__ */ new Set([ - "area", - "base", - "basefont", - "br", - "col", - "command", - "embed", - "frame", - "hr", - "img", - "input", - "isindex", - "keygen", - "link", - "meta", - "param", - "source", - "track", - "wbr" - ]); - var foreignContextElements2 = /* @__PURE__ */ new Set(["math", "svg"]); - var htmlIntegrationElements2 = /* @__PURE__ */ new Set([ - "mi", - "mo", - "mn", - "ms", - "mtext", - "annotation-xml", - "foreignObject", - "desc", - "title" - ]); - var reNameEnd2 = /\s|\//; - var Parser3 = ( - /** @class */ - (function() { - function Parser4(cbs, options) { - if (options === void 0) { - options = {}; - } - var _a3, _b, _c, _d, _e; - this.startIndex = 0; - this.endIndex = null; - this.tagname = ""; - this.attribname = ""; - this.attribvalue = ""; - this.attribs = null; - this.stack = []; - this.foreignContext = []; - this.options = options; - this.cbs = cbs !== null && cbs !== void 0 ? cbs : {}; - this.lowerCaseTagNames = (_a3 = options.lowerCaseTags) !== null && _a3 !== void 0 ? _a3 : !options.xmlMode; - this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode; - this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer_1.default)(this.options, this); - (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this); - } - Parser4.prototype.updatePosition = function(initialOffset) { - if (this.endIndex === null) { - if (this.tokenizer.sectionStart <= initialOffset) { - this.startIndex = 0; - } else { - this.startIndex = this.tokenizer.sectionStart - initialOffset; - } - } else { - this.startIndex = this.endIndex + 1; - } - this.endIndex = this.tokenizer.getAbsoluteIndex(); - }; - Parser4.prototype.ontext = function(data) { - var _a3, _b; - this.updatePosition(1); - this.endIndex--; - (_b = (_a3 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a3, data); - }; - Parser4.prototype.onopentagname = function(name) { - var _a3, _b; - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - this.tagname = name; - if (!this.options.xmlMode && Object.prototype.hasOwnProperty.call(openImpliesClose2, name)) { - var el = void 0; - while (this.stack.length > 0 && openImpliesClose2[name].has(el = this.stack[this.stack.length - 1])) { - this.onclosetag(el); - } - } - if (this.options.xmlMode || !voidElements4.has(name)) { - this.stack.push(name); - if (foreignContextElements2.has(name)) { - this.foreignContext.push(true); - } else if (htmlIntegrationElements2.has(name)) { - this.foreignContext.push(false); - } - } - (_b = (_a3 = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a3, name); - if (this.cbs.onopentag) - this.attribs = {}; - }; - Parser4.prototype.onopentagend = function() { - var _a3, _b; - this.updatePosition(1); - if (this.attribs) { - (_b = (_a3 = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a3, this.tagname, this.attribs); - this.attribs = null; - } - if (!this.options.xmlMode && this.cbs.onclosetag && voidElements4.has(this.tagname)) { - this.cbs.onclosetag(this.tagname); - } - this.tagname = ""; - }; - Parser4.prototype.onclosetag = function(name) { - this.updatePosition(1); - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - if (foreignContextElements2.has(name) || htmlIntegrationElements2.has(name)) { - this.foreignContext.pop(); - } - if (this.stack.length && (this.options.xmlMode || !voidElements4.has(name))) { - var pos = this.stack.lastIndexOf(name); - if (pos !== -1) { - if (this.cbs.onclosetag) { - pos = this.stack.length - pos; - while (pos--) { - this.cbs.onclosetag(this.stack.pop()); - } - } else - this.stack.length = pos; - } else if (name === "p" && !this.options.xmlMode) { - this.onopentagname(name); - this.closeCurrentTag(); - } - } else if (!this.options.xmlMode && (name === "br" || name === "p")) { - this.onopentagname(name); - this.closeCurrentTag(); - } - }; - Parser4.prototype.onselfclosingtag = function() { - if (this.options.xmlMode || this.options.recognizeSelfClosing || this.foreignContext[this.foreignContext.length - 1]) { - this.closeCurrentTag(); - } else { - this.onopentagend(); - } - }; - Parser4.prototype.closeCurrentTag = function() { - var _a3, _b; - var name = this.tagname; - this.onopentagend(); - if (this.stack[this.stack.length - 1] === name) { - (_b = (_a3 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a3, name); - this.stack.pop(); - } - }; - Parser4.prototype.onattribname = function(name) { - if (this.lowerCaseAttributeNames) { - name = name.toLowerCase(); - } - this.attribname = name; - }; - Parser4.prototype.onattribdata = function(value) { - this.attribvalue += value; - }; - Parser4.prototype.onattribend = function(quote) { - var _a3, _b; - (_b = (_a3 = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a3, this.attribname, this.attribvalue, quote); - if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) { - this.attribs[this.attribname] = this.attribvalue; - } - this.attribname = ""; - this.attribvalue = ""; - }; - Parser4.prototype.getInstructionName = function(value) { - var idx = value.search(reNameEnd2); - var name = idx < 0 ? value : value.substr(0, idx); - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - return name; - }; - Parser4.prototype.ondeclaration = function(value) { - if (this.cbs.onprocessinginstruction) { - var name_1 = this.getInstructionName(value); - this.cbs.onprocessinginstruction("!" + name_1, "!" + value); - } - }; - Parser4.prototype.onprocessinginstruction = function(value) { - if (this.cbs.onprocessinginstruction) { - var name_2 = this.getInstructionName(value); - this.cbs.onprocessinginstruction("?" + name_2, "?" + value); - } - }; - Parser4.prototype.oncomment = function(value) { - var _a3, _b, _c, _d; - this.updatePosition(4); - (_b = (_a3 = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a3, value); - (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c); - }; - Parser4.prototype.oncdata = function(value) { - var _a3, _b, _c, _d, _e, _f; - this.updatePosition(1); - if (this.options.xmlMode || this.options.recognizeCDATA) { - (_b = (_a3 = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a3); - (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value); - (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e); - } else { - this.oncomment("[CDATA[" + value + "]]"); - } - }; - Parser4.prototype.onerror = function(err) { - var _a3, _b; - (_b = (_a3 = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a3, err); - }; - Parser4.prototype.onend = function() { - var _a3, _b; - if (this.cbs.onclosetag) { - for (var i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i])) - ; - } - (_b = (_a3 = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a3); - }; - Parser4.prototype.reset = function() { - var _a3, _b, _c, _d; - (_b = (_a3 = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a3); - this.tokenizer.reset(); - this.tagname = ""; - this.attribname = ""; - this.attribs = null; - this.stack = []; - (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this); - }; - Parser4.prototype.parseComplete = function(data) { - this.reset(); - this.end(data); - }; - Parser4.prototype.write = function(chunk) { - this.tokenizer.write(chunk); - }; - Parser4.prototype.end = function(chunk) { - this.tokenizer.end(chunk); - }; - Parser4.prototype.pause = function() { - this.tokenizer.pause(); - }; - Parser4.prototype.resume = function() { - this.tokenizer.resume(); - }; - Parser4.prototype.parseChunk = function(chunk) { - this.write(chunk); - }; - Parser4.prototype.done = function(chunk) { - this.end(chunk); - }; - return Parser4; - })() - ); - exports2.Parser = Parser3; - } -}); - -// node_modules/domelementtype/lib/index.js -var require_lib6 = __commonJS({ - "node_modules/domelementtype/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Doctype = exports2.CDATA = exports2.Tag = exports2.Style = exports2.Script = exports2.Comment = exports2.Directive = exports2.Text = exports2.Root = exports2.isTag = exports2.ElementType = void 0; - var ElementType5; - (function(ElementType6) { - ElementType6["Root"] = "root"; - ElementType6["Text"] = "text"; - ElementType6["Directive"] = "directive"; - ElementType6["Comment"] = "comment"; - ElementType6["Script"] = "script"; - ElementType6["Style"] = "style"; - ElementType6["Tag"] = "tag"; - ElementType6["CDATA"] = "cdata"; - ElementType6["Doctype"] = "doctype"; - })(ElementType5 = exports2.ElementType || (exports2.ElementType = {})); - function isTag6(elem) { - return elem.type === ElementType5.Tag || elem.type === ElementType5.Script || elem.type === ElementType5.Style; - } - exports2.isTag = isTag6; - exports2.Root = ElementType5.Root; - exports2.Text = ElementType5.Text; - exports2.Directive = ElementType5.Directive; - exports2.Comment = ElementType5.Comment; - exports2.Script = ElementType5.Script; - exports2.Style = ElementType5.Style; - exports2.Tag = ElementType5.Tag; - exports2.CDATA = ElementType5.CDATA; - exports2.Doctype = ElementType5.Doctype; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/node.js -var require_node2 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/node.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ (function() { - var extendStatics2 = function(d, b) { - extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - }; - return extendStatics2(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics2(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __assign2 = exports2 && exports2.__assign || function() { - __assign2 = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign2.apply(this, arguments); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.cloneNode = exports2.hasChildren = exports2.isDocument = exports2.isDirective = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = exports2.Element = exports2.Document = exports2.NodeWithChildren = exports2.ProcessingInstruction = exports2.Comment = exports2.Text = exports2.DataNode = exports2.Node = void 0; - var domelementtype_1 = require_lib6(); - var nodeTypes = /* @__PURE__ */ new Map([ - [domelementtype_1.ElementType.Tag, 1], - [domelementtype_1.ElementType.Script, 1], - [domelementtype_1.ElementType.Style, 1], - [domelementtype_1.ElementType.Directive, 1], - [domelementtype_1.ElementType.Text, 3], - [domelementtype_1.ElementType.CDATA, 4], - [domelementtype_1.ElementType.Comment, 8], - [domelementtype_1.ElementType.Root, 9] - ]); - var Node4 = ( - /** @class */ - (function() { - function Node5(type) { - this.type = type; - this.parent = null; - this.prev = null; - this.next = null; - this.startIndex = null; - this.endIndex = null; - } - Object.defineProperty(Node5.prototype, "nodeType", { - // Read-only aliases - /** - * [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible - * node {@link type}. - */ - get: function() { - var _a3; - return (_a3 = nodeTypes.get(this.type)) !== null && _a3 !== void 0 ? _a3 : 1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Node5.prototype, "parentNode", { - // Read-write aliases for properties - /** - * Same as {@link parent}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.parent; - }, - set: function(parent) { - this.parent = parent; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Node5.prototype, "previousSibling", { - /** - * Same as {@link prev}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.prev; - }, - set: function(prev) { - this.prev = prev; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Node5.prototype, "nextSibling", { - /** - * Same as {@link next}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.next; - }, - set: function(next) { - this.next = next; - }, - enumerable: false, - configurable: true - }); - Node5.prototype.cloneNode = function(recursive) { - if (recursive === void 0) { - recursive = false; - } - return cloneNode2(this, recursive); - }; - return Node5; - })() - ); - exports2.Node = Node4; - var DataNode2 = ( - /** @class */ - (function(_super) { - __extends2(DataNode3, _super); - function DataNode3(type, data) { - var _this = _super.call(this, type) || this; - _this.data = data; - return _this; - } - Object.defineProperty(DataNode3.prototype, "nodeValue", { - /** - * Same as {@link data}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.data; - }, - set: function(data) { - this.data = data; - }, - enumerable: false, - configurable: true - }); - return DataNode3; - })(Node4) - ); - exports2.DataNode = DataNode2; - var Text8 = ( - /** @class */ - (function(_super) { - __extends2(Text9, _super); - function Text9(data) { - return _super.call(this, domelementtype_1.ElementType.Text, data) || this; - } - return Text9; - })(DataNode2) - ); - exports2.Text = Text8; - var Comment8 = ( - /** @class */ - (function(_super) { - __extends2(Comment9, _super); - function Comment9(data) { - return _super.call(this, domelementtype_1.ElementType.Comment, data) || this; - } - return Comment9; - })(DataNode2) - ); - exports2.Comment = Comment8; - var ProcessingInstruction2 = ( - /** @class */ - (function(_super) { - __extends2(ProcessingInstruction3, _super); - function ProcessingInstruction3(name, data) { - var _this = _super.call(this, domelementtype_1.ElementType.Directive, data) || this; - _this.name = name; - return _this; - } - return ProcessingInstruction3; - })(DataNode2) - ); - exports2.ProcessingInstruction = ProcessingInstruction2; - var NodeWithChildren2 = ( - /** @class */ - (function(_super) { - __extends2(NodeWithChildren3, _super); - function NodeWithChildren3(type, children) { - var _this = _super.call(this, type) || this; - _this.children = children; - return _this; - } - Object.defineProperty(NodeWithChildren3.prototype, "firstChild", { - // Aliases - /** First child of the node. */ - get: function() { - var _a3; - return (_a3 = this.children[0]) !== null && _a3 !== void 0 ? _a3 : null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NodeWithChildren3.prototype, "lastChild", { - /** Last child of the node. */ - get: function() { - return this.children.length > 0 ? this.children[this.children.length - 1] : null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NodeWithChildren3.prototype, "childNodes", { - /** - * Same as {@link children}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.children; - }, - set: function(children) { - this.children = children; - }, - enumerable: false, - configurable: true - }); - return NodeWithChildren3; - })(Node4) - ); - exports2.NodeWithChildren = NodeWithChildren2; - var Document5 = ( - /** @class */ - (function(_super) { - __extends2(Document6, _super); - function Document6(children) { - return _super.call(this, domelementtype_1.ElementType.Root, children) || this; - } - return Document6; - })(NodeWithChildren2) - ); - exports2.Document = Document5; - var Element4 = ( - /** @class */ - (function(_super) { - __extends2(Element5, _super); - function Element5(name, attribs, children, type) { - if (children === void 0) { - children = []; - } - if (type === void 0) { - type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag; - } - var _this = _super.call(this, type, children) || this; - _this.name = name; - _this.attribs = attribs; - return _this; - } - Object.defineProperty(Element5.prototype, "tagName", { - // DOM Level 1 aliases - /** - * Same as {@link name}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get: function() { - return this.name; - }, - set: function(name) { - this.name = name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Element5.prototype, "attributes", { - get: function() { - var _this = this; - return Object.keys(this.attribs).map(function(name) { - var _a3, _b; - return { - name, - value: _this.attribs[name], - namespace: (_a3 = _this["x-attribsNamespace"]) === null || _a3 === void 0 ? void 0 : _a3[name], - prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name] - }; - }); - }, - enumerable: false, - configurable: true - }); - return Element5; - })(NodeWithChildren2) - ); - exports2.Element = Element4; - function isTag6(node) { - return (0, domelementtype_1.isTag)(node); - } - exports2.isTag = isTag6; - function isCDATA3(node) { - return node.type === domelementtype_1.ElementType.CDATA; - } - exports2.isCDATA = isCDATA3; - function isText3(node) { - return node.type === domelementtype_1.ElementType.Text; - } - exports2.isText = isText3; - function isComment3(node) { - return node.type === domelementtype_1.ElementType.Comment; - } - exports2.isComment = isComment3; - function isDirective2(node) { - return node.type === domelementtype_1.ElementType.Directive; - } - exports2.isDirective = isDirective2; - function isDocument2(node) { - return node.type === domelementtype_1.ElementType.Root; - } - exports2.isDocument = isDocument2; - function hasChildren3(node) { - return Object.prototype.hasOwnProperty.call(node, "children"); - } - exports2.hasChildren = hasChildren3; - function cloneNode2(node, recursive) { - if (recursive === void 0) { - recursive = false; - } - var result; - if (isText3(node)) { - result = new Text8(node.data); - } else if (isComment3(node)) { - result = new Comment8(node.data); - } else if (isTag6(node)) { - var children = recursive ? cloneChildren2(node.children) : []; - var clone_1 = new Element4(node.name, __assign2({}, node.attribs), children); - children.forEach(function(child) { - return child.parent = clone_1; - }); - if (node.namespace != null) { - clone_1.namespace = node.namespace; - } - if (node["x-attribsNamespace"]) { - clone_1["x-attribsNamespace"] = __assign2({}, node["x-attribsNamespace"]); - } - if (node["x-attribsPrefix"]) { - clone_1["x-attribsPrefix"] = __assign2({}, node["x-attribsPrefix"]); - } - result = clone_1; - } else if (isCDATA3(node)) { - var children = recursive ? cloneChildren2(node.children) : []; - var clone_2 = new NodeWithChildren2(domelementtype_1.ElementType.CDATA, children); - children.forEach(function(child) { - return child.parent = clone_2; - }); - result = clone_2; - } else if (isDocument2(node)) { - var children = recursive ? cloneChildren2(node.children) : []; - var clone_3 = new Document5(children); - children.forEach(function(child) { - return child.parent = clone_3; - }); - if (node["x-mode"]) { - clone_3["x-mode"] = node["x-mode"]; - } - result = clone_3; - } else if (isDirective2(node)) { - var instruction = new ProcessingInstruction2(node.name, node.data); - if (node["x-name"] != null) { - instruction["x-name"] = node["x-name"]; - instruction["x-publicId"] = node["x-publicId"]; - instruction["x-systemId"] = node["x-systemId"]; - } - result = instruction; - } else { - throw new Error("Not implemented yet: ".concat(node.type)); - } - result.startIndex = node.startIndex; - result.endIndex = node.endIndex; - if (node.sourceCodeLocation != null) { - result.sourceCodeLocation = node.sourceCodeLocation; - } - return result; - } - exports2.cloneNode = cloneNode2; - function cloneChildren2(childs) { - var children = childs.map(function(child) { - return cloneNode2(child, true); - }); - for (var i = 1; i < children.length; i++) { - children[i].prev = children[i - 1]; - children[i - 1].next = children[i]; - } - return children; - } - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/index.js -var require_lib7 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DomHandler = void 0; - var domelementtype_1 = require_lib6(); - var node_1 = require_node2(); - __exportStar2(require_node2(), exports2); - var reWhitespace = /\s+/g; - var defaultOpts2 = { - normalizeWhitespace: false, - withStartIndices: false, - withEndIndices: false, - xmlMode: false - }; - var DomHandler2 = ( - /** @class */ - (function() { - function DomHandler3(callback, options, elementCB) { - this.dom = []; - this.root = new node_1.Document(this.dom); - this.done = false; - this.tagStack = [this.root]; - this.lastNode = null; - this.parser = null; - if (typeof options === "function") { - elementCB = options; - options = defaultOpts2; - } - if (typeof callback === "object") { - options = callback; - callback = void 0; - } - this.callback = callback !== null && callback !== void 0 ? callback : null; - this.options = options !== null && options !== void 0 ? options : defaultOpts2; - this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null; - } - DomHandler3.prototype.onparserinit = function(parser) { - this.parser = parser; - }; - DomHandler3.prototype.onreset = function() { - this.dom = []; - this.root = new node_1.Document(this.dom); - this.done = false; - this.tagStack = [this.root]; - this.lastNode = null; - this.parser = null; - }; - DomHandler3.prototype.onend = function() { - if (this.done) - return; - this.done = true; - this.parser = null; - this.handleCallback(null); - }; - DomHandler3.prototype.onerror = function(error) { - this.handleCallback(error); - }; - DomHandler3.prototype.onclosetag = function() { - this.lastNode = null; - var elem = this.tagStack.pop(); - if (this.options.withEndIndices) { - elem.endIndex = this.parser.endIndex; - } - if (this.elementCB) - this.elementCB(elem); - }; - DomHandler3.prototype.onopentag = function(name, attribs) { - var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0; - var element = new node_1.Element(name, attribs, void 0, type); - this.addNode(element); - this.tagStack.push(element); - }; - DomHandler3.prototype.ontext = function(data) { - var normalizeWhitespace = this.options.normalizeWhitespace; - var lastNode = this.lastNode; - if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) { - if (normalizeWhitespace) { - lastNode.data = (lastNode.data + data).replace(reWhitespace, " "); - } else { - lastNode.data += data; - } - if (this.options.withEndIndices) { - lastNode.endIndex = this.parser.endIndex; - } - } else { - if (normalizeWhitespace) { - data = data.replace(reWhitespace, " "); - } - var node = new node_1.Text(data); - this.addNode(node); - this.lastNode = node; - } - }; - DomHandler3.prototype.oncomment = function(data) { - if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) { - this.lastNode.data += data; - return; - } - var node = new node_1.Comment(data); - this.addNode(node); - this.lastNode = node; - }; - DomHandler3.prototype.oncommentend = function() { - this.lastNode = null; - }; - DomHandler3.prototype.oncdatastart = function() { - var text = new node_1.Text(""); - var node = new node_1.NodeWithChildren(domelementtype_1.ElementType.CDATA, [text]); - this.addNode(node); - text.parent = node; - this.lastNode = text; - }; - DomHandler3.prototype.oncdataend = function() { - this.lastNode = null; - }; - DomHandler3.prototype.onprocessinginstruction = function(name, data) { - var node = new node_1.ProcessingInstruction(name, data); - this.addNode(node); - }; - DomHandler3.prototype.handleCallback = function(error) { - if (typeof this.callback === "function") { - this.callback(error, this.dom); - } else if (error) { - throw error; - } - }; - DomHandler3.prototype.addNode = function(node) { - var parent = this.tagStack[this.tagStack.length - 1]; - var previousSibling2 = parent.children[parent.children.length - 1]; - if (this.options.withStartIndices) { - node.startIndex = this.parser.startIndex; - } - if (this.options.withEndIndices) { - node.endIndex = this.parser.endIndex; - } - parent.children.push(node); - if (previousSibling2) { - node.prev = previousSibling2; - previousSibling2.next = node; - } - node.parent = parent; - this.lastNode = null; - }; - return DomHandler3; - })() - ); - exports2.DomHandler = DomHandler2; - exports2.default = DomHandler2; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode.js -var require_decode2 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decodeHTML = exports2.decodeHTMLStrict = exports2.decodeXML = void 0; - var entities_json_1 = __importDefault2(require_entities()); - var legacy_json_1 = __importDefault2(require_legacy()); - var xml_json_1 = __importDefault2(require_xml()); - var decode_codepoint_1 = __importDefault2(require_decode_codepoint()); - var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; - exports2.decodeXML = getStrictDecoder(xml_json_1.default); - exports2.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); - function getStrictDecoder(map) { - var replace2 = getReplacer(map); - return function(str) { - return String(str).replace(strictEntityRe, replace2); - }; - } - var sorter = function(a, b) { - return a < b ? 1 : -1; - }; - exports2.decodeHTML = (function() { - var legacy = Object.keys(legacy_json_1.default).sort(sorter); - var keys2 = Object.keys(entities_json_1.default).sort(sorter); - for (var i = 0, j = 0; i < keys2.length; i++) { - if (legacy[j] === keys2[i]) { - keys2[i] += ";?"; - j++; - } else { - keys2[i] += ";"; - } - } - var re = new RegExp("&(?:" + keys2.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); - var replace2 = getReplacer(entities_json_1.default); - function replacer(str) { - if (str.substr(-1) !== ";") - str += ";"; - return replace2(str); - } - return function(str) { - return String(str).replace(re, replacer); - }; - })(); - function getReplacer(map) { - return function replace2(str) { - if (str.charAt(1) === "#") { - var secondChar = str.charAt(2); - if (secondChar === "X" || secondChar === "x") { - return decode_codepoint_1.default(parseInt(str.substr(3), 16)); - } - return decode_codepoint_1.default(parseInt(str.substr(2), 10)); - } - return map[str.slice(1, -1)] || str; - }; - } - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/encode.js -var require_encode = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/encode.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.escapeUTF8 = exports2.escape = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.encodeXML = void 0; - var xml_json_1 = __importDefault2(require_xml()); - var inverseXML = getInverseObj(xml_json_1.default); - var xmlReplacer2 = getInverseReplacer(inverseXML); - exports2.encodeXML = getASCIIEncoder(inverseXML); - var entities_json_1 = __importDefault2(require_entities()); - var inverseHTML = getInverseObj(entities_json_1.default); - var htmlReplacer = getInverseReplacer(inverseHTML); - exports2.encodeHTML = getInverse(inverseHTML, htmlReplacer); - exports2.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); - function getInverseObj(obj) { - return Object.keys(obj).sort().reduce(function(inverse, name) { - inverse[obj[name]] = "&" + name + ";"; - return inverse; - }, {}); - } - function getInverseReplacer(inverse) { - var single = []; - var multiple = []; - for (var _i = 0, _a3 = Object.keys(inverse); _i < _a3.length; _i++) { - var k = _a3[_i]; - if (k.length === 1) { - single.push("\\" + k); - } else { - multiple.push(k); - } - } - single.sort(); - for (var start = 0; start < single.length - 1; start++) { - var end = start; - while (end < single.length - 1 && single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { - end += 1; - } - var count = 1 + end - start; - if (count < 3) - continue; - single.splice(start, count, single[start] + "-" + single[end]); - } - multiple.unshift("[" + single.join("") + "]"); - return new RegExp(multiple.join("|"), "g"); - } - var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; - var getCodePoint2 = ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - String.prototype.codePointAt != null ? ( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - function(str) { - return str.codePointAt(0); - } - ) : ( - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - function(c) { - return (c.charCodeAt(0) - 55296) * 1024 + c.charCodeAt(1) - 56320 + 65536; - } - ) - ); - function singleCharReplacer(c) { - return "&#x" + (c.length > 1 ? getCodePoint2(c) : c.charCodeAt(0)).toString(16).toUpperCase() + ";"; - } - function getInverse(inverse, re) { - return function(data) { - return data.replace(re, function(name) { - return inverse[name]; - }).replace(reNonASCII, singleCharReplacer); - }; - } - var reEscapeChars = new RegExp(xmlReplacer2.source + "|" + reNonASCII.source, "g"); - function escape5(data) { - return data.replace(reEscapeChars, singleCharReplacer); - } - exports2.escape = escape5; - function escapeUTF83(data) { - return data.replace(xmlReplacer2, singleCharReplacer); - } - exports2.escapeUTF8 = escapeUTF83; - function getASCIIEncoder(obj) { - return function(data) { - return data.replace(reEscapeChars, function(c) { - return obj[c] || singleCharReplacer(c); - }); - }; - } - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/index.js -var require_lib8 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decodeXMLStrict = exports2.decodeHTML5Strict = exports2.decodeHTML4Strict = exports2.decodeHTML5 = exports2.decodeHTML4 = exports2.decodeHTMLStrict = exports2.decodeHTML = exports2.decodeXML = exports2.encodeHTML5 = exports2.encodeHTML4 = exports2.escapeUTF8 = exports2.escape = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.encodeXML = exports2.encode = exports2.decodeStrict = exports2.decode = void 0; - var decode_1 = require_decode2(); - var encode_1 = require_encode(); - function decode(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); - } - exports2.decode = decode; - function decodeStrict(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); - } - exports2.decodeStrict = decodeStrict; - function encode(data, level) { - return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); - } - exports2.encode = encode; - var encode_2 = require_encode(); - Object.defineProperty(exports2, "encodeXML", { enumerable: true, get: function() { - return encode_2.encodeXML; - } }); - Object.defineProperty(exports2, "encodeHTML", { enumerable: true, get: function() { - return encode_2.encodeHTML; - } }); - Object.defineProperty(exports2, "encodeNonAsciiHTML", { enumerable: true, get: function() { - return encode_2.encodeNonAsciiHTML; - } }); - Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { - return encode_2.escape; - } }); - Object.defineProperty(exports2, "escapeUTF8", { enumerable: true, get: function() { - return encode_2.escapeUTF8; - } }); - Object.defineProperty(exports2, "encodeHTML4", { enumerable: true, get: function() { - return encode_2.encodeHTML; - } }); - Object.defineProperty(exports2, "encodeHTML5", { enumerable: true, get: function() { - return encode_2.encodeHTML; - } }); - var decode_2 = require_decode2(); - Object.defineProperty(exports2, "decodeXML", { enumerable: true, get: function() { - return decode_2.decodeXML; - } }); - Object.defineProperty(exports2, "decodeHTML", { enumerable: true, get: function() { - return decode_2.decodeHTML; - } }); - Object.defineProperty(exports2, "decodeHTMLStrict", { enumerable: true, get: function() { - return decode_2.decodeHTMLStrict; - } }); - Object.defineProperty(exports2, "decodeHTML4", { enumerable: true, get: function() { - return decode_2.decodeHTML; - } }); - Object.defineProperty(exports2, "decodeHTML5", { enumerable: true, get: function() { - return decode_2.decodeHTML; - } }); - Object.defineProperty(exports2, "decodeHTML4Strict", { enumerable: true, get: function() { - return decode_2.decodeHTMLStrict; - } }); - Object.defineProperty(exports2, "decodeHTML5Strict", { enumerable: true, get: function() { - return decode_2.decodeHTMLStrict; - } }); - Object.defineProperty(exports2, "decodeXMLStrict", { enumerable: true, get: function() { - return decode_2.decodeXML; - } }); - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js -var require_foreignNames = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.attributeNames = exports2.elementNames = void 0; - exports2.elementNames = /* @__PURE__ */ new Map([ - ["altglyph", "altGlyph"], - ["altglyphdef", "altGlyphDef"], - ["altglyphitem", "altGlyphItem"], - ["animatecolor", "animateColor"], - ["animatemotion", "animateMotion"], - ["animatetransform", "animateTransform"], - ["clippath", "clipPath"], - ["feblend", "feBlend"], - ["fecolormatrix", "feColorMatrix"], - ["fecomponenttransfer", "feComponentTransfer"], - ["fecomposite", "feComposite"], - ["feconvolvematrix", "feConvolveMatrix"], - ["fediffuselighting", "feDiffuseLighting"], - ["fedisplacementmap", "feDisplacementMap"], - ["fedistantlight", "feDistantLight"], - ["fedropshadow", "feDropShadow"], - ["feflood", "feFlood"], - ["fefunca", "feFuncA"], - ["fefuncb", "feFuncB"], - ["fefuncg", "feFuncG"], - ["fefuncr", "feFuncR"], - ["fegaussianblur", "feGaussianBlur"], - ["feimage", "feImage"], - ["femerge", "feMerge"], - ["femergenode", "feMergeNode"], - ["femorphology", "feMorphology"], - ["feoffset", "feOffset"], - ["fepointlight", "fePointLight"], - ["fespecularlighting", "feSpecularLighting"], - ["fespotlight", "feSpotLight"], - ["fetile", "feTile"], - ["feturbulence", "feTurbulence"], - ["foreignobject", "foreignObject"], - ["glyphref", "glyphRef"], - ["lineargradient", "linearGradient"], - ["radialgradient", "radialGradient"], - ["textpath", "textPath"] - ]); - exports2.attributeNames = /* @__PURE__ */ new Map([ - ["definitionurl", "definitionURL"], - ["attributename", "attributeName"], - ["attributetype", "attributeType"], - ["basefrequency", "baseFrequency"], - ["baseprofile", "baseProfile"], - ["calcmode", "calcMode"], - ["clippathunits", "clipPathUnits"], - ["diffuseconstant", "diffuseConstant"], - ["edgemode", "edgeMode"], - ["filterunits", "filterUnits"], - ["glyphref", "glyphRef"], - ["gradienttransform", "gradientTransform"], - ["gradientunits", "gradientUnits"], - ["kernelmatrix", "kernelMatrix"], - ["kernelunitlength", "kernelUnitLength"], - ["keypoints", "keyPoints"], - ["keysplines", "keySplines"], - ["keytimes", "keyTimes"], - ["lengthadjust", "lengthAdjust"], - ["limitingconeangle", "limitingConeAngle"], - ["markerheight", "markerHeight"], - ["markerunits", "markerUnits"], - ["markerwidth", "markerWidth"], - ["maskcontentunits", "maskContentUnits"], - ["maskunits", "maskUnits"], - ["numoctaves", "numOctaves"], - ["pathlength", "pathLength"], - ["patterncontentunits", "patternContentUnits"], - ["patterntransform", "patternTransform"], - ["patternunits", "patternUnits"], - ["pointsatx", "pointsAtX"], - ["pointsaty", "pointsAtY"], - ["pointsatz", "pointsAtZ"], - ["preservealpha", "preserveAlpha"], - ["preserveaspectratio", "preserveAspectRatio"], - ["primitiveunits", "primitiveUnits"], - ["refx", "refX"], - ["refy", "refY"], - ["repeatcount", "repeatCount"], - ["repeatdur", "repeatDur"], - ["requiredextensions", "requiredExtensions"], - ["requiredfeatures", "requiredFeatures"], - ["specularconstant", "specularConstant"], - ["specularexponent", "specularExponent"], - ["spreadmethod", "spreadMethod"], - ["startoffset", "startOffset"], - ["stddeviation", "stdDeviation"], - ["stitchtiles", "stitchTiles"], - ["surfacescale", "surfaceScale"], - ["systemlanguage", "systemLanguage"], - ["tablevalues", "tableValues"], - ["targetx", "targetX"], - ["targety", "targetY"], - ["textlength", "textLength"], - ["viewbox", "viewBox"], - ["viewtarget", "viewTarget"], - ["xchannelselector", "xChannelSelector"], - ["ychannelselector", "yChannelSelector"], - ["zoomandpan", "zoomAndPan"] - ]); - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js -var require_lib9 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __assign2 = exports2 && exports2.__assign || function() { - __assign2 = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign2.apply(this, arguments); - }; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var ElementType5 = __importStar2(require_lib6()); - var entities_1 = require_lib8(); - var foreignNames_1 = require_foreignNames(); - var unencodedElements3 = /* @__PURE__ */ new Set([ - "style", - "script", - "xmp", - "iframe", - "noembed", - "noframes", - "plaintext", - "noscript" - ]); - function formatAttributes3(attributes, opts) { - if (!attributes) - return; - return Object.keys(attributes).map(function(key2) { - var _a3, _b; - var value = (_a3 = attributes[key2]) !== null && _a3 !== void 0 ? _a3 : ""; - if (opts.xmlMode === "foreign") { - key2 = (_b = foreignNames_1.attributeNames.get(key2)) !== null && _b !== void 0 ? _b : key2; - } - if (!opts.emptyAttrs && !opts.xmlMode && value === "") { - return key2; - } - return key2 + '="' + (opts.decodeEntities !== false ? entities_1.encodeXML(value) : value.replace(/"/g, """)) + '"'; - }).join(" "); - } - var singleTag2 = /* @__PURE__ */ new Set([ - "area", - "base", - "basefont", - "br", - "col", - "command", - "embed", - "frame", - "hr", - "img", - "input", - "isindex", - "keygen", - "link", - "meta", - "param", - "source", - "track", - "wbr" - ]); - function render3(node, options) { - if (options === void 0) { - options = {}; - } - var nodes = "length" in node ? node : [node]; - var output = ""; - for (var i = 0; i < nodes.length; i++) { - output += renderNode3(nodes[i], options); - } - return output; - } - exports2.default = render3; - function renderNode3(node, options) { - switch (node.type) { - case ElementType5.Root: - return render3(node.children, options); - case ElementType5.Directive: - case ElementType5.Doctype: - return renderDirective2(node); - case ElementType5.Comment: - return renderComment2(node); - case ElementType5.CDATA: - return renderCdata2(node); - case ElementType5.Script: - case ElementType5.Style: - case ElementType5.Tag: - return renderTag3(node, options); - case ElementType5.Text: - return renderText2(node, options); - } - } - var foreignModeIntegrationPoints3 = /* @__PURE__ */ new Set([ - "mi", - "mo", - "mn", - "ms", - "mtext", - "annotation-xml", - "foreignObject", - "desc", - "title" - ]); - var foreignElements3 = /* @__PURE__ */ new Set(["svg", "math"]); - function renderTag3(elem, opts) { - var _a3; - if (opts.xmlMode === "foreign") { - elem.name = (_a3 = foreignNames_1.elementNames.get(elem.name)) !== null && _a3 !== void 0 ? _a3 : elem.name; - if (elem.parent && foreignModeIntegrationPoints3.has(elem.parent.name)) { - opts = __assign2(__assign2({}, opts), { xmlMode: false }); - } - } - if (!opts.xmlMode && foreignElements3.has(elem.name)) { - opts = __assign2(__assign2({}, opts), { xmlMode: "foreign" }); - } - var tag = "<" + elem.name; - var attribs = formatAttributes3(elem.attribs, opts); - if (attribs) { - tag += " " + attribs; - } - if (elem.children.length === 0 && (opts.xmlMode ? ( - // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags - opts.selfClosingTags !== false - ) : ( - // User explicitly asked for self-closing tags, even in HTML mode - opts.selfClosingTags && singleTag2.has(elem.name) - ))) { - if (!opts.xmlMode) - tag += " "; - tag += "/>"; - } else { - tag += ">"; - if (elem.children.length > 0) { - tag += render3(elem.children, opts); - } - if (opts.xmlMode || !singleTag2.has(elem.name)) { - tag += "</" + elem.name + ">"; - } - } - return tag; - } - function renderDirective2(elem) { - return "<" + elem.data + ">"; - } - function renderText2(elem, opts) { - var data = elem.data || ""; - if (opts.decodeEntities !== false && !(!opts.xmlMode && elem.parent && unencodedElements3.has(elem.parent.name))) { - data = entities_1.encodeXML(data); - } - return data; - } - function renderCdata2(elem) { - return "<![CDATA[" + elem.children[0].data + "]]>"; - } - function renderComment2(elem) { - return "<!--" + elem.data + "-->"; - } - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js -var require_stringify3 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.innerText = exports2.textContent = exports2.getText = exports2.getInnerHTML = exports2.getOuterHTML = void 0; - var domhandler_1 = require_lib7(); - var dom_serializer_1 = __importDefault2(require_lib9()); - var domelementtype_1 = require_lib6(); - function getOuterHTML3(node, options) { - return (0, dom_serializer_1.default)(node, options); - } - exports2.getOuterHTML = getOuterHTML3; - function getInnerHTML3(node, options) { - return (0, domhandler_1.hasChildren)(node) ? node.children.map(function(node2) { - return getOuterHTML3(node2, options); - }).join("") : ""; - } - exports2.getInnerHTML = getInnerHTML3; - function getText4(node) { - if (Array.isArray(node)) - return node.map(getText4).join(""); - if ((0, domhandler_1.isTag)(node)) - return node.name === "br" ? "\n" : getText4(node.children); - if ((0, domhandler_1.isCDATA)(node)) - return getText4(node.children); - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; - } - exports2.getText = getText4; - function textContent3(node) { - if (Array.isArray(node)) - return node.map(textContent3).join(""); - if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) { - return textContent3(node.children); - } - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; - } - exports2.textContent = textContent3; - function innerText3(node) { - if (Array.isArray(node)) - return node.map(innerText3).join(""); - if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) { - return innerText3(node.children); - } - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; - } - exports2.innerText = innerText3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js -var require_traversal = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.prevElementSibling = exports2.nextElementSibling = exports2.getName = exports2.hasAttrib = exports2.getAttributeValue = exports2.getSiblings = exports2.getParent = exports2.getChildren = void 0; - var domhandler_1 = require_lib7(); - var emptyArray = []; - function getChildren4(elem) { - var _a3; - return (_a3 = elem.children) !== null && _a3 !== void 0 ? _a3 : emptyArray; - } - exports2.getChildren = getChildren4; - function getParent4(elem) { - return elem.parent || null; - } - exports2.getParent = getParent4; - function getSiblings4(elem) { - var _a3, _b; - var parent = getParent4(elem); - if (parent != null) - return getChildren4(parent); - var siblings = [elem]; - var prev = elem.prev, next = elem.next; - while (prev != null) { - siblings.unshift(prev); - _a3 = prev, prev = _a3.prev; - } - while (next != null) { - siblings.push(next); - _b = next, next = _b.next; - } - return siblings; - } - exports2.getSiblings = getSiblings4; - function getAttributeValue4(elem, name) { - var _a3; - return (_a3 = elem.attribs) === null || _a3 === void 0 ? void 0 : _a3[name]; - } - exports2.getAttributeValue = getAttributeValue4; - function hasAttrib4(elem, name) { - return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null; - } - exports2.hasAttrib = hasAttrib4; - function getName4(elem) { - return elem.name; - } - exports2.getName = getName4; - function nextElementSibling4(elem) { - var _a3; - var next = elem.next; - while (next !== null && !(0, domhandler_1.isTag)(next)) - _a3 = next, next = _a3.next; - return next; - } - exports2.nextElementSibling = nextElementSibling4; - function prevElementSibling3(elem) { - var _a3; - var prev = elem.prev; - while (prev !== null && !(0, domhandler_1.isTag)(prev)) - _a3 = prev, prev = _a3.prev; - return prev; - } - exports2.prevElementSibling = prevElementSibling3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js -var require_manipulation = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.prepend = exports2.prependChild = exports2.append = exports2.appendChild = exports2.replaceElement = exports2.removeElement = void 0; - function removeElement3(elem) { - if (elem.prev) - elem.prev.next = elem.next; - if (elem.next) - elem.next.prev = elem.prev; - if (elem.parent) { - var childs = elem.parent.children; - childs.splice(childs.lastIndexOf(elem), 1); - } - } - exports2.removeElement = removeElement3; - function replaceElement3(elem, replacement) { - var prev = replacement.prev = elem.prev; - if (prev) { - prev.next = replacement; - } - var next = replacement.next = elem.next; - if (next) { - next.prev = replacement; - } - var parent = replacement.parent = elem.parent; - if (parent) { - var childs = parent.children; - childs[childs.lastIndexOf(elem)] = replacement; - } - } - exports2.replaceElement = replaceElement3; - function appendChild3(elem, child) { - removeElement3(child); - child.next = null; - child.parent = elem; - if (elem.children.push(child) > 1) { - var sibling = elem.children[elem.children.length - 2]; - sibling.next = child; - child.prev = sibling; - } else { - child.prev = null; - } - } - exports2.appendChild = appendChild3; - function append4(elem, next) { - removeElement3(next); - var parent = elem.parent; - var currNext = elem.next; - next.next = currNext; - next.prev = elem; - elem.next = next; - next.parent = parent; - if (currNext) { - currNext.prev = next; - if (parent) { - var childs = parent.children; - childs.splice(childs.lastIndexOf(currNext), 0, next); - } - } else if (parent) { - parent.children.push(next); - } - } - exports2.append = append4; - function prependChild3(elem, child) { - removeElement3(child); - child.parent = elem; - child.prev = null; - if (elem.children.unshift(child) !== 1) { - var sibling = elem.children[1]; - sibling.prev = child; - child.next = sibling; - } else { - child.next = null; - } - } - exports2.prependChild = prependChild3; - function prepend3(elem, prev) { - removeElement3(prev); - var parent = elem.parent; - if (parent) { - var childs = parent.children; - childs.splice(childs.indexOf(elem), 0, prev); - } - if (elem.prev) { - elem.prev.next = prev; - } - prev.parent = parent; - prev.prev = elem.prev; - prev.next = elem; - elem.prev = prev; - } - exports2.prepend = prepend3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/querying.js -var require_querying = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/querying.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.findAll = exports2.existsOne = exports2.findOne = exports2.findOneChild = exports2.find = exports2.filter = void 0; - var domhandler_1 = require_lib7(); - function filter3(test, node, recurse, limit) { - if (recurse === void 0) { - recurse = true; - } - if (limit === void 0) { - limit = Infinity; - } - if (!Array.isArray(node)) - node = [node]; - return find3(test, node, recurse, limit); - } - exports2.filter = filter3; - function find3(test, nodes, recurse, limit) { - var result = []; - for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { - var elem = nodes_1[_i]; - if (test(elem)) { - result.push(elem); - if (--limit <= 0) - break; - } - if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) { - var children = find3(test, elem.children, recurse, limit); - result.push.apply(result, children); - limit -= children.length; - if (limit <= 0) - break; - } - } - return result; - } - exports2.find = find3; - function findOneChild2(test, nodes) { - return nodes.find(test); - } - exports2.findOneChild = findOneChild2; - function findOne5(test, nodes, recurse) { - if (recurse === void 0) { - recurse = true; - } - var elem = null; - for (var i = 0; i < nodes.length && !elem; i++) { - var checked = nodes[i]; - if (!(0, domhandler_1.isTag)(checked)) { - continue; - } else if (test(checked)) { - elem = checked; - } else if (recurse && checked.children.length > 0) { - elem = findOne5(test, checked.children); - } - } - return elem; - } - exports2.findOne = findOne5; - function existsOne4(test, nodes) { - return nodes.some(function(checked) { - return (0, domhandler_1.isTag)(checked) && (test(checked) || checked.children.length > 0 && existsOne4(test, checked.children)); - }); - } - exports2.existsOne = existsOne4; - function findAll5(test, nodes) { - var _a3; - var result = []; - var stack = nodes.filter(domhandler_1.isTag); - var elem; - while (elem = stack.shift()) { - var children = (_a3 = elem.children) === null || _a3 === void 0 ? void 0 : _a3.filter(domhandler_1.isTag); - if (children && children.length > 0) { - stack.unshift.apply(stack, children); - } - if (test(elem)) - result.push(elem); - } - return result; - } - exports2.findAll = findAll5; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js -var require_legacy2 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getElementsByTagType = exports2.getElementsByTagName = exports2.getElementById = exports2.getElements = exports2.testElement = void 0; - var domhandler_1 = require_lib7(); - var querying_1 = require_querying(); - var Checks3 = { - tag_name: function(name) { - if (typeof name === "function") { - return function(elem) { - return (0, domhandler_1.isTag)(elem) && name(elem.name); - }; - } else if (name === "*") { - return domhandler_1.isTag; - } - return function(elem) { - return (0, domhandler_1.isTag)(elem) && elem.name === name; - }; - }, - tag_type: function(type) { - if (typeof type === "function") { - return function(elem) { - return type(elem.type); - }; - } - return function(elem) { - return elem.type === type; - }; - }, - tag_contains: function(data) { - if (typeof data === "function") { - return function(elem) { - return (0, domhandler_1.isText)(elem) && data(elem.data); - }; - } - return function(elem) { - return (0, domhandler_1.isText)(elem) && elem.data === data; - }; - } - }; - function getAttribCheck3(attrib, value) { - if (typeof value === "function") { - return function(elem) { - return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]); - }; - } - return function(elem) { - return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value; - }; - } - function combineFuncs3(a, b) { - return function(elem) { - return a(elem) || b(elem); - }; - } - function compileTest3(options) { - var funcs = Object.keys(options).map(function(key2) { - var value = options[key2]; - return Object.prototype.hasOwnProperty.call(Checks3, key2) ? Checks3[key2](value) : getAttribCheck3(key2, value); - }); - return funcs.length === 0 ? null : funcs.reduce(combineFuncs3); - } - function testElement3(options, node) { - var test = compileTest3(options); - return test ? test(node) : true; - } - exports2.testElement = testElement3; - function getElements3(options, nodes, recurse, limit) { - if (limit === void 0) { - limit = Infinity; - } - var test = compileTest3(options); - return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : []; - } - exports2.getElements = getElements3; - function getElementById3(id, nodes, recurse) { - if (recurse === void 0) { - recurse = true; - } - if (!Array.isArray(nodes)) - nodes = [nodes]; - return (0, querying_1.findOne)(getAttribCheck3("id", id), nodes, recurse); - } - exports2.getElementById = getElementById3; - function getElementsByTagName3(tagName19, nodes, recurse, limit) { - if (recurse === void 0) { - recurse = true; - } - if (limit === void 0) { - limit = Infinity; - } - return (0, querying_1.filter)(Checks3.tag_name(tagName19), nodes, recurse, limit); - } - exports2.getElementsByTagName = getElementsByTagName3; - function getElementsByTagType3(type, nodes, recurse, limit) { - if (recurse === void 0) { - recurse = true; - } - if (limit === void 0) { - limit = Infinity; - } - return (0, querying_1.filter)(Checks3.tag_type(type), nodes, recurse, limit); - } - exports2.getElementsByTagType = getElementsByTagType3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js -var require_helpers = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.uniqueSort = exports2.compareDocumentPosition = exports2.removeSubsets = void 0; - var domhandler_1 = require_lib7(); - function removeSubsets4(nodes) { - var idx = nodes.length; - while (--idx >= 0) { - var node = nodes[idx]; - if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) { - nodes.splice(idx, 1); - continue; - } - for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - if (nodes.includes(ancestor)) { - nodes.splice(idx, 1); - break; - } - } - } - return nodes; - } - exports2.removeSubsets = removeSubsets4; - function compareDocumentPosition3(nodeA, nodeB) { - var aParents = []; - var bParents = []; - if (nodeA === nodeB) { - return 0; - } - var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent; - while (current) { - aParents.unshift(current); - current = current.parent; - } - current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent; - while (current) { - bParents.unshift(current); - current = current.parent; - } - var maxIdx = Math.min(aParents.length, bParents.length); - var idx = 0; - while (idx < maxIdx && aParents[idx] === bParents[idx]) { - idx++; - } - if (idx === 0) { - return 1; - } - var sharedParent = aParents[idx - 1]; - var siblings = sharedParent.children; - var aSibling = aParents[idx]; - var bSibling = bParents[idx]; - if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { - if (sharedParent === nodeB) { - return 4 | 16; - } - return 4; - } - if (sharedParent === nodeA) { - return 2 | 8; - } - return 2; - } - exports2.compareDocumentPosition = compareDocumentPosition3; - function uniqueSort3(nodes) { - nodes = nodes.filter(function(node, i, arr) { - return !arr.includes(node, i + 1); - }); - nodes.sort(function(a, b) { - var relative = compareDocumentPosition3(a, b); - if (relative & 2) { - return -1; - } else if (relative & 4) { - return 1; - } - return 0; - }); - return nodes; - } - exports2.uniqueSort = uniqueSort3; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js -var require_feeds = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getFeed = void 0; - var stringify_1 = require_stringify3(); - var legacy_1 = require_legacy2(); - function getFeed3(doc) { - var feedRoot = getOneElement3(isValidFeed3, doc); - return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed3(feedRoot) : getRssFeed3(feedRoot); - } - exports2.getFeed = getFeed3; - function getAtomFeed3(feedRoot) { - var _a3; - var childs = feedRoot.children; - var feed = { - type: "atom", - items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function(item) { - var _a4; - var children = item.children; - var entry = { media: getMediaElements3(children) }; - addConditionally3(entry, "id", "id", children); - addConditionally3(entry, "title", "title", children); - var href2 = (_a4 = getOneElement3("link", children)) === null || _a4 === void 0 ? void 0 : _a4.attribs.href; - if (href2) { - entry.link = href2; - } - var description = fetch4("summary", children) || fetch4("content", children); - if (description) { - entry.description = description; - } - var pubDate = fetch4("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); - } - return entry; - }) - }; - addConditionally3(feed, "id", "id", childs); - addConditionally3(feed, "title", "title", childs); - var href = (_a3 = getOneElement3("link", childs)) === null || _a3 === void 0 ? void 0 : _a3.attribs.href; - if (href) { - feed.link = href; - } - addConditionally3(feed, "description", "subtitle", childs); - var updated = fetch4("updated", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally3(feed, "author", "email", childs, true); - return feed; - } - function getRssFeed3(feedRoot) { - var _a3, _b; - var childs = (_b = (_a3 = getOneElement3("channel", feedRoot.children)) === null || _a3 === void 0 ? void 0 : _a3.children) !== null && _b !== void 0 ? _b : []; - var feed = { - type: feedRoot.name.substr(0, 3), - id: "", - items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function(item) { - var children = item.children; - var entry = { media: getMediaElements3(children) }; - addConditionally3(entry, "id", "guid", children); - addConditionally3(entry, "title", "title", children); - addConditionally3(entry, "link", "link", children); - addConditionally3(entry, "description", "description", children); - var pubDate = fetch4("pubDate", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - return entry; - }) - }; - addConditionally3(feed, "title", "title", childs); - addConditionally3(feed, "link", "link", childs); - addConditionally3(feed, "description", "description", childs); - var updated = fetch4("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally3(feed, "author", "managingEditor", childs, true); - return feed; - } - var MEDIA_KEYS_STRING3 = ["url", "type", "lang"]; - var MEDIA_KEYS_INT3 = [ - "fileSize", - "bitrate", - "framerate", - "samplingrate", - "channels", - "duration", - "height", - "width" - ]; - function getMediaElements3(where) { - return (0, legacy_1.getElementsByTagName)("media:content", where).map(function(elem) { - var attribs = elem.attribs; - var media = { - medium: attribs.medium, - isDefault: !!attribs.isDefault - }; - for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING3; _i < MEDIA_KEYS_STRING_1.length; _i++) { - var attrib = MEDIA_KEYS_STRING_1[_i]; - if (attribs[attrib]) { - media[attrib] = attribs[attrib]; - } - } - for (var _a3 = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT3; _a3 < MEDIA_KEYS_INT_1.length; _a3++) { - var attrib = MEDIA_KEYS_INT_1[_a3]; - if (attribs[attrib]) { - media[attrib] = parseInt(attribs[attrib], 10); - } - } - if (attribs.expression) { - media.expression = attribs.expression; - } - return media; - }); - } - function getOneElement3(tagName19, node) { - return (0, legacy_1.getElementsByTagName)(tagName19, node, true, 1)[0]; - } - function fetch4(tagName19, where, recurse) { - if (recurse === void 0) { - recurse = false; - } - return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName19, where, recurse, 1)).trim(); - } - function addConditionally3(obj, prop2, tagName19, where, recurse) { - if (recurse === void 0) { - recurse = false; - } - var val = fetch4(tagName19, where, recurse); - if (val) - obj[prop2] = val; - } - function isValidFeed3(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; - } - } -}); - -// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/index.js -var require_lib10 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.hasChildren = exports2.isDocument = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = void 0; - __exportStar2(require_stringify3(), exports2); - __exportStar2(require_traversal(), exports2); - __exportStar2(require_manipulation(), exports2); - __exportStar2(require_querying(), exports2); - __exportStar2(require_legacy2(), exports2); - __exportStar2(require_helpers(), exports2); - __exportStar2(require_feeds(), exports2); - var domhandler_1 = require_lib7(); - Object.defineProperty(exports2, "isTag", { enumerable: true, get: function() { - return domhandler_1.isTag; - } }); - Object.defineProperty(exports2, "isCDATA", { enumerable: true, get: function() { - return domhandler_1.isCDATA; - } }); - Object.defineProperty(exports2, "isText", { enumerable: true, get: function() { - return domhandler_1.isText; - } }); - Object.defineProperty(exports2, "isComment", { enumerable: true, get: function() { - return domhandler_1.isComment; - } }); - Object.defineProperty(exports2, "isDocument", { enumerable: true, get: function() { - return domhandler_1.isDocument; - } }); - Object.defineProperty(exports2, "hasChildren", { enumerable: true, get: function() { - return domhandler_1.hasChildren; - } }); - } -}); - -// node_modules/telegram/node_modules/htmlparser2/lib/FeedHandler.js -var require_FeedHandler = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/lib/FeedHandler.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ (function() { - var extendStatics2 = function(d, b) { - extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - }; - return extendStatics2(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics2(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseFeed = exports2.FeedHandler = void 0; - var domhandler_1 = __importDefault2(require_lib7()); - var DomUtils = __importStar2(require_lib10()); - var Parser_1 = require_Parser(); - var FeedItemMediaMedium; - (function(FeedItemMediaMedium2) { - FeedItemMediaMedium2[FeedItemMediaMedium2["image"] = 0] = "image"; - FeedItemMediaMedium2[FeedItemMediaMedium2["audio"] = 1] = "audio"; - FeedItemMediaMedium2[FeedItemMediaMedium2["video"] = 2] = "video"; - FeedItemMediaMedium2[FeedItemMediaMedium2["document"] = 3] = "document"; - FeedItemMediaMedium2[FeedItemMediaMedium2["executable"] = 4] = "executable"; - })(FeedItemMediaMedium || (FeedItemMediaMedium = {})); - var FeedItemMediaExpression; - (function(FeedItemMediaExpression2) { - FeedItemMediaExpression2[FeedItemMediaExpression2["sample"] = 0] = "sample"; - FeedItemMediaExpression2[FeedItemMediaExpression2["full"] = 1] = "full"; - FeedItemMediaExpression2[FeedItemMediaExpression2["nonstop"] = 2] = "nonstop"; - })(FeedItemMediaExpression || (FeedItemMediaExpression = {})); - var FeedHandler = ( - /** @class */ - (function(_super) { - __extends2(FeedHandler2, _super); - function FeedHandler2(callback, options) { - var _this = this; - if (typeof callback === "object") { - callback = void 0; - options = callback; - } - _this = _super.call(this, callback, options) || this; - return _this; - } - FeedHandler2.prototype.onend = function() { - var _a3, _b; - var feedRoot = getOneElement3(isValidFeed3, this.dom); - if (!feedRoot) { - this.handleCallback(new Error("couldn't find root of feed")); - return; - } - var feed = {}; - if (feedRoot.name === "feed") { - var childs = feedRoot.children; - feed.type = "atom"; - addConditionally3(feed, "id", "id", childs); - addConditionally3(feed, "title", "title", childs); - var href = getAttribute("href", getOneElement3("link", childs)); - if (href) { - feed.link = href; - } - addConditionally3(feed, "description", "subtitle", childs); - var updated = fetch4("updated", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally3(feed, "author", "email", childs, true); - feed.items = getElements3("entry", childs).map(function(item) { - var entry = {}; - var children = item.children; - addConditionally3(entry, "id", "id", children); - addConditionally3(entry, "title", "title", children); - var href2 = getAttribute("href", getOneElement3("link", children)); - if (href2) { - entry.link = href2; - } - var description = fetch4("summary", children) || fetch4("content", children); - if (description) { - entry.description = description; - } - var pubDate = fetch4("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); - } - entry.media = getMediaElements3(children); - return entry; - }); - } else { - var childs = (_b = (_a3 = getOneElement3("channel", feedRoot.children)) === null || _a3 === void 0 ? void 0 : _a3.children) !== null && _b !== void 0 ? _b : []; - feed.type = feedRoot.name.substr(0, 3); - feed.id = ""; - addConditionally3(feed, "title", "title", childs); - addConditionally3(feed, "link", "link", childs); - addConditionally3(feed, "description", "description", childs); - var updated = fetch4("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally3(feed, "author", "managingEditor", childs, true); - feed.items = getElements3("item", feedRoot.children).map(function(item) { - var entry = {}; - var children = item.children; - addConditionally3(entry, "id", "guid", children); - addConditionally3(entry, "title", "title", children); - addConditionally3(entry, "link", "link", children); - addConditionally3(entry, "description", "description", children); - var pubDate = fetch4("pubDate", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - entry.media = getMediaElements3(children); - return entry; - }); - } - this.feed = feed; - this.handleCallback(null); - }; - return FeedHandler2; - })(domhandler_1.default) - ); - exports2.FeedHandler = FeedHandler; - function getMediaElements3(where) { - return getElements3("media:content", where).map(function(elem) { - var media = { - medium: elem.attribs.medium, - isDefault: !!elem.attribs.isDefault - }; - if (elem.attribs.url) { - media.url = elem.attribs.url; - } - if (elem.attribs.fileSize) { - media.fileSize = parseInt(elem.attribs.fileSize, 10); - } - if (elem.attribs.type) { - media.type = elem.attribs.type; - } - if (elem.attribs.expression) { - media.expression = elem.attribs.expression; - } - if (elem.attribs.bitrate) { - media.bitrate = parseInt(elem.attribs.bitrate, 10); - } - if (elem.attribs.framerate) { - media.framerate = parseInt(elem.attribs.framerate, 10); - } - if (elem.attribs.samplingrate) { - media.samplingrate = parseInt(elem.attribs.samplingrate, 10); - } - if (elem.attribs.channels) { - media.channels = parseInt(elem.attribs.channels, 10); - } - if (elem.attribs.duration) { - media.duration = parseInt(elem.attribs.duration, 10); - } - if (elem.attribs.height) { - media.height = parseInt(elem.attribs.height, 10); - } - if (elem.attribs.width) { - media.width = parseInt(elem.attribs.width, 10); - } - if (elem.attribs.lang) { - media.lang = elem.attribs.lang; - } - return media; - }); - } - function getElements3(tagName19, where) { - return DomUtils.getElementsByTagName(tagName19, where, true); - } - function getOneElement3(tagName19, node) { - return DomUtils.getElementsByTagName(tagName19, node, true, 1)[0]; - } - function fetch4(tagName19, where, recurse) { - if (recurse === void 0) { - recurse = false; - } - return DomUtils.getText(DomUtils.getElementsByTagName(tagName19, where, recurse, 1)).trim(); - } - function getAttribute(name, elem) { - if (!elem) { - return null; - } - var attribs = elem.attribs; - return attribs[name]; - } - function addConditionally3(obj, prop2, what, where, recurse) { - if (recurse === void 0) { - recurse = false; - } - var tmp = fetch4(what, where, recurse); - if (tmp) - obj[prop2] = tmp; - } - function isValidFeed3(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; - } - function parseFeed2(feed, options) { - if (options === void 0) { - options = { xmlMode: true }; - } - var handler4 = new FeedHandler(options); - new Parser_1.Parser(handler4, options).end(feed); - return handler4.feed; - } - exports2.parseFeed = parseFeed2; - } -}); - -// node_modules/telegram/node_modules/htmlparser2/lib/index.js -var require_lib11 = __commonJS({ - "node_modules/telegram/node_modules/htmlparser2/lib/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); - }; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RssHandler = exports2.DefaultHandler = exports2.DomUtils = exports2.ElementType = exports2.Tokenizer = exports2.createDomStream = exports2.parseDOM = exports2.parseDocument = exports2.DomHandler = exports2.Parser = void 0; - var Parser_1 = require_Parser(); - Object.defineProperty(exports2, "Parser", { enumerable: true, get: function() { - return Parser_1.Parser; - } }); - var domhandler_1 = require_lib7(); - Object.defineProperty(exports2, "DomHandler", { enumerable: true, get: function() { - return domhandler_1.DomHandler; - } }); - Object.defineProperty(exports2, "DefaultHandler", { enumerable: true, get: function() { - return domhandler_1.DomHandler; - } }); - function parseDocument2(data, options) { - var handler4 = new domhandler_1.DomHandler(void 0, options); - new Parser_1.Parser(handler4, options).end(data); - return handler4.root; - } - exports2.parseDocument = parseDocument2; - function parseDOM2(data, options) { - return parseDocument2(data, options).children; - } - exports2.parseDOM = parseDOM2; - function createDomStream2(cb, options, elementCb) { - var handler4 = new domhandler_1.DomHandler(cb, options, elementCb); - return new Parser_1.Parser(handler4, options); - } - exports2.createDomStream = createDomStream2; - var Tokenizer_1 = require_Tokenizer(); - Object.defineProperty(exports2, "Tokenizer", { enumerable: true, get: function() { - return __importDefault2(Tokenizer_1).default; - } }); - var ElementType5 = __importStar2(require_lib6()); - exports2.ElementType = ElementType5; - __exportStar2(require_FeedHandler(), exports2); - exports2.DomUtils = __importStar2(require_lib10()); - var FeedHandler_1 = require_FeedHandler(); - Object.defineProperty(exports2, "RssHandler", { enumerable: true, get: function() { - return FeedHandler_1.FeedHandler; - } }); - } -}); - -// node_modules/telegram/extensions/html.js -var require_html = __commonJS({ - "node_modules/telegram/extensions/html.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HTMLParser = void 0; - var htmlparser2_1 = require_lib11(); - var tl_1 = require_tl(); - var index_1 = require_telegram(); - var HTMLToTelegramParser = class { - constructor() { - this.text = ""; - this.entities = []; - this._buildingEntities = /* @__PURE__ */ new Map(); - this._openTags = []; - this._openTagsMeta = []; - } - onopentag(name, attributes) { - this._openTags.unshift(name); - this._openTagsMeta.unshift(void 0); - let EntityType; - const args = {}; - if (name == "strong" || name == "b") { - EntityType = tl_1.Api.MessageEntityBold; - } else if (name == "spoiler") { - EntityType = tl_1.Api.MessageEntitySpoiler; - } else if (name == "em" || name == "i") { - EntityType = tl_1.Api.MessageEntityItalic; - } else if (name == "u") { - EntityType = tl_1.Api.MessageEntityUnderline; - } else if (name == "del" || name == "s") { - EntityType = tl_1.Api.MessageEntityStrike; - } else if (name == "blockquote") { - EntityType = tl_1.Api.MessageEntityBlockquote; - if (attributes.expandable !== void 0) { - args.collapsed = true; - } - } else if (name == "code") { - const pre = this._buildingEntities.get("pre"); - if (pre && pre instanceof tl_1.Api.MessageEntityPre) { - try { - pre.language = attributes.class.slice("language-".length, attributes.class.length); - } catch (e) { - } - } else { - EntityType = tl_1.Api.MessageEntityCode; - } - } else if (name == "pre") { - EntityType = tl_1.Api.MessageEntityPre; - args["language"] = ""; - } else if (name == "a") { - let url = attributes.href; - if (!url) { - return; - } - if (url.startsWith("mailto:")) { - url = url.slice("mailto:".length, url.length); - EntityType = tl_1.Api.MessageEntityEmail; - } else { - EntityType = tl_1.Api.MessageEntityTextUrl; - args["url"] = url; - url = void 0; - } - this._openTagsMeta.shift(); - this._openTagsMeta.unshift(url); - } else if (name == "tg-emoji") { - EntityType = tl_1.Api.MessageEntityCustomEmoji; - args["documentId"] = attributes["emoji-id"]; - } - if (EntityType && !this._buildingEntities.has(name)) { - this._buildingEntities.set(name, new EntityType(Object.assign({ offset: this.text.length, length: 0 }, args))); - } - } - ontext(text) { - const previousTag = this._openTags.length > 0 ? this._openTags[0] : ""; - if (previousTag == "a") { - const url = this._openTagsMeta[0]; - if (url) { - text = url; - } - } - for (let [tag, entity] of this._buildingEntities) { - entity.length += text.length; - } - this.text += text; - } - onclosetag(tagname) { - this._openTagsMeta.shift(); - this._openTags.shift(); - const entity = this._buildingEntities.get(tagname); - if (entity) { - this._buildingEntities.delete(tagname); - this.entities.push(entity); - } - } - onattribute(name, value, quote) { - } - oncdataend() { - } - oncdatastart() { - } - oncomment(data) { - } - oncommentend() { - } - onend() { - } - onerror(error) { - } - onopentagname(name) { - } - onparserinit(parser) { - } - onprocessinginstruction(name, data) { - } - onreset() { - } - }; - var HTMLParser = class { - static parse(html) { - if (!html) { - return [html, []]; - } - const handler4 = new HTMLToTelegramParser(); - const parser = new htmlparser2_1.Parser(handler4); - parser.write(html); - parser.end(); - const text = index_1.helpers.stripText(handler4.text, handler4.entities); - return [text, handler4.entities]; - } - static unparse(text, entities2, _offset = 0, _length) { - if (!text || !entities2 || !entities2.length) { - return text; - } - if (_length == void 0) { - _length = text.length; - } - const html = []; - let lastOffset = 0; - for (let i = 0; i < entities2.length; i++) { - const entity = entities2[i]; - if (entity.offset >= _offset + _length) { - break; - } - let relativeOffset = entity.offset - _offset; - if (relativeOffset > lastOffset) { - html.push(text.slice(lastOffset, relativeOffset)); - } else if (relativeOffset < lastOffset) { - continue; - } - let skipEntity = false; - let length = entity.length; - let entityText = this.unparse(text.slice(relativeOffset, relativeOffset + length), entities2.slice(i + 1, entities2.length), entity.offset, length); - if (entity instanceof tl_1.Api.MessageEntityBold) { - html.push(`<strong>${entityText}</strong>`); - } else if (entity instanceof tl_1.Api.MessageEntitySpoiler) { - html.push(`<spoiler>${entityText}</spoiler>`); - } else if (entity instanceof tl_1.Api.MessageEntityItalic) { - html.push(`<em>${entityText}</em>`); - } else if (entity instanceof tl_1.Api.MessageEntityCode) { - html.push(`<code>${entityText}</code>`); - } else if (entity instanceof tl_1.Api.MessageEntityUnderline) { - html.push(`<u>${entityText}</u>`); - } else if (entity instanceof tl_1.Api.MessageEntityStrike) { - html.push(`<del>${entityText}</del>`); - } else if (entity instanceof tl_1.Api.MessageEntityBlockquote) { - html.push(`<blockquote>${entityText}</blockquote>`); - } else if (entity instanceof tl_1.Api.MessageEntityPre) { - if (entity.language) { - html.push(`<pre><code class="language-${entity.language}">${entityText}</code></pre>`); - } else { - html.push(`<pre>${entityText}</pre>`); - } - } else if (entity instanceof tl_1.Api.MessageEntityEmail) { - html.push(`<a href="mailto:${entityText}">${entityText}</a>`); - } else if (entity instanceof tl_1.Api.MessageEntityUrl) { - html.push(`<a href="${entityText}">${entityText}</a>`); - } else if (entity instanceof tl_1.Api.MessageEntityTextUrl) { - html.push(`<a href="${entity.url}">${entityText}</a>`); - } else if (entity instanceof tl_1.Api.MessageEntityMentionName) { - html.push(`<a href="tg://user?id=${entity.userId}">${entityText}</a>`); - } else if (entity instanceof tl_1.Api.MessageEntityCustomEmoji) { - html.push(`<tg-emoji emoji-id="${entity.documentId}">${entityText}</tg-emoji>`); - } else { - skipEntity = true; - } - lastOffset = relativeOffset + (skipEntity ? 0 : length); - } - html.push(text.slice(lastOffset, text.length)); - return html.join(""); - } - }; - exports2.HTMLParser = HTMLParser; - } -}); - -// node_modules/telegram/client/messageParse.js -var require_messageParse = __commonJS({ - "node_modules/telegram/client/messageParse.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet, + MediaList: require_MediaList().MediaList }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DEFAULT_DELIMITERS = void 0; - exports2._replaceWithMention = _replaceWithMention; - exports2._parseMessageText = _parseMessageText; - exports2._getResponseMessage = _getResponseMessage; - var Utils_1 = require_Utils(); - var api_1 = require_api(); - var index_1 = require_telegram(); - var Helpers_1 = require_Helpers(); - var big_integer_1 = __importDefault2(require_BigInteger()); - exports2.DEFAULT_DELIMITERS = { - "**": api_1.Api.MessageEntityBold, - __: api_1.Api.MessageEntityItalic, - "~~": api_1.Api.MessageEntityStrike, - "`": api_1.Api.MessageEntityCode, - "```": api_1.Api.MessageEntityPre + var regexPatterns = require_regexPatterns().regexPatterns; + CSSOM2.CSSImportRule = function CSSImportRule() { + CSSOM2.CSSRule.call(this); + this.__href = ""; + this.__media = new CSSOM2.MediaList(); + this.__layerName = null; + this.__supportsText = null; + this.__styleSheet = new CSSOM2.CSSStyleSheet(); }; - async function _replaceWithMention(client2, entities2, i, user) { - try { - entities2[i] = new api_1.Api.InputMessageEntityMentionName({ - offset: entities2[i].offset, - length: entities2[i].length, - userId: await client2.getInputEntity(user) - }); - return true; - } catch (e) { - return false; - } - } - async function _parseMessageText(client2, message, parseMode) { - if (parseMode == false) { - return [message, []]; - } - if (parseMode == void 0) { - if (client2.parseMode == void 0) { - return [message, []]; - } - parseMode = client2.parseMode; - } else if (typeof parseMode === "string") { - parseMode = (0, Utils_1.sanitizeParseMode)(parseMode); - } - const [rawMessage, msgEntities] = parseMode.parse(message); - for (let i = msgEntities.length - 1; i >= 0; i--) { - const e = msgEntities[i]; - if (e instanceof api_1.Api.MessageEntityTextUrl) { - const m = /^@|\+|tg:\/\/user\?id=(\d+)/.exec(e.url); - if (m) { - const userIdOrUsername = m[1] ? Number(m[1]) : e.url; - const isMention = await _replaceWithMention(client2, msgEntities, i, userIdOrUsername); - if (!isMention) { - msgEntities.splice(i, 1); - } - } - } - } - return [rawMessage, msgEntities]; - } - function _getResponseMessage(client2, request, result, inputChat) { - let updates = []; - let entities2 = /* @__PURE__ */ new Map(); - if (result instanceof api_1.Api.UpdateShort) { - updates = [result.update]; - } else if (result instanceof api_1.Api.Updates || result instanceof api_1.Api.UpdatesCombined) { - updates = result.updates; - for (const x of [...result.users, ...result.chats]) { - entities2.set(index_1.utils.getPeerId(x), x); - } - } else { - return; - } - const randomToId = /* @__PURE__ */ new Map(); - const idToMessage = /* @__PURE__ */ new Map(); - let schedMessage; - for (const update2 of updates) { - if (update2 instanceof api_1.Api.UpdateMessageID) { - randomToId.set(update2.randomId.toString(), update2.id); - } else if (update2 instanceof api_1.Api.UpdateNewChannelMessage || update2 instanceof api_1.Api.UpdateNewMessage) { - update2.message._finishInit(client2, entities2, inputChat); - if ("randomId" in request || (0, Helpers_1.isArrayLike)(request)) { - idToMessage.set(update2.message.id, update2.message); - } else { - return update2.message; - } - } else if (update2 instanceof api_1.Api.UpdateEditMessage && "peer" in request && (0, Helpers_1._entityType)(request.peer) != Helpers_1._EntityType.CHANNEL) { - update2.message._finishInit(client2, entities2, inputChat); - if ("randomId" in request) { - idToMessage.set(update2.message.id, update2.message); - } else if ("id" in request && request.id === update2.message.id) { - return update2.message; - } - } else if (update2 instanceof api_1.Api.UpdateEditChannelMessage && "peer" in request && (0, Utils_1.getPeerId)(request.peer) == (0, Utils_1.getPeerId)(update2.message.peerId)) { - if (request.id == update2.message.id) { - update2.message._finishInit(client2, entities2, inputChat); - return update2.message; - } - } else if (update2 instanceof api_1.Api.UpdateNewScheduledMessage) { - update2.message._finishInit(client2, entities2, inputChat); - schedMessage = update2.message; - idToMessage.set(update2.message.id, update2.message); - } else if (update2 instanceof api_1.Api.UpdateMessagePoll) { - if (request.media.poll.id == update2.pollId) { - const m = new api_1.Api.Message({ - id: request.id, - peerId: index_1.utils.getPeerId(request.peer), - media: new api_1.Api.MessageMediaPoll({ - poll: update2.poll, - results: update2.results - }), - message: "", - date: 0 - }); - m._finishInit(client2, entities2, inputChat); - return m; - } - } - } - if (request == void 0) { - return idToMessage; - } - let randomId; - if ((0, Helpers_1.isArrayLike)(request) || typeof request == "number" || big_integer_1.default.isInstance(request)) { - randomId = request; - } else { - randomId = request.randomId; + CSSOM2.CSSImportRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSImportRule.prototype.constructor = CSSOM2.CSSImportRule; + Object.setPrototypeOf(CSSOM2.CSSImportRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "type", { + value: 3, + writable: false + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "cssText", { + get: function() { + var mediaText = this.media.mediaText; + return '@import url("' + this.href.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '")' + (this.layerName !== null ? " layer" + (this.layerName && "(" + this.layerName + ")") : "") + (this.supportsText ? " supports(" + this.supportsText + ")" : "") + (mediaText ? " " + mediaText : "") + ";"; } - if (!randomId) { - if (schedMessage) { - return schedMessage; - } - client2._log.warn(`No randomId in ${request} to map to. returning undefined for ${result} (Message was empty)`); - return void 0; + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "href", { + get: function() { + return this.__href; } - if (!(0, Helpers_1.isArrayLike)(randomId)) { - let msg = idToMessage.get(randomToId.get(randomId.toString())); - if (!msg) { - client2._log.warn(`Request ${request.className} had missing message mapping ${result.className} (Message was empty)`); + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "media", { + get: function() { + return this.__media; + }, + set: function(value) { + if (typeof value === "string") { + this.__media.mediaText = value; + } else { + this.__media = value; } - return msg; } - const final = []; - let warned = false; - for (const rnd of randomId) { - const tmp = randomToId.get(rnd.toString()); - if (!tmp) { - warned = true; - break; - } - const tmp2 = idToMessage.get(tmp); - if (!tmp2) { - warned = true; - break; - } - final.push(tmp2); + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "layerName", { + get: function() { + return this.__layerName; } - if (warned) { - client2._log.warn(`Request ${request.className} had missing message mapping ${result.className} (Message was empty)`); + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "supportsText", { + get: function() { + return this.__supportsText; } - const finalToReturn = []; - for (const rnd of randomId) { - finalToReturn.push(idToMessage.get(randomToId.get(rnd.toString()))); + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "styleSheet", { + get: function() { + return this.__styleSheet; } - return finalToReturn; - } - } -}); - -// node_modules/telegram/extensions/markdown.js -var require_markdown = __commonJS({ - "node_modules/telegram/extensions/markdown.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MarkdownParser = void 0; - var messageParse_1 = require_messageParse(); - var MarkdownParser = class { - // TODO maybe there is a better way :shrug: - static parse(message) { - let i = 0; - const keys2 = {}; - for (const k in messageParse_1.DEFAULT_DELIMITERS) { - keys2[k] = false; - } - const entities2 = []; - const tempEntities = {}; - while (i < message.length) { - let foundIndex = -1; - let foundDelim = void 0; - for (const key2 of Object.keys(messageParse_1.DEFAULT_DELIMITERS)) { - const index2 = message.indexOf(key2, i); - if (index2 > -1 && (foundIndex === -1 || index2 < foundIndex)) { - foundIndex = index2; - foundDelim = key2; - } - } - if (foundIndex === -1 || foundDelim == void 0) { - break; + }); + Object.defineProperty(CSSOM2.CSSImportRule.prototype, "parse", { + value: function(cssText) { + var i = 0; + var state2 = ""; + var buffer = ""; + var index2; + var layerRegExp = regexPatterns.layerRegExp; + var layerRuleNameRegExp = regexPatterns.layerRuleNameRegExp; + var doubleOrMoreSpacesRegExp = regexPatterns.doubleOrMoreSpacesRegExp; + function extractSupportsContent(text) { + var supportsIndex = text.indexOf("supports("); + if (supportsIndex !== 0) { + return null; } - if (!keys2[foundDelim]) { - tempEntities[foundDelim] = new messageParse_1.DEFAULT_DELIMITERS[foundDelim]({ - offset: foundIndex, - length: -1, - language: "" - }); - keys2[foundDelim] = true; - } else { - keys2[foundDelim] = false; - tempEntities[foundDelim].length = foundIndex - tempEntities[foundDelim].offset; - entities2.push(tempEntities[foundDelim]); + var depth = 0; + var start = supportsIndex + "supports(".length; + var i2 = start; + for (; i2 < text.length; i2++) { + if (text[i2] === "(") { + depth++; + } else if (text[i2] === ")") { + if (depth === 0) { + return { + content: text.slice(start, i2), + endIndex: i2 + }; + } + depth--; + } } - message = message.toString().replace(foundDelim, ""); - i = foundIndex; - } - return [message, entities2]; - } - static unparse(text, entities2) { - const delimiters = messageParse_1.DEFAULT_DELIMITERS; - if (!text || !entities2) { - return text; + return null; } - let insertAt = []; - const tempDelimiters = /* @__PURE__ */ new Map(); - Object.keys(delimiters).forEach((key2) => { - tempDelimiters.set(delimiters[key2].className, key2); - }); - for (const entity of entities2) { - const s = entity.offset; - const e = entity.offset + entity.length; - const delimiter = tempDelimiters.get(entity.className); - if (delimiter) { - insertAt.push([s, delimiter]); - insertAt.push([e, delimiter]); + for (var character; character = cssText.charAt(i); i++) { + switch (character) { + case " ": + case " ": + case "\r": + case "\n": + case "\f": + if (state2 === "after-import") { + state2 = "url"; + } else { + buffer += character; + } + break; + case "@": + if (!state2 && cssText.indexOf("@import", i) === i) { + state2 = "after-import"; + i += "import".length; + buffer = ""; + } + break; + case "u": + if (state2 === "media") { + buffer += character; + } + if (state2 === "url" && cssText.indexOf("url(", i) === i) { + index2 = cssText.indexOf(")", i + 1); + if (index2 === -1) { + throw i + ': ")" not found'; + } + i += "url(".length; + var url = cssText.slice(i, index2); + if (url[0] === url[url.length - 1]) { + if (url[0] === '"' || url[0] === "'") { + url = url.slice(1, -1); + } + } + this.__href = url; + i = index2; + state2 = "media"; + } + break; + case '"': + if (state2 === "after-import" || state2 === "url") { + index2 = cssText.indexOf('"', i + 1); + if (!index2) { + throw i + `: '"' not found`; + } + this.__href = cssText.slice(i + 1, index2); + i = index2; + state2 = "media"; + } + break; + case "'": + if (state2 === "after-import" || state2 === "url") { + index2 = cssText.indexOf("'", i + 1); + if (!index2) { + throw i + `: "'" not found`; + } + this.__href = cssText.slice(i + 1, index2); + i = index2; + state2 = "media"; + } + break; + case ";": + if (state2 === "media") { + if (buffer) { + var bufferTrimmed = buffer.trim(); + if (bufferTrimmed.indexOf("layer") === 0) { + var layerMatch = bufferTrimmed.match(layerRegExp); + if (layerMatch) { + var layerName = layerMatch[1].trim(); + if (layerName.match(layerRuleNameRegExp) !== null) { + this.__layerName = layerMatch[1].trim(); + bufferTrimmed = bufferTrimmed.replace(layerRegExp, "").replace(doubleOrMoreSpacesRegExp, " ").trim(); + } else { + if (bufferTrimmed) { + this.media.mediaText = bufferTrimmed; + return; + } + } + } else { + this.__layerName = ""; + bufferTrimmed = bufferTrimmed.substring("layer".length).trim(); + } + } + var supportsResult = extractSupportsContent(bufferTrimmed); + if (supportsResult) { + this.__supportsText = supportsResult.content.trim(); + bufferTrimmed = bufferTrimmed.slice(0, 0) + bufferTrimmed.slice(supportsResult.endIndex + 1); + bufferTrimmed = bufferTrimmed.replace(doubleOrMoreSpacesRegExp, " ").trim(); + } + if (bufferTrimmed) { + this.media.mediaText = bufferTrimmed; + } + } + } + break; + default: + if (state2 === "media") { + buffer += character; + } + break; } } - insertAt = insertAt.sort((a, b) => { - return a[0] - b[0]; - }); - while (insertAt.length) { - const [at, what] = insertAt.pop(); - text = text.slice(0, at) + what + text.slice(at); - } - return text; } - }; - exports2.MarkdownParser = MarkdownParser; + }); + exports2.CSSImportRule = CSSOM2.CSSImportRule; } }); -// node_modules/telegram/extensions/markdownv2.js -var require_markdownv2 = __commonJS({ - "node_modules/telegram/extensions/markdownv2.js"(exports2) { - "use strict"; +// node_modules/@acemir/cssom/lib/CSSNamespaceRule.js +var require_CSSNamespaceRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSNamespaceRule.js"(exports2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MarkdownV2Parser = void 0; - var html_1 = require_html(); - var MarkdownV2Parser = class { - static parse(message) { - message = message.replace(/\*(.*?)\*/g, "<b>$1</b>"); - message = message.replace(/__(.*?)__/g, "<u>$1</u>"); - message = message.replace(/~(.*?)~/g, "<s>$1</s>"); - message = message.replace(/-(.*?)-/g, "<i>$1</i>"); - message = message.replace(/```([\s\S]*?)```/g, "<pre>$1</pre>"); - message = message.replace(/`(.*?)`/g, "<code>$1</code>"); - message = message.replace(/\|\|(.*?)\|\|/g, "<spoiler>$1</spoiler>"); - message = message.replace(/(?<!\!)\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>'); - message = message.replace(/!\[([^\]]+)\]\(tg:\/\/emoji\?id=(\d+)\)/g, '<tg-emoji emoji-id="$2">$1</tg-emoji>'); - return html_1.HTMLParser.parse(message); - } - static unparse(text, entities2) { - text = html_1.HTMLParser.unparse(text, entities2); - text = text.replace(/<b>(.*?)<\/b>/g, "*$1*"); - text = text.replace(/<u>(.*?)<\/u>/g, "__$1__"); - text = text.replace(/<code>(.*?)<\/code>/g, "`$1`"); - text = text.replace(/<pre>(.*?)<\/pre>/g, "```$1```"); - text = text.replace(/<s>(.*?)<\/s>/g, "~$1~"); - text = text.replace(/<i>(.*?)<\/i>/g, "-$1-"); - text = text.replace(/<spoiler>(.*?)<\/spoiler>/g, "||$1||"); - text = text.replace(/<a href="([^"]+)">([^<]+)<\/a>/g, "[$2]($1)"); - text = text.replace(/<tg-emoji emoji-id="(\d+)">([^<]+)<\/tg-emoji>/g, "![$2](tg://emoji?id=$1)"); - return text; - } + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet }; - exports2.MarkdownV2Parser = MarkdownV2Parser; - } -}); - -// node_modules/telegram/Utils.js -var require_Utils = __commonJS({ - "node_modules/telegram/Utils.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; + CSSOM2.CSSNamespaceRule = function CSSNamespaceRule() { + CSSOM2.CSSRule.call(this); + this.__prefix = ""; + this.__namespaceURI = ""; }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getFileInfo = getFileInfo; - exports2.chunks = chunks; - exports2.getInputPeer = getInputPeer; - exports2._photoSizeByteCount = _photoSizeByteCount; - exports2._getEntityPair = _getEntityPair; - exports2.getInnerText = getInnerText; - exports2.getInputChannel = getInputChannel; - exports2.getInputUser = getInputUser; - exports2.getInputMessage = getInputMessage; - exports2.getInputChatPhoto = getInputChatPhoto; - exports2.strippedPhotoToJpg = strippedPhotoToJpg; - exports2.getInputPhoto = getInputPhoto; - exports2.getInputDocument = getInputDocument; - exports2.isAudio = isAudio; - exports2.isImage = isImage; - exports2.getExtension = getExtension; - exports2.getAttributes = getAttributes; - exports2.getInputGeo = getInputGeo; - exports2.getInputMedia = getInputMedia; - exports2.getAppropriatedPartSize = getAppropriatedPartSize; - exports2.getPeer = getPeer; - exports2.sanitizeParseMode = sanitizeParseMode; - exports2.getPeerId = getPeerId; - exports2.resolveId = resolveId; - exports2.getMessageId = getMessageId; - exports2.parsePhone = parsePhone; - exports2.parseID = parseID; - exports2.resolveInviteLink = resolveInviteLink; - exports2.parseUsername = parseUsername; - exports2.rtrim = rtrim; - exports2.getDisplayName = getDisplayName; - var big_integer_1 = __importDefault2(require_BigInteger()); - var mime_1 = __importDefault2(require_mime2()); - var html_1 = require_html(); - var markdown_1 = require_markdown(); - var markdownv2_1 = require_markdownv2(); - var Helpers_1 = require_Helpers(); - var tl_1 = require_tl(); - function getFileInfo(fileLocation) { - if (!fileLocation || !fileLocation.SUBCLASS_OF_ID) { - _raiseCastFail(fileLocation, "InputFileLocation"); - } - if (fileLocation.SUBCLASS_OF_ID == 354669666) { - return { - dcId: void 0, - location: fileLocation, - size: void 0 - }; - } - let location; - if (fileLocation instanceof tl_1.Api.Message) { - location = fileLocation.media; - } - if (fileLocation instanceof tl_1.Api.MessageMediaDocument) { - location = fileLocation.document; - } else if (fileLocation instanceof tl_1.Api.MessageMediaPhoto) { - location = fileLocation.photo; - } - if (location instanceof tl_1.Api.Document) { - return { - dcId: location.dcId, - location: new tl_1.Api.InputDocumentFileLocation({ - id: location.id, - accessHash: location.accessHash, - fileReference: location.fileReference, - thumbSize: "" - }), - size: location.size - }; - } else if (location instanceof tl_1.Api.Photo) { - return { - dcId: location.dcId, - location: new tl_1.Api.InputPhotoFileLocation({ - id: location.id, - accessHash: location.accessHash, - fileReference: location.fileReference, - thumbSize: location.sizes[location.sizes.length - 1].type - }), - size: (0, big_integer_1.default)(_photoSizeByteCount(location.sizes[location.sizes.length - 1]) || 0) - }; + CSSOM2.CSSNamespaceRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSNamespaceRule.prototype.constructor = CSSOM2.CSSNamespaceRule; + Object.setPrototypeOf(CSSOM2.CSSNamespaceRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "type", { + value: 10, + writable: false + }); + Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "cssText", { + get: function() { + return "@namespace" + (this.prefix && " " + this.prefix) + ' url("' + this.namespaceURI + '");'; } - _raiseCastFail(fileLocation, "InputFileLocation"); - } - function* chunks(arr, size = 100) { - for (let i = 0; i < arr.length; i += size) { - yield arr.slice(i, i + size); + }); + Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "prefix", { + get: function() { + return this.__prefix; } - } - var USERNAME_RE = new RegExp("@|(?:https?:\\/\\/)?(?:www\\.)?(?:telegram\\.(?:me|dog)|t\\.me)\\/(@|joinchat\\/)?", "i"); - var JPEG_HEADER = Buffer.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00", "hex"); - var JPEG_FOOTER = Buffer.from("ffd9", "hex"); - var TG_JOIN_RE = new RegExp("tg:\\/\\/(join)\\?invite=", "i"); - var VALID_USERNAME_RE = new RegExp("^([a-z]((?!__)[\\w\\d]){3,30}[a-z\\d]|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$", "i"); - function _raiseCastFail(entity, target) { - let toWrite = entity; - if (typeof entity === "object" && "className" in entity) { - toWrite = entity.className; + }); + Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "namespaceURI", { + get: function() { + return this.__namespaceURI; } - throw new Error(`Cannot cast ${toWrite} to any kind of ${target}`); - } - function getInputPeer(entity, allowSelf = true, checkHash = true) { - if (entity.SUBCLASS_OF_ID === void 0) { - if (allowSelf && "inputEntity" in entity) { - return entity.inputEntity; - } else if ("entity" in entity) { - return getInputPeer(entity.entity); - } else { - _raiseCastFail(entity, "InputPeer"); + }); + Object.defineProperty(CSSOM2.CSSNamespaceRule.prototype, "parse", { + value: function(cssText) { + var newPrefix = ""; + var newNamespaceURI = ""; + var text = cssText.trim(); + if (text.indexOf("@namespace") === 0) { + text = text.slice("@namespace".length).trim(); } - } - if (entity.SUBCLASS_OF_ID === 3374092470) { - return entity; - } - if (entity instanceof tl_1.Api.User) { - if (entity.self && allowSelf) { - return new tl_1.Api.InputPeerSelf(); - } else if (entity.accessHash !== void 0 && !entity.min || !checkHash) { - return new tl_1.Api.InputPeerUser({ - userId: entity.id, - accessHash: entity.accessHash || (0, big_integer_1.default)(0) - }); - } else { - throw new Error("User without accessHash or min cannot be input"); + if (text.charAt(text.length - 1) === ";") { + text = text.slice(0, -1).trim(); } - } - if (entity instanceof tl_1.Api.Chat || entity instanceof tl_1.Api.ChatEmpty || entity instanceof tl_1.Api.ChatForbidden) { - return new tl_1.Api.InputPeerChat({ chatId: entity.id }); - } - if (entity instanceof tl_1.Api.Channel) { - if (entity.accessHash !== void 0 && !entity.min || !checkHash) { - return new tl_1.Api.InputPeerChannel({ - channelId: entity.id, - accessHash: entity.accessHash || (0, big_integer_1.default)(0) - }); + var re = /^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s*|([^)]*?))\s*\)|(['"])(.*?)\5)$/; + var match = text.match(re); + if (match) { + if (match[1]) { + newPrefix = match[1]; + } + if (typeof match[3] !== "undefined") { + newNamespaceURI = match[3]; + } else if (typeof match[4] !== "undefined") { + newNamespaceURI = match[4].trim(); + } else if (typeof match[6] !== "undefined") { + newNamespaceURI = match[6]; + } + this.__prefix = newPrefix; + this.__namespaceURI = newNamespaceURI; } else { - throw new TypeError("Channel without accessHash or min info cannot be input"); + throw new DOMException("Invalid @namespace rule", "InvalidStateError"); } } - if (entity instanceof tl_1.Api.ChannelForbidden) { - return new tl_1.Api.InputPeerChannel({ - channelId: entity.id, - accessHash: entity.accessHash - }); - } - if (entity instanceof tl_1.Api.InputUser) { - return new tl_1.Api.InputPeerUser({ - userId: entity.userId, - accessHash: entity.accessHash - }); - } - if (entity instanceof tl_1.Api.InputChannel) { - return new tl_1.Api.InputPeerChannel({ - channelId: entity.channelId, - accessHash: entity.accessHash - }); - } - if (entity instanceof tl_1.Api.UserEmpty) { - return new tl_1.Api.InputPeerEmpty(); - } - if (entity instanceof tl_1.Api.UserFull) { - return getInputPeer(entity.id); - } - if (entity instanceof tl_1.Api.ChatFull) { - return new tl_1.Api.InputPeerChat({ chatId: entity.id }); - } - if (entity instanceof tl_1.Api.PeerChat) { - return new tl_1.Api.InputPeerChat({ - chatId: entity.chatId - }); + }); + exports2.CSSNamespaceRule = CSSOM2.CSSNamespaceRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSConditionRule.js +var require_CSSConditionRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSConditionRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule + }; + CSSOM2.CSSConditionRule = function CSSConditionRule() { + CSSOM2.CSSGroupingRule.call(this); + this.__conditionText = ""; + }; + CSSOM2.CSSConditionRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSConditionRule.prototype.constructor = CSSOM2.CSSConditionRule; + Object.setPrototypeOf(CSSOM2.CSSConditionRule, CSSOM2.CSSGroupingRule); + Object.defineProperty(CSSOM2.CSSConditionRule.prototype, "conditionText", { + get: function() { + return this.__conditionText; } - _raiseCastFail(entity, "InputPeer"); - } - function _photoSizeByteCount(size) { - if (size instanceof tl_1.Api.PhotoSize) { - return size.size; - } else if (size instanceof tl_1.Api.PhotoStrippedSize) { - if (size.bytes.length < 3 || size.bytes[0] != 1) { - return size.bytes.length; + }); + exports2.CSSConditionRule = CSSOM2.CSSConditionRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSMediaRule.js +var require_CSSMediaRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSMediaRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, + CSSConditionRule: require_CSSConditionRule().CSSConditionRule, + MediaList: require_MediaList().MediaList + }; + CSSOM2.CSSMediaRule = function CSSMediaRule() { + CSSOM2.CSSConditionRule.call(this); + this.__media = new CSSOM2.MediaList(); + }; + CSSOM2.CSSMediaRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); + CSSOM2.CSSMediaRule.prototype.constructor = CSSOM2.CSSMediaRule; + Object.setPrototypeOf(CSSOM2.CSSMediaRule, CSSOM2.CSSConditionRule); + Object.defineProperty(CSSOM2.CSSMediaRule.prototype, "type", { + value: 4, + writable: false + }); + Object.defineProperties(CSSOM2.CSSMediaRule.prototype, { + "media": { + get: function() { + return this.__media; + }, + set: function(value) { + if (typeof value === "string") { + this.__media.mediaText = value; + } else { + this.__media = value; + } + }, + configurable: true, + enumerable: true + }, + "conditionText": { + get: function() { + return this.media.mediaText; } - return size.bytes.length + 622; - } else if (size instanceof tl_1.Api.PhotoCachedSize) { - return size.bytes.length; - } else if (size instanceof tl_1.Api.PhotoSizeEmpty) { - return 0; - } else if (size instanceof tl_1.Api.PhotoSizeProgressive) { - return size.sizes[size.sizes.length - 1]; - } else { - return void 0; - } - } - function _getEntityPair(entityId, entities2, cache, getInputPeerFunction = getInputPeer) { - const entity = entities2.get(entityId); - let inputEntity; - try { - inputEntity = cache.get(entityId); - } catch (e) { - try { - inputEntity = getInputPeerFunction(inputEntity); - } catch (e2) { + }, + "cssText": { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@media " + this.media.mediaText + values; } } - return [entity, inputEntity]; - } - function getInnerText(text, entities2) { - const result = []; - entities2.forEach(function(value, key2) { - const start = value.offset; - const end = value.offset + value.length; - result.push(text.slice(start, end)); - }); - return result; - } - function getInputChannel(entity) { - if (typeof entity === "string" || typeof entity == "number" || typeof entity == "bigint" || big_integer_1.default.isInstance(entity)) { - _raiseCastFail(entity, "InputChannel"); - } - if (entity.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(entity, "InputChannel"); - } - if (entity.SUBCLASS_OF_ID === 1089602301) { - return entity; - } - if (entity instanceof tl_1.Api.Channel || entity instanceof tl_1.Api.ChannelForbidden) { - return new tl_1.Api.InputChannel({ - channelId: entity.id, - accessHash: entity.accessHash || big_integer_1.default.zero - }); - } - if (entity instanceof tl_1.Api.InputPeerChannel) { - return new tl_1.Api.InputChannel({ - channelId: entity.channelId, - accessHash: entity.accessHash - }); - } - _raiseCastFail(entity, "InputChannel"); - } - function getInputUser(entity) { - if (typeof entity === "string" || typeof entity == "number" || typeof entity == "bigint" || big_integer_1.default.isInstance(entity)) { - _raiseCastFail(entity, "InputUser"); - } - if (entity.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(entity, "InputUser"); - } - if (entity.SUBCLASS_OF_ID === 3865689926) { - return entity; + }); + exports2.CSSMediaRule = CSSOM2.CSSMediaRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSCounterStyleRule.js +var require_CSSCounterStyleRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSCounterStyleRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule + }; + CSSOM2.CSSCounterStyleRule = function CSSCounterStyleRule() { + CSSOM2.CSSRule.call(this); + this.name = ""; + this.__props = ""; + }; + CSSOM2.CSSCounterStyleRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSCounterStyleRule.prototype.constructor = CSSOM2.CSSCounterStyleRule; + Object.setPrototypeOf(CSSOM2.CSSCounterStyleRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "type", { + value: 11, + writable: false + }); + Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "cssText", { + get: function() { + return "@counter-style " + this.name + " { " + this.__props + " }"; } - if (entity instanceof tl_1.Api.User) { - if (entity.self) { - return new tl_1.Api.InputUserSelf(); - } else { - return new tl_1.Api.InputUser({ - userId: entity.id, - accessHash: entity.accessHash || big_integer_1.default.zero + }); + Object.defineProperty(CSSOM2.CSSCounterStyleRule.prototype, "parse", { + value: function(cssText) { + var match = cssText.match(/@counter-style\s+([^\s{]+)\s*\{([^]*)\}/); + if (match) { + this.name = match[1]; + var propsText = match[2]; + this.__props = propsText.trim().replace(/\n/g, " ").replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g, function(match2, quote) { + return quote ? match2 : " "; }); } } - if (entity instanceof tl_1.Api.InputPeerSelf) { - return new tl_1.Api.InputUserSelf(); + }); + exports2.CSSCounterStyleRule = CSSOM2.CSSCounterStyleRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSPropertyRule.js +var require_CSSPropertyRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSPropertyRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule + }; + CSSOM2.CSSPropertyRule = function CSSPropertyRule() { + CSSOM2.CSSRule.call(this); + this.__name = ""; + this.__syntax = ""; + this.__inherits = false; + this.__initialValue = null; + }; + CSSOM2.CSSPropertyRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSPropertyRule.prototype.constructor = CSSOM2.CSSPropertyRule; + Object.setPrototypeOf(CSSOM2.CSSPropertyRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "type", { + value: 0, + writable: false + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "cssText", { + get: function() { + var text = "@property " + this.name + " {"; + if (this.syntax !== "") { + text += ' syntax: "' + this.syntax.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '";'; + } + text += " inherits: " + (this.inherits ? "true" : "false") + ";"; + if (this.initialValue !== null) { + text += " initial-value: " + this.initialValue + ";"; + } + text += " }"; + return text; } - if (entity instanceof tl_1.Api.UserEmpty || entity instanceof tl_1.Api.InputPeerEmpty) { - return new tl_1.Api.InputUserEmpty(); + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "name", { + get: function() { + return this.__name; } - if (entity instanceof tl_1.Api.UserFull) { - return getInputUser(entity); + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "syntax", { + get: function() { + return this.__syntax; } - if (entity instanceof tl_1.Api.InputPeerUser) { - return new tl_1.Api.InputUser({ - userId: entity.userId, - accessHash: entity.accessHash - }); + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "inherits", { + get: function() { + return this.__inherits; } - if (entity instanceof tl_1.Api.InputPeerUserFromMessage) { - return new tl_1.Api.InputUserFromMessage({ - userId: entity.userId, - peer: entity.peer, - msgId: entity.msgId - }); + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "initialValue", { + get: function() { + return this.__initialValue; } - _raiseCastFail(entity, "InputUser"); - } - function getInputMessage(message) { - if (typeof message === "number") { - return new tl_1.Api.InputMessageID({ id: message }); + }); + Object.defineProperty(CSSOM2.CSSPropertyRule.prototype, "parse", { + value: function(cssText) { + var match = cssText.match(/@property\s+(--[^\s{]+)\s*\{([^]*)\}/); + if (!match) { + return false; + } + this.__name = match[1]; + var bodyText = match[2]; + var syntaxMatch = bodyText.match(/syntax\s*:\s*(['"])([^]*?)\1\s*;/); + if (!syntaxMatch) { + return false; + } + this.__syntax = syntaxMatch[2]; + if (this.__syntax === "") { + return false; + } + var inheritsMatch = bodyText.match(/inherits\s*:\s*(true|false)\s*;/); + if (!inheritsMatch) { + return false; + } + this.__inherits = inheritsMatch[1] === "true"; + var initialValueMatch = bodyText.match(/initial-value\s*:\s*([^;]+);/); + if (initialValueMatch) { + this.__initialValue = initialValueMatch[1].trim(); + } else { + if (this.__syntax !== "*") { + return false; + } + } + return true; } - if (message === void 0 || message.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(message, "InputMessage"); + }); + exports2.CSSPropertyRule = CSSOM2.CSSPropertyRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSContainerRule.js +var require_CSSContainerRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSContainerRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, + CSSConditionRule: require_CSSConditionRule().CSSConditionRule + }; + CSSOM2.CSSContainerRule = function CSSContainerRule() { + CSSOM2.CSSConditionRule.call(this); + }; + CSSOM2.CSSContainerRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); + CSSOM2.CSSContainerRule.prototype.constructor = CSSOM2.CSSContainerRule; + Object.setPrototypeOf(CSSOM2.CSSContainerRule, CSSOM2.CSSConditionRule); + Object.defineProperty(CSSOM2.CSSContainerRule.prototype, "type", { + value: 17, + writable: false + }); + Object.defineProperties(CSSOM2.CSSContainerRule.prototype, { + "cssText": { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@container " + this.conditionText + values; + } + }, + "containerName": { + get: function() { + var parts = this.conditionText.trim().split(/\s+/); + if (parts.length > 1 && parts[0] !== "(" && !parts[0].startsWith("(")) { + return parts[0]; + } + return ""; + } + }, + "containerQuery": { + get: function() { + var parts = this.conditionText.trim().split(/\s+/); + if (parts.length > 1 && parts[0] !== "(" && !parts[0].startsWith("(")) { + return parts.slice(1).join(" "); + } + return this.conditionText; + } } - if (message.SUBCLASS_OF_ID === 1421262021) { - return message; - } else if (message.SUBCLASS_OF_ID === 2030045667) { - return new tl_1.Api.InputMessageID({ id: message.id }); + }); + exports2.CSSContainerRule = CSSOM2.CSSContainerRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSSupportsRule.js +var require_CSSSupportsRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSSupportsRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, + CSSConditionRule: require_CSSConditionRule().CSSConditionRule + }; + CSSOM2.CSSSupportsRule = function CSSSupportsRule() { + CSSOM2.CSSConditionRule.call(this); + }; + CSSOM2.CSSSupportsRule.prototype = Object.create(CSSOM2.CSSConditionRule.prototype); + CSSOM2.CSSSupportsRule.prototype.constructor = CSSOM2.CSSSupportsRule; + Object.setPrototypeOf(CSSOM2.CSSSupportsRule, CSSOM2.CSSConditionRule); + Object.defineProperty(CSSOM2.CSSSupportsRule.prototype, "type", { + value: 12, + writable: false + }); + Object.defineProperty(CSSOM2.CSSSupportsRule.prototype, "cssText", { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@supports " + this.conditionText + values; } - _raiseCastFail(message, "InputMessage"); + }); + exports2.CSSSupportsRule = CSSOM2.CSSSupportsRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSFontFaceRule.js +var require_CSSFontFaceRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSFontFaceRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, + CSSRule: require_CSSRule().CSSRule + }; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } - function getInputChatPhoto(photo) { - if (photo === void 0 || photo.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(photo, "InputChatPhoto"); + CSSOM2.CSSFontFaceRule = function CSSFontFaceRule() { + CSSOM2.CSSRule.call(this); + this.__style = new CSSOM2.CSSStyleDeclaration(); + this.__style.parentRule = this; + }; + CSSOM2.CSSFontFaceRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSFontFaceRule.prototype.constructor = CSSOM2.CSSFontFaceRule; + Object.setPrototypeOf(CSSOM2.CSSFontFaceRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "type", { + value: 5, + writable: false + }); + Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "style", { + get: function() { + return this.__style; + }, + set: function(value) { + if (typeof value === "string") { + this.__style.cssText = value; + } else { + this.__style = value; + } } - if (photo.SUBCLASS_OF_ID === 3572182388) { - return photo; - } else if (photo.SUBCLASS_OF_ID === 3882180383) { - return new tl_1.Api.InputChatUploadedPhoto({ - file: photo - }); + }); + Object.defineProperty(CSSOM2.CSSFontFaceRule.prototype, "cssText", { + get: function() { + return "@font-face {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; } - photo = getInputPhoto(photo); - if (photo instanceof tl_1.Api.InputPhoto) { - return new tl_1.Api.InputChatPhoto({ - id: photo - }); - } else if (photo instanceof tl_1.Api.InputPhotoEmpty) { - return new tl_1.Api.InputChatPhotoEmpty(); + }); + exports2.CSSFontFaceRule = CSSOM2.CSSFontFaceRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSHostRule.js +var require_CSSHostRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSHostRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList + }; + CSSOM2.CSSHostRule = function CSSHostRule() { + CSSOM2.CSSRule.call(this); + this.cssRules = new CSSOM2.CSSRuleList(); + }; + CSSOM2.CSSHostRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSHostRule.prototype.constructor = CSSOM2.CSSHostRule; + Object.setPrototypeOf(CSSOM2.CSSHostRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSHostRule.prototype, "type", { + value: 1001, + writable: false + }); + Object.defineProperty(CSSOM2.CSSHostRule.prototype, "cssText", { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@host" + values; } - _raiseCastFail(photo, "InputChatPhoto"); - } - function strippedPhotoToJpg(stripped) { - if (stripped.length < 3 || stripped[0] !== 1) { - return stripped; + }); + exports2.CSSHostRule = CSSOM2.CSSHostRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSStartingStyleRule.js +var require_CSSStartingStyleRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSStartingStyleRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule + }; + CSSOM2.CSSStartingStyleRule = function CSSStartingStyleRule() { + CSSOM2.CSSGroupingRule.call(this); + }; + CSSOM2.CSSStartingStyleRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSStartingStyleRule.prototype.constructor = CSSOM2.CSSStartingStyleRule; + Object.setPrototypeOf(CSSOM2.CSSStartingStyleRule, CSSOM2.CSSGroupingRule); + Object.defineProperty(CSSOM2.CSSStartingStyleRule.prototype, "type", { + value: 1002, + writable: false + }); + Object.defineProperty(CSSOM2.CSSStartingStyleRule.prototype, "cssText", { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@starting-style" + values; } - const header = Buffer.from(JPEG_HEADER); - header[164] = stripped[1]; - header[166] = stripped[2]; - return Buffer.concat([header, stripped.slice(3), JPEG_FOOTER]); + }); + exports2.CSSStartingStyleRule = CSSOM2.CSSStartingStyleRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSKeyframeRule.js +var require_CSSKeyframeRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSKeyframeRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration + }; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } - function getInputPhoto(photo) { - if (photo.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(photo, "InputPhoto"); + CSSOM2.CSSKeyframeRule = function CSSKeyframeRule() { + CSSOM2.CSSRule.call(this); + this.keyText = ""; + this.__style = new CSSOM2.CSSStyleDeclaration(); + this.__style.parentRule = this; + }; + CSSOM2.CSSKeyframeRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSKeyframeRule.prototype.constructor = CSSOM2.CSSKeyframeRule; + Object.setPrototypeOf(CSSOM2.CSSKeyframeRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "type", { + value: 8, + writable: false + }); + Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "style", { + get: function() { + return this.__style; + }, + set: function(value) { + if (typeof value === "string") { + this.__style.cssText = value; + } else { + this.__style = value; + } } - if (photo.SUBCLASS_OF_ID === 2221106144) { - return photo; + }); + Object.defineProperty(CSSOM2.CSSKeyframeRule.prototype, "cssText", { + get: function() { + return this.keyText + " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; } - if (photo instanceof tl_1.Api.Message) { - photo = photo.media; + }); + exports2.CSSKeyframeRule = CSSOM2.CSSKeyframeRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSKeyframesRule.js +var require_CSSKeyframesRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSKeyframesRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + parse: require_parse3().parse + }; + var errorUtils2 = require_errorUtils().errorUtils; + CSSOM2.CSSKeyframesRule = function CSSKeyframesRule() { + CSSOM2.CSSRule.call(this); + this.name = ""; + this.cssRules = new CSSOM2.CSSRuleList(); + this._setupIndexedAccess(); + var self2 = this; + var originalPush = this.cssRules.push; + var originalSplice = this.cssRules.splice; + Object.defineProperty(this.cssRules, "push", { + value: function() { + var result = originalPush.apply(this, arguments); + self2._setupIndexedAccess(); + return result; + }, + writable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(this.cssRules, "splice", { + value: function() { + var result = originalSplice.apply(this, arguments); + self2._setupIndexedAccess(); + return result; + }, + writable: true, + enumerable: false, + configurable: true + }); + }; + CSSOM2.CSSKeyframesRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSKeyframesRule.prototype.constructor = CSSOM2.CSSKeyframesRule; + Object.setPrototypeOf(CSSOM2.CSSKeyframesRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSKeyframesRule.prototype, "type", { + value: 7, + writable: false + }); + Object.defineProperty(CSSOM2.CSSKeyframesRule.prototype, "cssText", { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + var cssWideKeywords = ["initial", "inherit", "revert", "revert-layer", "unset", "none"]; + var processedName = cssWideKeywords.includes(this.name) ? '"' + this.name + '"' : this.name; + return "@" + (this._vendorPrefix || "") + "keyframes " + processedName + values; } - if (photo instanceof tl_1.Api.photos.Photo || photo instanceof tl_1.Api.MessageMediaPhoto) { - photo = photo.photo; + }); + CSSOM2.CSSKeyframesRule.prototype.appendRule = function appendRule(rule) { + if (arguments.length === 0) { + errorUtils2.throwMissingArguments(this, "appendRule", "CSSKeyframesRule"); } - if (photo instanceof tl_1.Api.Photo) { - return new tl_1.Api.InputPhoto({ - id: photo.id, - accessHash: photo.accessHash, - fileReference: photo.fileReference - }); + var parsedRule; + try { + var tempStyleSheet = CSSOM2.parse("@keyframes temp { " + rule + " }"); + if (tempStyleSheet.cssRules.length > 0 && tempStyleSheet.cssRules[0].cssRules.length > 0) { + parsedRule = tempStyleSheet.cssRules[0].cssRules[0]; + } else { + throw new Error("Failed to parse keyframe rule"); + } + } catch (e) { + errorUtils2.throwParseError(this, "appendRule", "CSSKeyframesRule", rule); } - if (photo instanceof tl_1.Api.PhotoEmpty) { - return new tl_1.Api.InputPhotoEmpty(); + parsedRule.__parentRule = this; + this.cssRules.push(parsedRule); + }; + CSSOM2.CSSKeyframesRule.prototype.deleteRule = function deleteRule(select) { + if (arguments.length === 0) { + errorUtils2.throwMissingArguments(this, "deleteRule", "CSSKeyframesRule"); + } + var normalizedSelect = this._normalizeKeyText(select); + for (var i = 0; i < this.cssRules.length; i++) { + var rule = this.cssRules[i]; + if (this._normalizeKeyText(rule.keyText) === normalizedSelect) { + rule.__parentRule = null; + this.cssRules.splice(i, 1); + return; + } } - if (photo instanceof tl_1.Api.messages.ChatFull) { - photo = photo.fullChat; + }; + CSSOM2.CSSKeyframesRule.prototype.findRule = function findRule(select) { + if (arguments.length === 0) { + errorUtils2.throwMissingArguments(this, "findRule", "CSSKeyframesRule"); } - if (photo instanceof tl_1.Api.ChannelFull) { - return getInputPhoto(photo.chatPhoto); - } else { - if (photo instanceof tl_1.Api.UserFull) { - return getInputPhoto(photo.profilePhoto); - } else { - if (photo instanceof tl_1.Api.Channel || photo instanceof tl_1.Api.Chat || photo instanceof tl_1.Api.User) { - return getInputPhoto(photo.photo); - } + var normalizedSelect = this._normalizeKeyText(select); + for (var i = this.cssRules.length - 1; i >= 0; i--) { + var rule = this.cssRules[i]; + if (this._normalizeKeyText(rule.keyText) === normalizedSelect) { + return rule; } } - if (photo instanceof tl_1.Api.UserEmpty || photo instanceof tl_1.Api.ChatEmpty || photo instanceof tl_1.Api.ChatForbidden || photo instanceof tl_1.Api.ChannelForbidden) { - return new tl_1.Api.InputPhotoEmpty(); + return null; + }; + CSSOM2.CSSKeyframesRule.prototype._normalizeKeyText = function _normalizeKeyText(keyText) { + if (!keyText) return ""; + var normalized2 = keyText.toString().trim().toLowerCase(); + if (normalized2 === "from") { + return "0%"; + } else if (normalized2 === "to") { + return "100%"; } - _raiseCastFail(photo, "InputPhoto"); + return normalized2; + }; + if (typeof Symbol !== "undefined" && Symbol.iterator) { + CSSOM2.CSSKeyframesRule.prototype[Symbol.iterator] = function() { + var index2 = 0; + var cssRules = this.cssRules; + return { + next: function() { + if (index2 < cssRules.length) { + return { value: cssRules[index2++], done: false }; + } else { + return { done: true }; + } + } + }; + }; } - function getInputDocument(document2) { - if (document2.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(document2, "InputDocument"); - } - if (document2.SUBCLASS_OF_ID === 4081048424) { - return document2; - } - if (document2 instanceof tl_1.Api.Document) { - return new tl_1.Api.InputDocument({ - id: document2.id, - accessHash: document2.accessHash, - fileReference: document2.fileReference - }); + CSSOM2.CSSKeyframesRule.prototype._setupIndexedAccess = function() { + for (var i = 0; i < 1e3; i++) { + if (this.hasOwnProperty(i)) { + delete this[i]; + } else { + break; + } } - if (document2 instanceof tl_1.Api.DocumentEmpty) { - return new tl_1.Api.InputDocumentEmpty(); + for (var i = 0; i < this.cssRules.length; i++) { + (function(index2) { + Object.defineProperty(this, index2, { + get: function() { + return this.cssRules[index2]; + }, + enumerable: false, + configurable: true + }); + }).call(this, i); } - if (document2 instanceof tl_1.Api.MessageMediaDocument) { - return getInputDocument(document2.document); + Object.defineProperty(this, "length", { + get: function() { + return this.cssRules.length; + }, + enumerable: false, + configurable: true + }); + }; + exports2.CSSKeyframesRule = CSSOM2.CSSKeyframesRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSValue.js +var require_CSSValue = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSValue.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + CSSOM2.CSSValue = function CSSValue() { + }; + CSSOM2.CSSValue.prototype = { + constructor: CSSOM2.CSSValue, + // @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue + set cssText(text) { + var name = this._getConstructorName(); + throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!'); + }, + get cssText() { + var name = this._getConstructorName(); + throw new Error('getter "cssText" of "' + name + '" is not implemented!'); + }, + _getConstructorName: function() { + var s = this.constructor.toString(), c = s.match(/function\s([^\(]+)/), name = c[1]; + return name; } - if (document2 instanceof tl_1.Api.Message) { - return getInputDocument(document2.media); + }; + exports2.CSSValue = CSSOM2.CSSValue; + } +}); + +// node_modules/@acemir/cssom/lib/CSSValueExpression.js +var require_CSSValueExpression = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSValueExpression.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSValue: require_CSSValue().CSSValue + }; + CSSOM2.CSSValueExpression = function CSSValueExpression(token, idx) { + this._token = token; + this._idx = idx; + }; + CSSOM2.CSSValueExpression.prototype = Object.create(CSSOM2.CSSValue.prototype); + CSSOM2.CSSValueExpression.prototype.constructor = CSSOM2.CSSValueExpression; + Object.setPrototypeOf(CSSOM2.CSSValueExpression, CSSOM2.CSSValue); + CSSOM2.CSSValueExpression.prototype.parse = function() { + var token = this._token, idx = this._idx; + var character = "", expression = "", error = "", info, paren = []; + for (; ; ++idx) { + character = token.charAt(idx); + if (character === "") { + error = "css expression error: unfinished expression!"; + break; + } + switch (character) { + case "(": + paren.push(character); + expression += character; + break; + case ")": + paren.pop(character); + expression += character; + break; + case "/": + if (info = this._parseJSComment(token, idx)) { + if (info.error) { + error = "css expression error: unfinished comment in expression!"; + } else { + idx = info.idx; + } + } else if (info = this._parseJSRexExp(token, idx)) { + idx = info.idx; + expression += info.text; + } else { + expression += character; + } + break; + case "'": + case '"': + info = this._parseJSString(token, idx, character); + if (info) { + idx = info.idx; + expression += info.text; + } else { + expression += character; + } + break; + default: + expression += character; + break; + } + if (error) { + break; + } + if (paren.length === 0) { + break; + } } - _raiseCastFail(document2, "InputDocument"); - } - function isAudio(file) { - const ext = _getExtension(file); - if (!ext) { - const metadata = _getMetadata(file); - return (metadata.get("mimeType") || "").startsWith("audio/"); + var ret; + if (error) { + ret = { + error + }; } else { - file = "a" + ext; - return (mime_1.default.getType(file) || "").startsWith("audio/"); - } - } - function isImage(file) { - const ext = _getExtension(file).toLowerCase(); - return ext.endsWith(".png") || ext.endsWith(".jpg") || ext.endsWith(".jpeg"); - } - function getExtension(media) { - try { - getInputPhoto(media); - return ".jpg"; - } catch (e) { - } - if (media instanceof tl_1.Api.UserProfilePhoto || media instanceof tl_1.Api.ChatPhoto) { - return ".jpg"; - } - if (media instanceof tl_1.Api.MessageMediaDocument) { - media = media.document; + ret = { + idx, + expression + }; } - if (media instanceof tl_1.Api.Document || media instanceof tl_1.Api.WebDocument || media instanceof tl_1.Api.WebDocumentNoProxy) { - if (media.mimeType === "application/octet-stream") { - return ""; + return ret; + }; + CSSOM2.CSSValueExpression.prototype._parseJSComment = function(token, idx) { + var nextChar = token.charAt(idx + 1), text; + if (nextChar === "/" || nextChar === "*") { + var startIdx = idx, endIdx, commentEndChar; + if (nextChar === "/") { + commentEndChar = "\n"; + } else if (nextChar === "*") { + commentEndChar = "*/"; + } + endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1); + if (endIdx !== -1) { + endIdx = endIdx + commentEndChar.length - 1; + text = token.substring(idx, endIdx + 1); + return { + idx: endIdx, + text + }; } else { - return mime_1.default.getExtension(media.mimeType) || ""; + var error = "css expression error: unfinished comment in expression!"; + return { + error + }; } + } else { + return false; } - return ""; - } - function _getExtension(file) { - if (typeof file === "string") { - return "." + file.split(".").pop(); - } else if ("name" in file) { - return _getExtension(file.name); + }; + CSSOM2.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) { + var endIdx = this._findMatchedIdx(token, idx, sep), text; + if (endIdx === -1) { + return false; } else { - return getExtension(file); + text = token.substring(idx, endIdx + sep.length); + return { + idx: endIdx, + text + }; } - } - function _getMetadata(file) { - return /* @__PURE__ */ new Map(); - } - function isVideo(file) { - var _a3; - const ext = _getExtension(file); - if (!ext) { - const metadata = _getMetadata(file); - if (metadata.has("mimeType")) { - return ((_a3 = metadata.get("mimeType")) === null || _a3 === void 0 ? void 0 : _a3.startsWith("video/")) || false; + }; + CSSOM2.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) { + var before = token.substring(0, idx).replace(/\s+$/, ""), legalRegx = [ + /^$/, + /\($/, + /\[$/, + /\!$/, + /\+$/, + /\-$/, + /\*$/, + /\/\s+/, + /\%$/, + /\=$/, + /\>$/, + /<$/, + /\&$/, + /\|$/, + /\^$/, + /\~$/, + /\?$/, + /\,$/, + /delete$/, + /in$/, + /instanceof$/, + /new$/, + /typeof$/, + /void$/ + ]; + var isLegal = legalRegx.some(function(reg) { + return reg.test(before); + }); + if (!isLegal) { + return false; + } else { + var sep = "/"; + return this._parseJSString(token, idx, sep); + } + }; + CSSOM2.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) { + var startIdx = idx, endIdx; + var NOT_FOUND = -1; + while (true) { + endIdx = token.indexOf(sep, startIdx + 1); + if (endIdx === -1) { + endIdx = NOT_FOUND; + break; } else { - return false; + var text = token.substring(idx + 1, endIdx), matched = text.match(/\\+$/); + if (!matched || matched[0] % 2 === 0) { + break; + } else { + startIdx = endIdx; + } } - } else { - file = "a" + ext; - return (mime_1.default.getType(file) || "").startsWith("video/"); } - } - function getAttributes(file, { attributes = null, mimeType = void 0, forceDocument = false, voiceNote = false, videoNote = false, supportsStreaming = false, thumb = null }) { - var _a3, _b, _c, _d; - const name = typeof file == "string" ? file : "name" in file ? file.name || "unnamed" : "unnamed"; - if (mimeType === void 0) { - mimeType = mime_1.default.getType(name) || "application/octet-stream"; + var nextNewLineIdx = token.indexOf("\n", idx + 1); + if (nextNewLineIdx < endIdx) { + endIdx = NOT_FOUND; } - const attrObj = /* @__PURE__ */ new Map(); - attrObj.set(tl_1.Api.DocumentAttributeFilename, new tl_1.Api.DocumentAttributeFilename({ - fileName: name.split(/[\\/]/).pop() || "" - })); - if (isAudio(file)) { - const m = _getMetadata(file); - attrObj.set(tl_1.Api.DocumentAttributeAudio, new tl_1.Api.DocumentAttributeAudio({ - voice: voiceNote, - title: m.has("title") ? m.get("title") : void 0, - performer: m.has("author") ? m.get("author") : void 0, - duration: Number.parseInt((_a3 = m.get("duration")) !== null && _a3 !== void 0 ? _a3 : "0") - })); + return endIdx; + }; + exports2.CSSValueExpression = CSSOM2.CSSValueExpression; + } +}); + +// node_modules/@acemir/cssom/lib/MatcherList.js +var require_MatcherList = __commonJS({ + "node_modules/@acemir/cssom/lib/MatcherList.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + CSSOM2.MatcherList = function MatcherList() { + this.length = 0; + }; + CSSOM2.MatcherList.prototype = { + constructor: CSSOM2.MatcherList, + /** + * @return {string} + */ + get matcherText() { + return Array.prototype.join.call(this, ", "); + }, + /** + * @param {string} value + */ + set matcherText(value) { + var values = value.split(","); + var length = this.length = values.length; + for (var i = 0; i < length; i++) { + this[i] = values[i].trim(); + } + }, + /** + * @param {string} matcher + */ + appendMatcher: function(matcher) { + if (Array.prototype.indexOf.call(this, matcher) === -1) { + this[this.length] = matcher; + this.length++; + } + }, + /** + * @param {string} matcher + */ + deleteMatcher: function(matcher) { + var index2 = Array.prototype.indexOf.call(this, matcher); + if (index2 !== -1) { + Array.prototype.splice.call(this, index2, 1); + } } - if (!forceDocument && isVideo(file)) { - let doc; - if (thumb) { - const t_m = _getMetadata(thumb); - const width = Number.parseInt((t_m === null || t_m === void 0 ? void 0 : t_m.get("width")) || "1"); - const height = Number.parseInt((t_m === null || t_m === void 0 ? void 0 : t_m.get("height")) || "1"); - doc = new tl_1.Api.DocumentAttributeVideo({ - duration: 0, - h: height, - w: width, - roundMessage: videoNote, - supportsStreaming - }); - } else { - const m = _getMetadata(file); - doc = new tl_1.Api.DocumentAttributeVideo({ - roundMessage: videoNote, - w: Number.parseInt((_b = m.get("width")) !== null && _b !== void 0 ? _b : "1"), - h: Number.parseInt((_c = m.get("height")) !== null && _c !== void 0 ? _c : "1"), - duration: Number.parseInt((_d = m.get("duration")) !== null && _d !== void 0 ? _d : "0"), - supportsStreaming - }); + }; + exports2.MatcherList = CSSOM2.MatcherList; + } +}); + +// node_modules/@acemir/cssom/lib/CSSDocumentRule.js +var require_CSSDocumentRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSDocumentRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + MatcherList: require_MatcherList().MatcherList + }; + CSSOM2.CSSDocumentRule = function CSSDocumentRule() { + CSSOM2.CSSRule.call(this); + this.matcher = new CSSOM2.MatcherList(); + this.cssRules = new CSSOM2.CSSRuleList(); + }; + CSSOM2.CSSDocumentRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSDocumentRule.prototype.constructor = CSSOM2.CSSDocumentRule; + Object.setPrototypeOf(CSSOM2.CSSDocumentRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSDocumentRule.prototype, "type", { + value: 10, + writable: false + }); + Object.defineProperty(CSSOM2.CSSDocumentRule.prototype, "cssText", { + get: function() { + var cssTexts = []; + for (var i = 0, length = this.cssRules.length; i < length; i++) { + cssTexts.push(this.cssRules[i].cssText); } - attrObj.set(tl_1.Api.DocumentAttributeVideo, doc); + return "@-moz-document " + this.matcher.matcherText + " {" + (cssTexts.length ? "\n " + cssTexts.join("\n ") : "") + "\n}"; } - if (videoNote) { - if (attrObj.has(tl_1.Api.DocumentAttributeAudio)) { - attrObj.get(tl_1.Api.DocumentAttributeAudio).voice = true; - } else { - attrObj.set(tl_1.Api.DocumentAttributeAudio, new tl_1.Api.DocumentAttributeAudio({ - duration: 0, - voice: true - })); + }); + exports2.CSSDocumentRule = CSSOM2.CSSDocumentRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSScopeRule.js +var require_CSSScopeRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSScopeRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule + }; + CSSOM2.CSSScopeRule = function CSSScopeRule() { + CSSOM2.CSSGroupingRule.call(this); + this.__start = null; + this.__end = null; + }; + CSSOM2.CSSScopeRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSScopeRule.prototype.constructor = CSSOM2.CSSScopeRule; + Object.setPrototypeOf(CSSOM2.CSSScopeRule, CSSOM2.CSSGroupingRule); + Object.defineProperties(CSSOM2.CSSScopeRule.prototype, { + type: { + value: 0, + writable: false + }, + cssText: { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@scope" + (this.start ? " (" + this.start + ")" : "") + (this.end ? " to (" + this.end + ")" : "") + values; + }, + configurable: true, + enumerable: true + }, + start: { + get: function() { + return this.__start; } - } - if (attributes) { - for (const a of attributes) { - attrObj.set(a.constructor, a); + }, + end: { + get: function() { + return this.__end; } } - return { - attrs: Array.from(attrObj.values()), - mimeType - }; - } - function getInputGeo(geo) { - if (geo === void 0 || geo.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(geo, "InputGeoPoint"); - } - if (geo.SUBCLASS_OF_ID === 70308389) { - return geo; - } - if (geo instanceof tl_1.Api.GeoPoint) { - return new tl_1.Api.InputGeoPoint({ lat: geo.lat, long: geo.long }); - } - if (geo instanceof tl_1.Api.GeoPointEmpty) { - return new tl_1.Api.InputGeoPointEmpty(); - } - if (geo instanceof tl_1.Api.MessageMediaGeo) { - return getInputGeo(geo.geo); + }); + exports2.CSSScopeRule = CSSOM2.CSSScopeRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSLayerBlockRule.js +var require_CSSLayerBlockRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSLayerBlockRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule + }; + CSSOM2.CSSLayerBlockRule = function CSSLayerBlockRule() { + CSSOM2.CSSGroupingRule.call(this); + this.name = ""; + }; + CSSOM2.CSSLayerBlockRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSLayerBlockRule.prototype.constructor = CSSOM2.CSSLayerBlockRule; + Object.setPrototypeOf(CSSOM2.CSSLayerBlockRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSLayerBlockRule.prototype, "type", { + value: 18, + writable: false + }); + Object.defineProperties(CSSOM2.CSSLayerBlockRule.prototype, { + cssText: { + get: function() { + var values = ""; + var valuesArr = [" {"]; + if (this.cssRules.length) { + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); + } + return acc; + }, []).join("\n ")); + } + values = valuesArr.join("\n ") + "\n}"; + return "@layer" + (this.name ? " " + this.name : "") + values; + } } - if (geo instanceof tl_1.Api.Message) { - return getInputGeo(geo.media); + }); + exports2.CSSLayerBlockRule = CSSOM2.CSSLayerBlockRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSLayerStatementRule.js +var require_CSSLayerStatementRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSLayerStatementRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSRule: require_CSSRule().CSSRule + }; + CSSOM2.CSSLayerStatementRule = function CSSLayerStatementRule() { + CSSOM2.CSSRule.call(this); + this.nameList = []; + }; + CSSOM2.CSSLayerStatementRule.prototype = Object.create(CSSOM2.CSSRule.prototype); + CSSOM2.CSSLayerStatementRule.prototype.constructor = CSSOM2.CSSLayerStatementRule; + Object.setPrototypeOf(CSSOM2.CSSLayerStatementRule, CSSOM2.CSSRule); + Object.defineProperty(CSSOM2.CSSLayerStatementRule.prototype, "type", { + value: 0, + writable: false + }); + Object.defineProperties(CSSOM2.CSSLayerStatementRule.prototype, { + cssText: { + get: function() { + return "@layer " + this.nameList.join(", ") + ";"; + } } - _raiseCastFail(geo, "InputGeoPoint"); + }); + exports2.CSSLayerStatementRule = CSSOM2.CSSLayerStatementRule; + } +}); + +// node_modules/@acemir/cssom/lib/CSSPageRule.js +var require_CSSPageRule = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSPageRule.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, + CSSRule: require_CSSRule().CSSRule, + CSSRuleList: require_CSSRuleList().CSSRuleList, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule + }; + var regexPatterns = require_regexPatterns().regexPatterns; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } - function getInputMedia(media, { isPhoto = false, attributes = void 0, forceDocument = false, voiceNote = false, videoNote = false, supportsStreaming = false } = {}) { - if (media.SUBCLASS_OF_ID === void 0) { - _raiseCastFail(media, "InputMedia"); - } - if (media.SUBCLASS_OF_ID === 4210575092) { - return media; - } else { - if (media.SUBCLASS_OF_ID === 2221106144) { - return new tl_1.Api.InputMediaPhoto({ id: media }); - } else { - if (media.SUBCLASS_OF_ID === 4081048424) { - return new tl_1.Api.InputMediaDocument({ id: media }); + CSSOM2.CSSPageRule = function CSSPageRule() { + CSSOM2.CSSGroupingRule.call(this); + this.__style = new CSSOM2.CSSStyleDeclaration(); + this.__style.parentRule = this; + }; + CSSOM2.CSSPageRule.prototype = Object.create(CSSOM2.CSSGroupingRule.prototype); + CSSOM2.CSSPageRule.prototype.constructor = CSSOM2.CSSPageRule; + Object.setPrototypeOf(CSSOM2.CSSPageRule, CSSOM2.CSSGroupingRule); + Object.defineProperty(CSSOM2.CSSPageRule.prototype, "type", { + value: 6, + writable: false + }); + Object.defineProperty(CSSOM2.CSSPageRule.prototype, "selectorText", { + get: function() { + return this.__selectorText; + }, + set: function(value) { + if (typeof value === "string") { + var trimmedValue = value.trim(); + if (trimmedValue === "") { + this.__selectorText = ""; + return; + } + var atPageRuleSelectorRegExp = regexPatterns.atPageRuleSelectorRegExp; + var cssCustomIdentifierRegExp = regexPatterns.cssCustomIdentifierRegExp; + var match = trimmedValue.match(atPageRuleSelectorRegExp); + if (match) { + var pageName = match[1] || ""; + var pseudoPages = match[2] || ""; + if (pageName) { + if (!cssCustomIdentifierRegExp.test(pageName)) { + return; + } + } + if (pseudoPages) { + var pseudos2 = pseudoPages.split(":").filter(function(p) { + return p; + }); + var validPseudos = ["left", "right", "first", "blank"]; + var allValid = true; + for (var j = 0; j < pseudos2.length; j++) { + if (validPseudos.indexOf(pseudos2[j].toLowerCase()) === -1) { + allValid = false; + break; + } + } + if (!allValid) { + return; + } + } + this.__selectorText = pageName + pseudoPages.toLowerCase(); } } } - if (media instanceof tl_1.Api.MessageMediaPhoto) { - return new tl_1.Api.InputMediaPhoto({ - id: getInputPhoto(media.photo), - ttlSeconds: media.ttlSeconds - }); - } - if (media instanceof tl_1.Api.Photo || media instanceof tl_1.Api.photos.Photo || media instanceof tl_1.Api.PhotoEmpty) { - return new tl_1.Api.InputMediaPhoto({ id: getInputPhoto(media) }); - } - if (media instanceof tl_1.Api.MessageMediaDocument) { - return new tl_1.Api.InputMediaDocument({ - id: getInputDocument(media.document), - ttlSeconds: media.ttlSeconds - }); - } - if (media instanceof tl_1.Api.Document || media instanceof tl_1.Api.DocumentEmpty) { - return new tl_1.Api.InputMediaDocument({ id: getInputDocument(media) }); - } - if (media instanceof tl_1.Api.InputFile || media instanceof tl_1.Api.InputFileBig) { - if (isPhoto) { - return new tl_1.Api.InputMediaUploadedPhoto({ file: media }); + }); + Object.defineProperty(CSSOM2.CSSPageRule.prototype, "style", { + get: function() { + return this.__style; + }, + set: function(value) { + if (typeof value === "string") { + this.__style.cssText = value; } else { - const { attrs, mimeType } = getAttributes(media, { - attributes, - forceDocument, - voiceNote, - videoNote, - supportsStreaming - }); - return new tl_1.Api.InputMediaUploadedDocument({ - file: media, - mimeType, - attributes: attrs, - forceFile: forceDocument - }); + this.__style = value; } } - if (media instanceof tl_1.Api.MessageMediaGame) { - return new tl_1.Api.InputMediaGame({ - id: new tl_1.Api.InputGameID({ - id: media.game.id, - accessHash: media.game.accessHash - }) - }); - } - if (media instanceof tl_1.Api.MessageMediaContact) { - return new tl_1.Api.InputMediaContact({ - phoneNumber: media.phoneNumber, - firstName: media.firstName, - lastName: media.lastName, - vcard: "" - }); - } - if (media instanceof tl_1.Api.MessageMediaGeo) { - return new tl_1.Api.InputMediaGeoPoint({ geoPoint: getInputGeo(media.geo) }); - } - if (media instanceof tl_1.Api.MessageMediaVenue) { - return new tl_1.Api.InputMediaVenue({ - geoPoint: getInputGeo(media.geo), - title: media.title, - address: media.address, - provider: media.provider, - venueId: media.venueId, - venueType: "" - }); - } - if (media instanceof tl_1.Api.MessageMediaDice) { - return new tl_1.Api.InputMediaDice({ - emoticon: media.emoticon - }); - } - if (media instanceof tl_1.Api.MessageMediaEmpty || media instanceof tl_1.Api.MessageMediaUnsupported || media instanceof tl_1.Api.ChatPhotoEmpty || media instanceof tl_1.Api.UserProfilePhotoEmpty || media instanceof tl_1.Api.ChatPhoto || media instanceof tl_1.Api.UserProfilePhoto) { - return new tl_1.Api.InputMediaEmpty(); - } - if (media instanceof tl_1.Api.Message) { - return getInputMedia(media.media, { isPhoto }); - } - if (media instanceof tl_1.Api.MessageMediaPoll) { - let correctAnswers; - if (media.poll.quiz) { - if (!media.results.results) { - throw new Error("Cannot cast unanswered quiz to any kind of InputMedia."); - } - correctAnswers = []; - for (const r of media.results.results) { - if (r.correct) { - correctAnswers.push(r.option); + }); + Object.defineProperty(CSSOM2.CSSPageRule.prototype, "cssText", { + get: function() { + var values = ""; + if (this.cssRules.length) { + var valuesArr = [" {"]; + this.style.cssText && valuesArr.push(this.style.cssText); + valuesArr.push(this.cssRules.reduce(function(acc, rule) { + if (rule.cssText !== "") { + acc.push(rule.cssText); } - } + return acc; + }, []).join("\n ")); + values = valuesArr.join("\n ") + "\n}"; } else { - correctAnswers = void 0; + values = " {" + (this.style.cssText ? " " + this.style.cssText : "") + " }"; } - return new tl_1.Api.InputMediaPoll({ - poll: media.poll, - correctAnswers, - solution: media.results.solution, - solutionEntities: media.results.solutionEntities - }); - } - if (media instanceof tl_1.Api.Poll) { - return new tl_1.Api.InputMediaPoll({ - poll: media - }); + return "@page" + (this.selectorText ? " " + this.selectorText : "") + values; } - _raiseCastFail(media, "InputMedia"); + }); + exports2.CSSPageRule = CSSOM2.CSSPageRule; + } +}); + +// node_modules/@acemir/cssom/lib/cssstyleTryCatchBlock.js +var require_cssstyleTryCatchBlock = __commonJS({ + "node_modules/@acemir/cssom/lib/cssstyleTryCatchBlock.js"() { + init_define_import_meta_env(); + try { + CSSOM.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { } - function getAppropriatedPartSize(fileSize) { - if (fileSize.lesser(104857600)) { - return 128; - } - if (fileSize.lesser(786432e3)) { - return 256; + } +}); + +// node_modules/@acemir/cssom/lib/parse.js +var require_parse3 = __commonJS({ + "node_modules/@acemir/cssom/lib/parse.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + var regexPatterns = require_regexPatterns().regexPatterns; + CSSOM2.parse = function parse3(token, opts, errorHandler) { + errorHandler = errorHandler === true ? console && console.error : errorHandler; + var i = 0; + var state2 = "before-selector"; + var index2; + var buffer = ""; + var valueParenthesisDepth = 0; + var hasUnmatchedQuoteInSelector = false; + var SIGNIFICANT_WHITESPACE = { + "name": true, + "before-name": true, + "selector": true, + "value": true, + "value-parenthesis": true, + "atRule": true, + "importRule-begin": true, + "importRule": true, + "namespaceRule-begin": true, + "namespaceRule": true, + "atBlock": true, + "containerBlock": true, + "conditionBlock": true, + "counterStyleBlock": true, + "propertyBlock": true, + "documentRule-begin": true, + "scopeBlock": true, + "layerBlock": true, + "pageBlock": true + }; + var styleSheet; + if (opts && opts.styleSheet) { + styleSheet = opts.styleSheet; + } else { + if (opts && opts.globalObject && opts.globalObject.CSSStyleSheet) { + styleSheet = new opts.globalObject.CSSStyleSheet(); + } else { + styleSheet = new CSSOM2.CSSStyleSheet(); + } + styleSheet.__constructed = false; } - return 512; - } - function getPeer(peer) { - if (!peer) { - _raiseCastFail(peer, "undefined"); + var topScope; + if (opts && opts.cssRules) { + topScope = { cssRules: opts.cssRules }; + } else { + topScope = styleSheet; } - if (typeof peer === "string") { - _raiseCastFail(peer, "peer"); + if (opts && opts.ownerNode) { + styleSheet.__ownerNode = opts.ownerNode; + var ownerNodeMedia = opts.ownerNode.media || opts.ownerNode.getAttribute && opts.ownerNode.getAttribute("media"); + if (ownerNodeMedia) { + styleSheet.media.mediaText = ownerNodeMedia; + } + var ownerNodeTitle = opts.ownerNode.title || opts.ownerNode.getAttribute && opts.ownerNode.getAttribute("title"); + if (ownerNodeTitle) { + styleSheet.__title = ownerNodeTitle; + } } - if (typeof peer == "number" || typeof peer == "bigint") { - peer = (0, Helpers_1.returnBigInt)(peer); + if (opts && opts.ownerRule) { + styleSheet.__ownerRule = opts.ownerRule; } - try { - if (big_integer_1.default.isInstance(peer)) { - const res = resolveId(peer); - if (res[1] === tl_1.Api.PeerChannel) { - return new tl_1.Api.PeerChannel({ channelId: res[0] }); - } else if (res[1] === tl_1.Api.PeerChat) { - return new tl_1.Api.PeerChat({ chatId: res[0] }); - } else { - return new tl_1.Api.PeerUser({ userId: res[0] }); - } - } - if (peer.SUBCLASS_OF_ID === void 0) { - throw new Error(); + var currentScope = topScope; + var parentRule; + var ancestorRules = []; + var prevScope; + var name, priority = "", styleRule, mediaRule, containerRule, counterStyleRule, propertyRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule, scopeRule, pageRule, layerBlockRule, layerStatementRule, nestedSelectorRule, namespaceRule; + var definedNamespacePrefixes = {}; + var ruleIdCounter = 0; + var addedToParent = {}; + var addedToTopScope = {}; + var addedToCurrentScope = {}; + function getRuleId(rule) { + if (!rule.__parseId) { + rule.__parseId = ++ruleIdCounter; } - if (peer.SUBCLASS_OF_ID === 47470215) { - return peer; - } else if (peer instanceof tl_1.Api.contacts.ResolvedPeer || peer instanceof tl_1.Api.InputNotifyPeer || peer instanceof tl_1.Api.TopPeer || peer instanceof tl_1.Api.Dialog || peer instanceof tl_1.Api.DialogPeer) { - return peer.peer; - } else if (peer instanceof tl_1.Api.ChannelFull) { - return new tl_1.Api.PeerChannel({ channelId: peer.id }); + return rule.__parseId; + } + var lastValidationBoundary = 0; + var validationRegexCache = {}; + function getValidationRegex(atRuleKey) { + if (!validationRegexCache[atRuleKey]) { + var sourceRuleRegExp = atRuleKey === "@import" ? forwardImportRuleValidationRegExp : forwardRuleValidationRegExp; + validationRegexCache[atRuleKey] = new RegExp(atRuleKey + sourceRuleRegExp.source, sourceRuleRegExp.flags); } - if (peer.SUBCLASS_OF_ID === 2105307014 || peer.SUBCLASS_OF_ID === 3653762072) { - if ("userId" in peer) { - return new tl_1.Api.PeerUser({ userId: peer.userId }); + return validationRegexCache[atRuleKey]; + } + var atKeyframesRegExp = regexPatterns.atKeyframesRegExp; + var beforeRulePortionRegExp = regexPatterns.beforeRulePortionRegExp; + var beforeRuleValidationRegExp = regexPatterns.beforeRuleValidationRegExp; + var forwardRuleValidationRegExp = regexPatterns.forwardRuleValidationRegExp; + var forwardImportRuleValidationRegExp = regexPatterns.forwardImportRuleValidationRegExp; + var regexBefore = new RegExp(beforeRulePortionRegExp.source, beforeRulePortionRegExp.flags); + var forwardRuleClosingBraceRegExp = regexPatterns.forwardRuleClosingBraceRegExp; + var forwardRuleSemicolonAndOpeningBraceRegExp = regexPatterns.forwardRuleSemicolonAndOpeningBraceRegExp; + var cssCustomIdentifierRegExp = regexPatterns.cssCustomIdentifierRegExp; + var startsWithCombinatorRegExp = regexPatterns.startsWithCombinatorRegExp; + var atPageRuleSelectorRegExp = regexPatterns.atPageRuleSelectorRegExp; + var startsWithHexEscapeRegExp = regexPatterns.startsWithHexEscapeRegExp; + var identStartCharRegExp = regexPatterns.identStartCharRegExp; + var identCharRegExp = regexPatterns.identCharRegExp; + var specialCharsNeedEscapeRegExp = regexPatterns.specialCharsNeedEscapeRegExp; + var combinatorOrSeparatorRegExp = regexPatterns.combinatorOrSeparatorRegExp; + var afterHexEscapeSeparatorRegExp = regexPatterns.afterHexEscapeSeparatorRegExp; + var trailingSpaceSeparatorRegExp = regexPatterns.trailingSpaceSeparatorRegExp; + var endsWithHexEscapeRegExp = regexPatterns.endsWithHexEscapeRegExp; + var attributeSelectorContentRegExp = regexPatterns.attributeSelectorContentRegExp; + var pseudoElementRegExp = regexPatterns.pseudoElementRegExp; + var invalidCombinatorLtGtRegExp = regexPatterns.invalidCombinatorLtGtRegExp; + var invalidCombinatorDoubleGtRegExp = regexPatterns.invalidCombinatorDoubleGtRegExp; + var consecutiveCombinatorsRegExp = regexPatterns.consecutiveCombinatorsRegExp; + var invalidSlottedRegExp = regexPatterns.invalidSlottedRegExp; + var invalidPartRegExp = regexPatterns.invalidPartRegExp; + var invalidCueRegExp = regexPatterns.invalidCueRegExp; + var invalidCueRegionRegExp = regexPatterns.invalidCueRegionRegExp; + var invalidNestingPattern = regexPatterns.invalidNestingPattern; + var emptyPseudoClassRegExp = regexPatterns.emptyPseudoClassRegExp; + var whitespaceNormalizationRegExp = regexPatterns.whitespaceNormalizationRegExp; + var newlineRemovalRegExp = regexPatterns.newlineRemovalRegExp; + var whitespaceAndDotRegExp = regexPatterns.whitespaceAndDotRegExp; + var declarationOrOpenBraceRegExp = regexPatterns.declarationOrOpenBraceRegExp; + var ampersandRegExp = regexPatterns.ampersandRegExp; + var hexEscapeSequenceRegExp = regexPatterns.hexEscapeSequenceRegExp; + var attributeCaseFlagRegExp = regexPatterns.attributeCaseFlagRegExp; + var prependedAmpersandRegExp = regexPatterns.prependedAmpersandRegExp; + var openBraceGlobalRegExp = regexPatterns.openBraceGlobalRegExp; + var closeBraceGlobalRegExp = regexPatterns.closeBraceGlobalRegExp; + var scopePreludeSplitRegExp = regexPatterns.scopePreludeSplitRegExp; + var leadingWhitespaceRegExp = regexPatterns.leadingWhitespaceRegExp; + var doubleQuoteRegExp = regexPatterns.doubleQuoteRegExp; + var backslashRegExp = regexPatterns.backslashRegExp; + var invalidMediaOperatorWithoutSpaceRegExp = regexPatterns.invalidMediaOperatorWithoutSpaceRegExp; + var invalidMediaNotAfterOperatorRegExp = regexPatterns.invalidMediaNotAfterOperatorRegExp; + var invalidMediaNotIdentifierRegExp = regexPatterns.invalidMediaNotIdentifierRegExp; + var invalidMediaNotAfterFeatureRegExp = regexPatterns.invalidMediaNotAfterFeatureRegExp; + var invalidMediaOperatorBetweenParensRegExp = regexPatterns.invalidMediaOperatorBetweenParensRegExp; + var invalidMediaNotWithMediaTypeRegExp = regexPatterns.invalidMediaNotWithMediaTypeRegExp; + var mediaFeatureColonRegExp = regexPatterns.mediaFeatureColonRegExp; + var identifierBeforeParenRegExp = regexPatterns.identifierBeforeParenRegExp; + var mediaAndOperatorRegExp = regexPatterns.mediaAndOperatorRegExp; + var mediaOrOperatorRegExp = regexPatterns.mediaOrOperatorRegExp; + var mediaNotOperatorStartRegExp = regexPatterns.mediaNotOperatorStartRegExp; + var mediaNotOperatorRegExp = regexPatterns.mediaNotOperatorRegExp; + function atRulesStatemenRegExpES5Alternative(ruleSlice) { + for (var i2 = 0; i2 < ruleSlice.length; i2++) { + var char = ruleSlice[i2]; + if (char === ";" || char === "}") { + var sliceBefore = ruleSlice.substring(0, i2); + var openBraceIndex = sliceBefore.indexOf("{"); + if (openBraceIndex === -1) { + var match = char; + var j = i2 + 1; + while (j < ruleSlice.length && /\s/.test(ruleSlice[j])) { + match += ruleSlice[j]; + j++; + } + var matchObj = [match]; + matchObj.index = i2; + matchObj.input = ruleSlice; + return matchObj; + } } } - peer = getInputPeer(peer, false, false); - if (peer instanceof tl_1.Api.InputPeerUser) { - return new tl_1.Api.PeerUser({ userId: peer.userId }); - } else if (peer instanceof tl_1.Api.InputPeerChat) { - return new tl_1.Api.PeerChat({ chatId: peer.chatId }); - } else if (peer instanceof tl_1.Api.InputPeerChannel) { - return new tl_1.Api.PeerChannel({ channelId: peer.channelId }); - } - } catch (e) { - } - _raiseCastFail(peer, "peer"); - } - function sanitizeParseMode(mode) { - if (mode === "md" || mode === "markdown") { - return markdown_1.MarkdownParser; - } - if (mode === "md2" || mode === "markdownv2") { - return markdownv2_1.MarkdownV2Parser; - } - if (mode == "html") { - return html_1.HTMLParser; - } - if (typeof mode == "object") { - if ("parse" in mode && "unparse" in mode) { - return mode; - } - } - throw new Error(`Invalid parse mode type ${mode}`); - } - function getPeerId(peer, addMark = true) { - if (typeof peer == "string" && parseID(peer)) { - peer = (0, Helpers_1.returnBigInt)(peer); - } - if (big_integer_1.default.isInstance(peer)) { - return addMark ? peer.toString() : resolveId(peer)[0].toString(); - } - if (peer instanceof tl_1.Api.InputPeerSelf) { - _raiseCastFail(peer, "int (you might want to use client.get_peer_id)"); - } - try { - peer = getPeer(peer); - } catch (e) { - _raiseCastFail(peer, "int"); + return null; } - if (peer instanceof tl_1.Api.PeerUser) { - return peer.userId.toString(); - } else if (peer instanceof tl_1.Api.PeerChat) { - peer.chatId = resolveId((0, Helpers_1.returnBigInt)(peer.chatId))[0]; - return addMark ? peer.chatId.negate().toString() : peer.chatId.toString(); - } else if (typeof peer == "object" && "channelId" in peer) { - peer.channelId = resolveId((0, Helpers_1.returnBigInt)(peer.channelId))[0]; - if (!addMark) { - return peer.channelId.toString(); + function matchBalancedBlock(str, fromIndex) { + fromIndex = fromIndex || 0; + var openIndex = str.indexOf("{", fromIndex); + if (openIndex === -1) return null; + var depth = 0; + for (var i2 = openIndex; i2 < str.length; i2++) { + if (str[i2] === "{") { + depth++; + } else if (str[i2] === "}") { + depth--; + if (depth === 0) { + var matchedString = str.slice(openIndex, i2 + 1); + return { + 0: matchedString, + index: openIndex, + input: str + }; + } + } } - return "-100" + peer.channelId.toString(); - } - _raiseCastFail(peer, "int"); - } - function resolveId(markedId) { - if (markedId.greaterOrEquals(big_integer_1.default.zero)) { - return [markedId, tl_1.Api.PeerUser]; - } - const m = markedId.toString().match(/-100([^0]\d*)/); - if (m) { - return [(0, big_integer_1.default)(m[1]), tl_1.Api.PeerChannel]; - } - return [markedId.negate(), tl_1.Api.PeerChat]; - } - function getMessageId(message) { - if (!message) { - return void 0; - } else if (typeof message === "number") { - return message; - } else if (message.SUBCLASS_OF_ID === 2030045667 || "id" in message) { - return message.id; - } else { - throw new Error(`Invalid message type: ${message.constructor.name}`); - } - } - function parsePhone(phone) { - phone = phone.toString().replace(/[()\s-]/gm, ""); - if (phone.startsWith("+") && phone.split("+").length - 1 == 1) { - return !isNaN(Number(phone)) ? phone.replace("+", "") : void 0; + return null; } - } - function parseID(id) { - const isValid = /^(-?[0-9][0-9]*)$/.test(id); - return isValid ? (0, big_integer_1.default)(id) : void 0; - } - function resolveInviteLink(link) { - throw new Error("not implemented"); - } - function parseUsername(username) { - username = username.trim(); - const m = username.match(USERNAME_RE) || username.match(TG_JOIN_RE); - if (m) { - username = username.replace(m[0], ""); - if (m[1]) { - return { - username, - isInvite: true - }; + function ignoreBalancedBlock(i2, str, fromIndex) { + var ruleClosingMatch2 = matchBalancedBlock(str, fromIndex); + if (ruleClosingMatch2) { + var ignoreRange = ruleClosingMatch2.index + ruleClosingMatch2[0].length; + i2 += ignoreRange; + if (token.charAt(i2) === "}") { + i2 -= 1; + } } else { - username = rtrim(username, "/"); + i2 += str.length; } + return i2; } - if (username.match(VALID_USERNAME_RE)) { - return { - username: username.toLowerCase(), - isInvite: false - }; - } else { + function parseScopePrelude(preludeContent) { + var parts = preludeContent.split(scopePreludeSplitRegExp); + if (parts.length === 2) { + parts[0] = parts[0] + ")"; + parts[1] = "(" + parts[1]; + } + var hasStart = parts[0] && parts[0].charAt(0) === "(" && parts[0].charAt(parts[0].length - 1) === ")"; + var hasEnd = parts[1] && parts[1].charAt(0) === "(" && parts[1].charAt(parts[1].length - 1) === ")"; + var hasOnlyEnd = !hasStart && !hasEnd && parts[0].indexOf("to (") === 0 && parts[0].charAt(parts[0].length - 1) === ")"; + var startSelector = ""; + var endSelector = ""; + if (hasStart) { + startSelector = parts[0].slice(1, -1).trim(); + } + if (hasEnd) { + endSelector = parts[1].slice(1, -1).trim(); + } + if (hasOnlyEnd) { + endSelector = parts[0].slice(4, -1).trim(); + } return { - username: void 0, - isInvite: false + startSelector, + endSelector, + hasStart, + hasEnd, + hasOnlyEnd }; } - } - function rtrim(s, mask) { - while (~mask.indexOf(s[s.length - 1])) { - s = s.slice(0, -1); + ; + function hasPseudoElement(selector2) { + return pseudoElementRegExp.test(selector2); } - return s; - } - function getDisplayName(entity) { - if (entity instanceof tl_1.Api.User) { - if (entity.lastName && entity.firstName) { - return `${entity.firstName} ${entity.lastName}`; - } else if (entity.firstName) { - return entity.firstName; - } else if (entity.lastName) { - return entity.lastName; + ; + function validateBalancedSyntax(selector2, trackAttributes, useStack) { + var parenDepth = 0; + var bracketDepth = 0; + var inSingleQuote = false; + var inDoubleQuote = false; + var inAttr = false; + var stack = useStack ? [] : null; + for (var i2 = 0; i2 < selector2.length; i2++) { + var char = selector2[i2]; + if (char === "\\") { + var escapeLen2 = getEscapeSequenceLength(selector2, i2); + if (escapeLen2 > 0) { + i2 += escapeLen2 - 1; + continue; + } + } + if (inSingleQuote) { + if (char === "'") { + inSingleQuote = false; + } + } else if (inDoubleQuote) { + if (char === '"') { + inDoubleQuote = false; + } + } else if (trackAttributes && inAttr) { + if (char === "]") { + inAttr = false; + } else if (char === "'") { + inSingleQuote = true; + } else if (char === '"') { + inDoubleQuote = true; + } + } else { + if (trackAttributes && char === "[") { + inAttr = true; + } else if (char === "'") { + inSingleQuote = true; + } else if (char === '"') { + inDoubleQuote = true; + } else if (char === "(") { + if (useStack) { + stack.push("("); + } else { + parenDepth++; + } + } else if (char === ")") { + if (useStack) { + if (!stack.length || stack.pop() !== "(") { + return false; + } + } else { + parenDepth--; + if (parenDepth < 0) { + return false; + } + } + } else if (char === "[") { + bracketDepth++; + } else if (char === "]") { + bracketDepth--; + if (bracketDepth < 0) { + return false; + } + } + } + } + if (useStack) { + return stack.length === 0 && bracketDepth === 0 && !inSingleQuote && !inDoubleQuote && !inAttr; } else { - return ""; + return parenDepth === 0 && bracketDepth === 0 && !inSingleQuote && !inDoubleQuote; } - } else if (entity instanceof tl_1.Api.Chat || entity instanceof tl_1.Api.Channel) { - return entity.title; } - return ""; - } - } -}); - -// node_modules/telegram/tl/custom/forward.js -var require_forward = __commonJS({ - "node_modules/telegram/tl/custom/forward.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Forward = void 0; - var chatGetter_1 = require_chatGetter(); - var senderGetter_1 = require_senderGetter(); - var Helpers_1 = require_Helpers(); - var Utils_1 = require_Utils(); - var inspect_1 = require_inspect(); - var Forward = class extends senderGetter_1.SenderGetter { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + ; + function hasBasicSyntaxError(selector2) { + return !validateBalancedSyntax(selector2, false, false); } - constructor(client2, original, entities2) { - super(); - this.originalFwd = original; - let senderId = void 0; - let sender = void 0; - let inputSender = void 0; - let peer = void 0; - let chat = void 0; - let inputChat = void 0; - if (original.fromId) { - const ty = (0, Helpers_1._entityType)(original.fromId); - if (ty === Helpers_1._EntityType.USER) { - senderId = (0, Utils_1.getPeerId)(original.fromId); - [sender, inputSender] = (0, Utils_1._getEntityPair)(senderId, entities2, client2._entityCache); - } else if (ty === Helpers_1._EntityType.CHANNEL || ty === Helpers_1._EntityType.CHAT) { - peer = original.fromId; - [chat, inputChat] = (0, Utils_1._getEntityPair)((0, Utils_1.getPeerId)(peer), entities2, client2._entityCache); + ; + function hasInvalidCombinators(selector2) { + if (invalidCombinatorLtGtRegExp.test(selector2)) return true; + if (invalidCombinatorDoubleGtRegExp.test(selector2)) return true; + if (consecutiveCombinatorsRegExp.test(selector2)) return true; + return false; + } + ; + function hasInvalidPseudoSyntax(selector2) { + var invalidPatterns = [ + invalidSlottedRegExp, + invalidPartRegExp, + invalidCueRegExp, + invalidCueRegionRegExp + ]; + for (var i2 = 0; i2 < invalidPatterns.length; i2++) { + if (invalidPatterns[i2].test(selector2)) { + return true; } } - chatGetter_1.ChatGetter.initChatClass(this, { - chatPeer: peer, - chat, - inputChat - }); - senderGetter_1.SenderGetter.initSenderClass(this, { - senderId: senderId ? (0, Helpers_1.returnBigInt)(senderId) : void 0, - sender, - inputSender - }); - this._client = client2; - } - }; - exports2.Forward = Forward; - } -}); - -// node_modules/telegram/tl/custom/file.js -var require_file = __commonJS({ - "node_modules/telegram/tl/custom/file.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.File = void 0; - var api_1 = require_api(); - var Utils_1 = require_Utils(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var File2 = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(media) { - this.media = media; - } - get id() { - throw new Error("Unsupported"); + return false; } - get name() { - return this._fromAttr(api_1.Api.DocumentAttributeFilename, "fileName"); + ; + function hasInvalidNestingSelector(selector2) { + return invalidNestingPattern.test(selector2); } - get mimeType() { - if (this.media instanceof api_1.Api.Photo) { - return "image/jpeg"; - } else if (this.media instanceof api_1.Api.Document) { - return this.media.mimeType; + ; + function canAtRuleBeNested() { + if (currentScope === topScope) { + return true; } - } - get width() { - return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "w"); - } - get height() { - return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "h"); - } - get duration() { - return this._fromAttr([api_1.Api.DocumentAttributeAudio, api_1.Api.DocumentAttributeVideo], "duration"); - } - get title() { - return this._fromAttr(api_1.Api.DocumentAttributeAudio, "title"); - } - get performer() { - return this._fromAttr(api_1.Api.DocumentAttributeAudio, "performer"); - } - get emoji() { - return this._fromAttr(api_1.Api.DocumentAttributeSticker, "alt"); - } - get stickerSet() { - return this._fromAttr(api_1.Api.DocumentAttributeSticker, "stickerset"); - } - get size() { - if (this.media instanceof api_1.Api.Photo) { - return (0, Utils_1._photoSizeByteCount)(this.media.sizes[this.media.sizes.length - 1]); - } else if (this.media instanceof api_1.Api.Document) { - return this.media.size; + var hasStyleRuleInChain = false; + var hasValidParent = false; + if (currentScope.constructor.name === "CSSStyleRule") { + hasStyleRuleInChain = true; + } else if (currentScope instanceof CSSOM2.CSSScopeRule || currentScope instanceof CSSOM2.CSSConditionRule) { + hasValidParent = true; + } + if (!hasStyleRuleInChain) { + for (var j = 0; j < ancestorRules.length; j++) { + if (ancestorRules[j].constructor.name === "CSSStyleRule") { + hasStyleRuleInChain = true; + break; + } + if (ancestorRules[j] instanceof CSSOM2.CSSScopeRule || ancestorRules[j] instanceof CSSOM2.CSSConditionRule) { + hasValidParent = true; + } + } } + return hasValidParent && !hasStyleRuleInChain; } - _fromAttr(cls, field) { - if (this.media instanceof api_1.Api.Document) { - for (const attr of this.media.attributes) { - if (attr instanceof cls) { - return attr[field]; + function validateAtRule(atRuleKey, validCallback, cannotBeNested2) { + var isValid2 = false; + var ruleRegExp = getValidationRegex(atRuleKey); + var lookAheadLength = Math.min(100, token.length - i); + var ruleSlice = token.slice(i, i + lookAheadLength); + var shouldPerformCheck = cannotBeNested2 && currentScope !== topScope ? false : true; + if (shouldPerformCheck && ruleSlice.search(ruleRegExp) === 0) { + var searchStart = Math.max(0, lastValidationBoundary); + var beforeSlice = token.slice(searchStart, i); + var matches = beforeSlice.match(regexBefore); + var lastI = matches ? searchStart + beforeSlice.lastIndexOf(matches[matches.length - 1]) : searchStart; + var toCheckSlice = token.slice(lastI, i); + var checkedSlice = toCheckSlice.search(beforeRuleValidationRegExp); + if (checkedSlice === 0) { + isValid2 = true; + lastValidationBoundary = lastI; + } + } + if (isValid2 && atRuleKey === "@scope") { + var openBraceIndex = ruleSlice.indexOf("{"); + if (openBraceIndex !== -1) { + var rulePrelude = ruleSlice.slice(0, openBraceIndex).trim(); + var preludeContent = rulePrelude.slice("@scope".length).trim(); + if (preludeContent.length > 0) { + var parsedScopePrelude2 = parseScopePrelude(preludeContent); + var startSelector = parsedScopePrelude2.startSelector; + var endSelector = parsedScopePrelude2.endSelector; + var hasStart = parsedScopePrelude2.hasStart; + var hasEnd = parsedScopePrelude2.hasEnd; + var hasOnlyEnd = parsedScopePrelude2.hasOnlyEnd; + if (hasStart && startSelector === "" || hasEnd && endSelector === "" || hasOnlyEnd && endSelector === "") { + isValid2 = false; + } else if (startSelector && hasPseudoElement(startSelector) || endSelector && hasPseudoElement(endSelector)) { + isValid2 = false; + } else if (startSelector && hasBasicSyntaxError(startSelector) || endSelector && hasBasicSyntaxError(endSelector)) { + isValid2 = false; + } else if (startSelector && hasInvalidCombinators(startSelector) || endSelector && hasInvalidCombinators(endSelector)) { + isValid2 = false; + } else if (startSelector && hasInvalidPseudoSyntax(startSelector) || endSelector && hasInvalidPseudoSyntax(endSelector)) { + isValid2 = false; + } else if (!hasStart && !hasOnlyEnd) { + isValid2 = false; + } + } + } + } + if (isValid2 && atRuleKey === "@page") { + var openBraceIndex = ruleSlice.indexOf("{"); + if (openBraceIndex !== -1) { + var rulePrelude = ruleSlice.slice(0, openBraceIndex).trim(); + var preludeContent = rulePrelude.slice("@page".length).trim(); + if (preludeContent.length > 0) { + var trimmedValue = preludeContent.trim(); + if (trimmedValue !== "") { + var match = trimmedValue.match(atPageRuleSelectorRegExp); + if (match) { + var pageName = match[1] || ""; + var pseudoPages = match[2] || ""; + if (pageName) { + if (!cssCustomIdentifierRegExp.test(pageName)) { + isValid2 = false; + } + } + if (pseudoPages) { + var pseudos2 = pseudoPages.split(":").filter(function(p) { + return p; + }); + var validPseudos = ["left", "right", "first", "blank"]; + var allValid = true; + for (var j = 0; j < pseudos2.length; j++) { + if (validPseudos.indexOf(pseudos2[j].toLowerCase()) === -1) { + allValid = false; + break; + } + } + if (!allValid) { + isValid2 = false; + } + } + } else { + isValid2 = false; + } + } + } + } + } + if (!isValid2) { + var ruleStatementMatch = atRulesStatemenRegExpES5Alternative(ruleSlice); + if (ruleStatementMatch && currentScope !== topScope) { + var ignoreEnd = ruleStatementMatch[0].indexOf(";"); + i += ruleStatementMatch.index + ignoreEnd; + return; + } + if (atRuleKey === "@layer") { + var ruleSemicolonAndOpeningBraceMatch = ruleSlice.match(forwardRuleSemicolonAndOpeningBraceRegExp); + if (ruleSemicolonAndOpeningBraceMatch && ruleSemicolonAndOpeningBraceMatch[1] === ";") { + i += ruleSemicolonAndOpeningBraceMatch.index + ruleSemicolonAndOpeningBraceMatch[0].length; + state2 = "before-selector"; + return; } } - } - } - }; - exports2.File = File2; - } -}); - -// node_modules/telegram/extensions/Logger.js -var require_Logger = __commonJS({ - "node_modules/telegram/extensions/Logger.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Logger = exports2.LogLevel = void 0; - var platform_1 = require_platform(); - var LogLevel; - (function(LogLevel2) { - LogLevel2["NONE"] = "none"; - LogLevel2["ERROR"] = "error"; - LogLevel2["WARN"] = "warn"; - LogLevel2["INFO"] = "info"; - LogLevel2["DEBUG"] = "debug"; - })(LogLevel || (exports2.LogLevel = LogLevel = {})); - var Logger = class { - constructor(level) { - this.levels = ["error", "warn", "info", "debug"]; - this._logLevel = level || LogLevel.INFO; - this.isBrowser = !platform_1.isNode; - if (!this.isBrowser) { - this.colors = { - start: "\x1B[2m", - warn: "\x1B[35m", - info: "\x1B[33m", - debug: "\x1B[36m", - error: "\x1B[31m", - end: "\x1B[0m" - }; + i = ignoreBalancedBlock(i, ruleSlice); + state2 = "before-selector"; } else { - this.colors = { - start: "%c", - warn: "color : #ff00ff", - info: "color : #ffff00", - debug: "color : #00ffff", - error: "color : #ff0000", - end: "" - }; + validCallback.call(this); } - this.messageFormat = "[%t] [%l] - [%m]"; - this.tzOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 6e4; - } - /** - * - * @param level {string} - * @returns {boolean} - */ - canSend(level) { - return this._logLevel ? this.levels.indexOf(this._logLevel) >= this.levels.indexOf(level) : false; - } - /** - * @param message {string} - */ - warn(message) { - this._log(LogLevel.WARN, message, this.colors.warn); - } - /** - * @param message {string} - */ - info(message) { - this._log(LogLevel.INFO, message, this.colors.info); - } - /** - * @param message {string} - */ - debug(message) { - this._log(LogLevel.DEBUG, message, this.colors.debug); - } - /** - * @param message {string} - */ - error(message) { - this._log(LogLevel.ERROR, message, this.colors.error); - } - format(message, level) { - return this.messageFormat.replace("%t", this.getDateTime()).replace("%l", level.toUpperCase()).replace("%m", message); } - get logLevel() { - return this._logLevel; - } - setLevel(level) { - this._logLevel = level; + function isIdentStart(c) { + return /[a-zA-Z_\u00A0-\uFFFF]/.test(c); } - static setLevel(level) { - console.log("Logger.setLevel is deprecated, it will has no effect. Please, use client.setLogLevel instead."); + function isIdentChar(c) { + return /[a-zA-Z0-9_\u00A0-\uFFFF\-]/.test(c); } - /** - * @param level {string} - * @param message {string} - * @param color {string} - */ - _log(level, message, color) { - if (this.canSend(level)) { - this.log(level, message, color); - } else { - return; + function looseSelectorValidator(selector2) { + if (!selector2 || selector2.length === 0) { + return false; } - } - /** - * Override this function for custom Logger. <br /> - * - * @remarks use `this.isBrowser` to check and handle for different environment. - * @param level {string} - * @param message {string} - * @param color {string} - */ - log(level, message, color) { - if (!this.isBrowser) { - console.log(color + this.format(message, level) + this.colors.end); - } else { - console.log(this.colors.start + this.format(message, level), color); + var i2 = 0; + var len = selector2.length; + var hasMatchedComponent = false; + function skipEscape() { + if (i2 < len && selector2[i2] === "\\") { + var escapeLen2 = getEscapeSequenceLength(selector2, i2); + if (escapeLen2 > 0) { + i2 += escapeLen2; + return true; + } + } + return false; } - } - getDateTime() { - return new Date(Date.now() - this.tzOffset).toISOString().slice(0, -1); - } - }; - exports2.Logger = Logger; - } -}); - -// node_modules/telegram/extensions/Deferred.js -var require_Deferred = __commonJS({ - "node_modules/telegram/extensions/Deferred.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - var Deferred = class _Deferred { - constructor() { - this.promise = new Promise((resolve, reject) => { - this.reject = reject; - this.resolve = resolve; - }); - } - static resolved(value) { - const deferred = new _Deferred(); - deferred.resolve(value); - return deferred; - } - }; - exports2.default = Deferred; - } -}); - -// node_modules/telegram/network/RequestState.js -var require_RequestState = __commonJS({ - "node_modules/telegram/network/RequestState.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RequestState = void 0; - var Deferred_1 = __importDefault2(require_Deferred()); - var RequestState = class { - constructor(request) { - this.containerId = void 0; - this.msgId = void 0; - this.request = request; - this.data = request.getBytes(); - this.after = void 0; - this.result = void 0; - this.finished = new Deferred_1.default(); - this.resetPromise(); - } - isReady() { - if (!this.after) { - return true; + function parseIdentifier() { + var start2 = i2; + while (i2 < len) { + if (skipEscape()) { + continue; + } else if (isIdentChar(selector2[i2])) { + i2++; + } else { + break; + } + } + return i2 > start2; } - return this.after.finished.promise; - } - resetPromise() { - var _a3; - (_a3 = this.reject) === null || _a3 === void 0 ? void 0 : _a3.call(this); - this.promise = new Promise((resolve, reject) => { - this.resolve = resolve; - this.reject = reject; - }); - } - }; - exports2.RequestState = RequestState; - } -}); - -// node_modules/telegram/client/users.js -var require_users = __commonJS({ - "node_modules/telegram/client/users.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.invoke = invoke; - exports2.getMe = getMe; - exports2.isBot = isBot; - exports2.isUserAuthorized = isUserAuthorized; - exports2.getEntity = getEntity; - exports2.getInputEntity = getInputEntity; - exports2._getEntityFromString = _getEntityFromString; - exports2.getPeerId = getPeerId; - exports2._getPeer = _getPeer; - exports2._getInputDialog = _getInputDialog; - exports2._getInputNotify = _getInputNotify; - exports2._selfId = _selfId; - var tl_1 = require_tl(); - var Utils_1 = require_Utils(); - var Helpers_1 = require_Helpers(); - var __1 = require_telegram(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var Logger_1 = require_Logger(); - var RequestState_1 = require_RequestState(); - async function invoke(client2, request, dcId, otherSender) { - if (request.classType !== "request") { - throw new Error("You can only invoke MTProtoRequests"); - } - let sender = client2._sender; - if (dcId) { - sender = await client2.getSender(dcId); - } - if (otherSender != void 0) { - sender = otherSender; - } - if (sender == void 0) { - throw new Error("Cannot send requests while disconnected. You need to call .connect()"); + function parseNamespace() { + var start2 = i2; + if (i2 < len && selector2[i2] === "*") { + i2++; + } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\")) { + parseIdentifier(); + } + if (i2 < len && selector2[i2] === "|") { + i2++; + return true; + } + i2 = start2; + return false; + } + function parsePseudoArgs() { + if (i2 >= len || selector2[i2] !== "(") { + return false; + } + i2++; + var depth2 = 1; + var inString = false; + var stringChar = ""; + while (i2 < len && depth2 > 0) { + var c = selector2[i2]; + if (c === "\\" && i2 + 1 < len) { + i2 += 2; + } else if (!inString && (c === '"' || c === "'")) { + inString = true; + stringChar = c; + i2++; + } else if (inString && c === stringChar) { + inString = false; + i2++; + } else if (!inString && c === "(") { + depth2++; + i2++; + } else if (!inString && c === ")") { + depth2--; + i2++; + } else { + i2++; + } + } + return depth2 === 0; + } + while (i2 < len) { + var matched = false; + var start = i2; + while (i2 < len && /\s/.test(selector2[i2])) { + i2++; + } + if (i2 > start) { + hasMatchedComponent = true; + continue; + } + if (i2 < len && /[>+~]/.test(selector2[i2])) { + i2++; + hasMatchedComponent = true; + while (i2 < len && /\s/.test(selector2[i2])) { + i2++; + } + continue; + } + if (i2 < len && selector2[i2] === "&") { + i2++; + hasMatchedComponent = true; + matched = true; + } else if (i2 < len && selector2[i2] === ".") { + i2++; + if (parseIdentifier()) { + hasMatchedComponent = true; + matched = true; + } + } else if (i2 < len && selector2[i2] === "#") { + i2++; + if (parseIdentifier()) { + hasMatchedComponent = true; + matched = true; + } + } else if (i2 < len && selector2[i2] === ":") { + i2++; + if (i2 < len && selector2[i2] === ":") { + i2++; + } + if (parseIdentifier()) { + parsePseudoArgs(); + hasMatchedComponent = true; + matched = true; + } + } else if (i2 < len && selector2[i2] === "[") { + i2++; + var depth = 1; + while (i2 < len && depth > 0) { + if (selector2[i2] === "\\") { + i2 += 2; + } else if (selector2[i2] === "'") { + i2++; + while (i2 < len && selector2[i2] !== "'") { + if (selector2[i2] === "\\") i2 += 2; + else i2++; + } + if (i2 < len) i2++; + } else if (selector2[i2] === '"') { + i2++; + while (i2 < len && selector2[i2] !== '"') { + if (selector2[i2] === "\\") i2 += 2; + else i2++; + } + if (i2 < len) i2++; + } else if (selector2[i2] === "[") { + depth++; + i2++; + } else if (selector2[i2] === "]") { + depth--; + i2++; + } else { + i2++; + } + } + if (depth === 0) { + hasMatchedComponent = true; + matched = true; + } + } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\" || selector2[i2] === "*" || selector2[i2] === "|" || selector2[i2] === "-")) { + parseNamespace(); + if (i2 < len && selector2[i2] === "*") { + i2++; + hasMatchedComponent = true; + matched = true; + } else if (i2 < len && (isIdentStart(selector2[i2]) || selector2[i2] === "\\" || selector2[i2] === "-")) { + if (parseIdentifier()) { + hasMatchedComponent = true; + matched = true; + } + } + } + if (!matched && i2 === start) { + return false; + } + } + return hasMatchedComponent; } - if (sender.userDisconnected) { - throw new Error("Cannot send requests while disconnected. Please reconnect."); + function basicSelectorValidator(selector2) { + if (selector2.length > 1e4) { + return false; + } + if (!validateBalancedSyntax(selector2, true, true)) { + return false; + } + if (hasInvalidCombinators(selector2)) { + return false; + } + if (hasInvalidPseudoSyntax(selector2)) { + return false; + } + if (hasInvalidNestingSelector(selector2)) { + return false; + } + var noQuotesPseudos = ["lang", "dir", "nth-child", "nth-last-child", "nth-of-type", "nth-last-of-type"]; + for (var idx = 0; idx < selector2.length; idx++) { + if (selector2[idx] === ":") { + var pseudoStart = idx; + idx++; + if (idx < selector2.length && selector2[idx] === ":") { + idx++; + } + var nameStart = idx; + while (idx < selector2.length && /[a-zA-Z0-9\-]/.test(selector2[idx])) { + idx++; + } + if (idx === nameStart) { + continue; + } + var pseudoName = selector2.substring(nameStart, idx).toLowerCase(); + if (idx < selector2.length && selector2[idx] === "(") { + idx++; + var contentStart = idx; + var depth = 1; + while (idx < selector2.length && depth > 0) { + if (selector2[idx] === "\\") { + idx += 2; + } else if (selector2[idx] === "(") { + depth++; + idx++; + } else if (selector2[idx] === ")") { + depth--; + idx++; + } else { + idx++; + } + } + if (depth === 0) { + var pseudoContent = selector2.substring(contentStart, idx - 1); + for (var j = 0; j < noQuotesPseudos.length; j++) { + if (pseudoName === noQuotesPseudos[j] && /['"]/.test(pseudoContent)) { + return false; + } + } + } + } + } + } + return looseSelectorValidator(selector2); } - await client2._connectedDeferred.promise; - await request.resolve(client2, __1.utils); - client2._lastRequest = (/* @__PURE__ */ new Date()).getTime(); - const state = new RequestState_1.RequestState(request); - let attempt = 0; - for (attempt = 0; attempt < client2._requestRetries; attempt++) { - sender.addStateToQueue(state); - try { - const result = await state.promise; - state.finished.resolve(); - client2.session.processEntities(result); - client2._entityCache.add(result); - return result; - } catch (e) { - if (e instanceof __1.errors.ServerError || e.errorMessage === "RPC_CALL_FAIL" || e.errorMessage === "RPC_MCGET_FAIL") { - client2._log.warn(`Telegram is having internal issues ${e.constructor.name}`); - await (0, Helpers_1.sleep)(2e3); - } else if (e instanceof __1.errors.FloodWaitError || e instanceof __1.errors.FloodTestPhoneWaitError) { - if (e.seconds <= client2.floodSleepThreshold) { - client2._log.info(`Sleeping for ${e.seconds}s on flood wait (Caused by ${request.className})`); - await (0, Helpers_1.sleep)(e.seconds * 1e3); - } else { - state.finished.resolve(); - throw e; + function extractPseudoClasses(selector2) { + var matches = []; + for (var i2 = 0; i2 < selector2.length; i2++) { + if (selector2[i2] === ":") { + var pseudoStart = i2; + i2++; + if (i2 < selector2.length && selector2[i2] === ":") { + i2++; } - } else if (e instanceof __1.errors.PhoneMigrateError || e instanceof __1.errors.NetworkMigrateError || e instanceof __1.errors.UserMigrateError) { - client2._log.info(`Phone migrated to ${e.newDc}`); - const shouldRaise = e instanceof __1.errors.PhoneMigrateError || e instanceof __1.errors.NetworkMigrateError; - if (shouldRaise && await client2.isUserAuthorized()) { - state.finished.resolve(); - throw e; + var nameStart = i2; + while (i2 < selector2.length && /[a-zA-Z\-]/.test(selector2[i2])) { + i2++; + } + if (i2 === nameStart) { + continue; + } + var pseudoName = selector2.substring(nameStart, i2); + if (i2 < selector2.length && selector2[i2] === "(") { + i2++; + var argsStart = i2; + var depth = 1; + var inSingleQuote = false; + var inDoubleQuote = false; + while (i2 < selector2.length && depth > 0) { + var ch = selector2[i2]; + if (ch === "\\") { + i2 += 2; + } else if (ch === "'" && !inDoubleQuote) { + inSingleQuote = !inSingleQuote; + i2++; + } else if (ch === '"' && !inSingleQuote) { + inDoubleQuote = !inDoubleQuote; + i2++; + } else if (ch === "(" && !inSingleQuote && !inDoubleQuote) { + depth++; + i2++; + } else if (ch === ")" && !inSingleQuote && !inDoubleQuote) { + depth--; + i2++; + } else { + i2++; + } + } + if (depth === 0) { + var pseudoArgs = selector2.substring(argsStart, i2 - 1); + var fullMatch = selector2.substring(pseudoStart, i2); + matches.push([fullMatch, pseudoName, pseudoArgs, pseudoStart]); + } + i2--; } - await client2._switchDC(e.newDc); - sender = dcId === void 0 ? client2._sender : await client2.getSender(dcId); - } else if (e instanceof __1.errors.MsgWaitError) { - await state.isReady(); - state.after = void 0; - } else if (e.message === "CONNECTION_NOT_INITED") { - await client2.disconnect(); - await (0, Helpers_1.sleep)(2e3); - await client2.connect(); - } else { - state.finished.resolve(); - throw e; } } - state.resetPromise(); - } - throw new Error(`Request was unsuccessful ${attempt} time(s)`); - } - async function getMe(client2, inputPeer) { - if (inputPeer && client2._selfInputPeer) { - return client2._selfInputPeer; - } - const me = (await client2.invoke(new tl_1.Api.users.GetUsers({ id: [new tl_1.Api.InputUserSelf()] })))[0]; - client2._bot = me.bot; - if (!client2._selfInputPeer) { - client2._selfInputPeer = __1.utils.getInputPeer(me, false); - } - return inputPeer ? client2._selfInputPeer : me; - } - async function isBot(client2) { - if (client2._bot === void 0) { - const me = await client2.getMe(); - if (me) { - return !(me instanceof tl_1.Api.InputPeerUser) ? me.bot : void 0; - } - } - return client2._bot; - } - async function isUserAuthorized(client2) { - try { - await client2.invoke(new tl_1.Api.updates.GetState()); - return true; - } catch (e) { - return false; - } - } - async function getEntity(client2, entity) { - const single = !(0, Helpers_1.isArrayLike)(entity); - let entityArray = []; - if ((0, Helpers_1.isArrayLike)(entity)) { - entityArray = entity; - } else { - entityArray.push(entity); + return matches; } - const inputs = []; - for (const x of entityArray) { - if (typeof x === "string") { - const valid = (0, Utils_1.parseID)(x); - if (valid) { - inputs.push(await client2.getInputEntity(valid)); + function parseAndSplitNestedSelectors(selector2) { + var depth = 0; + var buffer2 = ""; + var parts = []; + var inSingleQuote = false; + var inDoubleQuote = false; + var i2, char; + for (i2 = 0; i2 < selector2.length; i2++) { + char = selector2.charAt(i2); + if (char === "\\" && i2 + 1 < selector2.length) { + buffer2 += char; + i2++; + buffer2 += selector2.charAt(i2); + continue; + } + if (char === "'" && !inDoubleQuote) { + inSingleQuote = !inSingleQuote; + buffer2 += char; + } else if (char === '"' && !inSingleQuote) { + inDoubleQuote = !inDoubleQuote; + buffer2 += char; + } else if (!inSingleQuote && !inDoubleQuote) { + if (char === "(") { + depth++; + buffer2 += char; + } else if (char === ")") { + depth--; + buffer2 += char; + } else if (char === "," && depth === 0) { + if (buffer2.trim()) { + parts.push(buffer2.trim()); + } + buffer2 = ""; + } else { + buffer2 += char; + } } else { - inputs.push(x); + buffer2 += char; } - } else { - inputs.push(await client2.getInputEntity(x)); } - } - const lists = /* @__PURE__ */ new Map([ - [Helpers_1._EntityType.USER, []], - [Helpers_1._EntityType.CHAT, []], - [Helpers_1._EntityType.CHANNEL, []] - ]); - for (const x of inputs) { - try { - lists.get((0, Helpers_1._entityType)(x)).push(x); - } catch (e) { + var trimmed = buffer2.trim(); + if (trimmed) { + var endsWithHexEscape = endsWithHexEscapeRegExp.test(buffer2); + parts.push(endsWithHexEscape ? buffer2.replace(leadingWhitespaceRegExp, "") : trimmed); } + return parts; } - let users = lists.get(Helpers_1._EntityType.USER); - let chats = lists.get(Helpers_1._EntityType.CHAT); - let channels = lists.get(Helpers_1._EntityType.CHANNEL); - if (users.length) { - users = await client2.invoke(new tl_1.Api.users.GetUsers({ - id: users - })); - } - if (chats.length) { - const chatIds = chats.map((x) => x.chatId); - chats = (await client2.invoke(new tl_1.Api.messages.GetChats({ id: chatIds }))).chats; - } - if (channels.length) { - channels = (await client2.invoke(new tl_1.Api.channels.GetChannels({ id: channels }))).chats; - } - const idEntity = /* @__PURE__ */ new Map(); - for (const user of users) { - idEntity.set((0, Utils_1.getPeerId)(user), user); - } - for (const channel of channels) { - idEntity.set((0, Utils_1.getPeerId)(channel), channel); - } - for (const chat of chats) { - idEntity.set((0, Utils_1.getPeerId)(chat), chat); - } - const result = []; - for (const x of inputs) { - if (typeof x === "string") { - result.push(await _getEntityFromString(client2, x)); - } else if (!(x instanceof tl_1.Api.InputPeerSelf)) { - result.push(idEntity.get((0, Utils_1.getPeerId)(x))); - } else { - for (const [key2, u] of idEntity.entries()) { - if (u instanceof tl_1.Api.User && u.self) { - result.push(u); - break; + var validatedSelectorsCache = {}; + var selectorListPseudoClasses = { + "not": true, + "is": true, + "has": true, + "where": true + }; + function validateSelector(selector2) { + if (validatedSelectorsCache.hasOwnProperty(selector2)) { + return validatedSelectorsCache[selector2]; + } + var pseudoClassMatches = extractPseudoClasses(selector2); + for (var j = 0; j < pseudoClassMatches.length; j++) { + var pseudoClass = pseudoClassMatches[j][1]; + if (selectorListPseudoClasses.hasOwnProperty(pseudoClass)) { + var nestedSelectors = parseAndSplitNestedSelectors(pseudoClassMatches[j][2]); + var hasAmpersand = false; + for (var k = 0; k < nestedSelectors.length; k++) { + if (ampersandRegExp.test(nestedSelectors[k])) { + hasAmpersand = true; + break; + } + } + if (hasAmpersand) { + continue; + } + for (var i2 = 0; i2 < nestedSelectors.length; i2++) { + var nestedSelector = nestedSelectors[i2]; + if (!validatedSelectorsCache.hasOwnProperty(nestedSelector)) { + var nestedSelectorValidation = validateSelector(nestedSelector); + validatedSelectorsCache[nestedSelector] = nestedSelectorValidation; + if (!nestedSelectorValidation) { + validatedSelectorsCache[selector2] = false; + return false; + } + } else if (!validatedSelectorsCache[nestedSelector]) { + validatedSelectorsCache[selector2] = false; + return false; + } } } } + var basicSelectorValidation = basicSelectorValidator(selector2); + validatedSelectorsCache[selector2] = basicSelectorValidation; + return basicSelectorValidation; } - return single ? result[0] : result; - } - async function getInputEntity(client2, peer) { - try { - return __1.utils.getInputPeer(peer); - } catch (e) { - } - try { - if (typeof peer == "string") { - const valid = (0, Utils_1.parseID)(peer); - if (valid) { - const res = client2._entityCache.get(peer); - if (res) { - return res; + function validateNamespaceSelector(selector2) { + var pipeIndex = -1; + var inAttr = false; + var inSingleQuote = false; + var inDoubleQuote = false; + for (var i2 = 0; i2 < selector2.length; i2++) { + var char = selector2[i2]; + if (char === "\\") { + var escapeLen2 = getEscapeSequenceLength(selector2, i2); + if (escapeLen2 > 0) { + i2 += escapeLen2 - 1; + continue; } } - } - if (typeof peer === "number" || typeof peer === "bigint" || big_integer_1.default.isInstance(peer)) { - const res = client2._entityCache.get(peer.toString()); - if (res) { - return res; - } - } - if (typeof peer == "object" && !big_integer_1.default.isInstance(peer) && peer.SUBCLASS_OF_ID === 47470215) { - const res = client2._entityCache.get(__1.utils.getPeerId(peer)); - if (res) { - return res; + if (inSingleQuote) { + if (char === "'") { + inSingleQuote = false; + } + } else if (inDoubleQuote) { + if (char === '"') { + inDoubleQuote = false; + } + } else if (inAttr) { + if (char === "]") { + inAttr = false; + } else if (char === "'") { + inSingleQuote = true; + } else if (char === '"') { + inDoubleQuote = true; + } + } else { + if (char === "[") { + inAttr = true; + } else if (char === "|" && !inAttr) { + pipeIndex = i2; + break; + } } } - } catch (e) { - } - if (typeof peer == "string") { - if (["me", "this", "self"].includes(peer)) { - return new tl_1.Api.InputPeerSelf(); + if (pipeIndex === -1) { + return true; } - } - try { - if (peer != void 0) { - return client2.session.getInputEntity(peer); + var namespacePrefix = selector2.substring(0, pipeIndex); + if (namespacePrefix === "*" || namespacePrefix === "") { + return true; } - } catch (e) { - } - if (typeof peer === "string") { - return __1.utils.getInputPeer(await _getEntityFromString(client2, peer)); - } - if (typeof peer === "number") { - peer = (0, Helpers_1.returnBigInt)(peer); + return definedNamespacePrefixes.hasOwnProperty(namespacePrefix); } - peer = __1.utils.getPeer(peer); - if (peer instanceof tl_1.Api.PeerUser) { - const users = await client2.invoke(new tl_1.Api.users.GetUsers({ - id: [ - new tl_1.Api.InputUser({ - userId: peer.userId, - accessHash: big_integer_1.default.zero - }) - ] - })); - if (users.length && !(users[0] instanceof tl_1.Api.UserEmpty)) { - return __1.utils.getInputPeer(users[0]); - } - } else if (peer instanceof tl_1.Api.PeerChat) { - return new tl_1.Api.InputPeerChat({ - chatId: peer.chatId - }); - } else if (peer instanceof tl_1.Api.PeerChannel) { - try { - const channels = await client2.invoke(new tl_1.Api.channels.GetChannels({ - id: [ - new tl_1.Api.InputChannel({ - channelId: peer.channelId, - accessHash: big_integer_1.default.zero - }) - ] - })); - return __1.utils.getInputPeer(channels.chats[0]); - } catch (e) { - if (client2._errorHandler) { - await client2._errorHandler(e); + function normalizeSelectorEscapes(selector2) { + var result = ""; + var i2 = 0; + var nextChar = ""; + var inIdentifier = false; + var inAttribute = false; + var attributeDepth = 0; + var needsEscapeForIdent = false; + var lastWasHexEscape = false; + while (i2 < selector2.length) { + var char = selector2[i2]; + if (char === "[" && !inAttribute) { + inAttribute = true; + attributeDepth = 1; + result += char; + i2++; + needsEscapeForIdent = false; + inIdentifier = false; + lastWasHexEscape = false; + continue; } - if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); + if (inAttribute) { + if (char === "[") attributeDepth++; + if (char === "]") { + attributeDepth--; + if (attributeDepth === 0) inAttribute = false; + } + if (char === "\\" && i2 + 1 < selector2.length) { + var escapeLen2 = getEscapeSequenceLength(selector2, i2); + result += selector2.substr(i2, escapeLen2); + i2 += escapeLen2; + } else { + result += char; + i2++; + } + lastWasHexEscape = false; + continue; + } + if (char === "\\") { + var escapeLen2 = getEscapeSequenceLength(selector2, i2); + if (escapeLen2 > 0) { + var escapeSeq = selector2.substr(i2, escapeLen2); + var decoded = decodeEscapeSequence(escapeSeq); + var wasHexEscape = startsWithHexEscapeRegExp.test(escapeSeq); + var hadTerminatingSpace = wasHexEscape && escapeSeq[escapeLen2 - 1] === " "; + nextChar = selector2[i2 + escapeLen2] || ""; + var needsEscape = false; + var useHexEscape = false; + if (needsEscapeForIdent) { + if (isDigit(decoded)) { + needsEscape = true; + useHexEscape = true; + } else if (decoded === "-") { + var remainingSelector = selector2.substring(i2 + escapeLen2); + var hasMoreIdentChars = remainingSelector && identCharRegExp.test(remainingSelector[0]); + needsEscape = !hasMoreIdentChars; + } else if (!identStartCharRegExp.test(decoded)) { + needsEscape = true; + } + } else { + if (specialCharsNeedEscapeRegExp.test(decoded)) { + needsEscape = true; + } + } + if (needsEscape) { + if (useHexEscape) { + var codePoint = decoded.charCodeAt(0); + var hex = codePoint.toString(16); + result += "\\" + hex; + if (isHexDigit(nextChar) || !nextChar || afterHexEscapeSeparatorRegExp.test(nextChar)) { + result += " "; + lastWasHexEscape = false; + } else { + lastWasHexEscape = true; + } + } else { + result += "\\" + decoded; + lastWasHexEscape = false; + } + } else { + if (lastWasHexEscape && !hadTerminatingSpace && isAlphanumeric(decoded)) { + result += " "; + } + result += decoded; + if (hadTerminatingSpace && (!nextChar || afterHexEscapeSeparatorRegExp.test(nextChar))) { + result += " "; + } + lastWasHexEscape = false; + } + i2 += escapeLen2; + needsEscapeForIdent = needsEscapeForIdent && decoded === "-"; + inIdentifier = true; + continue; + } + } + if (char === "." || char === "#") { + result += char; + needsEscapeForIdent = true; + inIdentifier = false; + lastWasHexEscape = false; + i2++; + } else if (char === "-" && needsEscapeForIdent) { + result += char; + needsEscapeForIdent = true; + lastWasHexEscape = false; + i2++; + } else if (isDigit(char) && needsEscapeForIdent) { + var codePoint = char.charCodeAt(0); + var hex = codePoint.toString(16); + result += "\\" + hex; + nextChar = selector2[i2 + 1] || ""; + if (isHexDigit(nextChar) || !nextChar || afterHexEscapeSeparatorRegExp.test(nextChar)) { + result += " "; + lastWasHexEscape = false; + } else { + lastWasHexEscape = true; + } + needsEscapeForIdent = false; + inIdentifier = true; + i2++; + } else if (char === ":" || combinatorOrSeparatorRegExp.test(char)) { + if (!(char === " " && lastWasHexEscape && result[result.length - 1] === " ")) { + result += char; + } + needsEscapeForIdent = false; + inIdentifier = false; + lastWasHexEscape = false; + i2++; + } else if (isLetter(char) && lastWasHexEscape) { + result += " " + char; + needsEscapeForIdent = false; + inIdentifier = true; + lastWasHexEscape = false; + i2++; + } else if (char === " " && lastWasHexEscape) { + nextChar = selector2[i2 + 1] || ""; + if (!nextChar || trailingSpaceSeparatorRegExp.test(nextChar)) { + result += char; + } + needsEscapeForIdent = false; + inIdentifier = false; + lastWasHexEscape = false; + i2++; + } else { + result += char; + needsEscapeForIdent = false; + inIdentifier = true; + lastWasHexEscape = false; + i2++; } } + return result; } - throw new Error(`Could not find the input entity for ${JSON.stringify(peer)}. - Please read https://docs.telethon.dev/en/stable/concepts/entities.html to find out more details.`); - } - async function _getEntityFromString(client2, string) { - const phone = __1.utils.parsePhone(string); - if (phone) { - try { - const result = await client2.invoke(new tl_1.Api.contacts.GetContacts({ - hash: big_integer_1.default.zero - })); - if (!(result instanceof tl_1.Api.contacts.ContactsNotModified)) { - for (const user of result.users) { - if (user instanceof tl_1.Api.User && user.phone === phone) { - return user; - } + function decodeEscapeSequencesInString(str) { + var result = ""; + for (var i2 = 0; i2 < str.length; i2++) { + if (str[i2] === "\\" && i2 + 1 < str.length) { + var escapeLen2 = getEscapeSequenceLength(str, i2); + if (escapeLen2 > 0) { + var escapeSeq = str.substr(i2, escapeLen2); + var decoded = decodeEscapeSequence(escapeSeq); + result += decoded; + i2 += escapeLen2 - 1; + continue; } } - } catch (e) { - if (e.errorMessage === "BOT_METHOD_INVALID") { - throw new Error("Cannot get entity by phone number as a bot (try using integer IDs, not strings)"); + result += str[i2]; + } + return result; + } + function decodeEscapeSequence(escapeSeq) { + if (escapeSeq.length < 2 || escapeSeq[0] !== "\\") { + return escapeSeq; + } + var content = escapeSeq.substring(1); + var hexMatch = content.match(hexEscapeSequenceRegExp); + if (hexMatch) { + var codePoint = parseInt(hexMatch[1], 16); + if (codePoint > 65535) { + codePoint -= 65536; + var high = 55296 + (codePoint >> 10); + var low = 56320 + (codePoint & 1023); + return String.fromCharCode(high, low); } - throw e; + return String.fromCharCode(codePoint); } + return content[0] || ""; } - const id = __1.utils.parseID(string); - if (id != void 0) { - return getInputEntity(client2, id); - } else if (["me", "this"].includes(string.toLowerCase())) { - return client2.getMe(); - } else { - const { username, isInvite } = __1.utils.parseUsername(string); - if (isInvite) { - const invite = await client2.invoke(new tl_1.Api.messages.CheckChatInvite({ - hash: username - })); - if (invite instanceof tl_1.Api.ChatInvite) { - throw new Error("Cannot get entity from a channel (or group) that you are not part of. Join the group and retry"); - } else if (invite instanceof tl_1.Api.ChatInviteAlready) { - return invite.chat; - } - } else if (username) { - try { - const result = await client2.invoke(new tl_1.Api.contacts.ResolveUsername({ username })); - const pid = __1.utils.getPeerId(result.peer, false); - if (result.peer instanceof tl_1.Api.PeerUser) { - for (const x of result.users) { - if ((0, Helpers_1.returnBigInt)(x.id).equals((0, Helpers_1.returnBigInt)(pid))) { - return x; - } + function normalizeAttributeSelectors(selector2) { + var result = ""; + var i2 = 0; + while (i2 < selector2.length) { + if (selector2[i2] === "[") { + result += "["; + i2++; + var attrContent = ""; + var depth = 1; + while (i2 < selector2.length && depth > 0) { + if (selector2[i2] === "\\" && i2 + 1 < selector2.length) { + attrContent += selector2.substring(i2, i2 + 2); + i2 += 2; + continue; } - } else { - for (const x of result.chats) { - if ((0, Helpers_1.returnBigInt)(x.id).equals((0, Helpers_1.returnBigInt)(pid))) { - return x; - } + if (selector2[i2] === "[") depth++; + if (selector2[i2] === "]") { + depth--; + if (depth === 0) break; } + attrContent += selector2[i2]; + i2++; } - } catch (e) { - if (e.errorMessage === "USERNAME_NOT_OCCUPIED") { - throw new Error(`No user has "${username}" as username`); + var normalized2 = normalizeAttributeContent(attrContent); + if (normalized2 === null) { + return null; } - throw e; + result += normalized2; + if (i2 < selector2.length && selector2[i2] === "]") { + result += "]"; + i2++; + } + } else { + result += selector2[i2]; + i2++; } } + return result; } - throw new Error(`Cannot find any entity corresponding to "${string}"`); - } - async function getPeerId(client2, peer, addMark = true) { - if (typeof peer == "string") { - const valid = (0, Utils_1.parseID)(peer); - if (valid) { - return __1.utils.getPeerId(peer, addMark); - } else { - peer = await client2.getInputEntity(peer); - } - } - if (typeof peer == "number" || typeof peer == "bigint" || big_integer_1.default.isInstance(peer)) { - return __1.utils.getPeerId(peer, addMark); - } - if (peer.SUBCLASS_OF_ID == 47470215 || peer.SUBCLASS_OF_ID == 3374092470) { - peer = await client2.getInputEntity(peer); - } - if (peer instanceof tl_1.Api.InputPeerSelf) { - peer = await client2.getMe(true); - } - return __1.utils.getPeerId(peer, addMark); - } - async function _getPeer(client2, peer) { - if (!peer) { - return void 0; - } - const [i, cls] = __1.utils.resolveId((0, Helpers_1.returnBigInt)(await client2.getPeerId(peer))); - return new cls({ - userId: i, - channelId: i, - chatId: i - }); - } - async function _getInputDialog(client2, dialog) { - try { - if (dialog.SUBCLASS_OF_ID == 2719782805) { - dialog.peer = await client2.getInputEntity(dialog.peer); - return dialog; - } else if (dialog.SUBCLASS_OF_ID == 3374092470) { - return new tl_1.Api.InputDialogPeer({ - peer: dialog - }); + function processQuotedAttributeValue(trimmedValue, quoteChar, attrName, operator, flag) { + if (trimmedValue.length < 2) { + return null; } - } catch (e) { - } - return new tl_1.Api.InputDialogPeer({ - peer: dialog - }); - } - async function _getInputNotify(client2, notify) { - try { - if (notify.SUBCLASS_OF_ID == 1486362133) { - if (notify instanceof tl_1.Api.InputNotifyPeer) { - notify.peer = await client2.getInputEntity(notify.peer); + var i2 = 1; + var foundClose = false; + while (i2 < trimmedValue.length) { + if (trimmedValue[i2] === "\\" && i2 + 1 < trimmedValue.length) { + var escapeLen2 = getEscapeSequenceLength(trimmedValue, i2); + i2 += escapeLen2; + continue; } - return notify; - } - } catch (e) { - } - return new tl_1.Api.InputNotifyPeer({ - peer: await client2.getInputEntity(notify) - }); - } - function _selfId(client2) { - return client2._selfInputPeer ? client2._selfInputPeer.userId : void 0; - } - } -}); - -// node_modules/telegram/tl/custom/button.js -var require_button = __commonJS({ - "node_modules/telegram/tl/custom/button.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Button = void 0; - var api_1 = require_api(); - var __1 = require_telegram(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var Button = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(button, resize, singleUse, selective) { - this.button = button; - this.resize = resize; - this.singleUse = singleUse; - this.selective = selective; - } - static _isInline(button) { - return button instanceof api_1.Api.KeyboardButtonCallback || button instanceof api_1.Api.KeyboardButtonSwitchInline || button instanceof api_1.Api.KeyboardButtonUrl || button instanceof api_1.Api.KeyboardButtonUrlAuth || button instanceof api_1.Api.InputKeyboardButtonUrlAuth; - } - static inline(text, data) { - if (!data) { - data = Buffer.from(text, "utf-8"); + if (trimmedValue[i2] === quoteChar) { + foundClose = i2 === trimmedValue.length - 1; + break; + } + i2++; } - if (data.length > 64) { - throw new Error("Too many bytes for the data"); + if (!foundClose) { + return null; } - return new api_1.Api.KeyboardButtonCallback({ - text, - data - }); - } - static switchInline(text, query2 = "", samePeer = false) { - return new api_1.Api.KeyboardButtonSwitchInline({ - text, - query: query2, - samePeer - }); - } - static url(text, url) { - return new api_1.Api.KeyboardButtonUrl({ - text, - url: url || text - }); - } - static auth(text, url, bot, writeAccess, fwdText) { - return new api_1.Api.InputKeyboardButtonUrlAuth({ - text, - url: url || text, - bot: __1.utils.getInputUser(bot || new api_1.Api.InputUserSelf()), - requestWriteAccess: writeAccess, - fwdText - }); - } - static text(text, resize, singleUse, selective) { - return new this(new api_1.Api.KeyboardButton({ text }), resize, singleUse, selective); - } - static requestLocation(text, resize, singleUse, selective) { - return new this(new api_1.Api.KeyboardButtonRequestGeoLocation({ text }), resize, singleUse, selective); - } - static requestPhone(text, resize, singleUse, selective) { - return new this(new api_1.Api.KeyboardButtonRequestPhone({ text }), resize, singleUse, selective); - } - static requestPoll(text, resize, singleUse, selective) { - return new this(new api_1.Api.KeyboardButtonRequestPoll({ text }), resize, singleUse, selective); - } - static clear() { - return new api_1.Api.ReplyKeyboardHide({}); - } - static forceReply() { - return new api_1.Api.ReplyKeyboardForceReply({}); - } - }; - exports2.Button = Button; - } -}); - -// node_modules/telegram/Password.js -var require_Password = __commonJS({ - "node_modules/telegram/Password.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.computeCheck = computeCheck; - exports2.computeDigest = computeDigest; - var tl_1 = require_tl(); - var Helpers_1 = require_Helpers(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var CryptoFile_1 = __importDefault2(require_CryptoFile()); - var SIZE_FOR_HASH = 256; - function checkPrimeAndGood(primeBytes, g) { - const goodPrime = Buffer.from([ - 199, - 28, - 174, - 185, - 198, - 177, - 201, - 4, - 142, - 108, - 82, - 47, - 112, - 241, - 63, - 115, - 152, - 13, - 64, - 35, - 142, - 62, - 33, - 193, - 73, - 52, - 208, - 55, - 86, - 61, - 147, - 15, - 72, - 25, - 138, - 10, - 167, - 193, - 64, - 88, - 34, - 148, - 147, - 210, - 37, - 48, - 244, - 219, - 250, - 51, - 111, - 110, - 10, - 201, - 37, - 19, - 149, - 67, - 174, - 212, - 76, - 206, - 124, - 55, - 32, - 253, - 81, - 246, - 148, - 88, - 112, - 90, - 198, - 140, - 212, - 254, - 107, - 107, - 19, - 171, - 220, - 151, - 70, - 81, - 41, - 105, - 50, - 132, - 84, - 241, - 143, - 175, - 140, - 89, - 95, - 100, - 36, - 119, - 254, - 150, - 187, - 42, - 148, - 29, - 91, - 205, - 29, - 74, - 200, - 204, - 73, - 136, - 7, - 8, - 250, - 155, - 55, - 142, - 60, - 79, - 58, - 144, - 96, - 190, - 230, - 124, - 249, - 164, - 164, - 166, - 149, - 129, - 16, - 81, - 144, - 126, - 22, - 39, - 83, - 181, - 107, - 15, - 107, - 65, - 13, - 186, - 116, - 216, - 168, - 75, - 42, - 20, - 179, - 20, - 78, - 14, - 241, - 40, - 71, - 84, - 253, - 23, - 237, - 149, - 13, - 89, - 101, - 180, - 185, - 221, - 70, - 88, - 45, - 177, - 23, - 141, - 22, - 156, - 107, - 196, - 101, - 176, - 214, - 255, - 156, - 163, - 146, - 143, - 239, - 91, - 154, - 228, - 228, - 24, - 252, - 21, - 232, - 62, - 190, - 160, - 248, - 127, - 169, - 255, - 94, - 237, - 112, - 5, - 13, - 237, - 40, - 73, - 244, - 123, - 249, - 89, - 217, - 86, - 133, - 12, - 233, - 41, - 133, - 31, - 13, - 129, - 21, - 246, - 53, - 177, - 5, - 238, - 46, - 78, - 21, - 208, - 75, - 36, - 84, - 191, - 111, - 79, - 173, - 240, - 52, - 177, - 4, - 3, - 17, - 156, - 216, - 227, - 185, - 47, - 204, - 91 - ]); - if (goodPrime.equals(primeBytes)) { - if ([3, 4, 5, 7].includes(g)) { - return; + var innerValue = trimmedValue.slice(1, -1); + var decodedValue = decodeEscapeSequencesInString(innerValue); + var escapedValue = decodedValue.replace(doubleQuoteRegExp, '\\"'); + return attrName + operator + '"' + escapedValue + '"' + (flag ? " " + flag : ""); + } + function normalizeAttributeContent(content) { + var match = content.match(attributeSelectorContentRegExp); + if (!match) { + return content; + } + var attrName = match[1]; + var operator = match[2]; + var valueAndFlag = match[3].trim(); + var flagMatch = valueAndFlag.match(attributeCaseFlagRegExp); + var value = flagMatch ? flagMatch[1] : valueAndFlag; + var flag = flagMatch ? flagMatch[2] : ""; + var trimmedValue = value.trim(); + var firstChar = trimmedValue[0]; + if (firstChar === '"') { + return processQuotedAttributeValue(trimmedValue, '"', attrName, operator, flag); + } + if (firstChar === "'") { + return processQuotedAttributeValue(trimmedValue, "'", attrName, operator, flag); + } + var hasUnescapedSpecialChar = false; + for (var i2 = 0; i2 < trimmedValue.length; i2++) { + var char = trimmedValue[i2]; + if (char === "\\" && i2 + 1 < trimmedValue.length) { + var escapeLen2 = getEscapeSequenceLength(trimmedValue, i2); + if (escapeLen2 > 0) { + i2 += escapeLen2 - 1; + continue; + } + } + if (specialCharsNeedEscapeRegExp.test(char)) { + hasUnescapedSpecialChar = true; + break; + } } + if (hasUnescapedSpecialChar) { + return null; + } + var decodedValue = decodeEscapeSequencesInString(trimmedValue); + var escapedValue = decodedValue.replace(backslashRegExp, "\\\\").replace(doubleQuoteRegExp, '\\"'); + return attrName + operator + '"' + escapedValue + '"' + (flag ? " " + flag : ""); } - throw new Error("Changing passwords unsupported"); - } - function isGoodLarge(number, p) { - return number.greater((0, big_integer_1.default)(0)) && p.subtract(number).greater((0, big_integer_1.default)(0)); - } - function numBytesForHash(number) { - return Buffer.concat([Buffer.alloc(SIZE_FOR_HASH - number.length), number]); - } - function bigNumForHash(g) { - return (0, Helpers_1.readBufferFromBigInt)(g, SIZE_FOR_HASH, false); - } - function isGoodModExpFirst(modexp, prime) { - const diff = prime.subtract(modexp); - const minDiffBitsCount = 2048 - 64; - const maxModExpSize = 256; - return !(diff.lesser((0, big_integer_1.default)(0)) || diff.bitLength().toJSNumber() < minDiffBitsCount || modexp.bitLength().toJSNumber() < minDiffBitsCount || Math.floor((modexp.bitLength().toJSNumber() + 7) / 8) > maxModExpSize); - } - function xor(a, b) { - const length = Math.min(a.length, b.length); - for (let i = 0; i < length; i++) { - a[i] = a[i] ^ b[i]; + function processSelectorText(selectorText) { + var normalized2 = selectorText.replace(whitespaceNormalizationRegExp, function(match, _, newline) { + if (newline) return " "; + return match; + }); + normalized2 = normalizeSelectorEscapes(normalized2); + normalized2 = normalizeAttributeSelectors(normalized2); + if (normalized2 === null) { + return ""; + } + return processNestedPseudoClasses(normalized2); } - return a; - } - function pbkdf2sha512(password, salt, iterations) { - return CryptoFile_1.default.pbkdf2Sync(password, salt, iterations, 64, "sha512"); - } - async function computeHash(algo, password) { - const hash1 = await (0, Helpers_1.sha256)(Buffer.concat([algo.salt1, Buffer.from(password, "utf-8"), algo.salt1])); - const hash2 = await (0, Helpers_1.sha256)(Buffer.concat([algo.salt2, hash1, algo.salt2])); - const hash3 = await pbkdf2sha512(hash2, algo.salt1, 1e5); - return (0, Helpers_1.sha256)(Buffer.concat([algo.salt2, hash3, algo.salt2])); - } - async function computeDigest(algo, password) { - try { - checkPrimeAndGood(algo.p, algo.g); - } catch (e) { - throw new Error("bad p/g in password"); + function processNestedPseudoClasses(selectorText, depth) { + if (typeof depth === "undefined") { + depth = 0; + } + if (depth > 10) { + return selectorText; + } + var pseudoClassMatches = extractPseudoClasses(selectorText); + if (pseudoClassMatches.length === 0) { + return selectorText; + } + var result = selectorText; + for (var j = pseudoClassMatches.length - 1; j >= 0; j--) { + var pseudoClass = pseudoClassMatches[j][1]; + if (selectorListPseudoClasses.hasOwnProperty(pseudoClass)) { + var fullMatch = pseudoClassMatches[j][0]; + var pseudoArgs = pseudoClassMatches[j][2]; + var matchStart = pseudoClassMatches[j][3]; + var nestedSelectorsRaw = parseAndSplitNestedSelectors(pseudoArgs); + var hasAmpersand = false; + for (var k = 0; k < nestedSelectorsRaw.length; k++) { + if (ampersandRegExp.test(nestedSelectorsRaw[k])) { + hasAmpersand = true; + break; + } + } + if (hasAmpersand) { + continue; + } + var processedArgs = processNestedPseudoClasses(pseudoArgs, depth + 1); + var nestedSelectors = parseAndSplitNestedSelectors(processedArgs); + var validSelectors = []; + for (var i2 = 0; i2 < nestedSelectors.length; i2++) { + var nestedSelector = nestedSelectors[i2]; + if (basicSelectorValidator(nestedSelector)) { + validSelectors.push(nestedSelector); + } + } + var newArgs = validSelectors.join(", "); + var newPseudoClass = ":" + pseudoClass + "(" + newArgs + ")"; + result = result.substring(0, matchStart) + newPseudoClass + result.substring(matchStart + fullMatch.length); + } + } + return result; + return normalized; } - const value = (0, Helpers_1.modExp)((0, big_integer_1.default)(algo.g), (0, Helpers_1.readBigIntFromBuffer)(await computeHash(algo, password), false), (0, Helpers_1.readBigIntFromBuffer)(algo.p, false)); - return bigNumForHash(value); - } - async function computeCheck(request, password) { - const algo = request.currentAlgo; - if (!(algo instanceof tl_1.Api.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) { - throw new Error(`Unsupported password algorithm ${algo === null || algo === void 0 ? void 0 : algo.className}`); + function hasNewlineInQuotedString(selectorText) { + for (var i2 = 0; i2 < selectorText.length; i2++) { + var char = selectorText[i2]; + if (char === "'") { + i2++; + while (i2 < selectorText.length) { + if (selectorText[i2] === "\\" && i2 + 1 < selectorText.length) { + i2 += 2; + continue; + } + if (selectorText[i2] === "'") { + break; + } + if (selectorText[i2] === "\r" || selectorText[i2] === "\n") { + return true; + } + i2++; + } + } else if (char === '"') { + i2++; + while (i2 < selectorText.length) { + if (selectorText[i2] === "\\" && i2 + 1 < selectorText.length) { + i2 += 2; + continue; + } + if (selectorText[i2] === '"') { + break; + } + if (selectorText[i2] === "\r" || selectorText[i2] === "\n") { + return true; + } + i2++; + } + } + } + return false; } - const srp_B = request.srp_B; - const srpId = request.srpId; - if (!srp_B || !srpId) { - throw new Error(`Undefined srp_b ${request}`); + function isValidSelectorText(selectorText) { + if (!selectorText || selectorText.trim() === "") { + return false; + } + if (emptyPseudoClassRegExp.test(selectorText)) { + return false; + } + if (hasNewlineInQuotedString(selectorText)) { + return false; + } + var selectors = parseAndSplitNestedSelectors(selectorText); + for (var i2 = 0; i2 < selectors.length; i2++) { + var selector2 = selectors[i2].trim(); + if (!validateSelector(selector2) || !validateNamespaceSelector(selector2)) { + return false; + } + } + return true; } - const pwHash = await computeHash(algo, password); - const p = (0, Helpers_1.readBigIntFromBuffer)(algo.p, false); - const g = algo.g; - const B = (0, Helpers_1.readBigIntFromBuffer)(srp_B, false); - try { - checkPrimeAndGood(algo.p, g); - } catch (e) { - throw new Error("bad /g in password"); + function pushToAncestorRules(rule) { + ancestorRules.push(rule); } - if (!isGoodLarge(B, p)) { - throw new Error("bad b in check"); + function parseError(message, isNested) { + var lines = token.substring(0, i).split("\n"); + var lineCount = lines.length; + var charCount = lines.pop().length + 1; + var error = new Error(message + " (line " + lineCount + ", char " + charCount + ")"); + error.line = lineCount; + error["char"] = charCount; + error.styleSheet = styleSheet; + error.isNested = !!isNested; + try { + throw error; + } catch (e) { + errorHandler && errorHandler(e); + } } - const x = (0, Helpers_1.readBigIntFromBuffer)(pwHash, false); - const pForHash = numBytesForHash(algo.p); - const gForHash = bigNumForHash((0, big_integer_1.default)(g)); - const bForHash = numBytesForHash(srp_B); - const gX = (0, Helpers_1.modExp)((0, big_integer_1.default)(g), x, p); - const k = (0, Helpers_1.readBigIntFromBuffer)(await (0, Helpers_1.sha256)(Buffer.concat([pForHash, gForHash])), false); - const kgX = (0, Helpers_1.bigIntMod)(k.multiply(gX), p); - const generateAndCheckRandom = async () => { - const randomSize = 256; - while (true) { - const random = (0, Helpers_1.generateRandomBytes)(randomSize); - const a2 = (0, Helpers_1.readBigIntFromBuffer)(random, false); - const A = (0, Helpers_1.modExp)((0, big_integer_1.default)(g), a2, p); - if (isGoodModExpFirst(A, p)) { - const aForHash2 = bigNumForHash(A); - const u2 = (0, Helpers_1.readBigIntFromBuffer)(await (0, Helpers_1.sha256)(Buffer.concat([aForHash2, bForHash])), false); - if (u2.greater((0, big_integer_1.default)(0))) { - return { - a: a2, - aForHash: aForHash2, - u: u2 - }; + ; + function handleUnmatchedQuoteInSelector(nextState) { + var ruleClosingMatch2 = token.slice(i).match(forwardRuleClosingBraceRegExp); + if (ruleClosingMatch2) { + i += ruleClosingMatch2.index + ruleClosingMatch2[0].length - 1; + } + styleRule = null; + buffer = ""; + hasUnmatchedQuoteInSelector = false; + state2 = nextState; + } + function isSelectorStartChar(char) { + return ".:#&*[\\".indexOf(char) !== -1; + } + function isWhitespaceChar(char) { + return " \n\r".indexOf(char) !== -1; + } + function isDigit(char) { + var code = char.charCodeAt(0); + return code >= 48 && code <= 57; + } + function isHexDigit(char) { + if (!char) return false; + var code = char.charCodeAt(0); + return code >= 48 && code <= 57 || // 0-9 + code >= 65 && code <= 70 || // A-F + code >= 97 && code <= 102; + } + function isLetter(char) { + if (!char) return false; + var code = char.charCodeAt(0); + return code >= 65 && code <= 90 || // A-Z + code >= 97 && code <= 122; + } + function isAlphanumeric(char) { + var code = char.charCodeAt(0); + return code >= 48 && code <= 57 || // 0-9 + code >= 65 && code <= 90 || // A-Z + code >= 97 && code <= 122; + } + function getEscapeSequenceLength(str, pos) { + if (str[pos] !== "\\" || pos + 1 >= str.length) { + return 0; + } + var nextChar = str[pos + 1]; + if (isHexDigit(nextChar)) { + var hexLength = 1; + while (hexLength < 6 && pos + 1 + hexLength < str.length && isHexDigit(str[pos + 1 + hexLength])) { + hexLength++; + } + if (pos + 1 + hexLength < str.length && isWhitespaceChar(str[pos + 1 + hexLength])) { + return 1 + hexLength + 1; + } + return 1 + hexLength; + } + return 2; + } + function containsUnescaped(str, char) { + for (var i2 = 0; i2 < str.length; i2++) { + if (str[i2] === "\\") { + var escapeLen2 = getEscapeSequenceLength(str, i2); + if (escapeLen2 > 0) { + i2 += escapeLen2 - 1; + continue; + } + } + if (str[i2] === char) { + return true; + } + } + return false; + } + function isInvalidConditionText(text) { + return invalidMediaOperatorWithoutSpaceRegExp.test(text) || invalidMediaNotAfterOperatorRegExp.test(text) || invalidMediaNotIdentifierRegExp.test(text) || invalidMediaNotAfterFeatureRegExp.test(text) || invalidMediaOperatorBetweenParensRegExp.test(text) || invalidMediaNotWithMediaTypeRegExp.test(text); + } + function normalizeConditionText(text) { + if (isInvalidConditionText(text)) { + return "not all"; + } + var result = text; + result = result.replace(mediaFeatureColonRegExp, function(match, openParen, name2, spaces, rest) { + var beforeMatch = result.lastIndexOf(match); + var beforeParen = beforeMatch > 0 ? result.charAt(beforeMatch - 1) : ""; + if (identifierBeforeParenRegExp.test(beforeParen)) { + return match; + } + return openParen + name2 + ": " + rest; + }); + result = result.replace(mediaAndOperatorRegExp, " and "); + result = result.replace(mediaOrOperatorRegExp, " or "); + result = result.replace(mediaNotOperatorStartRegExp, "not "); + result = result.replace(mediaNotOperatorRegExp, " not "); + return result.trim(); + } + var endingIndex = token.length - 1; + var initialEndingIndex = endingIndex; + for (var character; character = token.charAt(i); i++) { + if (i === endingIndex) { + switch (state2) { + case "importRule": + case "namespaceRule": + case "layerBlock": + if (character !== ";") { + token += ";"; + endingIndex += 1; + } + break; + case "value": + if (character !== "}") { + if (character === ";") { + token += "}"; + } else { + token += ";"; + } + endingIndex += 1; + break; + } + case "name": + case "before-name": + if (character === "}") { + token += " "; + } else { + token += "}"; + } + endingIndex += 1; + break; + case "before-selector": + if (character !== "}" && currentScope !== styleSheet) { + token += "}"; + endingIndex += 1; + break; + } + } + } + if (character === "\\" && i + 1 < token.length) { + var escapeLen = getEscapeSequenceLength(token, i); + if (escapeLen > 0) { + buffer += token.substr(i, escapeLen); + i += escapeLen - 1; + continue; + } + } + switch (character) { + case " ": + case " ": + case "\r": + case "\n": + case "\f": + if (SIGNIFICANT_WHITESPACE[state2]) { + buffer += character; + } + break; + // String + case '"': + index2 = i + 1; + do { + index2 = token.indexOf('"', index2) + 1; + if (!index2) { + parseError('Unmatched "'); + if (state2 === "selector" || state2 === "atRule") { + hasUnmatchedQuoteInSelector = true; + } + } + } while (token[index2 - 2] === "\\"); + if (index2 === 0) { + break; + } + buffer += token.slice(i, index2); + i = index2 - 1; + switch (state2) { + case "before-value": + state2 = "value"; + break; + case "importRule-begin": + state2 = "importRule"; + if (i === endingIndex) { + token += ";"; + } + break; + case "namespaceRule-begin": + state2 = "namespaceRule"; + if (i === endingIndex) { + token += ";"; + } + break; + } + break; + case "'": + index2 = i + 1; + do { + index2 = token.indexOf("'", index2) + 1; + if (!index2) { + parseError("Unmatched '"); + if (state2 === "selector" || state2 === "atRule") { + hasUnmatchedQuoteInSelector = true; + } + } + } while (token[index2 - 2] === "\\"); + if (index2 === 0) { + break; + } + buffer += token.slice(i, index2); + i = index2 - 1; + switch (state2) { + case "before-value": + state2 = "value"; + break; + case "importRule-begin": + state2 = "importRule"; + break; + case "namespaceRule-begin": + state2 = "namespaceRule"; + break; + } + break; + // Comment + case "/": + if (token.charAt(i + 1) === "*") { + i += 2; + index2 = token.indexOf("*/", i); + if (index2 === -1) { + i = token.length - 1; + buffer = ""; + } else { + i = index2 + 1; + } + } else { + buffer += character; + } + if (state2 === "importRule-begin") { + buffer += " "; + state2 = "importRule"; + } + if (state2 === "namespaceRule-begin") { + buffer += " "; + state2 = "namespaceRule"; + } + break; + // At-rule + case "@": + if (nestedSelectorRule) { + if (styleRule && styleRule.constructor.name === "CSSNestedDeclarations") { + currentScope.cssRules.push(styleRule); + } + if (styleRule !== nestedSelectorRule && nestedSelectorRule.parentRule && nestedSelectorRule.parentRule.constructor.name === "CSSStyleRule") { + styleRule = nestedSelectorRule.parentRule; + } + } + if (token.indexOf("@-moz-document", i) === i) { + validateAtRule("@-moz-document", function() { + state2 = "documentRule-begin"; + documentRule = new CSSOM2.CSSDocumentRule(); + documentRule.__starts = i; + i += "-moz-document".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@media", i) === i) { + validateAtRule("@media", function() { + state2 = "atBlock"; + mediaRule = new CSSOM2.CSSMediaRule(); + mediaRule.__starts = i; + i += "media".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@container", i) === i) { + validateAtRule("@container", function() { + state2 = "containerBlock"; + containerRule = new CSSOM2.CSSContainerRule(); + containerRule.__starts = i; + i += "container".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@counter-style", i) === i) { + buffer = ""; + var cannotBeNested = !canAtRuleBeNested(); + validateAtRule("@counter-style", function() { + state2 = "counterStyleBlock"; + counterStyleRule = new CSSOM2.CSSCounterStyleRule(); + counterStyleRule.__starts = i; + i += "counter-style".length; + }, cannotBeNested); + break; + } else if (token.indexOf("@property", i) === i) { + buffer = ""; + var cannotBeNested = !canAtRuleBeNested(); + validateAtRule("@property", function() { + state2 = "propertyBlock"; + propertyRule = new CSSOM2.CSSPropertyRule(); + propertyRule.__starts = i; + i += "property".length; + }, cannotBeNested); + break; + } else if (token.indexOf("@scope", i) === i) { + validateAtRule("@scope", function() { + state2 = "scopeBlock"; + scopeRule = new CSSOM2.CSSScopeRule(); + scopeRule.__starts = i; + i += "scope".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@layer", i) === i) { + validateAtRule("@layer", function() { + state2 = "layerBlock"; + layerBlockRule = new CSSOM2.CSSLayerBlockRule(); + layerBlockRule.__starts = i; + i += "layer".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@page", i) === i) { + validateAtRule("@page", function() { + state2 = "pageBlock"; + pageRule = new CSSOM2.CSSPageRule(); + pageRule.__starts = i; + i += "page".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@supports", i) === i) { + validateAtRule("@supports", function() { + state2 = "conditionBlock"; + supportsRule = new CSSOM2.CSSSupportsRule(); + supportsRule.__starts = i; + i += "supports".length; + }); + buffer = ""; + break; + } else if (token.indexOf("@host", i) === i) { + validateAtRule("@host", function() { + state2 = "hostRule-begin"; + i += "host".length; + hostRule = new CSSOM2.CSSHostRule(); + hostRule.__starts = i; + }); + buffer = ""; + break; + } else if (token.indexOf("@starting-style", i) === i) { + validateAtRule("@starting-style", function() { + state2 = "startingStyleRule-begin"; + i += "starting-style".length; + startingStyleRule = new CSSOM2.CSSStartingStyleRule(); + startingStyleRule.__starts = i; + }); + buffer = ""; + break; + } else if (token.indexOf("@import", i) === i) { + buffer = ""; + validateAtRule("@import", function() { + state2 = "importRule-begin"; + i += "import".length; + buffer += "@import"; + }, true); + break; + } else if (token.indexOf("@namespace", i) === i) { + buffer = ""; + validateAtRule("@namespace", function() { + state2 = "namespaceRule-begin"; + i += "namespace".length; + buffer += "@namespace"; + }, true); + break; + } else if (token.indexOf("@font-face", i) === i) { + buffer = ""; + var cannotBeNested = !canAtRuleBeNested(); + validateAtRule("@font-face", function() { + state2 = "fontFaceRule-begin"; + i += "font-face".length; + fontFaceRule = new CSSOM2.CSSFontFaceRule(); + fontFaceRule.__starts = i; + }, cannotBeNested); + break; + } else { + atKeyframesRegExp.lastIndex = i; + var matchKeyframes = atKeyframesRegExp.exec(token); + if (matchKeyframes && matchKeyframes.index === i) { + state2 = "keyframesRule-begin"; + keyframesRule = new CSSOM2.CSSKeyframesRule(); + keyframesRule.__starts = i; + keyframesRule._vendorPrefix = matchKeyframes[1]; + i += matchKeyframes[0].length - 1; + buffer = ""; + break; + } else if (state2 === "selector") { + state2 = "atRule"; + } } - } - } - }; - const { a, aForHash, u } = await generateAndCheckRandom(); - const gB = (0, Helpers_1.bigIntMod)(B.subtract(kgX), p); - if (!isGoodModExpFirst(gB, p)) { - throw new Error("bad gB"); - } - const ux = u.multiply(x); - const aUx = a.add(ux); - const S = (0, Helpers_1.modExp)(gB, aUx, p); - const [K, pSha, gSha, salt1Sha, salt2Sha] = await Promise.all([ - (0, Helpers_1.sha256)(bigNumForHash(S)), - (0, Helpers_1.sha256)(pForHash), - (0, Helpers_1.sha256)(gForHash), - (0, Helpers_1.sha256)(algo.salt1), - (0, Helpers_1.sha256)(algo.salt2) - ]); - const M1 = await (0, Helpers_1.sha256)(Buffer.concat([ - xor(pSha, gSha), - salt1Sha, - salt2Sha, - aForHash, - bForHash, - K - ])); - return new tl_1.Api.InputCheckPasswordSRP({ - srpId, - A: Buffer.from(aForHash), - M1 - }); - } - } -}); - -// node_modules/telegram/tl/custom/messageButton.js -var require_messageButton = __commonJS({ - "node_modules/telegram/tl/custom/messageButton.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MessageButton = void 0; - var api_1 = require_api(); - var button_1 = require_button(); - var Helpers_1 = require_Helpers(); - var Password_1 = require_Password(); - var inspect_1 = require_inspect(); - var MessageButton = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(client2, original, chat, bot, msgId) { - this.button = original; - this._bot = bot; - this._chat = chat; - this._msgId = msgId; - this._client = client2; - } - get client() { - return this._client; - } - get text() { - return !(this.button instanceof button_1.Button) ? this.button.text : ""; - } - get data() { - if (this.button instanceof api_1.Api.KeyboardButtonCallback) { - return this.button.data; - } - } - get inlineQuery() { - if (this.button instanceof api_1.Api.KeyboardButtonSwitchInline) { - return this.button.query; - } - } - get url() { - if (this.button instanceof api_1.Api.KeyboardButtonUrl) { - return this.button.url; - } - } - /** - * Emulates the behaviour of clicking this button. - - If it's a normal `KeyboardButton` with text, a message will be - sent, and the sent `Message <Message>` returned. - - If it's an inline `KeyboardButtonCallback` with text and data, - it will be "clicked" and the `BotCallbackAnswer` returned. - - If it's an inline `KeyboardButtonSwitchInline` button, the - `StartBot` will be invoked and the resulting updates - returned. - - If it's a `KeyboardButtonUrl`, the URL of the button will - be returned. - - If it's a `KeyboardButtonRequestPhone`, you must indicate that you - want to ``sharePhone=True`` in order to share it. Sharing it is not a - default because it is a privacy concern and could happen accidentally. - - You may also use ``sharePhone=phone`` to share a specific number, in - which case either `str` or `InputMediaContact` should be used. - - If it's a `KeyboardButtonRequestGeoLocation`, you must pass a - tuple in ``shareGeo=[longitude, latitude]``. Note that Telegram seems - to have some heuristics to determine impossible locations, so changing - this value a lot quickly may not work as expected. You may also pass a - `InputGeoPoint` if you find the order confusing. - */ - async click({ sharePhone = false, shareGeo = [0, 0], password }) { - if (this.button instanceof api_1.Api.KeyboardButton) { - return this._client.sendMessage(this._chat, { - message: this.button.text, - parseMode: void 0 - }); - } else if (this.button instanceof api_1.Api.KeyboardButtonCallback) { - let encryptedPassword; - if (password != void 0) { - const pwd = await this.client.invoke(new api_1.Api.account.GetPassword()); - encryptedPassword = await (0, Password_1.computeCheck)(pwd, password); - } - const request = new api_1.Api.messages.GetBotCallbackAnswer({ - peer: this._chat, - msgId: this._msgId, - data: this.button.data, - password: encryptedPassword - }); - try { - return await this._client.invoke(request); - } catch (e) { - if (e.errorMessage == "BOT_RESPONSE_TIMEOUT") { - return null; + buffer += character; + break; + case "{": + if (currentScope === topScope) { + nestedSelectorRule = null; + } + if (state2 === "before-selector") { + parseError("Unexpected {"); + i = ignoreBalancedBlock(i, token.slice(i)); + break; + } + if (state2 === "selector" || state2 === "atRule") { + if (!nestedSelectorRule && containsUnescaped(buffer, ";")) { + var ruleClosingMatch = token.slice(i).match(forwardRuleClosingBraceRegExp); + if (ruleClosingMatch) { + styleRule = null; + buffer = ""; + state2 = "before-selector"; + i += ruleClosingMatch.index + ruleClosingMatch[0].length; + break; + } + } + if (!styleRule) { + styleRule = new CSSOM2.CSSStyleRule(); + styleRule.__starts = i; + } + if (hasUnmatchedQuoteInSelector) { + handleUnmatchedQuoteInSelector("before-selector"); + break; + } + var originalParentRule = parentRule; + if (parentRule) { + styleRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + } + currentScope = parentRule = styleRule; + var processedSelectorText = processSelectorText(buffer.trim()); + if (originalParentRule && originalParentRule.constructor.name === "CSSStyleRule") { + styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).map(function(sel) { + return sel.indexOf("&") === -1 || startsWithCombinatorRegExp.test(sel) ? "& " + sel : sel; + }).join(", "); + } else { + styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).join(", "); + } + styleRule.style.__starts = i; + styleRule.__parentStyleSheet = styleSheet; + buffer = ""; + state2 = "before-name"; + } else if (state2 === "atBlock") { + mediaRule.media.mediaText = normalizeConditionText(buffer.trim()); + if (parentRule) { + mediaRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = mediaRule; + pushToAncestorRules(mediaRule); + mediaRule.__parentStyleSheet = styleSheet; + if (!styleRule || styleRule.constructor.name !== "CSSStyleRule" || !styleRule.__parentRule) { + styleRule = null; + } + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "containerBlock") { + containerRule.__conditionText = normalizeConditionText(buffer.trim()); + if (parentRule) { + containerRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = containerRule; + pushToAncestorRules(containerRule); + containerRule.__parentStyleSheet = styleSheet; + styleRule = null; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "counterStyleBlock") { + var counterStyleName = buffer.trim().replace(newlineRemovalRegExp, ""); + var isValidCounterStyleName = counterStyleName.length > 0 && !whitespaceAndDotRegExp.test(counterStyleName); + if (isValidCounterStyleName) { + counterStyleRule.name = counterStyleName; + if (parentRule) { + counterStyleRule.__parentRule = parentRule; + } + counterStyleRule.__parentStyleSheet = styleSheet; + styleRule = counterStyleRule; + } + buffer = ""; + } else if (state2 === "propertyBlock") { + var propertyName = buffer.trim().replace(newlineRemovalRegExp, ""); + var isValidPropertyName = propertyName.indexOf("--") === 0; + if (isValidPropertyName) { + propertyRule.__name = propertyName; + if (parentRule) { + propertyRule.__parentRule = parentRule; + } + propertyRule.__parentStyleSheet = styleSheet; + styleRule = propertyRule; + } + buffer = ""; + } else if (state2 === "conditionBlock") { + supportsRule.__conditionText = normalizeConditionText(buffer.trim()); + if (parentRule) { + supportsRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = supportsRule; + pushToAncestorRules(supportsRule); + supportsRule.__parentStyleSheet = styleSheet; + styleRule = null; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "scopeBlock") { + var parsedScopePrelude = parseScopePrelude(buffer.trim()); + if (parsedScopePrelude.hasStart) { + scopeRule.__start = parsedScopePrelude.startSelector; + } + if (parsedScopePrelude.hasEnd) { + scopeRule.__end = parsedScopePrelude.endSelector; + } + if (parsedScopePrelude.hasOnlyEnd) { + scopeRule.__end = parsedScopePrelude.endSelector; + } + if (parentRule) { + scopeRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = scopeRule; + pushToAncestorRules(scopeRule); + scopeRule.__parentStyleSheet = styleSheet; + styleRule = null; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "layerBlock") { + layerBlockRule.name = buffer.trim(); + var isValidName = layerBlockRule.name.length === 0 || layerBlockRule.name.match(cssCustomIdentifierRegExp) !== null; + if (isValidName) { + if (parentRule) { + layerBlockRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = layerBlockRule; + pushToAncestorRules(layerBlockRule); + layerBlockRule.__parentStyleSheet = styleSheet; + } + styleRule = null; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "pageBlock") { + pageRule.selectorText = buffer.trim(); + if (parentRule) { + pageRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + } + currentScope = parentRule = pageRule; + pageRule.__parentStyleSheet = styleSheet; + styleRule = pageRule; + buffer = ""; + state2 = "before-name"; + } else if (state2 === "hostRule-begin") { + if (parentRule) { + pushToAncestorRules(parentRule); + } + currentScope = parentRule = hostRule; + pushToAncestorRules(hostRule); + hostRule.__parentStyleSheet = styleSheet; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "startingStyleRule-begin") { + if (parentRule) { + startingStyleRule.__parentRule = parentRule; + pushToAncestorRules(parentRule); + if (parentRule.constructor.name === "CSSStyleRule" && !nestedSelectorRule) { + nestedSelectorRule = parentRule; + } + } + currentScope = parentRule = startingStyleRule; + pushToAncestorRules(startingStyleRule); + startingStyleRule.__parentStyleSheet = styleSheet; + styleRule = null; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "fontFaceRule-begin") { + if (parentRule) { + fontFaceRule.__parentRule = parentRule; + } + fontFaceRule.__parentStyleSheet = styleSheet; + styleRule = fontFaceRule; + buffer = ""; + state2 = "before-name"; + } else if (state2 === "keyframesRule-begin") { + keyframesRule.name = buffer.trim(); + if (parentRule) { + pushToAncestorRules(parentRule); + keyframesRule.__parentRule = parentRule; + } + keyframesRule.__parentStyleSheet = styleSheet; + currentScope = parentRule = keyframesRule; + buffer = ""; + state2 = "keyframeRule-begin"; + } else if (state2 === "keyframeRule-begin") { + styleRule = new CSSOM2.CSSKeyframeRule(); + styleRule.keyText = buffer.trim(); + styleRule.__starts = i; + buffer = ""; + state2 = "before-name"; + } else if (state2 === "documentRule-begin") { + documentRule.matcher.matcherText = buffer.trim(); + if (parentRule) { + pushToAncestorRules(parentRule); + documentRule.__parentRule = parentRule; + } + currentScope = parentRule = documentRule; + pushToAncestorRules(documentRule); + documentRule.__parentStyleSheet = styleSheet; + buffer = ""; + state2 = "before-selector"; + } else if (state2 === "before-name" || state2 === "name") { + if (styleRule.constructor.name === "CSSFontFaceRule" || styleRule.constructor.name === "CSSKeyframeRule" || styleRule.constructor.name === "CSSPageRule" && parentRule === styleRule) { + var ruleClosingMatch = token.slice(i).match(forwardRuleClosingBraceRegExp); + if (ruleClosingMatch) { + i += ruleClosingMatch.index + ruleClosingMatch[0].length - 1; + buffer = ""; + state2 = "before-name"; + break; + } + } + if (styleRule.constructor.name === "CSSNestedDeclarations") { + if (styleRule.style.length) { + parentRule.cssRules.push(styleRule); + styleRule.__parentRule = parentRule; + styleRule.__parentStyleSheet = styleSheet; + pushToAncestorRules(parentRule); + } else { + pushToAncestorRules(parentRule); + } + } else { + currentScope = parentRule = styleRule; + pushToAncestorRules(parentRule); + styleRule.__parentStyleSheet = styleSheet; + } + styleRule = new CSSOM2.CSSStyleRule(); + if (hasUnmatchedQuoteInSelector) { + handleUnmatchedQuoteInSelector("before-name"); + break; + } + var processedSelectorText = processSelectorText(buffer.trim()); + if (parentRule.constructor.name === "CSSScopeRule" || parentRule.constructor.name !== "CSSStyleRule" && parentRule.parentRule === null) { + styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).join(", "); + } else { + styleRule.selectorText = parseAndSplitNestedSelectors(processedSelectorText).map(function(sel) { + return sel.indexOf("&") === -1 || startsWithCombinatorRegExp.test(sel) ? "& " + sel : sel; + }).join(", "); + } + styleRule.style.__starts = i - buffer.length; + styleRule.__parentRule = parentRule; + if (parentRule.constructor.name === "CSSStyleRule" || parentRule.constructor.name === "CSSScopeRule") { + nestedSelectorRule = styleRule; + } + styleRule.__parentStyleSheet = styleSheet; + currentScope = parentRule = styleRule; + buffer = ""; + state2 = "before-name"; + } + break; + case ":": + if (state2 === "name") { + var openBraceBeforeMatch = token.slice(i).match(declarationOrOpenBraceRegExp); + var hasOpenBraceBefore = openBraceBeforeMatch && openBraceBeforeMatch[0] === "{"; + if (hasOpenBraceBefore) { + buffer += character; + } else { + name = buffer.trim(); + buffer = ""; + state2 = "before-value"; + } + } else { + buffer += character; + } + break; + case "(": + if (state2 === "value") { + if (buffer.trim() === "expression") { + var info = new CSSOM2.CSSValueExpression(token, i).parse(); + if (info.error) { + parseError(info.error); + } else { + buffer += info.expression; + i = info.idx; + } + } else { + state2 = "value-parenthesis"; + valueParenthesisDepth = 1; + buffer += character; + } + } else if (state2 === "value-parenthesis") { + valueParenthesisDepth++; + buffer += character; + } else { + buffer += character; + } + break; + case ")": + if (state2 === "value-parenthesis") { + valueParenthesisDepth--; + if (valueParenthesisDepth === 0) state2 = "value"; + } + buffer += character; + break; + case "!": + if (state2 === "value" && token.indexOf("!important", i) === i) { + priority = "important"; + i += "important".length; + } else { + buffer += character; + } + break; + case ";": + switch (state2) { + case "before-value": + case "before-name": + parseError("Unexpected ;"); + buffer = ""; + state2 = "before-name"; + break; + case "value": + styleRule.style.setProperty(name, buffer.trim(), priority, parseError); + priority = ""; + buffer = ""; + state2 = "before-name"; + break; + case "atRule": + buffer = ""; + state2 = "before-selector"; + break; + case "importRule": + var isValid = topScope.cssRules.length === 0 || topScope.cssRules.some(function(rule) { + return ["CSSImportRule", "CSSLayerStatementRule"].indexOf(rule.constructor.name) !== -1; + }); + if (isValid) { + importRule = new CSSOM2.CSSImportRule(); + if (opts && opts.globalObject && opts.globalObject.CSSStyleSheet) { + importRule.__styleSheet = new opts.globalObject.CSSStyleSheet(); + } + importRule.styleSheet.__constructed = false; + importRule.__parentStyleSheet = importRule.styleSheet.__parentStyleSheet = styleSheet; + importRule.parse(buffer + character); + topScope.cssRules.push(importRule); + } + buffer = ""; + state2 = "before-selector"; + break; + case "namespaceRule": + var isValid = topScope.cssRules.length === 0 || topScope.cssRules.every(function(rule) { + return ["CSSImportRule", "CSSLayerStatementRule", "CSSNamespaceRule"].indexOf(rule.constructor.name) !== -1; + }); + if (isValid) { + try { + var testNamespaceRule = new CSSOM2.CSSNamespaceRule(); + testNamespaceRule.parse(buffer + character); + namespaceRule = testNamespaceRule; + namespaceRule.__parentStyleSheet = styleSheet; + topScope.cssRules.push(namespaceRule); + if (namespaceRule.prefix) { + definedNamespacePrefixes[namespaceRule.prefix] = namespaceRule.namespaceURI; + } + } catch (e) { + parseError(e.message); + } + } + buffer = ""; + state2 = "before-selector"; + break; + case "layerBlock": + var nameListStr = buffer.trim().split(",").map(function(name2) { + return name2.trim(); + }); + var isInvalid = nameListStr.some(function(name2) { + return name2.trim().match(cssCustomIdentifierRegExp) === null; + }); + var hasStyleRuleParent = false; + if (parentRule) { + var checkParent = parentRule; + while (checkParent) { + if (checkParent.constructor.name === "CSSStyleRule") { + hasStyleRuleParent = true; + break; + } + checkParent = checkParent.__parentRule; + } + } + if (!isInvalid && !hasStyleRuleParent) { + layerStatementRule = new CSSOM2.CSSLayerStatementRule(); + layerStatementRule.__parentStyleSheet = styleSheet; + layerStatementRule.__starts = layerBlockRule.__starts; + layerStatementRule.__ends = i; + layerStatementRule.nameList = nameListStr; + if (parentRule) { + layerStatementRule.__parentRule = parentRule; + parentRule.cssRules.push(layerStatementRule); + } else { + topScope.cssRules.push(layerStatementRule); + } + } + buffer = ""; + state2 = "before-selector"; + break; + default: + buffer += character; + break; } - throw e; - } - } else if (this.button instanceof api_1.Api.KeyboardButtonSwitchInline) { - return this._client.invoke(new api_1.Api.messages.StartBot({ - bot: this._bot, - peer: this._chat, - startParam: this.button.query - })); - } else if (this.button instanceof api_1.Api.KeyboardButtonUrl) { - return this.button.url; - } else if (this.button instanceof api_1.Api.KeyboardButtonGame) { - const request = new api_1.Api.messages.GetBotCallbackAnswer({ - peer: this._chat, - msgId: this._msgId, - game: true - }); - try { - return await this._client.invoke(request); - } catch (e) { - if (e.errorMessage == "BOT_RESPONSE_TIMEOUT") { - return null; + break; + case "}": + if (state2 === "counterStyleBlock") { + if (counterStyleRule.name) { + counterStyleRule.parse("@counter-style " + counterStyleRule.name + " { " + buffer + " }"); + counterStyleRule.__ends = i + 1; + if (counterStyleRule.__parentRule) { + counterStyleRule.__parentRule.cssRules.push(counterStyleRule); + } else { + topScope.cssRules.push(counterStyleRule); + } + } + if (counterStyleRule.__parentRule) { + currentScope = counterStyleRule.__parentRule; + } + styleRule = null; + buffer = ""; + state2 = "before-selector"; + break; } - throw e; - } - } else if (this.button instanceof api_1.Api.KeyboardButtonRequestPhone) { - if (!sharePhone) { - throw new Error("cannot click on phone buttons unless sharePhone=true"); - } - if (sharePhone == true || typeof sharePhone == "string") { - const me = await this._client.getMe(); - sharePhone = new api_1.Api.InputMediaContact({ - phoneNumber: (sharePhone == true ? me.phone : sharePhone) || "", - firstName: me.firstName || "", - lastName: me.lastName || "", - vcard: "" - }); - } - throw new Error("Not supported for now"); - } else if (this.button instanceof api_1.Api.InputWebFileGeoPointLocation) { - if (!shareGeo) { - throw new Error("cannot click on geo buttons unless shareGeo=[longitude, latitude]"); - } - throw new Error("Not supported for now"); - } - } - }; - exports2.MessageButton = MessageButton; - } -}); - -// node_modules/telegram/tl/custom/message.js -var require_message = __commonJS({ - "node_modules/telegram/tl/custom/message.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CustomMessage = void 0; - var senderGetter_1 = require_senderGetter(); - var api_1 = require_api(); - var chatGetter_1 = require_chatGetter(); - var utils = __importStar2(require_Utils()); - var forward_1 = require_forward(); - var file_1 = require_file(); - var Helpers_1 = require_Helpers(); - var users_1 = require_users(); - var Logger_1 = require_Logger(); - var messageButton_1 = require_messageButton(); - var inspect_1 = require_inspect(); - var CustomMessage = class extends senderGetter_1.SenderGetter { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - init({ id, peerId = void 0, date = void 0, out = void 0, mentioned = void 0, mediaUnread = void 0, silent = void 0, post = void 0, fromId = void 0, replyTo = void 0, message = void 0, fwdFrom = void 0, viaBotId = void 0, media = void 0, replyMarkup = void 0, entities: entities2 = void 0, views = void 0, editDate = void 0, postAuthor = void 0, groupedId = void 0, fromScheduled = void 0, legacy = void 0, editHide = void 0, pinned = void 0, restrictionReason = void 0, forwards = void 0, replies = void 0, action = void 0, reactions = void 0, noforwards = void 0, ttlPeriod = void 0, _entities = /* @__PURE__ */ new Map() }) { - if (!id) - throw new Error("id is a required attribute for Message"); - let senderId = void 0; - if (fromId) { - senderId = utils.getPeerId(fromId); - } else if (peerId) { - if (post || !out && peerId instanceof api_1.Api.PeerUser) { - senderId = utils.getPeerId(peerId); - } - } - this._entities = _entities; - this.out = out; - this.mentioned = mentioned; - this.mediaUnread = mediaUnread; - this.silent = silent; - this.post = post; - this.post = post; - this.fromScheduled = fromScheduled; - this.legacy = legacy; - this.editHide = editHide; - this.ttlPeriod = ttlPeriod; - this.id = id; - this.fromId = fromId; - this.peerId = peerId; - this.fwdFrom = fwdFrom; - this.viaBotId = viaBotId; - this.replyTo = replyTo; - this.date = date; - this.message = message; - this.media = media instanceof api_1.Api.MessageMediaEmpty ? media : void 0; - this.replyMarkup = replyMarkup; - this.entities = entities2; - this.views = views; - this.forwards = forwards; - this.replies = replies; - this.editDate = editDate; - this.pinned = pinned; - this.postAuthor = postAuthor; - this.groupedId = groupedId; - this.restrictionReason = restrictionReason; - this.action = action; - this.noforwards = noforwards; - this.reactions = reactions; - this._client = void 0; - this._text = void 0; - this._file = void 0; - this._replyMessage = void 0; - this._buttons = void 0; - this._buttonsFlat = void 0; - this._buttonsCount = 0; - this._viaBot = void 0; - this._viaInputBot = void 0; - this._actionEntities = void 0; - chatGetter_1.ChatGetter.initChatClass(this, { chatPeer: peerId, broadcast: post }); - senderGetter_1.SenderGetter.initSenderClass(this, { - senderId: senderId ? (0, Helpers_1.returnBigInt)(senderId) : void 0 - }); - this._forward = void 0; - } - constructor(args) { - super(); - this.init(args); - } - _finishInit(client2, entities2, inputChat) { - this._client = client2; - const cache = client2._entityCache; - if (this.senderId) { - [this._sender, this._inputSender] = utils._getEntityPair(this.senderId.toString(), entities2, cache); - } - if (this.chatId) { - [this._chat, this._inputChat] = utils._getEntityPair(this.chatId.toString(), entities2, cache); - } - if (inputChat) { - this._inputChat = inputChat; - } - if (this.viaBotId) { - [this._viaBot, this._viaInputBot] = utils._getEntityPair(this.viaBotId.toString(), entities2, cache); - } - if (this.fwdFrom) { - this._forward = new forward_1.Forward(this._client, this.fwdFrom, entities2); - } - if (this.action) { - if (this.action instanceof api_1.Api.MessageActionChatAddUser || this.action instanceof api_1.Api.MessageActionChatCreate) { - this._actionEntities = this.action.users.map((i) => entities2.get(i.toString())); - } else if (this.action instanceof api_1.Api.MessageActionChatDeleteUser) { - this._actionEntities = [ - entities2.get(this.action.userId.toString()) - ]; - } else if (this.action instanceof api_1.Api.MessageActionChatJoinedByLink) { - this._actionEntities = [ - entities2.get(utils.getPeerId(new api_1.Api.PeerChannel({ - channelId: this.action.inviterId - }))) - ]; - } else if (this.action instanceof api_1.Api.MessageActionChannelMigrateFrom) { - this._actionEntities = [ - entities2.get(utils.getPeerId(new api_1.Api.PeerChat({ chatId: this.action.chatId }))) - ]; - } - } - } - get client() { - return this._client; - } - get text() { - if (this._text === void 0 && this._client) { - if (!this._client.parseMode) { - this._text = this.message; - } else { - this._text = this._client.parseMode.unparse(this.message || "", this.entities || []); - } + if (state2 === "propertyBlock") { + if (propertyRule.__name) { + var parseSuccess = propertyRule.parse("@property " + propertyRule.__name + " { " + buffer + " }"); + if (parseSuccess) { + propertyRule.__ends = i + 1; + if (propertyRule.__parentRule) { + propertyRule.__parentRule.cssRules.push(propertyRule); + } else { + topScope.cssRules.push(propertyRule); + } + } + } + if (propertyRule.__parentRule) { + currentScope = propertyRule.__parentRule; + } + styleRule = null; + buffer = ""; + state2 = "before-selector"; + break; + } + switch (state2) { + case "value": + styleRule.style.setProperty(name, buffer.trim(), priority, parseError); + priority = ""; + /* falls through */ + case "before-value": + case "before-name": + case "name": + styleRule.__ends = i + 1; + if (parentRule === styleRule) { + parentRule = ancestorRules.pop(); + } + if (parentRule) { + styleRule.__parentRule = parentRule; + } + styleRule.__parentStyleSheet = styleSheet; + if (currentScope === styleRule) { + currentScope = parentRule || topScope; + } + if (styleRule.constructor.name === "CSSStyleRule" && !isValidSelectorText(styleRule.selectorText)) { + if (styleRule === nestedSelectorRule) { + nestedSelectorRule = null; + } + parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null); + } else { + if (styleRule.parentRule) { + styleRule.parentRule.cssRules.push(styleRule); + } else { + currentScope.cssRules.push(styleRule); + } + } + buffer = ""; + if (currentScope.constructor === CSSOM2.CSSKeyframesRule) { + state2 = "keyframeRule-begin"; + } else { + state2 = "before-selector"; + } + if (styleRule.constructor.name === "CSSNestedDeclarations") { + if (currentScope !== topScope) { + if (currentScope.constructor.name === "CSSStyleRule" || currentScope.constructor.name === "CSSScopeRule") { + nestedSelectorRule = currentScope; + } + } + styleRule = null; + } else { + if (styleRule === nestedSelectorRule) { + var selector = styleRule.selectorText && styleRule.selectorText.trim(); + var isPrependedAmpersand = selector && selector.match(prependedAmpersandRegExp); + var isGroupingRule = currentScope && currentScope instanceof CSSOM2.CSSGroupingRule; + if (!isPrependedAmpersand && isGroupingRule) { + if (currentScope.constructor.name === "CSSStyleRule" || currentScope.constructor.name === "CSSScopeRule") { + nestedSelectorRule = currentScope; + } + } else { + nestedSelectorRule = null; + } + } else if (nestedSelectorRule && currentScope instanceof CSSOM2.CSSGroupingRule) { + } + styleRule = null; + break; + } + case "keyframeRule-begin": + case "before-selector": + case "selector": + if (!parentRule) { + parseError("Unexpected }"); + var hasPreviousStyleRule = currentScope.cssRules.length && currentScope.cssRules[currentScope.cssRules.length - 1].constructor.name === "CSSStyleRule"; + if (hasPreviousStyleRule) { + i = ignoreBalancedBlock(i, token.slice(i), 1); + } + break; + } + while (ancestorRules.length > 0) { + parentRule = ancestorRules.pop(); + if (parentRule === currentScope) { + continue; + } + if (!(parentRule instanceof CSSOM2.CSSGroupingRule && (parentRule.constructor.name !== "CSSStyleRule" || parentRule.__parentRule))) { + continue; + } + var isClosingNestedSelectorContext = nestedSelectorRule && (currentScope === nestedSelectorRule || nestedSelectorRule.__parentRule === currentScope); + if (isClosingNestedSelectorContext) { + if (nestedSelectorRule.parentRule) { + prevScope = nestedSelectorRule; + currentScope = nestedSelectorRule.parentRule; + var scopeId = getRuleId(prevScope); + if (!addedToCurrentScope[scopeId]) { + currentScope.cssRules.push(prevScope); + addedToCurrentScope[scopeId] = true; + } + nestedSelectorRule = currentScope; + break; + } else { + prevScope = currentScope; + var actualParent = ancestorRules.length > 0 ? ancestorRules[ancestorRules.length - 1] : nestedSelectorRule; + if (actualParent !== prevScope) { + actualParent.cssRules.push(prevScope); + } + currentScope = actualParent; + parentRule = actualParent; + break; + } + } else { + prevScope = currentScope; + if (parentRule !== prevScope) { + parentRule.cssRules.push(prevScope); + } + break; + } + } + if (ancestorRules.length === 0 && currentScope.__parentRule && currentScope.__parentRule.cssRules) { + var parentId = getRuleId(currentScope); + if (!addedToParent[parentId]) { + currentScope.__parentRule.cssRules.push(currentScope); + addedToParent[parentId] = true; + } + } + if (ancestorRules.length === 0 && currentScope.parentRule == null) { + currentScope.__ends = i + 1; + var topId = getRuleId(currentScope); + if (currentScope !== topScope && !addedToTopScope[topId]) { + topScope.cssRules.push(currentScope); + addedToTopScope[topId] = true; + } + currentScope = topScope; + if (nestedSelectorRule === parentRule) { + var nestedSelectorTokenToCurrentSelectorToken = token.slice(nestedSelectorRule.__starts, i + 1); + var openingBraceMatch = nestedSelectorTokenToCurrentSelectorToken.match(openBraceGlobalRegExp); + var closingBraceMatch = nestedSelectorTokenToCurrentSelectorToken.match(closeBraceGlobalRegExp); + var openingBraceLen = openingBraceMatch && openingBraceMatch.length; + var closingBraceLen = closingBraceMatch && closingBraceMatch.length; + if (openingBraceLen === closingBraceLen) { + nestedSelectorRule.__ends = i + 1; + nestedSelectorRule = null; + parentRule = null; + } + } else { + parentRule = null; + } + } else { + currentScope = parentRule; + } + buffer = ""; + state2 = "before-selector"; + break; + } + break; + default: + switch (state2) { + case "before-selector": + state2 = "selector"; + if ((styleRule || scopeRule) && parentRule) { + if (!isSelectorStartChar(character) && !isWhitespaceChar(character) && parentRule instanceof CSSOM2.CSSGroupingRule) { + state2 = "before-name"; + if (styleRule !== parentRule) { + styleRule = new CSSOM2.CSSNestedDeclarations(); + styleRule.__starts = i; + } + } + } else if (nestedSelectorRule && parentRule && parentRule instanceof CSSOM2.CSSGroupingRule) { + if (isSelectorStartChar(character)) { + styleRule = new CSSOM2.CSSStyleRule(); + styleRule.__starts = i; + } else if (!isWhitespaceChar(character)) { + state2 = "before-name"; + if (parentRule.cssRules.length || nestedSelectorRule) { + currentScope = parentRule; + if (parentRule.constructor.name === "CSSStyleRule" || parentRule.constructor.name === "CSSScopeRule") { + nestedSelectorRule = parentRule; + } + styleRule = new CSSOM2.CSSNestedDeclarations(); + styleRule.__starts = i; + } else { + if (parentRule.constructor.name === "CSSStyleRule") { + styleRule = parentRule; + } else { + styleRule = new CSSOM2.CSSStyleRule(); + styleRule.__starts = i; + } + } + } + } + break; + case "before-name": + state2 = "name"; + break; + case "before-value": + state2 = "value"; + break; + case "importRule-begin": + state2 = "importRule"; + break; + case "namespaceRule-begin": + state2 = "namespaceRule"; + break; + } + buffer += character; + break; } - return this._text || ""; - } - set text(value) { - this._text = value; - if (this._client && this._client.parseMode) { - [this.message, this.entities] = this._client.parseMode.parse(value); - } else { - this.message = value; - this.entities = []; + if (i === initialEndingIndex && (currentScope !== topScope || ancestorRules.length > 0)) { + var needsClosing = ancestorRules.length; + if (currentScope !== topScope && ancestorRules.indexOf(currentScope) === -1) { + needsClosing += 1; + } + for (var closeIdx = 0; closeIdx < needsClosing; closeIdx++) { + token += "}"; + endingIndex += 1; + } } } - get rawText() { - return this.message || ""; + if (buffer.trim() !== "") { + parseError("Unexpected end of input"); } + return styleSheet; + }; + exports2.parse = CSSOM2.parse; + CSSOM2.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet; + CSSOM2.CSSStyleRule = require_CSSStyleRule().CSSStyleRule; + CSSOM2.CSSNestedDeclarations = require_CSSNestedDeclarations().CSSNestedDeclarations; + CSSOM2.CSSImportRule = require_CSSImportRule().CSSImportRule; + CSSOM2.CSSNamespaceRule = require_CSSNamespaceRule().CSSNamespaceRule; + CSSOM2.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule; + CSSOM2.CSSMediaRule = require_CSSMediaRule().CSSMediaRule; + CSSOM2.CSSCounterStyleRule = require_CSSCounterStyleRule().CSSCounterStyleRule; + CSSOM2.CSSPropertyRule = require_CSSPropertyRule().CSSPropertyRule; + CSSOM2.CSSContainerRule = require_CSSContainerRule().CSSContainerRule; + CSSOM2.CSSConditionRule = require_CSSConditionRule().CSSConditionRule; + CSSOM2.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule; + CSSOM2.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule; + CSSOM2.CSSHostRule = require_CSSHostRule().CSSHostRule; + CSSOM2.CSSStartingStyleRule = require_CSSStartingStyleRule().CSSStartingStyleRule; + CSSOM2.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration; + CSSOM2.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule; + CSSOM2.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule; + CSSOM2.CSSValueExpression = require_CSSValueExpression().CSSValueExpression; + CSSOM2.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule; + CSSOM2.CSSScopeRule = require_CSSScopeRule().CSSScopeRule; + CSSOM2.CSSLayerBlockRule = require_CSSLayerBlockRule().CSSLayerBlockRule; + CSSOM2.CSSLayerStatementRule = require_CSSLayerStatementRule().CSSLayerStatementRule; + CSSOM2.CSSPageRule = require_CSSPageRule().CSSPageRule; + require_cssstyleTryCatchBlock(); + } +}); + +// node_modules/@acemir/cssom/lib/CSSStyleDeclaration.js +var require_CSSStyleDeclaration = __commonJS({ + "node_modules/@acemir/cssom/lib/CSSStyleDeclaration.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = {}; + var regexPatterns = require_regexPatterns().regexPatterns; + var indexedPropertyNameRegExp = /^(0|[1-9][0-9]*)$/; + CSSOM2.CSSStyleDeclaration = function CSSStyleDeclaration() { + this.length = 0; + this.parentRule = null; + this._importants = {}; + }; + CSSOM2.CSSStyleDeclaration.prototype = { + constructor: CSSOM2.CSSStyleDeclaration, /** - * @param {string} value + * + * @param {string} name + * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue + * @return {string} the value of the property if it has been explicitly set for this declaration block. + * Returns the empty string if the property has not been set. */ - set rawText(value) { - this.message = value; - this.entities = []; - this._text = ""; - } - get isReply() { - return !!this.replyTo; - } - get forward() { - return this._forward; - } - async _refetchSender() { - await this._reloadMessage(); - } + getPropertyValue: function(name) { + return this[name] || ""; + }, /** - * Re-fetches this message to reload the sender and chat entities, - * along with their input versions. - * @private + * + * @param {string} name + * @param {string} value + * @param {string} [priority=null] "important" or null + * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty */ - async _reloadMessage() { - if (!this._client) + setProperty: function(name, value, priority, parseErrorHandler) { + if (name === "length" || name === "parentRule" || name === "_importants" || name === "__starts" || name in CSSOM2.CSSStyleDeclaration.prototype || indexedPropertyNameRegExp.test(name)) { return; - let msg = void 0; - try { - const chat = this.isChannel ? await this.getInputChat() : void 0; - let temp = await this._client.getMessages(chat, { ids: this.id }); - if (temp) { - msg = temp[0]; - } - } catch (e) { - this._client._log.error("Got error while trying to finish init message with id " + this.id); - if (this._client._errorHandler) { - await this._client._errorHandler(e); + } + var basicStylePropertyValueValidationRegExp = regexPatterns.basicStylePropertyValueValidationRegExp; + if (basicStylePropertyValueValidationRegExp.test(value)) { + parseErrorHandler && parseErrorHandler('Invalid CSSStyleDeclaration property (name = "' + name + '", value = "' + value + '")'); + } else if (this[name]) { + var index2 = Array.prototype.indexOf.call(this, name); + if (index2 < 0) { + this[this.length] = name; + this.length++; } - if (this._client._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); + if (priority || !this._importants[name]) { + this.removeProperty(name); + this[this.length] = name; + this.length++; + this[name] = value + ""; + this._importants[name] = priority; } + } else { + this[this.length] = name; + this.length++; + this[name] = value + ""; + this._importants[name] = priority; } - if (msg == void 0) - return; - this._sender = msg._sender; - this._inputSender = msg._inputSender; - this._chat = msg._chat; - this._inputChat = msg._inputChat; - this._viaBot = msg._viaBot; - this._viaInputBot = msg._viaInputBot; - this._forward = msg._forward; - this._actionEntities = msg._actionEntities; - } + }, /** - * Returns a list of lists of `MessageButton <MessageButton>`, if any. - * Otherwise, it returns `undefined`. + * + * @param {string} name + * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty + * @return {string} the value of the property if it has been explicitly set for this declaration block. + * Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property. */ - get buttons() { - if (!this._buttons && this.replyMarkup) { - if (!this.inputChat) { - return; - } - try { - const bot = this._neededMarkupBot(); - this._setButtons(this.inputChat, bot); - } catch (e) { - return; - } + removeProperty: function(name) { + if (!(name in this)) { + return ""; } - return this._buttons; - } + var index2 = Array.prototype.indexOf.call(this, name); + if (index2 < 0) { + return ""; + } + var prevValue = this[name]; + this[name] = ""; + Array.prototype.splice.call(this, index2, 1); + return prevValue; + }, + getPropertyCSSValue: function() { + }, /** - * Returns `buttons` when that property fails (this is rarely needed). + * + * @param {String} name */ - async getButtons() { - if (!this.buttons && this.replyMarkup) { - const chat = await this.getInputChat(); - if (!chat) - return; - let bot; - try { - bot = this._neededMarkupBot(); - } catch (e) { - await this._reloadMessage(); - bot = this._neededMarkupBot(); + getPropertyPriority: function(name) { + return this._importants[name] || ""; + }, + /** + * element.style.overflow = "auto" + * element.style.getPropertyShorthand("overflow-x") + * -> "overflow" + */ + getPropertyShorthand: function() { + }, + isPropertyImplicit: function() { + }, + // Doesn't work in IE < 9 + get cssText() { + var properties = []; + for (var i = 0, length = this.length; i < length; ++i) { + var name = this[i]; + var value = this.getPropertyValue(name); + var priority = this.getPropertyPriority(name); + if (priority) { + priority = " !" + priority; } - this._setButtons(chat, bot); + properties[i] = name + ": " + value + priority + ";"; } - return this._buttons; - } - get buttonCount() { - if (!this._buttonsCount) { - if (this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup) { - this._buttonsCount = this.replyMarkup.rows.map((r) => r.buttons.length).reduce(function(a, b) { - return a + b; - }, 0); - } else { - this._buttonsCount = 0; - } + return properties.join(" "); + }, + set cssText(text) { + var i, name; + for (i = this.length; i--; ) { + name = this[i]; + this[name] = ""; + } + Array.prototype.splice.call(this, 0, this.length); + this._importants = {}; + var dummyRule = CSSOM2.parse("#bogus{" + text + "}").cssRules[0].style; + var length = dummyRule.length; + for (i = 0; i < length; ++i) { + name = dummyRule[i]; + this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name)); } - return this._buttonsCount; } - get file() { - if (!this._file) { - const media = this.photo || this.document; - if (media) { - this._file = new file_1.File(media); + }; + exports2.CSSStyleDeclaration = CSSOM2.CSSStyleDeclaration; + CSSOM2.parse = require_parse3().parse; + } +}); + +// node_modules/@acemir/cssom/lib/clone.js +var require_clone = __commonJS({ + "node_modules/@acemir/cssom/lib/clone.js"(exports2) { + init_define_import_meta_env(); + var CSSOM2 = { + CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet, + CSSRule: require_CSSRule().CSSRule, + CSSNestedDeclarations: require_CSSNestedDeclarations().CSSNestedDeclarations, + CSSStyleRule: require_CSSStyleRule().CSSStyleRule, + CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule, + CSSConditionRule: require_CSSConditionRule().CSSConditionRule, + CSSMediaRule: require_CSSMediaRule().CSSMediaRule, + CSSContainerRule: require_CSSContainerRule().CSSContainerRule, + CSSSupportsRule: require_CSSSupportsRule().CSSSupportsRule, + CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration, + CSSKeyframeRule: require_CSSKeyframeRule().CSSKeyframeRule, + CSSKeyframesRule: require_CSSKeyframesRule().CSSKeyframesRule, + CSSScopeRule: require_CSSScopeRule().CSSScopeRule, + CSSLayerBlockRule: require_CSSLayerBlockRule().CSSLayerBlockRule, + CSSLayerStatementRule: require_CSSLayerStatementRule().CSSLayerStatementRule + }; + try { + CSSOM2.CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; + } catch (e) { + } + CSSOM2.clone = function clone(stylesheet) { + var cloned = new CSSOM2.CSSStyleSheet(); + var rules = stylesheet.cssRules; + if (!rules) { + return cloned; + } + for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) { + var rule = rules[i]; + var ruleClone = cloned.cssRules[i] = new rule.constructor(); + var style = rule.style; + if (style) { + var styleClone = ruleClone.style = new CSSOM2.CSSStyleDeclaration(); + for (var j = 0, styleLength = style.length; j < styleLength; j++) { + var name = style[j]; + styleClone.setProperty(name, style.getPropertyValue(name), style.getPropertyPriority(name)); } } - return this._file; - } - get photo() { - if (this.media instanceof api_1.Api.MessageMediaPhoto) { - if (this.media.photo instanceof api_1.Api.Photo) - return this.media.photo; - } else if (this.action instanceof api_1.Api.MessageActionChatEditPhoto) { - return this.action.photo; - } else { - return this.webPreview && this.webPreview.photo instanceof api_1.Api.Photo ? this.webPreview.photo : void 0; + if (rule.hasOwnProperty("keyText")) { + ruleClone.keyText = rule.keyText; } - return void 0; - } - get document() { - if (this.media instanceof api_1.Api.MessageMediaDocument) { - if (this.media.document instanceof api_1.Api.Document) - return this.media.document; - } else { - const web = this.webPreview; - return web && web.document instanceof api_1.Api.Document ? web.document : void 0; + if (rule.hasOwnProperty("selectorText")) { + ruleClone.selectorText = rule.selectorText; } - return void 0; - } - get webPreview() { - if (this.media instanceof api_1.Api.MessageMediaWebPage) { - if (this.media.webpage instanceof api_1.Api.WebPage) - return this.media.webpage; + if (rule.hasOwnProperty("mediaText")) { + ruleClone.mediaText = rule.mediaText; + } + if (rule.hasOwnProperty("supportsText")) { + ruleClone.supports = rule.supports; + } + if (rule.hasOwnProperty("conditionText")) { + ruleClone.conditionText = rule.conditionText; + } + if (rule.hasOwnProperty("layerName")) { + ruleClone.layerName = rule.layerName; + } + if (rule.hasOwnProperty("href")) { + ruleClone.href = rule.href; + } + if (rule.hasOwnProperty("name")) { + ruleClone.name = rule.name; + } + if (rule.hasOwnProperty("nameList")) { + ruleClone.nameList = rule.nameList; + } + if (rule.hasOwnProperty("cssRules")) { + ruleClone.cssRules = clone(rule).cssRules; } } - get audio() { - return this._documentByAttribute(api_1.Api.DocumentAttributeAudio, (attr) => !attr.voice); + return cloned; + }; + exports2.clone = CSSOM2.clone; + } +}); + +// node_modules/@acemir/cssom/lib/index.js +var require_lib10 = __commonJS({ + "node_modules/@acemir/cssom/lib/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + exports2.setup = require_CSSOM().setup; + require_errorUtils(); + require_regexPatterns(); + exports2.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration; + require_cssstyleTryCatchBlock(); + exports2.CSSRule = require_CSSRule().CSSRule; + exports2.CSSRuleList = require_CSSRuleList().CSSRuleList; + exports2.CSSNestedDeclarations = require_CSSNestedDeclarations().CSSNestedDeclarations; + exports2.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule; + exports2.CSSCounterStyleRule = require_CSSCounterStyleRule().CSSCounterStyleRule; + exports2.CSSPropertyRule = require_CSSPropertyRule().CSSPropertyRule; + exports2.CSSConditionRule = require_CSSConditionRule().CSSConditionRule; + exports2.CSSStyleRule = require_CSSStyleRule().CSSStyleRule; + exports2.MediaList = require_MediaList().MediaList; + exports2.CSSMediaRule = require_CSSMediaRule().CSSMediaRule; + exports2.CSSContainerRule = require_CSSContainerRule().CSSContainerRule; + exports2.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule; + exports2.CSSImportRule = require_CSSImportRule().CSSImportRule; + exports2.CSSNamespaceRule = require_CSSNamespaceRule().CSSNamespaceRule; + exports2.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule; + exports2.CSSHostRule = require_CSSHostRule().CSSHostRule; + exports2.CSSStartingStyleRule = require_CSSStartingStyleRule().CSSStartingStyleRule; + exports2.StyleSheet = require_StyleSheet().StyleSheet; + exports2.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet; + exports2.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule; + exports2.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule; + exports2.MatcherList = require_MatcherList().MatcherList; + exports2.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule; + exports2.CSSValue = require_CSSValue().CSSValue; + exports2.CSSValueExpression = require_CSSValueExpression().CSSValueExpression; + exports2.CSSScopeRule = require_CSSScopeRule().CSSScopeRule; + exports2.CSSLayerBlockRule = require_CSSLayerBlockRule().CSSLayerBlockRule; + exports2.CSSLayerStatementRule = require_CSSLayerStatementRule().CSSLayerStatementRule; + exports2.CSSPageRule = require_CSSPageRule().CSSPageRule; + exports2.parse = require_parse3().parse; + exports2.clone = require_clone().clone; + } +}); + +// node_modules/linkedom/cjs/html/style-element.js +var require_style_element = __commonJS({ + "node_modules/linkedom/cjs/html/style-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { parse: parse3 } = require_lib10(); + var { registerHTMLClass } = require_register_html_class(); + var { SHEET } = require_symbols(); + var { TextElement } = require_text_element(); + var tagName = "style"; + var HTMLStyleElement = class extends TextElement { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + this[SHEET] = null; } - get voice() { - return this._documentByAttribute(api_1.Api.DocumentAttributeAudio, (attr) => !!attr.voice); + get sheet() { + const sheet = this[SHEET]; + if (sheet !== null) { + return sheet; + } + return this[SHEET] = parse3(this.textContent); } - get video() { - return this._documentByAttribute(api_1.Api.DocumentAttributeVideo); + get innerHTML() { + return super.innerHTML || ""; } - get videoNote() { - return this._documentByAttribute(api_1.Api.DocumentAttributeVideo, (attr) => !!attr.roundMessage); + set innerHTML(value) { + super.textContent = value; + this[SHEET] = null; } - get gif() { - return this._documentByAttribute(api_1.Api.DocumentAttributeAnimated); + get innerText() { + return super.innerText || ""; } - get sticker() { - return this._documentByAttribute(api_1.Api.DocumentAttributeSticker); + set innerText(value) { + super.textContent = value; + this[SHEET] = null; } - get contact() { - if (this.media instanceof api_1.Api.MessageMediaContact) { - return this.media; - } + get textContent() { + return super.textContent || ""; } - get game() { - if (this.media instanceof api_1.Api.MessageMediaGame) { - return this.media.game; - } + set textContent(value) { + super.textContent = value; + this[SHEET] = null; } - get geo() { - if (this.media instanceof api_1.Api.MessageMediaGeo || this.media instanceof api_1.Api.MessageMediaGeoLive || this.media instanceof api_1.Api.MessageMediaVenue) { - return this.media.geo; - } + }; + registerHTMLClass(tagName, HTMLStyleElement); + exports2.HTMLStyleElement = HTMLStyleElement; + } +}); + +// node_modules/linkedom/cjs/html/time-element.js +var require_time_element = __commonJS({ + "node_modules/linkedom/cjs/html/time-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { stringAttribute } = require_attributes(); + var { registerHTMLClass } = require_register_html_class(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTimeElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "time") { + super(ownerDocument, localName); } - get invoice() { - if (this.media instanceof api_1.Api.MessageMediaInvoice) { - return this.media; - } + /** + * @type {string} + */ + get dateTime() { + return stringAttribute.get(this, "datetime"); } - get poll() { - if (this.media instanceof api_1.Api.MessageMediaPoll) { - return this.media; - } + set dateTime(value) { + stringAttribute.set(this, "datetime", value); } - get venue() { - if (this.media instanceof api_1.Api.MessageMediaVenue) { - return this.media; - } + }; + registerHTMLClass("time", HTMLTimeElement); + exports2.HTMLTimeElement = HTMLTimeElement; + } +}); + +// node_modules/linkedom/cjs/html/field-set-element.js +var require_field_set_element = __commonJS({ + "node_modules/linkedom/cjs/html/field-set-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLFieldSetElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "fieldset") { + super(ownerDocument, localName); } - get dice() { - if (this.media instanceof api_1.Api.MessageMediaDice) { - return this.media; - } + }; + exports2.HTMLFieldSetElement = HTMLFieldSetElement; + } +}); + +// node_modules/linkedom/cjs/html/embed-element.js +var require_embed_element = __commonJS({ + "node_modules/linkedom/cjs/html/embed-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLEmbedElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "embed") { + super(ownerDocument, localName); } - get actionEntities() { - return this._actionEntities; + }; + exports2.HTMLEmbedElement = HTMLEmbedElement; + } +}); + +// node_modules/linkedom/cjs/html/hr-element.js +var require_hr_element = __commonJS({ + "node_modules/linkedom/cjs/html/hr-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLHRElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "hr") { + super(ownerDocument, localName); } - get viaBot() { - return this._viaBot; + }; + exports2.HTMLHRElement = HTMLHRElement; + } +}); + +// node_modules/linkedom/cjs/html/progress-element.js +var require_progress_element = __commonJS({ + "node_modules/linkedom/cjs/html/progress-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLProgressElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "progress") { + super(ownerDocument, localName); } - get viaInputBot() { - return this._viaInputBot; + }; + exports2.HTMLProgressElement = HTMLProgressElement; + } +}); + +// node_modules/linkedom/cjs/html/paragraph-element.js +var require_paragraph_element = __commonJS({ + "node_modules/linkedom/cjs/html/paragraph-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLParagraphElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "p") { + super(ownerDocument, localName); } - get replyToMsgId() { - var _a3; - return (_a3 = this.replyTo) === null || _a3 === void 0 ? void 0 : _a3.replyToMsgId; + }; + exports2.HTMLParagraphElement = HTMLParagraphElement; + } +}); + +// node_modules/linkedom/cjs/html/table-element.js +var require_table_element = __commonJS({ + "node_modules/linkedom/cjs/html/table-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTableElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "table") { + super(ownerDocument, localName); } - get toId() { - if (this._client && !this.out && this.isPrivate) { - return new api_1.Api.PeerUser({ - userId: (0, users_1._selfId)(this._client) - }); - } - return this.peerId; + }; + exports2.HTMLTableElement = HTMLTableElement; + } +}); + +// node_modules/linkedom/cjs/html/frame-set-element.js +var require_frame_set_element = __commonJS({ + "node_modules/linkedom/cjs/html/frame-set-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLFrameSetElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "frameset") { + super(ownerDocument, localName); + } + }; + exports2.HTMLFrameSetElement = HTMLFrameSetElement; + } +}); + +// node_modules/linkedom/cjs/html/li-element.js +var require_li_element = __commonJS({ + "node_modules/linkedom/cjs/html/li-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLLIElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "li") { + super(ownerDocument, localName); } - getEntitiesText(cls) { - let ent = this.entities; - if (!ent || ent.length == 0) - return; - if (cls) { - ent = ent.filter((v) => v instanceof cls); - } - const texts = utils.getInnerText(this.message || "", ent); - const zip = (rows) => rows[0].map((_, c) => rows.map((row) => row[c])); - return zip([ent, texts]); + }; + exports2.HTMLLIElement = HTMLLIElement; + } +}); + +// node_modules/linkedom/cjs/html/base-element.js +var require_base_element = __commonJS({ + "node_modules/linkedom/cjs/html/base-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLBaseElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "base") { + super(ownerDocument, localName); } - async getReplyMessage() { - if (!this._replyMessage && this._client) { - if (!this.replyTo) - return void 0; - this._replyMessage = (await this._client.getMessages(this.isChannel ? await this.getInputChat() : void 0, { - ids: new api_1.Api.InputMessageReplyTo({ id: this.id }) - }))[0]; - if (!this._replyMessage) { - this._replyMessage = (await this._client.getMessages(this.isChannel ? this._inputChat : void 0, { - ids: this.replyToMsgId - }))[0]; - } - } - return this._replyMessage; + }; + exports2.HTMLBaseElement = HTMLBaseElement; + } +}); + +// node_modules/linkedom/cjs/html/data-list-element.js +var require_data_list_element = __commonJS({ + "node_modules/linkedom/cjs/html/data-list-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDataListElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "datalist") { + super(ownerDocument, localName); } - async respond(params) { - if (this._client) { - return this._client.sendMessage(await this.getInputChat(), params); - } + }; + exports2.HTMLDataListElement = HTMLDataListElement; + } +}); + +// node_modules/linkedom/cjs/html/input-element.js +var require_input_element = __commonJS({ + "node_modules/linkedom/cjs/html/input-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "input"; + var HTMLInputElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - async reply(params) { - if (this._client) { - params.replyTo = this.id; - return this._client.sendMessage(await this.getInputChat(), params); - } + /* c8 ignore start */ + get autofocus() { + return booleanAttribute.get(this, "autofocus") || -1; } - async forwardTo(entity) { - if (this._client) { - entity = await this._client.getInputEntity(entity); - const params = { - messages: [this.id], - fromPeer: await this.getInputChat() - }; - return this._client.forwardMessages(entity, params); - } + set autofocus(value) { + booleanAttribute.set(this, "autofocus", value); } - async edit(params) { - const param = params; - if (this.fwdFrom || !this._client) - return void 0; - if (param.linkPreview == void 0) { - param.linkPreview = !!this.webPreview; - } - if (param.buttons == void 0) { - param.buttons = this.replyMarkup; - } - param.message = this.id; - return this._client.editMessage(await this.getInputChat(), param); + get disabled() { + return booleanAttribute.get(this, "disabled"); } - async delete({ revoke } = { revoke: false }) { - if (this._client) { - return this._client.deleteMessages(await this.getInputChat(), [this.id], { - revoke - }); - } + set disabled(value) { + booleanAttribute.set(this, "disabled", value); } - async pin(params) { - if (this._client) { - const entity = await this.getInputChat(); - if (entity === void 0) { - throw Error("Failed to pin message due to cannot get input chat."); - } - return this._client.pinMessage(entity, this.id, params); - } + get name() { + return this.getAttribute("name"); } - async unpin(params) { - if (this._client) { - const entity = await this.getInputChat(); - if (entity === void 0) { - throw Error("Failed to unpin message due to cannot get input chat."); - } - return this._client.unpinMessage(entity, this.id, params); - } + set name(value) { + this.setAttribute("name", value); } - async downloadMedia(params) { - if (this._client) - return this._client.downloadMedia(this, params || {}); + get placeholder() { + return this.getAttribute("placeholder"); } - async markAsRead() { - if (this._client) { - const entity = await this.getInputChat(); - if (entity === void 0) { - throw Error(`Failed to mark message id ${this.id} as read due to cannot get input chat.`); - } - return this._client.markAsRead(entity, this.id); - } + set placeholder(value) { + this.setAttribute("placeholder", value); } - async click({ i, j, text, filter: filter3, data, sharePhone, shareGeo, password }) { - if (!this.client) { - return; - } - if (data) { - const chat = await this.getInputChat(); - if (!chat) { - return; - } - const button2 = new api_1.Api.KeyboardButtonCallback({ - text: "", - data - }); - return await new messageButton_1.MessageButton(this.client, button2, chat, void 0, this.id).click({ - sharePhone, - shareGeo, - password - }); - } - if (this.poll) { - let findPoll = function(answers) { - if (i != void 0) { - if (Array.isArray(i)) { - const corrects = []; - for (let x = 0; x < i.length; x++) { - corrects.push(answers[x].option); - } - return corrects; - } - return [answers[i].option]; - } - if (text != void 0) { - if (typeof text == "function") { - for (const answer of answers) { - if (text(answer.text)) { - return [answer.option]; - } - } - } else { - for (const answer of answers) { - if (answer.text.text == text) { - return [answer.option]; - } - } - } - return; - } - if (filter3 != void 0) { - for (const answer of answers) { - if (filter3(answer)) { - return [answer.option]; - } - } - return; - } - }; - const options = findPoll(this.poll.poll.answers) || []; - return await this.client.invoke(new api_1.Api.messages.SendVote({ - peer: this.inputChat, - msgId: this.id, - options - })); - } - if (!await this.getButtons()) { - return; - } - function findButton(self2) { - if (!self2._buttonsFlat || !self2._buttons) { - return; - } - if (Array.isArray(i)) { - i = i[0]; - } - if (text != void 0) { - if (typeof text == "function") { - for (const button2 of self2._buttonsFlat) { - if (text(button2.text)) { - return button2; - } - } - } else { - for (const button2 of self2._buttonsFlat) { - if (button2.text == text) { - return button2; - } - } - } - return; - } - if (filter3 != void 0) { - for (const button2 of self2._buttonsFlat) { - if (filter3(button2)) { - return button2; - } - } - return; - } - if (i == void 0) { - i = 0; - } - if (j == void 0) { - return self2._buttonsFlat[i]; - } else { - return self2._buttons[i][j]; - } - } - const button = findButton(this); - if (button) { - return await button.click({ - sharePhone, - shareGeo, - password - }); - } + get type() { + return this.getAttribute("type"); } - /** - * Helper methods to set the buttons given the input sender and chat. - */ - _setButtons(chat, bot) { - if (this.client && (this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup)) { - this._buttons = []; - this._buttonsFlat = []; - for (const row of this.replyMarkup.rows) { - const tmp = []; - for (const button of row.buttons) { - const btn = new messageButton_1.MessageButton(this.client, button, chat, bot, this.id); - tmp.push(btn); - this._buttonsFlat.push(btn); - } - this._buttons.push(tmp); - } - } + set type(value) { + this.setAttribute("type", value); } - /** - *Returns the input peer of the bot that's needed for the reply markup. - - This is necessary for `KeyboardButtonSwitchInline` since we need - to know what bot we want to start. Raises ``Error`` if the bot - cannot be found but is needed. Returns `None` if it's not needed. - */ - _neededMarkupBot() { - if (!this.client || this.replyMarkup == void 0) { - return; - } - if (!(this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup)) { - return; - } - for (const row of this.replyMarkup.rows) { - for (const button of row.buttons) { - if (button instanceof api_1.Api.KeyboardButtonSwitchInline) { - if (button.samePeer || !this.viaBotId) { - const bot = this._inputSender; - if (!bot) - throw new Error("No input sender"); - return bot; - } else { - const ent = this.client._entityCache.get(this.viaBotId); - if (!ent) - throw new Error("No input sender"); - return ent; - } - } - } - } + get value() { + return stringAttribute.get(this, "value"); } - // TODO fix this - _documentByAttribute(kind, condition) { - const doc = this.document; - if (doc) { - for (const attr of doc.attributes) { - if (attr instanceof kind) { - if (condition == void 0 || typeof condition == "function" && condition(attr)) { - return doc; - } - return void 0; - } - } - } + set value(value) { + stringAttribute.set(this, "value", value); } + /* c8 ignore stop */ }; - exports2.CustomMessage = CustomMessage; + registerHTMLClass(tagName, HTMLInputElement); + exports2.HTMLInputElement = HTMLInputElement; } }); -// node_modules/telegram/tl/patched/index.js -var require_patched = __commonJS({ - "node_modules/telegram/tl/patched/index.js"(exports2) { +// node_modules/linkedom/cjs/html/param-element.js +var require_param_element = __commonJS({ + "node_modules/linkedom/cjs/html/param-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.patchAll = patchAll; - var api_1 = require_api(); - var message_1 = require_message(); - function getGetter(obj, prop2) { - while (obj) { - let getter = Object.getOwnPropertyDescriptor(obj, prop2); - if (getter && getter.get) { - return getter.get; - } - obj = Object.getPrototypeOf(obj); - } - } - function getSetter(obj, prop2) { - while (obj) { - let getter = Object.getOwnPropertyDescriptor(obj, prop2); - if (getter && getter.set) { - return getter.set; - } - obj = Object.getPrototypeOf(obj); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLParamElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "param") { + super(ownerDocument, localName); } - } - var getInstanceMethods = (obj) => { - let keys2 = { - methods: /* @__PURE__ */ new Set(), - setters: /* @__PURE__ */ new Set(), - getters: /* @__PURE__ */ new Set() - }; - let topObject = obj; - const mapAllMethods = (property) => { - const getter = getGetter(topObject, property); - const setter = getSetter(topObject, property); - if (getter) { - keys2["getters"].add(property); - } else if (setter) { - keys2["setters"].add(property); - } else { - if (!(property == "constructor")) { - keys2["methods"].add(property); - } - } - }; - do { - Object.getOwnPropertyNames(obj).map(mapAllMethods); - obj = Object.getPrototypeOf(obj); - } while ( - // not the the Object prototype methods (hasOwnProperty, etc...) - obj && Object.getPrototypeOf(obj) - ); - return keys2; }; - function patchClass(clazz) { - const { getters, setters, methods } = getInstanceMethods(message_1.CustomMessage.prototype); - for (const getter of getters) { - Object.defineProperty(clazz.prototype, getter, { - get: getGetter(message_1.CustomMessage.prototype, getter) - }); - } - for (const setter of setters) { - Object.defineProperty(clazz.prototype, setter, { - set: getSetter(message_1.CustomMessage.prototype, setter) - }); - } - for (const method of methods) { - clazz.prototype[method] = message_1.CustomMessage.prototype[method]; + exports2.HTMLParamElement = HTMLParamElement; + } +}); + +// node_modules/linkedom/cjs/html/media-element.js +var require_media_element = __commonJS({ + "node_modules/linkedom/cjs/html/media-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLMediaElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "media") { + super(ownerDocument, localName); } - } - function patchAll() { - patchClass(api_1.Api.Message); - patchClass(api_1.Api.MessageService); - patchClass(api_1.Api.MessageEmpty); - } + }; + exports2.HTMLMediaElement = HTMLMediaElement; } }); -// node_modules/telegram/tl/index.js -var require_tl = __commonJS({ - "node_modules/telegram/tl/index.js"(exports2) { +// node_modules/linkedom/cjs/html/audio-element.js +var require_audio_element = __commonJS({ + "node_modules/linkedom/cjs/html/audio-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.serializeDate = exports2.serializeBytes = exports2.Api = void 0; - var api_1 = require_api(); - Object.defineProperty(exports2, "Api", { enumerable: true, get: function() { - return api_1.Api; - } }); - var patched_1 = require_patched(); - (0, patched_1.patchAll)(); - var generationHelpers_1 = require_generationHelpers(); - Object.defineProperty(exports2, "serializeBytes", { enumerable: true, get: function() { - return generationHelpers_1.serializeBytes; - } }); - Object.defineProperty(exports2, "serializeDate", { enumerable: true, get: function() { - return generationHelpers_1.serializeDate; - } }); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLAudioElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "audio") { + super(ownerDocument, localName); + } + }; + exports2.HTMLAudioElement = HTMLAudioElement; } }); -// node_modules/telegram/extensions/BinaryWriter.js -var require_BinaryWriter = __commonJS({ - "node_modules/telegram/extensions/BinaryWriter.js"(exports2) { +// node_modules/linkedom/cjs/html/heading-element.js +var require_heading_element = __commonJS({ + "node_modules/linkedom/cjs/html/heading-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.BinaryWriter = void 0; - var BinaryWriter = class { - constructor(stream) { - this._buffers = [stream]; + var { registerHTMLClass } = require_register_html_class(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "h1"; + var HTMLHeadingElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - write(buffer) { - this._buffers.push(buffer); + }; + registerHTMLClass([tagName, "h2", "h3", "h4", "h5", "h6"], HTMLHeadingElement); + exports2.HTMLHeadingElement = HTMLHeadingElement; + } +}); + +// node_modules/linkedom/cjs/html/directory-element.js +var require_directory_element = __commonJS({ + "node_modules/linkedom/cjs/html/directory-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDirectoryElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "dir") { + super(ownerDocument, localName); } - getValue() { - return Buffer.concat(this._buffers); + }; + exports2.HTMLDirectoryElement = HTMLDirectoryElement; + } +}); + +// node_modules/linkedom/cjs/html/quote-element.js +var require_quote_element = __commonJS({ + "node_modules/linkedom/cjs/html/quote-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLQuoteElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "quote") { + super(ownerDocument, localName); } }; - exports2.BinaryWriter = BinaryWriter; + exports2.HTMLQuoteElement = HTMLQuoteElement; } }); -// node_modules/ts-custom-error/dist/custom-error.js -var require_custom_error = __commonJS({ - "node_modules/ts-custom-error/dist/custom-error.js"(exports2) { +// node_modules/linkedom/commonjs/canvas-shim.cjs +var require_canvas_shim = __commonJS({ + "node_modules/linkedom/commonjs/canvas-shim.cjs"(exports2, module2) { init_define_import_meta_env(); - function fixProto(target, prototype2) { - var setPrototypeOf2 = Object.setPrototypeOf; - setPrototypeOf2 ? setPrototypeOf2(target, prototype2) : target.__proto__ = prototype2; - } - function fixStack(target, fn) { - if (fn === void 0) { - fn = target.constructor; + var Canvas = class { + constructor(width, height) { + this.width = width; + this.height = height; } - var captureStackTrace = Error.captureStackTrace; - captureStackTrace && captureStackTrace(target, fn); - } - var __extends2 = /* @__PURE__ */ (function() { - var _extendStatics = function extendStatics2(d, b) { - _extendStatics = Object.setPrototypeOf || { - __proto__: [] - } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) { - if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - } - }; - return _extendStatics(d, b); - }; - return function(d, b) { - if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - _extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var CustomError = (function(_super) { - __extends2(CustomError2, _super); - function CustomError2(message, options) { - var _newTarget = this.constructor; - var _this = _super.call(this, message, options) || this; - Object.defineProperty(_this, "name", { - value: _newTarget.name, - enumerable: false, - configurable: true - }); - fixProto(_this, _newTarget.prototype); - fixStack(_this); - return _this; + getContext() { + return null; } - return CustomError2; - })(Error); - var __spreadArray2 = function(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } + toDataURL() { + return ""; } - return to.concat(ar || Array.prototype.slice.call(from)); }; - function customErrorFactory(fn, parent) { - if (parent === void 0) { - parent = Error; + module2.exports = { + createCanvas: (width, height) => new Canvas(width, height) + }; + } +}); + +// node_modules/linkedom/commonjs/canvas.cjs +var require_canvas = __commonJS({ + "node_modules/linkedom/commonjs/canvas.cjs"(exports2, module2) { + init_define_import_meta_env(); + try { + module2.exports = require("canvas"); + } catch (fallback) { + module2.exports = require_canvas_shim(); + } + } +}); + +// node_modules/linkedom/cjs/html/canvas-element.js +var require_canvas_element = __commonJS({ + "node_modules/linkedom/cjs/html/canvas-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { IMAGE } = require_symbols(); + var { registerHTMLClass } = require_register_html_class(); + var { numericAttribute } = require_attributes(); + var Canvas = require_canvas(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { createCanvas } = Canvas; + var tagName = "canvas"; + var HTMLCanvasElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + this[IMAGE] = createCanvas(300, 150); } - function CustomError2() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (!(this instanceof CustomError2)) return new (CustomError2.bind.apply(CustomError2, __spreadArray2([void 0], args, false)))(); - parent.apply(this, args); - Object.defineProperty(this, "name", { - value: fn.name || parent.name, - enumerable: false, - configurable: true - }); - fn.apply(this, args); - fixStack(this, CustomError2); + get width() { + return this[IMAGE].width; } - return Object.defineProperties(CustomError2, { - prototype: { - value: Object.create(parent.prototype, { - constructor: { - value: CustomError2, - writable: true, - configurable: true - } - }) - } - }); - } - exports2.CustomError = CustomError; - exports2.customErrorFactory = customErrorFactory; + set width(value) { + numericAttribute.set(this, "width", value); + this[IMAGE].width = value; + } + get height() { + return this[IMAGE].height; + } + set height(value) { + numericAttribute.set(this, "height", value); + this[IMAGE].height = value; + } + getContext(type) { + return this[IMAGE].getContext(type); + } + toDataURL(...args) { + return this[IMAGE].toDataURL(...args); + } + }; + registerHTMLClass(tagName, HTMLCanvasElement); + exports2.HTMLCanvasElement = HTMLCanvasElement; } }); -// node_modules/telegram/errors/RPCBaseErrors.js -var require_RPCBaseErrors = __commonJS({ - "node_modules/telegram/errors/RPCBaseErrors.js"(exports2) { +// node_modules/linkedom/cjs/html/legend-element.js +var require_legend_element = __commonJS({ + "node_modules/linkedom/cjs/html/legend-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TimedOutError = exports2.ServerError = exports2.FloodError = exports2.AuthKeyError = exports2.NotFoundError = exports2.ForbiddenError = exports2.UnauthorizedError = exports2.BadRequestError = exports2.InvalidDCError = exports2.RPCError = void 0; - var ts_custom_error_1 = require_custom_error(); - var RPCError = class _RPCError extends ts_custom_error_1.CustomError { - constructor(message, request, code) { - super("{0}: {1}{2}".replace("{0}", (code === null || code === void 0 ? void 0 : code.toString()) || "").replace("{1}", message || "").replace("{2}", _RPCError._fmtRequest(request))); - this.code = code; - this.errorMessage = message; - } - static _fmtRequest(request) { - if (request) { - return ` (caused by ${request.className})`; - } else { - return ""; - } + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLLegendElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "legend") { + super(ownerDocument, localName); } }; - exports2.RPCError = RPCError; - var InvalidDCError = class extends RPCError { - constructor(message, request, code) { - super(message, request, code); - this.code = code || 303; - this.errorMessage = message || "ERROR_SEE_OTHER"; + exports2.HTMLLegendElement = HTMLLegendElement; + } +}); + +// node_modules/linkedom/cjs/html/option-element.js +var require_option_element = __commonJS({ + "node_modules/linkedom/cjs/html/option-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { registerHTMLClass } = require_register_html_class(); + var tagName = "option"; + var HTMLOptionElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - }; - exports2.InvalidDCError = InvalidDCError; - var BadRequestError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 400; - this.errorMessage = "BAD_REQUEST"; + /* c8 ignore start */ + get value() { + return stringAttribute.get(this, "value"); } - }; - exports2.BadRequestError = BadRequestError; - var UnauthorizedError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 401; - this.errorMessage = "UNAUTHORIZED"; + set value(value) { + stringAttribute.set(this, "value", value); } - }; - exports2.UnauthorizedError = UnauthorizedError; - var ForbiddenError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 403; - this.errorMessage = "FORBIDDEN"; + /* c8 ignore stop */ + get selected() { + return booleanAttribute.get(this, "selected"); } - }; - exports2.ForbiddenError = ForbiddenError; - var NotFoundError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 404; - this.errorMessage = "NOT_FOUND"; + set selected(value) { + const option = this.parentElement?.querySelector("option[selected]"); + if (option && option !== this) + option.selected = false; + booleanAttribute.set(this, "selected", value); } }; - exports2.NotFoundError = NotFoundError; - var AuthKeyError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 406; - this.errorMessage = "AUTH_KEY"; + registerHTMLClass(tagName, HTMLOptionElement); + exports2.HTMLOptionElement = HTMLOptionElement; + } +}); + +// node_modules/linkedom/cjs/html/span-element.js +var require_span_element = __commonJS({ + "node_modules/linkedom/cjs/html/span-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLSpanElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "span") { + super(ownerDocument, localName); } }; - exports2.AuthKeyError = AuthKeyError; - var FloodError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 420; - this.errorMessage = "FLOOD"; + exports2.HTMLSpanElement = HTMLSpanElement; + } +}); + +// node_modules/linkedom/cjs/html/meter-element.js +var require_meter_element = __commonJS({ + "node_modules/linkedom/cjs/html/meter-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLMeterElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "meter") { + super(ownerDocument, localName); } }; - exports2.FloodError = FloodError; - var ServerError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 500; - this.errorMessage = "INTERNAL"; + exports2.HTMLMeterElement = HTMLMeterElement; + } +}); + +// node_modules/linkedom/cjs/html/video-element.js +var require_video_element = __commonJS({ + "node_modules/linkedom/cjs/html/video-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLVideoElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "video") { + super(ownerDocument, localName); } }; - exports2.ServerError = ServerError; - var TimedOutError = class extends RPCError { - constructor() { - super(...arguments); - this.code = 503; - this.errorMessage = "Timeout"; + exports2.HTMLVideoElement = HTMLVideoElement; + } +}); + +// node_modules/linkedom/cjs/html/table-cell-element.js +var require_table_cell_element = __commonJS({ + "node_modules/linkedom/cjs/html/table-cell-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTableCellElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "td") { + super(ownerDocument, localName); } }; - exports2.TimedOutError = TimedOutError; + exports2.HTMLTableCellElement = HTMLTableCellElement; } }); -// node_modules/telegram/errors/RPCErrorList.js -var require_RPCErrorList = __commonJS({ - "node_modules/telegram/errors/RPCErrorList.js"(exports2) { +// node_modules/linkedom/cjs/html/title-element.js +var require_title_element = __commonJS({ + "node_modules/linkedom/cjs/html/title-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.rpcErrorRe = exports2.MsgWaitError = exports2.EmailUnconfirmedError = exports2.NetworkMigrateError = exports2.FileMigrateError = exports2.FloodTestPhoneWaitError = exports2.FloodWaitError = exports2.SlowModeWaitError = exports2.PhoneMigrateError = exports2.UserMigrateError = void 0; - var RPCBaseErrors_1 = require_RPCBaseErrors(); - var UserMigrateError = class extends RPCBaseErrors_1.InvalidDCError { - constructor(args) { - const newDc = Number(args.capture || 0); - super(`The user whose identity is being used to execute queries is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `The user whose identity is being used to execute queries is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.newDc = newDc; + var { registerHTMLClass } = require_register_html_class(); + var { TextElement } = require_text_element(); + var tagName = "title"; + var HTMLTitleElement = class extends TextElement { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } }; - exports2.UserMigrateError = UserMigrateError; - var PhoneMigrateError = class extends RPCBaseErrors_1.InvalidDCError { - constructor(args) { - const newDc = Number(args.capture || 0); - super(`The phone number a user is trying to use for authorization is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `The phone number a user is trying to use for authorization is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.newDc = newDc; + registerHTMLClass(tagName, HTMLTitleElement); + exports2.HTMLTitleElement = HTMLTitleElement; + } +}); + +// node_modules/linkedom/cjs/html/output-element.js +var require_output_element = __commonJS({ + "node_modules/linkedom/cjs/html/output-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLOutputElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "output") { + super(ownerDocument, localName); } }; - exports2.PhoneMigrateError = PhoneMigrateError; - var SlowModeWaitError = class extends RPCBaseErrors_1.FloodError { - constructor(args) { - const seconds = Number(args.capture || 0); - super(`A wait of ${seconds} seconds is required before sending another message in this chat` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `A wait of ${seconds} seconds is required before sending another message in this chat` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.seconds = seconds; + exports2.HTMLOutputElement = HTMLOutputElement; + } +}); + +// node_modules/linkedom/cjs/html/table-row-element.js +var require_table_row_element = __commonJS({ + "node_modules/linkedom/cjs/html/table-row-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTableRowElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "tr") { + super(ownerDocument, localName); } }; - exports2.SlowModeWaitError = SlowModeWaitError; - var FloodWaitError = class extends RPCBaseErrors_1.FloodError { - constructor(args) { - const seconds = Number(args.capture || 0); - super(`A wait of ${seconds} seconds is required` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `A wait of ${seconds} seconds is required` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.seconds = seconds; + exports2.HTMLTableRowElement = HTMLTableRowElement; + } +}); + +// node_modules/linkedom/cjs/html/data-element.js +var require_data_element = __commonJS({ + "node_modules/linkedom/cjs/html/data-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDataElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "data") { + super(ownerDocument, localName); } }; - exports2.FloodWaitError = FloodWaitError; - var FloodTestPhoneWaitError = class extends RPCBaseErrors_1.FloodError { - constructor(args) { - const seconds = Number(args.capture || 0); - super(`A wait of ${seconds} seconds is required in the test servers` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `A wait of ${seconds} seconds is required in the test servers` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.seconds = seconds; + exports2.HTMLDataElement = HTMLDataElement; + } +}); + +// node_modules/linkedom/cjs/html/menu-element.js +var require_menu_element = __commonJS({ + "node_modules/linkedom/cjs/html/menu-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLMenuElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "menu") { + super(ownerDocument, localName); } }; - exports2.FloodTestPhoneWaitError = FloodTestPhoneWaitError; - var FileMigrateError = class extends RPCBaseErrors_1.InvalidDCError { - constructor(args) { - const newDc = Number(args.capture || 0); - super(`The file to be accessed is currently stored in DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `The file to be accessed is currently stored in DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.newDc = newDc; + exports2.HTMLMenuElement = HTMLMenuElement; + } +}); + +// node_modules/linkedom/cjs/html/select-element.js +var require_select_element = __commonJS({ + "node_modules/linkedom/cjs/html/select-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { NodeList } = require_node_list(); + var tagName = "select"; + var HTMLSelectElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + } + get options() { + let children = new NodeList(); + let { firstElementChild } = this; + while (firstElementChild) { + if (firstElementChild.tagName === "OPTGROUP") + children.push(...firstElementChild.children); + else + children.push(firstElementChild); + firstElementChild = firstElementChild.nextElementSibling; + } + return children; } - }; - exports2.FileMigrateError = FileMigrateError; - var NetworkMigrateError = class extends RPCBaseErrors_1.InvalidDCError { - constructor(args) { - const newDc = Number(args.capture || 0); - super(`The source IP address is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); - this.message = `The source IP address is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); - this.newDc = newDc; + /* c8 ignore start */ + get disabled() { + return booleanAttribute.get(this, "disabled"); } - }; - exports2.NetworkMigrateError = NetworkMigrateError; - var EmailUnconfirmedError = class extends RPCBaseErrors_1.BadRequestError { - constructor(args) { - const codeLength = Number(args.capture || 0); - super(`Email unconfirmed, the length of the code must be ${codeLength}${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`, args.request, 400); - this.message = `Email unconfirmed, the length of the code must be ${codeLength}${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`; - this.codeLength = codeLength; + set disabled(value) { + booleanAttribute.set(this, "disabled", value); } - }; - exports2.EmailUnconfirmedError = EmailUnconfirmedError; - var MsgWaitError = class extends RPCBaseErrors_1.FloodError { - constructor(args) { - super(`Message failed to be sent.${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`, args.request); - this.message = `Message failed to be sent.${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`; + get name() { + return this.getAttribute("name"); + } + set name(value) { + this.setAttribute("name", value); + } + /* c8 ignore stop */ + get value() { + return this.querySelector("option[selected]")?.value; } }; - exports2.MsgWaitError = MsgWaitError; - exports2.rpcErrorRe = /* @__PURE__ */ new Map([ - [/FILE_MIGRATE_(\d+)/, FileMigrateError], - [/FLOOD_TEST_PHONE_WAIT_(\d+)/, FloodTestPhoneWaitError], - [/FLOOD_WAIT_(\d+)/, FloodWaitError], - [/FLOOD_PREMIUM_WAIT_(\d+)/, FloodWaitError], - [/MSG_WAIT_(.*)/, MsgWaitError], - [/PHONE_MIGRATE_(\d+)/, PhoneMigrateError], - [/SLOWMODE_WAIT_(\d+)/, SlowModeWaitError], - [/USER_MIGRATE_(\d+)/, UserMigrateError], - [/NETWORK_MIGRATE_(\d+)/, NetworkMigrateError], - [/EMAIL_UNCONFIRMED_(\d+)/, EmailUnconfirmedError] - ]); + registerHTMLClass(tagName, HTMLSelectElement); + exports2.HTMLSelectElement = HTMLSelectElement; } }); -// node_modules/telegram/errors/Common.js -var require_Common = __commonJS({ - "node_modules/telegram/errors/Common.js"(exports2) { +// node_modules/linkedom/cjs/html/br-element.js +var require_br_element = __commonJS({ + "node_modules/linkedom/cjs/html/br-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.BadMessageError = exports2.CdnFileTamperedError = exports2.SecurityError = exports2.InvalidBufferError = exports2.InvalidChecksumError = exports2.TypeNotFoundError = exports2.ReadCancelledError = void 0; - var ReadCancelledError = class extends Error { - constructor() { - super("The read operation was cancelled."); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLBRElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "br") { + super(ownerDocument, localName); } }; - exports2.ReadCancelledError = ReadCancelledError; - var TypeNotFoundError = class extends Error { - constructor(invalidConstructorId, remaining) { - super(`Could not find a matching Constructor ID for the TLObject that was supposed to be - read with ID ${invalidConstructorId}. Most likely, a TLObject was trying to be read when - it should not be read. Remaining bytes: ${remaining.length}`); - if (typeof alert !== "undefined") { - alert(`Missing MTProto Entity: Please, make sure to add TL definition for ID ${invalidConstructorId}`); - } - this.invalidConstructorId = invalidConstructorId; - this.remaining = remaining; + exports2.HTMLBRElement = HTMLBRElement; + } +}); + +// node_modules/linkedom/cjs/html/button-element.js +var require_button_element = __commonJS({ + "node_modules/linkedom/cjs/html/button-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "button"; + var HTMLButtonElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - }; - exports2.TypeNotFoundError = TypeNotFoundError; - var InvalidChecksumError = class extends Error { - constructor(checksum, validChecksum) { - super(`Invalid checksum (${checksum} when ${validChecksum} was expected). This packet should be skipped.`); - this.checksum = checksum; - this.validChecksum = validChecksum; + /* c8 ignore start */ + get disabled() { + return booleanAttribute.get(this, "disabled"); } - }; - exports2.InvalidChecksumError = InvalidChecksumError; - var InvalidBufferError = class extends Error { - constructor(payload) { - let code = void 0; - if (payload.length === 4) { - code = -payload.readInt32LE(0); - super(`Invalid response buffer (HTTP code ${code})`); - } else { - super(`Invalid response buffer (too short ${payload})`); - } - this.code = code; - this.payload = payload; + set disabled(value) { + booleanAttribute.set(this, "disabled", value); } - }; - exports2.InvalidBufferError = InvalidBufferError; - var SecurityError = class extends Error { - constructor(...args) { - if (!args.length) { - args = ["A security check failed."]; - } - super(...args); + get name() { + return this.getAttribute("name"); } - }; - exports2.SecurityError = SecurityError; - var CdnFileTamperedError = class extends SecurityError { - constructor() { - super("The CDN file has been altered and its download cancelled."); + set name(value) { + this.setAttribute("name", value); } - }; - exports2.CdnFileTamperedError = CdnFileTamperedError; - var BadMessageError = class _BadMessageError extends Error { - constructor(request, code) { - let errorMessage = _BadMessageError.ErrorMessages[code] || `Unknown error code (this should not happen): ${code}.`; - errorMessage += ` Caused by ${request.className}`; - super(errorMessage); - this.errorMessage = errorMessage; - this.code = code; + get type() { + return this.getAttribute("type"); } + set type(value) { + this.setAttribute("type", value); + } + /* c8 ignore stop */ }; - exports2.BadMessageError = BadMessageError; - BadMessageError.ErrorMessages = { - 16: "msg_id too low (most likely, client time is wrong it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the \u201Ccorrect\u201D msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted).", - 17: "msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id).", - 18: "Incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4).", - 19: "Container msg_id is the same as msg_id of a previously received message (this must never happen).", - 20: "Message too old, and it cannot be verified whether the server has received a message with this msg_id or not.", - 32: "msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno).", - 33: "msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno).", - 34: "An even msg_seqno expected (irrelevant message), but odd received.", - 35: "Odd msg_seqno expected (relevant message), but even received.", - 48: "Incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it).", - 64: "Invalid container." - }; + registerHTMLClass(tagName, HTMLButtonElement); + exports2.HTMLButtonElement = HTMLButtonElement; } }); -// node_modules/telegram/errors/index.js -var require_errors = __commonJS({ - "node_modules/telegram/errors/index.js"(exports2) { +// node_modules/linkedom/cjs/html/map-element.js +var require_map_element = __commonJS({ + "node_modules/linkedom/cjs/html/map-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLMapElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "map") { + super(ownerDocument, localName); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RPCMessageToError = RPCMessageToError; - var RPCBaseErrors_1 = require_RPCBaseErrors(); - var RPCErrorList_1 = require_RPCErrorList(); - function RPCMessageToError(rpcError, request) { - for (const [msgRegex, Cls] of RPCErrorList_1.rpcErrorRe) { - const m = rpcError.errorMessage.match(msgRegex); - if (m) { - const capture = m.length === 2 ? parseInt(m[1]) : null; - return new Cls({ request, capture }); - } + exports2.HTMLMapElement = HTMLMapElement; + } +}); + +// node_modules/linkedom/cjs/html/opt-group-element.js +var require_opt_group_element = __commonJS({ + "node_modules/linkedom/cjs/html/opt-group-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLOptGroupElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "optgroup") { + super(ownerDocument, localName); } - return new RPCBaseErrors_1.RPCError(rpcError.errorMessage, request, rpcError.errorCode); - } - __exportStar2(require_Common(), exports2); - __exportStar2(require_RPCBaseErrors(), exports2); - __exportStar2(require_RPCErrorList(), exports2); + }; + exports2.HTMLOptGroupElement = HTMLOptGroupElement; } }); -// node_modules/telegram/tl/core/TLMessage.js -var require_TLMessage = __commonJS({ - "node_modules/telegram/tl/core/TLMessage.js"(exports2) { +// node_modules/linkedom/cjs/html/d-list-element.js +var require_d_list_element = __commonJS({ + "node_modules/linkedom/cjs/html/d-list-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TLMessage = void 0; - var TLMessage = class { - constructor(msgId, seqNo, obj) { - this.msgId = msgId; - this.seqNo = seqNo; - this.obj = obj; - this.classType = "constructor"; + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDListElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "dl") { + super(ownerDocument, localName); } }; - exports2.TLMessage = TLMessage; - TLMessage.SIZE_OVERHEAD = 12; - TLMessage.classType = "constructor"; + exports2.HTMLDListElement = HTMLDListElement; } }); -// node_modules/telegram/tl/core/RPCResult.js -var require_RPCResult = __commonJS({ - "node_modules/telegram/tl/core/RPCResult.js"(exports2) { +// node_modules/linkedom/cjs/html/text-area-element.js +var require_text_area_element = __commonJS({ + "node_modules/linkedom/cjs/html/text-area-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RPCResult = void 0; - var api_1 = require_api(); - var _1 = require_core(); - var RPCResult = class _RPCResult { - constructor(reqMsgId, body, error) { - this.CONSTRUCTOR_ID = 4082920705; - this.reqMsgId = reqMsgId; - this.body = body; - this.error = error; - this.classType = "constructor"; + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute } = require_attributes(); + var { TextElement } = require_text_element(); + var tagName = "textarea"; + var HTMLTextAreaElement = class extends TextElement { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - static async fromReader(reader) { - const msgId = reader.readLong(); - const innerCode = reader.readInt(false); - if (innerCode === api_1.Api.RpcError.CONSTRUCTOR_ID) { - return new _RPCResult(msgId, void 0, api_1.Api.RpcError.fromReader(reader)); - } - if (innerCode === _1.GZIPPacked.CONSTRUCTOR_ID) { - return new _RPCResult(msgId, (await _1.GZIPPacked.fromReader(reader)).data); - } - reader.seek(-4); - return new _RPCResult(msgId, reader.read(), void 0); + /* c8 ignore start */ + get disabled() { + return booleanAttribute.get(this, "disabled"); + } + set disabled(value) { + booleanAttribute.set(this, "disabled", value); + } + get name() { + return this.getAttribute("name"); + } + set name(value) { + this.setAttribute("name", value); } + get placeholder() { + return this.getAttribute("placeholder"); + } + set placeholder(value) { + this.setAttribute("placeholder", value); + } + get type() { + return this.getAttribute("type"); + } + set type(value) { + this.setAttribute("type", value); + } + get value() { + return this.textContent; + } + set value(content) { + this.textContent = content; + } + /* c8 ignore stop */ }; - exports2.RPCResult = RPCResult; - RPCResult.CONSTRUCTOR_ID = 4082920705; - RPCResult.classType = "constructor"; + registerHTMLClass(tagName, HTMLTextAreaElement); + exports2.HTMLTextAreaElement = HTMLTextAreaElement; } }); -// node_modules/telegram/tl/core/MessageContainer.js -var require_MessageContainer = __commonJS({ - "node_modules/telegram/tl/core/MessageContainer.js"(exports2) { +// node_modules/linkedom/cjs/html/font-element.js +var require_font_element = __commonJS({ + "node_modules/linkedom/cjs/html/font-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MessageContainer = void 0; - var TLMessage_1 = require_TLMessage(); - var MessageContainer = class _MessageContainer { - constructor(messages) { - this.CONSTRUCTOR_ID = 1945237724; - this.messages = messages; - this.classType = "constructor"; + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLFontElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "font") { + super(ownerDocument, localName); } - static async fromReader(reader) { - const messages = []; - const length = reader.readInt(); - for (let x = 0; x < length; x++) { - const msgId = reader.readLong(); - const seqNo = reader.readInt(); - const length2 = reader.readInt(); - const before2 = reader.tellPosition(); - const obj = reader.tgReadObject(); - reader.setPosition(before2 + length2); - const tlMessage = new TLMessage_1.TLMessage(msgId, seqNo, obj); - messages.push(tlMessage); - } - return new _MessageContainer(messages); + }; + exports2.HTMLFontElement = HTMLFontElement; + } +}); + +// node_modules/linkedom/cjs/html/div-element.js +var require_div_element = __commonJS({ + "node_modules/linkedom/cjs/html/div-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDivElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "div") { + super(ownerDocument, localName); } }; - exports2.MessageContainer = MessageContainer; - MessageContainer.CONSTRUCTOR_ID = 1945237724; - MessageContainer.classType = "constructor"; - MessageContainer.MAXIMUM_SIZE = 1044456 - 8; - MessageContainer.MAXIMUM_LENGTH = 100; + exports2.HTMLDivElement = HTMLDivElement; } }); -// node_modules/pako/lib/zlib/trees.js -var require_trees = __commonJS({ - "node_modules/pako/lib/zlib/trees.js"(exports2, module2) { +// node_modules/linkedom/cjs/html/link-element.js +var require_link_element = __commonJS({ + "node_modules/linkedom/cjs/html/link-element.js"(exports2) { "use strict"; init_define_import_meta_env(); - var Z_FIXED = 4; - var Z_BINARY = 0; - var Z_TEXT = 1; - var Z_UNKNOWN = 2; - function zero(buf) { - let len = buf.length; - while (--len >= 0) { - buf[len] = 0; + var { registerHTMLClass } = require_register_html_class(); + var { booleanAttribute, stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "link"; + var HTMLLinkElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - } - var STORED_BLOCK = 0; - var STATIC_TREES = 1; - var DYN_TREES = 2; - var MIN_MATCH = 3; - var MAX_MATCH = 258; - var LENGTH_CODES = 29; - var LITERALS = 256; - var L_CODES = LITERALS + 1 + LENGTH_CODES; - var D_CODES = 30; - var BL_CODES = 19; - var HEAP_SIZE = 2 * L_CODES + 1; - var MAX_BITS = 15; - var Buf_size = 16; - var MAX_BL_BITS = 7; - var END_BLOCK = 256; - var REP_3_6 = 16; - var REPZ_3_10 = 17; - var REPZ_11_138 = 18; - var extra_lbits = ( - /* extra bits for each length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) - ); - var extra_dbits = ( - /* extra bits for each distance code */ - new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) - ); - var extra_blbits = ( - /* extra bits for each bit length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) - ); - var bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); - var DIST_CODE_LEN = 512; - var static_ltree = new Array((L_CODES + 2) * 2); - zero(static_ltree); - var static_dtree = new Array(D_CODES * 2); - zero(static_dtree); - var _dist_code = new Array(DIST_CODE_LEN); - zero(_dist_code); - var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); - zero(_length_code); - var base_length = new Array(LENGTH_CODES); - zero(base_length); - var base_dist = new Array(D_CODES); - zero(base_dist); - function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - this.static_tree = static_tree; - this.extra_bits = extra_bits; - this.extra_base = extra_base; - this.elems = elems; - this.max_length = max_length; - this.has_stree = static_tree && static_tree.length; - } - var static_l_desc; - var static_d_desc; - var static_bl_desc; - function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; - this.max_code = 0; - this.stat_desc = stat_desc; - } - var d_code = (dist) => { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; + /* c8 ignore start */ + // copy paste from img.src, already covered + get disabled() { + return booleanAttribute.get(this, "disabled"); + } + set disabled(value) { + booleanAttribute.set(this, "disabled", value); + } + get href() { + return stringAttribute.get(this, "href").trim(); + } + set href(value) { + stringAttribute.set(this, "href", value); + } + get hreflang() { + return stringAttribute.get(this, "hreflang"); + } + set hreflang(value) { + stringAttribute.set(this, "hreflang", value); + } + get media() { + return stringAttribute.get(this, "media"); + } + set media(value) { + stringAttribute.set(this, "media", value); + } + get rel() { + return stringAttribute.get(this, "rel"); + } + set rel(value) { + stringAttribute.set(this, "rel", value); + } + get type() { + return stringAttribute.get(this, "type"); + } + set type(value) { + stringAttribute.set(this, "type", value); + } + /* c8 ignore stop */ }; - var put_short = (s, w) => { - s.pending_buf[s.pending++] = w & 255; - s.pending_buf[s.pending++] = w >>> 8 & 255; + registerHTMLClass(tagName, HTMLLinkElement); + exports2.HTMLLinkElement = HTMLLinkElement; + } +}); + +// node_modules/linkedom/cjs/html/slot-element.js +var require_slot_element = __commonJS({ + "node_modules/linkedom/cjs/html/slot-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { registerHTMLClass } = require_register_html_class(); + var tagName = "slot"; + var HTMLSlotElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + } + /* c8 ignore start */ + get name() { + return this.getAttribute("name"); + } + set name(value) { + this.setAttribute("name", value); + } + assign() { + } + assignedNodes(options) { + const isNamedSlot = !!this.name; + const hostChildNodes = this.getRootNode().host?.childNodes ?? []; + let slottables; + if (isNamedSlot) { + slottables = [...hostChildNodes].filter((node) => node.slot === this.name); + } else { + slottables = [...hostChildNodes].filter((node) => !node.slot); + } + if (options?.flatten) { + const result = []; + for (let slottable of slottables) { + if (slottable.localName === "slot") { + result.push(...slottable.assignedNodes({ flatten: true })); + } else { + result.push(slottable); + } + } + slottables = result; + } + return slottables.length ? slottables : [...this.childNodes]; + } + assignedElements(options) { + const slottables = this.assignedNodes(options).filter((n) => n.nodeType === 1); + return slottables.length ? slottables : [...this.children]; + } + /* c8 ignore stop */ }; - var send_bits = (s, value, length) => { - if (s.bi_valid > Buf_size - length) { - s.bi_buf |= value << s.bi_valid & 65535; - put_short(s, s.bi_buf); - s.bi_buf = value >> Buf_size - s.bi_valid; - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= value << s.bi_valid & 65535; - s.bi_valid += length; + registerHTMLClass(tagName, HTMLSlotElement); + exports2.HTMLSlotElement = HTMLSlotElement; + } +}); + +// node_modules/linkedom/cjs/html/form-element.js +var require_form_element = __commonJS({ + "node_modules/linkedom/cjs/html/form-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLFormElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "form") { + super(ownerDocument, localName); } }; - var send_code = (s, c, tree) => { - send_bits( - s, - tree[c * 2], - tree[c * 2 + 1] - /*.Len*/ - ); + exports2.HTMLFormElement = HTMLFormElement; + } +}); + +// node_modules/linkedom/cjs/html/image-element.js +var require_image_element = __commonJS({ + "node_modules/linkedom/cjs/html/image-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { numericAttribute, stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "img"; + var HTMLImageElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + } + /* c8 ignore start */ + get alt() { + return stringAttribute.get(this, "alt"); + } + set alt(value) { + stringAttribute.set(this, "alt", value); + } + get sizes() { + return stringAttribute.get(this, "sizes"); + } + set sizes(value) { + stringAttribute.set(this, "sizes", value); + } + get src() { + return stringAttribute.get(this, "src"); + } + set src(value) { + stringAttribute.set(this, "src", value); + } + get srcset() { + return stringAttribute.get(this, "srcset"); + } + set srcset(value) { + stringAttribute.set(this, "srcset", value); + } + get title() { + return stringAttribute.get(this, "title"); + } + set title(value) { + stringAttribute.set(this, "title", value); + } + get width() { + return numericAttribute.get(this, "width"); + } + set width(value) { + numericAttribute.set(this, "width", value); + } + get height() { + return numericAttribute.get(this, "height"); + } + set height(value) { + numericAttribute.set(this, "height", value); + } + /* c8 ignore stop */ }; - var bi_reverse = (code, len) => { - let res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; + registerHTMLClass(tagName, HTMLImageElement); + exports2.HTMLImageElement = HTMLImageElement; + } +}); + +// node_modules/linkedom/cjs/html/pre-element.js +var require_pre_element = __commonJS({ + "node_modules/linkedom/cjs/html/pre-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLPreElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "pre") { + super(ownerDocument, localName); + } }; - var bi_flush = (s) => { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 255; - s.bi_buf >>= 8; - s.bi_valid -= 8; + exports2.HTMLPreElement = HTMLPreElement; + } +}); + +// node_modules/linkedom/cjs/html/u-list-element.js +var require_u_list_element = __commonJS({ + "node_modules/linkedom/cjs/html/u-list-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLUListElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "ul") { + super(ownerDocument, localName); } }; - var gen_bitlen = (s, desc) => { - const tree = desc.dyn_tree; - const max_code = desc.max_code; - const stree = desc.stat_desc.static_tree; - const has_stree = desc.stat_desc.has_stree; - const extra = desc.stat_desc.extra_bits; - const base = desc.stat_desc.extra_base; - const max_length = desc.stat_desc.max_length; - let h; - let n, m; - let bits; - let xbits; - let f; - let overflow = 0; - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; + exports2.HTMLUListElement = HTMLUListElement; + } +}); + +// node_modules/linkedom/cjs/html/meta-element.js +var require_meta_element = __commonJS({ + "node_modules/linkedom/cjs/html/meta-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { registerHTMLClass } = require_register_html_class(); + var { stringAttribute } = require_attributes(); + var tagName = "meta"; + var HTMLMetaElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); + } + /* c8 ignore start */ + get name() { + return stringAttribute.get(this, "name"); } - tree[s.heap[s.heap_max] * 2 + 1] = 0; - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1] = bits; - if (n > max_code) { - continue; - } - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1] + xbits); - } + set name(value) { + stringAttribute.set(this, "name", value); } - if (overflow === 0) { - return; + get httpEquiv() { + return stringAttribute.get(this, "http-equiv"); } - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { - bits--; - } - s.bl_count[bits]--; - s.bl_count[bits + 1] += 2; - s.bl_count[max_length]--; - overflow -= 2; - } while (overflow > 0); - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { - continue; - } - if (tree[m * 2 + 1] !== bits) { - s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2]; - tree[m * 2 + 1] = bits; - } - n--; - } + set httpEquiv(value) { + stringAttribute.set(this, "http-equiv", value); + } + get content() { + return stringAttribute.get(this, "content"); + } + set content(value) { + stringAttribute.set(this, "content", value); + } + get charset() { + return stringAttribute.get(this, "charset"); + } + set charset(value) { + stringAttribute.set(this, "charset", value); } + get media() { + return stringAttribute.get(this, "media"); + } + set media(value) { + stringAttribute.set(this, "media", value); + } + /* c8 ignore stop */ }; - var gen_codes = (tree, max_code, bl_count) => { - const next_code = new Array(MAX_BITS + 1); - let code = 0; - let bits; - let n; - for (bits = 1; bits <= MAX_BITS; bits++) { - code = code + bl_count[bits - 1] << 1; - next_code[bits] = code; + exports2.HTMLMetaElement = HTMLMetaElement; + registerHTMLClass(tagName, HTMLMetaElement); + } +}); + +// node_modules/linkedom/cjs/html/picture-element.js +var require_picture_element = __commonJS({ + "node_modules/linkedom/cjs/html/picture-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLPictureElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "picture") { + super(ownerDocument, localName); } - for (n = 0; n <= max_code; n++) { - let len = tree[n * 2 + 1]; - if (len === 0) { - continue; - } - tree[n * 2] = bi_reverse(next_code[len]++, len); + }; + exports2.HTMLPictureElement = HTMLPictureElement; + } +}); + +// node_modules/linkedom/cjs/html/area-element.js +var require_area_element = __commonJS({ + "node_modules/linkedom/cjs/html/area-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLAreaElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "area") { + super(ownerDocument, localName); } }; - var tr_static_init = () => { - let n; - let bits; - let length; - let code; - let dist; - const bl_count = new Array(MAX_BITS + 1); - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < 1 << extra_lbits[code]; n++) { - _length_code[length++] = code; - } + exports2.HTMLAreaElement = HTMLAreaElement; + } +}); + +// node_modules/linkedom/cjs/html/o-list-element.js +var require_o_list_element = __commonJS({ + "node_modules/linkedom/cjs/html/o-list-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLOListElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "ol") { + super(ownerDocument, localName); } - _length_code[length - 1] = code; - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < 1 << extra_dbits[code]; n++) { - _dist_code[dist++] = code; - } + }; + exports2.HTMLOListElement = HTMLOListElement; + } +}); + +// node_modules/linkedom/cjs/html/table-caption-element.js +var require_table_caption_element = __commonJS({ + "node_modules/linkedom/cjs/html/table-caption-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTableCaptionElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "caption") { + super(ownerDocument, localName); } - dist >>= 7; - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { - _dist_code[256 + dist++] = code; - } + }; + exports2.HTMLTableCaptionElement = HTMLTableCaptionElement; + } +}); + +// node_modules/linkedom/cjs/html/anchor-element.js +var require_anchor_element = __commonJS({ + "node_modules/linkedom/cjs/html/anchor-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "a"; + var HTMLAnchorElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; + /* c8 ignore start */ + // copy paste from img.src, already covered + get href() { + return encodeURI(decodeURI(stringAttribute.get(this, "href"))).trim(); } - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; + set href(value) { + stringAttribute.set(this, "href", decodeURI(value)); } - while (n <= 255) { - static_ltree[n * 2 + 1] = 9; - n++; - bl_count[9]++; + get download() { + return encodeURI(decodeURI(stringAttribute.get(this, "download"))); } - while (n <= 279) { - static_ltree[n * 2 + 1] = 7; - n++; - bl_count[7]++; + set download(value) { + stringAttribute.set(this, "download", decodeURI(value)); } - while (n <= 287) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; + get target() { + return stringAttribute.get(this, "target"); } - gen_codes(static_ltree, L_CODES + 1, bl_count); - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1] = 5; - static_dtree[n * 2] = bi_reverse(n, 5); + set target(value) { + stringAttribute.set(this, "target", value); } - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - }; - var init_block = (s) => { - let n; - for (n = 0; n < L_CODES; n++) { - s.dyn_ltree[n * 2] = 0; + get type() { + return stringAttribute.get(this, "type"); } - for (n = 0; n < D_CODES; n++) { - s.dyn_dtree[n * 2] = 0; + set type(value) { + stringAttribute.set(this, "type", value); } - for (n = 0; n < BL_CODES; n++) { - s.bl_tree[n * 2] = 0; + get rel() { + return stringAttribute.get(this, "rel"); } - s.dyn_ltree[END_BLOCK * 2] = 1; - s.opt_len = s.static_len = 0; - s.sym_next = s.matches = 0; + set rel(value) { + stringAttribute.set(this, "rel", value); + } + /* c8 ignore stop */ }; - var bi_windup = (s) => { - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - s.pending_buf[s.pending++] = s.bi_buf; + registerHTMLClass(tagName, HTMLAnchorElement); + exports2.HTMLAnchorElement = HTMLAnchorElement; + } +}); + +// node_modules/linkedom/cjs/html/label-element.js +var require_label_element = __commonJS({ + "node_modules/linkedom/cjs/html/label-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLLabelElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "label") { + super(ownerDocument, localName); } - s.bi_buf = 0; - s.bi_valid = 0; }; - var smaller = (tree, n, m, depth) => { - const _n2 = n * 2; - const _m2 = m * 2; - return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m]; + exports2.HTMLLabelElement = HTMLLabelElement; + } +}); + +// node_modules/linkedom/cjs/html/unknown-element.js +var require_unknown_element = __commonJS({ + "node_modules/linkedom/cjs/html/unknown-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLUnknownElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "unknown") { + super(ownerDocument, localName); + } }; - var pqdownheap = (s, tree, k) => { - const v = s.heap[k]; - let j = k << 1; - while (j <= s.heap_len) { - if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - if (smaller(tree, v, s.heap[j], s.depth)) { - break; - } - s.heap[k] = s.heap[j]; - k = j; - j <<= 1; + exports2.HTMLUnknownElement = HTMLUnknownElement; + } +}); + +// node_modules/linkedom/cjs/html/mod-element.js +var require_mod_element = __commonJS({ + "node_modules/linkedom/cjs/html/mod-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLModElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "mod") { + super(ownerDocument, localName); } - s.heap[k] = v; }; - var compress_block = (s, ltree, dtree) => { - let dist; - let lc; - let sx = 0; - let code; - let extra; - if (s.sym_next !== 0) { - do { - dist = s.pending_buf[s.sym_buf + sx++] & 255; - dist += (s.pending_buf[s.sym_buf + sx++] & 255) << 8; - lc = s.pending_buf[s.sym_buf + sx++]; - if (dist === 0) { - send_code(s, lc, ltree); - } else { - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); - } - dist--; - code = d_code(dist); - send_code(s, code, dtree); - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); - } - } - } while (sx < s.sym_next); + exports2.HTMLModElement = HTMLModElement; + } +}); + +// node_modules/linkedom/cjs/html/details-element.js +var require_details_element = __commonJS({ + "node_modules/linkedom/cjs/html/details-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLDetailsElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "details") { + super(ownerDocument, localName); } - send_code(s, END_BLOCK, ltree); }; - var build_tree = (s, desc) => { - const tree = desc.dyn_tree; - const stree = desc.stat_desc.static_tree; - const has_stree = desc.stat_desc.has_stree; - const elems = desc.stat_desc.elems; - let n, m; - let max_code = -1; - let node; - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - for (n = 0; n < elems; n++) { - if (tree[n * 2] !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - } else { - tree[n * 2 + 1] = 0; - } + exports2.HTMLDetailsElement = HTMLDetailsElement; + } +}); + +// node_modules/linkedom/cjs/html/source-element.js +var require_source_element = __commonJS({ + "node_modules/linkedom/cjs/html/source-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { registerHTMLClass } = require_register_html_class(); + var { stringAttribute } = require_attributes(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var tagName = "source"; + var HTMLSourceElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = tagName) { + super(ownerDocument, localName); } - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; - tree[node * 2] = 1; - s.depth[node] = 0; - s.opt_len--; - if (has_stree) { - s.static_len -= stree[node * 2 + 1]; - } + /* c8 ignore start */ + get src() { + return stringAttribute.get(this, "src"); } - desc.max_code = max_code; - for (n = s.heap_len >> 1; n >= 1; n--) { - pqdownheap(s, tree, n); + set src(value) { + stringAttribute.set(this, "src", value); } - node = elems; - do { - n = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[ - 1 - /*SMALLEST*/ - ] = s.heap[s.heap_len--]; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - m = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[--s.heap_max] = n; - s.heap[--s.heap_max] = m; - tree[node * 2] = tree[n * 2] + tree[m * 2]; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1] = tree[m * 2 + 1] = node; - s.heap[ - 1 - /*SMALLEST*/ - ] = node++; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - } while (s.heap_len >= 2); - s.heap[--s.heap_max] = s.heap[ - 1 - /*SMALLEST*/ - ]; - gen_bitlen(s, desc); - gen_codes(tree, max_code, s.bl_count); + get srcset() { + return stringAttribute.get(this, "srcset"); + } + set srcset(value) { + stringAttribute.set(this, "srcset", value); + } + get sizes() { + return stringAttribute.get(this, "sizes"); + } + set sizes(value) { + stringAttribute.set(this, "sizes", value); + } + get type() { + return stringAttribute.get(this, "type"); + } + set type(value) { + stringAttribute.set(this, "type", value); + } + /* c8 ignore stop */ }; - var scan_tree = (s, tree, max_code) => { - let n; - let prevlen = -1; - let curlen; - let nextlen = tree[0 * 2 + 1]; - let count = 0; - let max_count = 7; - let min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; + registerHTMLClass(tagName, HTMLSourceElement); + exports2.HTMLSourceElement = HTMLSourceElement; + } +}); + +// node_modules/linkedom/cjs/html/track-element.js +var require_track_element = __commonJS({ + "node_modules/linkedom/cjs/html/track-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLTrackElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "track") { + super(ownerDocument, localName); } - tree[(max_code + 1) * 2 + 1] = 65535; - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - s.bl_tree[curlen * 2] += count; - } else if (curlen !== 0) { - if (curlen !== prevlen) { - s.bl_tree[curlen * 2]++; - } - s.bl_tree[REP_3_6 * 2]++; - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]++; - } else { - s.bl_tree[REPZ_11_138 * 2]++; - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } + }; + exports2.HTMLTrackElement = HTMLTrackElement; + } +}); + +// node_modules/linkedom/cjs/html/marquee-element.js +var require_marquee_element = __commonJS({ + "node_modules/linkedom/cjs/html/marquee-element.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var HTMLMarqueeElement = class extends HTMLElement2 { + constructor(ownerDocument, localName = "marquee") { + super(ownerDocument, localName); + } + }; + exports2.HTMLMarqueeElement = HTMLMarqueeElement; + } +}); + +// node_modules/linkedom/cjs/shared/html-classes.js +var require_html_classes = __commonJS({ + "node_modules/linkedom/cjs/shared/html-classes.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { HTMLTemplateElement } = require_template_element(); + var { HTMLHtmlElement } = require_html_element(); + var { HTMLScriptElement } = require_script_element(); + var { HTMLFrameElement } = require_frame_element(); + var { HTMLIFrameElement } = require_i_frame_element(); + var { HTMLObjectElement } = require_object_element(); + var { HTMLHeadElement } = require_head_element(); + var { HTMLBodyElement } = require_body_element(); + var { HTMLStyleElement } = require_style_element(); + var { HTMLTimeElement } = require_time_element(); + var { HTMLFieldSetElement } = require_field_set_element(); + var { HTMLEmbedElement } = require_embed_element(); + var { HTMLHRElement } = require_hr_element(); + var { HTMLProgressElement } = require_progress_element(); + var { HTMLParagraphElement } = require_paragraph_element(); + var { HTMLTableElement } = require_table_element(); + var { HTMLFrameSetElement } = require_frame_set_element(); + var { HTMLLIElement } = require_li_element(); + var { HTMLBaseElement } = require_base_element(); + var { HTMLDataListElement } = require_data_list_element(); + var { HTMLInputElement } = require_input_element(); + var { HTMLParamElement } = require_param_element(); + var { HTMLMediaElement } = require_media_element(); + var { HTMLAudioElement } = require_audio_element(); + var { HTMLHeadingElement } = require_heading_element(); + var { HTMLDirectoryElement } = require_directory_element(); + var { HTMLQuoteElement } = require_quote_element(); + var { HTMLCanvasElement } = require_canvas_element(); + var { HTMLLegendElement } = require_legend_element(); + var { HTMLOptionElement } = require_option_element(); + var { HTMLSpanElement } = require_span_element(); + var { HTMLMeterElement } = require_meter_element(); + var { HTMLVideoElement } = require_video_element(); + var { HTMLTableCellElement } = require_table_cell_element(); + var { HTMLTitleElement } = require_title_element(); + var { HTMLOutputElement } = require_output_element(); + var { HTMLTableRowElement } = require_table_row_element(); + var { HTMLDataElement } = require_data_element(); + var { HTMLMenuElement } = require_menu_element(); + var { HTMLSelectElement } = require_select_element(); + var { HTMLBRElement } = require_br_element(); + var { HTMLButtonElement } = require_button_element(); + var { HTMLMapElement } = require_map_element(); + var { HTMLOptGroupElement } = require_opt_group_element(); + var { HTMLDListElement } = require_d_list_element(); + var { HTMLTextAreaElement } = require_text_area_element(); + var { HTMLFontElement } = require_font_element(); + var { HTMLDivElement } = require_div_element(); + var { HTMLLinkElement } = require_link_element(); + var { HTMLSlotElement } = require_slot_element(); + var { HTMLFormElement } = require_form_element(); + var { HTMLImageElement } = require_image_element(); + var { HTMLPreElement } = require_pre_element(); + var { HTMLUListElement } = require_u_list_element(); + var { HTMLMetaElement } = require_meta_element(); + var { HTMLPictureElement } = require_picture_element(); + var { HTMLAreaElement } = require_area_element(); + var { HTMLOListElement } = require_o_list_element(); + var { HTMLTableCaptionElement } = require_table_caption_element(); + var { HTMLAnchorElement } = require_anchor_element(); + var { HTMLLabelElement } = require_label_element(); + var { HTMLUnknownElement } = require_unknown_element(); + var { HTMLModElement } = require_mod_element(); + var { HTMLDetailsElement } = require_details_element(); + var { HTMLSourceElement } = require_source_element(); + var { HTMLTrackElement } = require_track_element(); + var { HTMLMarqueeElement } = require_marquee_element(); + exports2.HTMLElement = HTMLElement2; + exports2.HTMLTemplateElement = HTMLTemplateElement; + exports2.HTMLHtmlElement = HTMLHtmlElement; + exports2.HTMLScriptElement = HTMLScriptElement; + exports2.HTMLFrameElement = HTMLFrameElement; + exports2.HTMLIFrameElement = HTMLIFrameElement; + exports2.HTMLObjectElement = HTMLObjectElement; + exports2.HTMLHeadElement = HTMLHeadElement; + exports2.HTMLBodyElement = HTMLBodyElement; + exports2.HTMLStyleElement = HTMLStyleElement; + exports2.HTMLTimeElement = HTMLTimeElement; + exports2.HTMLFieldSetElement = HTMLFieldSetElement; + exports2.HTMLEmbedElement = HTMLEmbedElement; + exports2.HTMLHRElement = HTMLHRElement; + exports2.HTMLProgressElement = HTMLProgressElement; + exports2.HTMLParagraphElement = HTMLParagraphElement; + exports2.HTMLTableElement = HTMLTableElement; + exports2.HTMLFrameSetElement = HTMLFrameSetElement; + exports2.HTMLLIElement = HTMLLIElement; + exports2.HTMLBaseElement = HTMLBaseElement; + exports2.HTMLDataListElement = HTMLDataListElement; + exports2.HTMLInputElement = HTMLInputElement; + exports2.HTMLParamElement = HTMLParamElement; + exports2.HTMLMediaElement = HTMLMediaElement; + exports2.HTMLAudioElement = HTMLAudioElement; + exports2.HTMLHeadingElement = HTMLHeadingElement; + exports2.HTMLDirectoryElement = HTMLDirectoryElement; + exports2.HTMLQuoteElement = HTMLQuoteElement; + exports2.HTMLCanvasElement = HTMLCanvasElement; + exports2.HTMLLegendElement = HTMLLegendElement; + exports2.HTMLOptionElement = HTMLOptionElement; + exports2.HTMLSpanElement = HTMLSpanElement; + exports2.HTMLMeterElement = HTMLMeterElement; + exports2.HTMLVideoElement = HTMLVideoElement; + exports2.HTMLTableCellElement = HTMLTableCellElement; + exports2.HTMLTitleElement = HTMLTitleElement; + exports2.HTMLOutputElement = HTMLOutputElement; + exports2.HTMLTableRowElement = HTMLTableRowElement; + exports2.HTMLDataElement = HTMLDataElement; + exports2.HTMLMenuElement = HTMLMenuElement; + exports2.HTMLSelectElement = HTMLSelectElement; + exports2.HTMLBRElement = HTMLBRElement; + exports2.HTMLButtonElement = HTMLButtonElement; + exports2.HTMLMapElement = HTMLMapElement; + exports2.HTMLOptGroupElement = HTMLOptGroupElement; + exports2.HTMLDListElement = HTMLDListElement; + exports2.HTMLTextAreaElement = HTMLTextAreaElement; + exports2.HTMLFontElement = HTMLFontElement; + exports2.HTMLDivElement = HTMLDivElement; + exports2.HTMLLinkElement = HTMLLinkElement; + exports2.HTMLSlotElement = HTMLSlotElement; + exports2.HTMLFormElement = HTMLFormElement; + exports2.HTMLImageElement = HTMLImageElement; + exports2.HTMLPreElement = HTMLPreElement; + exports2.HTMLUListElement = HTMLUListElement; + exports2.HTMLMetaElement = HTMLMetaElement; + exports2.HTMLPictureElement = HTMLPictureElement; + exports2.HTMLAreaElement = HTMLAreaElement; + exports2.HTMLOListElement = HTMLOListElement; + exports2.HTMLTableCaptionElement = HTMLTableCaptionElement; + exports2.HTMLAnchorElement = HTMLAnchorElement; + exports2.HTMLLabelElement = HTMLLabelElement; + exports2.HTMLUnknownElement = HTMLUnknownElement; + exports2.HTMLModElement = HTMLModElement; + exports2.HTMLDetailsElement = HTMLDetailsElement; + exports2.HTMLSourceElement = HTMLSourceElement; + exports2.HTMLTrackElement = HTMLTrackElement; + exports2.HTMLMarqueeElement = HTMLMarqueeElement; + var HTMLClasses = { + HTMLElement: HTMLElement2, + HTMLTemplateElement, + HTMLHtmlElement, + HTMLScriptElement, + HTMLFrameElement, + HTMLIFrameElement, + HTMLObjectElement, + HTMLHeadElement, + HTMLBodyElement, + HTMLStyleElement, + HTMLTimeElement, + HTMLFieldSetElement, + HTMLEmbedElement, + HTMLHRElement, + HTMLProgressElement, + HTMLParagraphElement, + HTMLTableElement, + HTMLFrameSetElement, + HTMLLIElement, + HTMLBaseElement, + HTMLDataListElement, + HTMLInputElement, + HTMLParamElement, + HTMLMediaElement, + HTMLAudioElement, + HTMLHeadingElement, + HTMLDirectoryElement, + HTMLQuoteElement, + HTMLCanvasElement, + HTMLLegendElement, + HTMLOptionElement, + HTMLSpanElement, + HTMLMeterElement, + HTMLVideoElement, + HTMLTableCellElement, + HTMLTitleElement, + HTMLOutputElement, + HTMLTableRowElement, + HTMLDataElement, + HTMLMenuElement, + HTMLSelectElement, + HTMLBRElement, + HTMLButtonElement, + HTMLMapElement, + HTMLOptGroupElement, + HTMLDListElement, + HTMLTextAreaElement, + HTMLFontElement, + HTMLDivElement, + HTMLLinkElement, + HTMLSlotElement, + HTMLFormElement, + HTMLImageElement, + HTMLPreElement, + HTMLUListElement, + HTMLMetaElement, + HTMLPictureElement, + HTMLAreaElement, + HTMLOListElement, + HTMLTableCaptionElement, + HTMLAnchorElement, + HTMLLabelElement, + HTMLUnknownElement, + HTMLModElement, + HTMLDetailsElement, + HTMLSourceElement, + HTMLTrackElement, + HTMLMarqueeElement + }; + exports2.HTMLClasses = HTMLClasses; + } +}); + +// node_modules/linkedom/cjs/shared/mime.js +var require_mime2 = __commonJS({ + "node_modules/linkedom/cjs/shared/mime.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var voidElements2 = { test: () => true }; + var Mime = { + "text/html": { + docType: "<!DOCTYPE html>", + ignoreCase: true, + voidElements: /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i + }, + "image/svg+xml": { + docType: '<?xml version="1.0" encoding="utf-8"?>', + ignoreCase: false, + voidElements: voidElements2 + }, + "text/xml": { + docType: '<?xml version="1.0" encoding="utf-8"?>', + ignoreCase: false, + voidElements: voidElements2 + }, + "application/xml": { + docType: '<?xml version="1.0" encoding="utf-8"?>', + ignoreCase: false, + voidElements: voidElements2 + }, + "application/xhtml+xml": { + docType: '<?xml version="1.0" encoding="utf-8"?>', + ignoreCase: false, + voidElements: voidElements2 } }; - var send_tree = (s, tree, max_code) => { - let n; - let prevlen = -1; - let curlen; - let nextlen = tree[0 * 2 + 1]; - let count = 0; - let max_count = 7; - let min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; + exports2.Mime = Mime; + } +}); + +// node_modules/linkedom/cjs/interface/custom-event.js +var require_custom_event = __commonJS({ + "node_modules/linkedom/cjs/interface/custom-event.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { Event: Event2 } = require_event(); + var CustomEvent2 = class extends Event2 { + constructor(type, eventInitDict = {}) { + super(type, eventInitDict); + this.detail = eventInitDict.detail; } - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(s, curlen, s.bl_tree); - } while (--count !== 0); - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; + }; + exports2.CustomEvent = CustomEvent2; + } +}); + +// node_modules/linkedom/cjs/interface/input-event.js +var require_input_event = __commonJS({ + "node_modules/linkedom/cjs/interface/input-event.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { Event: Event2 } = require_event(); + var InputEvent = class extends Event2 { + constructor(type, inputEventInit = {}) { + super(type, inputEventInit); + this.inputType = inputEventInit.inputType; + this.data = inputEventInit.data; + this.dataTransfer = inputEventInit.dataTransfer; + this.isComposing = inputEventInit.isComposing || false; + this.ranges = inputEventInit.ranges; + } + }; + exports2.InputEvent = InputEvent; + } +}); + +// node_modules/linkedom/cjs/interface/image.js +var require_image = __commonJS({ + "node_modules/linkedom/cjs/interface/image.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { HTMLImageElement } = require_image_element(); + var ImageClass = (ownerDocument) => ( + /** + * @implements globalThis.Image + */ + class Image extends HTMLImageElement { + constructor(width, height) { + super(ownerDocument); + switch (arguments.length) { + case 1: + this.height = width; + this.width = width; + break; + case 2: + this.height = height; + this.width = width; + break; } - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; } } + ); + exports2.ImageClass = ImageClass; + } +}); + +// node_modules/linkedom/cjs/interface/range.js +var require_range2 = __commonJS({ + "node_modules/linkedom/cjs/interface/range.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { END, NEXT, PREV, START } = require_symbols(); + var { SVGElement } = require_element2(); + var { getEnd, htmlToFragment, setAdjacent } = require_utils4(); + var deleteContents = ({ [START]: start, [END]: end }, fragment = null) => { + setAdjacent(start[PREV], end[NEXT]); + do { + const after = getEnd(start); + const next = after === end ? after : after[NEXT]; + if (fragment) + fragment.insertBefore(start, fragment[END]); + else + start.remove(); + start = next; + } while (start !== end); }; - var build_bl_tree = (s) => { - let max_blindex; - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - build_tree(s, s.bl_desc); - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { - break; + var Range = class _Range { + constructor() { + this[START] = null; + this[END] = null; + this.commonAncestorContainer = null; + } + /* TODO: this is more complicated than it looks + setStart(node, offset) { + this[START] = node.childNodes[offset]; } + + setEnd(node, offset) { + this[END] = getEnd(node.childNodes[offset]); + } + //*/ + insertNode(newNode) { + this[END].parentNode.insertBefore(newNode, this[START]); + } + selectNode(node) { + this[START] = node; + this[END] = getEnd(node); + } + // TODO: SVG elements should then create contextual fragments + // that return SVG nodes + selectNodeContents(node) { + this.selectNode(node); + this.commonAncestorContainer = node; + } + surroundContents(parentNode) { + parentNode.replaceChildren(this.extractContents()); + } + setStartBefore(node) { + this[START] = node; + } + setStartAfter(node) { + this[START] = node.nextSibling; + } + setEndBefore(node) { + this[END] = getEnd(node.previousSibling); + } + setEndAfter(node) { + this[END] = getEnd(node); + } + cloneContents() { + let { [START]: start, [END]: end } = this; + const fragment = start.ownerDocument.createDocumentFragment(); + while (start !== end) { + fragment.insertBefore(start.cloneNode(true), fragment[END]); + start = getEnd(start); + if (start !== end) + start = start[NEXT]; + } + return fragment; + } + deleteContents() { + deleteContents(this); + } + extractContents() { + const fragment = this[START].ownerDocument.createDocumentFragment(); + deleteContents(this, fragment); + return fragment; + } + createContextualFragment(html) { + const { commonAncestorContainer: doc } = this; + const isSVG = "ownerSVGElement" in doc; + const document2 = isSVG ? doc.ownerDocument : doc; + let content = htmlToFragment(document2, html); + if (isSVG) { + const childNodes = [...content.childNodes]; + content = document2.createDocumentFragment(); + Object.setPrototypeOf(content, SVGElement.prototype); + content.ownerSVGElement = document2; + for (const child of childNodes) { + Object.setPrototypeOf(child, SVGElement.prototype); + child.ownerSVGElement = document2; + content.appendChild(child); + } + } else + this.selectNode(content); + return content; + } + cloneRange() { + const range = new _Range(); + range[START] = this[START]; + range[END] = this[END]; + return range; } - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - return max_blindex; }; - var send_all_trees = (s, lcodes, dcodes, blcodes) => { - let rank; - send_bits(s, lcodes - 257, 5); - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); - for (rank = 0; rank < blcodes; rank++) { - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3); + exports2.Range = Range; + } +}); + +// node_modules/linkedom/cjs/interface/tree-walker.js +var require_tree_walker = __commonJS({ + "node_modules/linkedom/cjs/interface/tree-walker.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + DOCUMENT_NODE, + ELEMENT_NODE, + TEXT_NODE, + CDATA_SECTION_NODE, + COMMENT_NODE, + SHOW_ALL, + SHOW_ELEMENT, + SHOW_CDATA_SECTION, + SHOW_COMMENT, + SHOW_TEXT + } = require_constants(); + var { PRIVATE, END, NEXT } = require_symbols(); + var isOK = ({ nodeType }, mask) => { + switch (nodeType) { + case ELEMENT_NODE: + return mask & SHOW_ELEMENT; + case TEXT_NODE: + return mask & SHOW_TEXT; + case COMMENT_NODE: + return mask & SHOW_COMMENT; + case CDATA_SECTION_NODE: + return mask & SHOW_CDATA_SECTION; } - send_tree(s, s.dyn_ltree, lcodes - 1); - send_tree(s, s.dyn_dtree, dcodes - 1); + return 0; }; - var detect_data_type = (s) => { - let block_mask = 4093624447; - let n; - for (n = 0; n <= 31; n++, block_mask >>>= 1) { - if (block_mask & 1 && s.dyn_ltree[n * 2] !== 0) { - return Z_BINARY; + var TreeWalker = class { + constructor(root, whatToShow = SHOW_ALL) { + this.root = root; + this.currentNode = root; + this.whatToShow = whatToShow; + let { [NEXT]: next, [END]: end } = root; + if (root.nodeType === DOCUMENT_NODE) { + const { documentElement } = root; + next = documentElement; + end = documentElement[END]; + } + const nodes = []; + while (next && next !== end) { + if (isOK(next, whatToShow)) + nodes.push(next); + next = next[NEXT]; } + this[PRIVATE] = { i: 0, nodes }; } - if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { - return Z_TEXT; + nextNode() { + const $ = this[PRIVATE]; + this.currentNode = $.i < $.nodes.length ? $.nodes[$.i++] : null; + return this.currentNode; } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2] !== 0) { - return Z_TEXT; + }; + exports2.TreeWalker = TreeWalker; + } +}); + +// node_modules/linkedom/cjs/interface/document.js +var require_document = __commonJS({ + "node_modules/linkedom/cjs/interface/document.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, SVG_NAMESPACE } = require_constants(); + var { + CUSTOM_ELEMENTS, + DOM_PARSER, + GLOBALS, + IMAGE, + MUTATION_OBSERVER, + DOCTYPE, + END, + NEXT, + MIME, + EVENT_TARGET, + UPGRADE + } = require_symbols(); + var { Facades, illegalConstructor } = require_facades(); + var { HTMLClasses } = require_html_classes(); + var { Mime } = require_mime2(); + var { knownSiblings } = require_utils4(); + var { assign, create, defineProperties, setPrototypeOf } = require_object(); + var { NonElementParentNode } = require_non_element_parent_node(); + var { SVGElement } = require_element2(); + var { Attr } = require_attr(); + var { CDATASection } = require_cdata_section(); + var { Comment: Comment4 } = require_comment(); + var { CustomElementRegistry } = require_custom_element_registry(); + var { CustomEvent: CustomEvent2 } = require_custom_event(); + var { DocumentFragment } = require_document_fragment(); + var { DocumentType } = require_document_type(); + var { Element } = require_element(); + var { Event: Event2 } = require_event(); + var { EventTarget } = require_event_target(); + var { InputEvent } = require_input_event(); + var { ImageClass } = require_image(); + var { MutationObserverClass } = require_mutation_observer(); + var { NamedNodeMap } = require_named_node_map(); + var { NodeList } = require_node_list(); + var { Range } = require_range2(); + var { Text: Text4 } = require_text2(); + var { TreeWalker } = require_tree_walker(); + var query = (method, ownerDocument, selectors) => { + let { [NEXT]: next, [END]: end } = ownerDocument; + return method.call({ ownerDocument, [NEXT]: next, [END]: end }, selectors); + }; + var globalExports = assign( + {}, + Facades, + HTMLClasses, + { + CustomEvent: CustomEvent2, + Event: Event2, + EventTarget, + InputEvent, + NamedNodeMap, + NodeList + } + ); + var window2 = /* @__PURE__ */ new WeakMap(); + var Document = class extends NonElementParentNode { + constructor(type) { + super(null, "#document", DOCUMENT_NODE); + this[CUSTOM_ELEMENTS] = { active: false, registry: null }; + this[MUTATION_OBSERVER] = { active: false, class: null }; + this[MIME] = Mime[type]; + this[DOCTYPE] = null; + this[DOM_PARSER] = null; + this[GLOBALS] = null; + this[IMAGE] = null; + this[UPGRADE] = null; + } + /** + * @type {globalThis.Document['defaultView']} + */ + get defaultView() { + if (!window2.has(this)) + window2.set(this, new Proxy(globalThis, { + set: (target, name, value) => { + switch (name) { + case "addEventListener": + case "removeEventListener": + case "dispatchEvent": + this[EVENT_TARGET][name] = value; + break; + default: + target[name] = value; + break; + } + return true; + }, + get: (globalThis2, name) => { + switch (name) { + case "addEventListener": + case "removeEventListener": + case "dispatchEvent": + if (!this[EVENT_TARGET]) { + const et = this[EVENT_TARGET] = new EventTarget(); + et.dispatchEvent = et.dispatchEvent.bind(et); + et.addEventListener = et.addEventListener.bind(et); + et.removeEventListener = et.removeEventListener.bind(et); + } + return this[EVENT_TARGET][name]; + case "document": + return this; + /* c8 ignore start */ + case "navigator": + return { + userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36" + }; + /* c8 ignore stop */ + case "window": + return window2.get(this); + case "customElements": + if (!this[CUSTOM_ELEMENTS].registry) + this[CUSTOM_ELEMENTS] = new CustomElementRegistry(this); + return this[CUSTOM_ELEMENTS]; + case "performance": + return globalThis2.performance; + case "DOMParser": + return this[DOM_PARSER]; + case "Image": + if (!this[IMAGE]) + this[IMAGE] = ImageClass(this); + return this[IMAGE]; + case "MutationObserver": + if (!this[MUTATION_OBSERVER].class) + this[MUTATION_OBSERVER] = new MutationObserverClass(this); + return this[MUTATION_OBSERVER].class; + } + return this[GLOBALS] && this[GLOBALS][name] || globalExports[name] || globalThis2[name]; + } + })); + return window2.get(this); + } + get doctype() { + const docType = this[DOCTYPE]; + if (docType) + return docType; + const { firstChild } = this; + if (firstChild && firstChild.nodeType === DOCUMENT_TYPE_NODE) + return this[DOCTYPE] = firstChild; + return null; + } + set doctype(value) { + if (/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(value)) { + const { $1: name, $4: publicId, $6: systemId } = RegExp; + this[DOCTYPE] = new DocumentType(this, name, publicId, systemId); + knownSiblings(this, this[DOCTYPE], this[NEXT]); } } - return Z_BINARY; - }; - var static_init_done = false; - var _tr_init = (s) => { - if (!static_init_done) { - tr_static_init(); - static_init_done = true; + get documentElement() { + return this.firstElementChild; } - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - s.bi_buf = 0; - s.bi_valid = 0; - init_block(s); - }; - var _tr_stored_block = (s, buf, stored_len, last) => { - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); - bi_windup(s); - put_short(s, stored_len); - put_short(s, ~stored_len); - if (stored_len) { - s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending); + get isConnected() { + return true; } - s.pending += stored_len; - }; - var _tr_align = (s) => { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); - }; - var _tr_flush_block = (s, buf, stored_len, last) => { - let opt_lenb, static_lenb; - let max_blindex = 0; - if (s.level > 0) { - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); + /** + * @protected + */ + _getParent() { + return this[EVENT_TARGET]; + } + createAttribute(name) { + return new Attr(this, name); + } + createCDATASection(data) { + return new CDATASection(this, data); + } + createComment(textContent2) { + return new Comment4(this, textContent2); + } + createDocumentFragment() { + return new DocumentFragment(this); + } + createDocumentType(name, publicId, systemId) { + return new DocumentType(this, name, publicId, systemId); + } + createElement(localName) { + return new Element(this, localName); + } + createRange() { + const range = new Range(); + range.commonAncestorContainer = this; + return range; + } + createTextNode(textContent2) { + return new Text4(this, textContent2); + } + createTreeWalker(root, whatToShow = -1) { + return new TreeWalker(root, whatToShow); + } + createNodeIterator(root, whatToShow = -1) { + return this.createTreeWalker(root, whatToShow); + } + createEvent(name) { + const event = create(name === "Event" ? new Event2("") : new CustomEvent2("")); + event.initEvent = event.initCustomEvent = (type, canBubble = false, cancelable = false, detail) => { + event.bubbles = !!canBubble; + defineProperties(event, { + type: { value: type }, + canBubble: { value: canBubble }, + cancelable: { value: cancelable }, + detail: { value: detail } + }); + }; + return event; + } + cloneNode(deep = false) { + const { + constructor, + [CUSTOM_ELEMENTS]: customElements, + [DOCTYPE]: doctype + } = this; + const document2 = new constructor(); + document2[CUSTOM_ELEMENTS] = customElements; + if (deep) { + const end = document2[END]; + const { childNodes } = this; + for (let { length } = childNodes, i = 0; i < length; i++) + document2.insertBefore(childNodes[i].cloneNode(true), end); + if (doctype) + document2[DOCTYPE] = childNodes[0]; } - build_tree(s, s.l_desc); - build_tree(s, s.d_desc); - max_blindex = build_bl_tree(s); - opt_lenb = s.opt_len + 3 + 7 >>> 3; - static_lenb = s.static_len + 3 + 7 >>> 3; - if (static_lenb <= opt_lenb) { - opt_lenb = static_lenb; + return document2; + } + importNode(externalNode) { + const deep = 1 < arguments.length && !!arguments[1]; + const node = externalNode.cloneNode(deep); + const { [CUSTOM_ELEMENTS]: customElements } = this; + const { active } = customElements; + const upgrade = (element) => { + const { ownerDocument, nodeType } = element; + element.ownerDocument = this; + if (active && ownerDocument !== this && nodeType === ELEMENT_NODE) + customElements.upgrade(element); + }; + upgrade(node); + if (deep) { + switch (node.nodeType) { + case ELEMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: { + let { [NEXT]: next, [END]: end } = node; + while (next !== end) { + if (next.nodeType === ELEMENT_NODE) + upgrade(next); + next = next[NEXT]; + } + break; + } + } } - } else { - opt_lenb = static_lenb = stored_len + 5; + return node; } - if (stored_len + 4 <= opt_lenb && buf !== -1) { - _tr_stored_block(s, buf, stored_len, last); - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); + toString() { + return this.childNodes.join(""); } - init_block(s); - if (last) { - bi_windup(s); + querySelector(selectors) { + return query(super.querySelector, this, selectors); } - }; - var _tr_tally = (s, dist, lc) => { - s.pending_buf[s.sym_buf + s.sym_next++] = dist; - s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8; - s.pending_buf[s.sym_buf + s.sym_next++] = lc; - if (dist === 0) { - s.dyn_ltree[lc * 2]++; - } else { - s.matches++; - dist--; - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++; - s.dyn_dtree[d_code(dist) * 2]++; + querySelectorAll(selectors) { + return query(super.querySelectorAll, this, selectors); } - return s.sym_next === s.sym_end; + /* c8 ignore start */ + getElementsByTagNameNS(_, name) { + return this.getElementsByTagName(name); + } + createAttributeNS(_, name) { + return this.createAttribute(name); + } + createElementNS(nsp, localName, options) { + return nsp === SVG_NAMESPACE ? new SVGElement(this, localName, null) : this.createElement(localName, options); + } + /* c8 ignore stop */ }; - module2.exports._tr_init = _tr_init; - module2.exports._tr_stored_block = _tr_stored_block; - module2.exports._tr_flush_block = _tr_flush_block; - module2.exports._tr_tally = _tr_tally; - module2.exports._tr_align = _tr_align; + exports2.Document = Document; + setPrototypeOf( + globalExports.Document = function Document2() { + illegalConstructor(); + }, + Document + ).prototype = Document.prototype; } }); -// node_modules/pako/lib/zlib/adler32.js -var require_adler32 = __commonJS({ - "node_modules/pako/lib/zlib/adler32.js"(exports2, module2) { +// node_modules/linkedom/cjs/html/document.js +var require_document2 = __commonJS({ + "node_modules/linkedom/cjs/html/document.js"(exports2) { "use strict"; init_define_import_meta_env(); - var adler32 = (adler, buf, len, pos) => { - let s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; - while (len !== 0) { - n = len > 2e3 ? 2e3 : len; - len -= n; - do { - s1 = s1 + buf[pos++] | 0; - s2 = s2 + s1 | 0; - } while (--n); - s1 %= 65521; - s2 %= 65521; + var { ELEMENT_NODE } = require_constants(); + var { CUSTOM_ELEMENTS, END, NEXT } = require_symbols(); + var { htmlClasses } = require_register_html_class(); + var { Document } = require_document(); + var { NodeList } = require_node_list(); + var { customElements } = require_custom_element_registry(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var createHTMLElement = (ownerDocument, builtin, localName, options) => { + if (!builtin && htmlClasses.has(localName)) { + const Class = htmlClasses.get(localName); + return new Class(ownerDocument, localName); + } + const { [CUSTOM_ELEMENTS]: { active, registry } } = ownerDocument; + if (active) { + const ce = builtin ? options.is : localName; + if (registry.has(ce)) { + const { Class } = registry.get(ce); + const element = new Class(ownerDocument, localName); + customElements.set(element, { connected: false }); + return element; + } + } + return new HTMLElement2(ownerDocument, localName); + }; + var HTMLDocument = class extends Document { + constructor() { + super("text/html"); + } + get all() { + const nodeList = new NodeList(); + let { [NEXT]: next, [END]: end } = this; + while (next !== end) { + switch (next.nodeType) { + case ELEMENT_NODE: + nodeList.push(next); + break; + } + next = next[NEXT]; + } + return nodeList; + } + /** + * @type HTMLHeadElement + */ + get head() { + const { documentElement } = this; + let { firstElementChild } = documentElement; + if (!firstElementChild || firstElementChild.tagName !== "HEAD") { + firstElementChild = this.createElement("head"); + documentElement.prepend(firstElementChild); + } + return firstElementChild; + } + /** + * @type HTMLBodyElement + */ + get body() { + const { head } = this; + let { nextElementSibling: nextElementSibling2 } = head; + if (!nextElementSibling2 || nextElementSibling2.tagName !== "BODY") { + nextElementSibling2 = this.createElement("body"); + head.after(nextElementSibling2); + } + return nextElementSibling2; + } + /** + * @type HTMLTitleElement + */ + get title() { + const { head } = this; + return head.getElementsByTagName("title").at(0)?.textContent || ""; + } + set title(textContent2) { + const { head } = this; + let title = head.getElementsByTagName("title").at(0); + if (title) + title.textContent = textContent2; + else { + head.insertBefore( + this.createElement("title"), + head.firstChild + ).textContent = textContent2; + } + } + createElement(localName, options) { + const builtin = !!(options && options.is); + const element = createHTMLElement(this, builtin, localName, options); + if (builtin) + element.setAttribute("is", options.is); + return element; } - return s1 | s2 << 16 | 0; }; - module2.exports = adler32; + exports2.HTMLDocument = HTMLDocument; } }); -// node_modules/pako/lib/zlib/crc32.js -var require_crc32 = __commonJS({ - "node_modules/pako/lib/zlib/crc32.js"(exports2, module2) { +// node_modules/linkedom/cjs/svg/document.js +var require_document3 = __commonJS({ + "node_modules/linkedom/cjs/svg/document.js"(exports2) { "use strict"; init_define_import_meta_env(); - var makeTable = () => { - let c, table = []; - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; - } - table[n] = c; + var { MIME } = require_symbols(); + var { Document } = require_document(); + var SVGDocument = class extends Document { + constructor() { + super("image/svg+xml"); } - return table; - }; - var crcTable = new Uint32Array(makeTable()); - var crc32 = (crc, buf, len, pos) => { - const t = crcTable; - const end = pos + len; - crc ^= -1; - for (let i = pos; i < end; i++) { - crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; + toString() { + return this[MIME].docType + super.toString(); } - return crc ^ -1; }; - module2.exports = crc32; + exports2.SVGDocument = SVGDocument; } }); -// node_modules/pako/lib/zlib/messages.js -var require_messages = __commonJS({ - "node_modules/pako/lib/zlib/messages.js"(exports2, module2) { +// node_modules/linkedom/cjs/xml/document.js +var require_document4 = __commonJS({ + "node_modules/linkedom/cjs/xml/document.js"(exports2) { "use strict"; init_define_import_meta_env(); - module2.exports = { - 2: "need dictionary", - /* Z_NEED_DICT 2 */ - 1: "stream end", - /* Z_STREAM_END 1 */ - 0: "", - /* Z_OK 0 */ - "-1": "file error", - /* Z_ERRNO (-1) */ - "-2": "stream error", - /* Z_STREAM_ERROR (-2) */ - "-3": "data error", - /* Z_DATA_ERROR (-3) */ - "-4": "insufficient memory", - /* Z_MEM_ERROR (-4) */ - "-5": "buffer error", - /* Z_BUF_ERROR (-5) */ - "-6": "incompatible version" - /* Z_VERSION_ERROR (-6) */ + var { MIME } = require_symbols(); + var { Document } = require_document(); + var XMLDocument = class extends Document { + constructor() { + super("text/xml"); + } + toString() { + return this[MIME].docType + super.toString(); + } }; + exports2.XMLDocument = XMLDocument; } }); -// node_modules/pako/lib/zlib/constants.js -var require_constants = __commonJS({ - "node_modules/pako/lib/zlib/constants.js"(exports2, module2) { +// node_modules/linkedom/cjs/dom/parser.js +var require_parser = __commonJS({ + "node_modules/linkedom/cjs/dom/parser.js"(exports2) { "use strict"; init_define_import_meta_env(); - module2.exports = { - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type + var { DOM_PARSER, GLOBALS } = require_symbols(); + var { parseFromString } = require_parse_from_string(); + var { HTMLDocument } = require_document2(); + var { SVGDocument } = require_document3(); + var { XMLDocument } = require_document4(); + var DOMParser3 = class _DOMParser { + /** @typedef {{ "text/html": HTMLDocument, "image/svg+xml": SVGDocument, "text/xml": XMLDocument }} MimeToDoc */ + /** + * @template {keyof MimeToDoc} MIME + * @param {string} markupLanguage + * @param {MIME} mimeType + * @returns {MimeToDoc[MIME]} + */ + parseFromString(markupLanguage, mimeType, globals = null) { + let isHTML = false, document2; + if (mimeType === "text/html") { + isHTML = true; + document2 = new HTMLDocument(); + } else if (mimeType === "image/svg+xml") + document2 = new SVGDocument(); + else + document2 = new XMLDocument(); + document2[DOM_PARSER] = _DOMParser; + if (globals) + document2[GLOBALS] = globals; + if (isHTML && markupLanguage === "...") + markupLanguage = "<!doctype html><html><head></head><body></body></html>"; + return markupLanguage ? parseFromString(document2, isHTML, markupLanguage) : document2; + } }; + exports2.DOMParser = DOMParser3; } }); -// node_modules/pako/lib/zlib/deflate.js -var require_deflate = __commonJS({ - "node_modules/pako/lib/zlib/deflate.js"(exports2, module2) { +// node_modules/linkedom/cjs/shared/parse-json.js +var require_parse_json = __commonJS({ + "node_modules/linkedom/cjs/shared/parse-json.js"(exports2) { "use strict"; init_define_import_meta_env(); - var { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require_trees(); - var adler32 = require_adler32(); - var crc32 = require_crc32(); - var msg = require_messages(); var { - Z_NO_FLUSH, - Z_PARTIAL_FLUSH, - Z_FULL_FLUSH, - Z_FINISH, - Z_BLOCK, - Z_OK, - Z_STREAM_END, - Z_STREAM_ERROR, - Z_DATA_ERROR, - Z_BUF_ERROR, - Z_DEFAULT_COMPRESSION, - Z_FILTERED, - Z_HUFFMAN_ONLY, - Z_RLE, - Z_FIXED, - Z_DEFAULT_STRATEGY, - Z_UNKNOWN, - Z_DEFLATED + NODE_END, + ELEMENT_NODE, + ATTRIBUTE_NODE, + TEXT_NODE, + CDATA_SECTION_NODE, + COMMENT_NODE, + DOCUMENT_NODE, + DOCUMENT_TYPE_NODE, + DOCUMENT_FRAGMENT_NODE } = require_constants(); - var MAX_MEM_LEVEL = 9; - var MAX_WBITS = 15; - var DEF_MEM_LEVEL = 8; - var LENGTH_CODES = 29; - var LITERALS = 256; - var L_CODES = LITERALS + 1 + LENGTH_CODES; - var D_CODES = 30; - var BL_CODES = 19; - var HEAP_SIZE = 2 * L_CODES + 1; - var MAX_BITS = 15; - var MIN_MATCH = 3; - var MAX_MATCH = 258; - var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; - var PRESET_DICT = 32; - var INIT_STATE = 42; - var GZIP_STATE = 57; - var EXTRA_STATE = 69; - var NAME_STATE = 73; - var COMMENT_STATE = 91; - var HCRC_STATE = 103; - var BUSY_STATE = 113; - var FINISH_STATE = 666; - var BS_NEED_MORE = 1; - var BS_BLOCK_DONE = 2; - var BS_FINISH_STARTED = 3; - var BS_FINISH_DONE = 4; - var OS_CODE = 3; - var err = (strm, errorCode) => { - strm.msg = msg[errorCode]; - return errorCode; + var { END, PREV } = require_symbols(); + var { htmlClasses } = require_register_html_class(); + var { knownBoundaries, knownSiblings } = require_utils4(); + var { Attr } = require_attr(); + var { CDATASection } = require_cdata_section(); + var { Comment: Comment4 } = require_comment(); + var { DocumentType } = require_document_type(); + var { Text: Text4 } = require_text2(); + var { HTMLDocument } = require_document2(); + var { HTMLElement: HTMLElement2 } = require_element3(); + var { SVGElement } = require_element2(); + var { parse: parse3 } = JSON; + var append2 = (parentNode, node, end) => { + node.parentNode = parentNode; + knownSiblings(end[PREV], node, end); + }; + var createHTMLElement = (ownerDocument, localName) => { + if (htmlClasses.has(localName)) { + const Class = htmlClasses.get(localName); + return new Class(ownerDocument, localName); + } + return new HTMLElement2(ownerDocument, localName); + }; + var parseJSON = (value) => { + const array = typeof value === "string" ? parse3(value) : value; + const { length } = array; + const document2 = new HTMLDocument(); + let parentNode = document2, end = parentNode[END], svg = false, i = 0; + while (i < length) { + let nodeType = array[i++]; + switch (nodeType) { + case ELEMENT_NODE: { + const localName = array[i++]; + const isSVG = svg || localName === "svg" || localName === "SVG"; + const element = isSVG ? new SVGElement(document2, localName, parentNode.ownerSVGElement || null) : createHTMLElement(document2, localName); + knownBoundaries(end[PREV], element, end); + element.parentNode = parentNode; + parentNode = element; + end = parentNode[END]; + svg = isSVG; + break; + } + case ATTRIBUTE_NODE: { + const name = array[i++]; + const value2 = typeof array[i] === "string" ? array[i++] : ""; + const attr = new Attr(document2, name, value2); + attr.ownerElement = parentNode; + knownSiblings(end[PREV], attr, end); + break; + } + case TEXT_NODE: + append2(parentNode, new Text4(document2, array[i++]), end); + break; + case COMMENT_NODE: + append2(parentNode, new Comment4(document2, array[i++]), end); + break; + case CDATA_SECTION_NODE: + append2(parentNode, new CDATASection(document2, array[i++]), end); + break; + case DOCUMENT_TYPE_NODE: { + const args = [document2]; + while (typeof array[i] === "string") + args.push(array[i++]); + if (args.length === 3 && /\.dtd$/i.test(args[2])) + args.splice(2, 0, ""); + append2(parentNode, new DocumentType(...args), end); + break; + } + case DOCUMENT_FRAGMENT_NODE: + parentNode = document2.createDocumentFragment(); + end = parentNode[END]; + /* eslint no-fallthrough:0 */ + case DOCUMENT_NODE: + break; + default: + do { + nodeType -= NODE_END; + if (svg && !parentNode.ownerSVGElement) + svg = false; + parentNode = parentNode.parentNode || parentNode; + } while (nodeType < 0); + end = parentNode[END]; + break; + } + } + switch (i && array[0]) { + case ELEMENT_NODE: + return document2.firstElementChild; + case DOCUMENT_FRAGMENT_NODE: + return parentNode; + } + return document2; }; - var rank = (f) => { - return f * 2 - (f > 4 ? 9 : 0); + exports2.parseJSON = parseJSON; + var toJSON = (node) => node.toJSON(); + exports2.toJSON = toJSON; + } +}); + +// node_modules/linkedom/cjs/interface/node-filter.js +var require_node_filter = __commonJS({ + "node_modules/linkedom/cjs/interface/node-filter.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { + SHOW_ALL, + SHOW_ELEMENT, + SHOW_COMMENT, + SHOW_CDATA_SECTION, + SHOW_TEXT + } = require_constants(); + var NodeFilter = class { + static get SHOW_ALL() { + return SHOW_ALL; + } + static get SHOW_ELEMENT() { + return SHOW_ELEMENT; + } + static get SHOW_COMMENT() { + return SHOW_COMMENT; + } + static get SHOW_CDATA_SECTION() { + return SHOW_CDATA_SECTION; + } + static get SHOW_TEXT() { + return SHOW_TEXT; + } }; - var zero = (buf) => { - let len = buf.length; - while (--len >= 0) { - buf[len] = 0; + exports2.NodeFilter = NodeFilter; + } +}); + +// node_modules/linkedom/cjs/index.js +var require_cjs2 = __commonJS({ + "node_modules/linkedom/cjs/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var { DOMParser: DOMParser3 } = require_parser(); + var { Document: _Document } = require_document(); + var { illegalConstructor } = require_facades(); + var { setPrototypeOf } = require_object(); + ((m) => { + exports2.parseJSON = m.parseJSON; + exports2.toJSON = m.toJSON; + })(require_parse_json()); + ((m) => Object.keys(m).map((k) => k !== "default" && (exports2[k] = m[k])))(require_facades()); + ((m) => Object.keys(m).map((k) => k !== "default" && (exports2[k] = m[k])))(require_html_classes()); + exports2.DOMParser = DOMParser3; + ((m) => { + exports2.CustomEvent = m.CustomEvent; + })(require_custom_event()); + ((m) => { + exports2.Event = m.Event; + })(require_event()); + ((m) => { + exports2.EventTarget = m.EventTarget; + })(require_event_target()); + ((m) => { + exports2.InputEvent = m.InputEvent; + })(require_input_event()); + ((m) => { + exports2.NodeList = m.NodeList; + })(require_node_list()); + ((m) => { + exports2.NodeFilter = m.NodeFilter; + })(require_node_filter()); + var parseHTML = (html, globals = null) => new DOMParser3().parseFromString( + html, + "text/html", + globals + ).defaultView; + exports2.parseHTML = parseHTML; + function Document() { + illegalConstructor(); + } + exports2.Document = Document; + setPrototypeOf(Document, _Document).prototype = _Document.prototype; + } +}); + +// node_modules/telegram/inspect.js +var require_inspect = __commonJS({ + "node_modules/telegram/inspect.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.inspect = void 0; + var util_1 = require("util"); + Object.defineProperty(exports2, "inspect", { enumerable: true, get: function() { + return util_1.inspect; + } }); + } +}); + +// node_modules/big-integer/BigInteger.js +var require_BigInteger = __commonJS({ + "node_modules/big-integer/BigInteger.js"(exports2, module2) { + init_define_import_meta_env(); + var bigInt = (function(undefined2) { + "use strict"; + var BASE2 = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; + var supportsNativeBigInt = typeof BigInt === "function"; + function Integer(v, radix, alphabet, caseSensitive) { + if (typeof v === "undefined") return Integer[0]; + if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); + return parseValue(v); + } + function BigInteger(value, sign) { + this.value = value; + this.sign = sign; + this.isSmall = false; } - }; - var slide_hash = (s) => { - let n, m; - let p; - let wsize = s.w_size; - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = m >= wsize ? m - wsize : 0; - } while (--n); - n = wsize; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = m >= wsize ? m - wsize : 0; - } while (--n); - }; - var HASH = (s, prev, data) => (prev << s.hash_shift ^ data) & s.hash_mask; - var INSERT_STRING = (s, str) => { - let h; - if (s.legacy_hash) { - h = s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); - } else { - const w = s.window; - const value = w[str] | w[str + 1] << 8 | w[str + 2] << 16 | w[str + 3] << 24; - h = s.ins_h = Math.imul(value, 66521) + 66521 >>> 16 & s.hash_mask; + BigInteger.prototype = Object.create(Integer.prototype); + function SmallInteger(value) { + this.value = value; + this.sign = value < 0; + this.isSmall = true; } - const hash_head = s.prev[str & s.w_mask] = s.head[h]; - s.head[h] = str; - return hash_head; - }; - var flush_pending = (strm) => { - const s = strm.state; - let len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; + SmallInteger.prototype = Object.create(Integer.prototype); + function NativeBigInt(value) { + this.value = value; } - if (len === 0) { - return; + NativeBigInt.prototype = Object.create(Integer.prototype); + function isPrecise(n) { + return -MAX_INT < n && n < MAX_INT; } - strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; + function smallToArray(n) { + if (n < 1e7) + return [n]; + if (n < 1e14) + return [n % 1e7, Math.floor(n / 1e7)]; + return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; } - }; - var flush_block_only = (s, last) => { - _tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); - }; - var put_byte = (s, b) => { - s.pending_buf[s.pending++] = b; - }; - var putShortMSB = (s, b) => { - s.pending_buf[s.pending++] = b >>> 8 & 255; - s.pending_buf[s.pending++] = b & 255; - }; - var read_buf = (strm, buf, start, size) => { - let len = strm.avail_in; - if (len > size) { - len = size; + function arrayToSmall(arr) { + trim(arr); + var length = arr.length; + if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { + switch (length) { + case 0: + return 0; + case 1: + return arr[0]; + case 2: + return arr[0] + arr[1] * BASE2; + default: + return arr[0] + (arr[1] + arr[2] * BASE2) * BASE2; + } + } + return arr; } - if (len === 0) { - return 0; + function trim(v) { + var i2 = v.length; + while (v[--i2] === 0) ; + v.length = i2 + 1; } - strm.avail_in -= len; - buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); + function createArray(length) { + var x = new Array(length); + var i2 = -1; + while (++i2 < length) { + x[i2] = 0; + } + return x; } - strm.next_in += len; - strm.total_in += len; - return len; - }; - var longest_match = (s, cur_match) => { - let chain_length = s.max_chain_length; - let scan = s.strstart; - let match; - let len; - let best_len = s.prev_length; - let nice_match = s.nice_match; - const limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; - const _win = s.window; - const wmask = s.w_mask; - const prev = s.prev; - const strend = s.strstart + MAX_MATCH; - let scan_end1 = _win[scan + best_len - 1]; - let scan_end = _win[scan + best_len]; - if (s.prev_length >= s.good_match) { - chain_length >>= 2; + function truncate(n) { + if (n > 0) return Math.floor(n); + return Math.ceil(n); } - if (nice_match > s.lookahead) { - nice_match = s.lookahead; + function add(a, b) { + var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE2, sum, i2; + for (i2 = 0; i2 < l_b; i2++) { + sum = a[i2] + b[i2] + carry; + carry = sum >= base ? 1 : 0; + r[i2] = sum - carry * base; + } + while (i2 < l_a) { + sum = a[i2] + carry; + carry = sum === base ? 1 : 0; + r[i2++] = sum - carry * base; + } + if (carry > 0) r.push(carry); + return r; } - do { - match = cur_match; - if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { - continue; + function addAny(a, b) { + if (a.length >= b.length) return add(a, b); + return add(b, a); + } + function addSmall(a, carry) { + var l = a.length, r = new Array(l), base = BASE2, sum, i2; + for (i2 = 0; i2 < l; i2++) { + sum = a[i2] - base + carry; + carry = Math.floor(sum / base); + r[i2] = sum - carry * base; + carry += 1; } - scan += 2; - match++; - do { - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { + while (carry > 0) { + r[i2++] = carry % base; + carry = Math.floor(carry / base); + } + return r; + } + BigInteger.prototype.add = function(v) { + var n = parseValue(v); + if (this.sign !== n.sign) { + return this.subtract(n.negate()); + } + var a = this.value, b = n.value; + if (n.isSmall) { + return new BigInteger(addSmall(a, Math.abs(b)), this.sign); + } + return new BigInteger(addAny(a, b), this.sign); + }; + BigInteger.prototype.plus = BigInteger.prototype.add; + SmallInteger.prototype.add = function(v) { + var n = parseValue(v); + var a = this.value; + if (a < 0 !== n.sign) { + return this.subtract(n.negate()); + } + var b = n.value; + if (n.isSmall) { + if (isPrecise(a + b)) return new SmallInteger(a + b); + b = smallToArray(Math.abs(b)); + } + return new BigInteger(addSmall(b, Math.abs(a)), a < 0); + }; + SmallInteger.prototype.plus = SmallInteger.prototype.add; + NativeBigInt.prototype.add = function(v) { + return new NativeBigInt(this.value + parseValue(v).value); + }; + NativeBigInt.prototype.plus = NativeBigInt.prototype.add; + function subtract(a, b) { + var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE2, i2, difference; + for (i2 = 0; i2 < b_l; i2++) { + difference = a[i2] - borrow - b[i2]; + if (difference < 0) { + difference += base; + borrow = 1; + } else borrow = 0; + r[i2] = difference; + } + for (i2 = b_l; i2 < a_l; i2++) { + difference = a[i2] - borrow; + if (difference < 0) difference += base; + else { + r[i2++] = difference; break; } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; + r[i2] = difference; } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - if (best_len <= s.lookahead) { - return best_len; + for (; i2 < a_l; i2++) { + r[i2] = a[i2]; + } + trim(r); + return r; } - return s.lookahead; - }; - var fill_window = (s) => { - const _w_size = s.w_size; - let n, more, str; - do { - more = s.window_size - s.lookahead - s.strstart; - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - s.block_start -= _w_size; - if (s.insert > s.strstart) { - s.insert = s.strstart; + function subtractAny(a, b, sign) { + var value; + if (compareAbs(a, b) >= 0) { + value = subtract(a, b); + } else { + value = subtract(b, a); + sign = !sign; + } + value = arrayToSmall(value); + if (typeof value === "number") { + if (sign) value = -value; + return new SmallInteger(value); + } + return new BigInteger(value, sign); + } + function subtractSmall(a, b, sign) { + var l = a.length, r = new Array(l), carry = -b, base = BASE2, i2, difference; + for (i2 = 0; i2 < l; i2++) { + difference = a[i2] + carry; + carry = Math.floor(difference / base); + difference %= base; + r[i2] = difference < 0 ? difference + base : difference; + } + r = arrayToSmall(r); + if (typeof r === "number") { + if (sign) r = -r; + return new SmallInteger(r); + } + return new BigInteger(r, sign); + } + BigInteger.prototype.subtract = function(v) { + var n = parseValue(v); + if (this.sign !== n.sign) { + return this.add(n.negate()); + } + var a = this.value, b = n.value; + if (n.isSmall) + return subtractSmall(a, Math.abs(b), this.sign); + return subtractAny(a, b, this.sign); + }; + BigInteger.prototype.minus = BigInteger.prototype.subtract; + SmallInteger.prototype.subtract = function(v) { + var n = parseValue(v); + var a = this.value; + if (a < 0 !== n.sign) { + return this.add(n.negate()); + } + var b = n.value; + if (n.isSmall) { + return new SmallInteger(a - b); + } + return subtractSmall(b, Math.abs(a), a >= 0); + }; + SmallInteger.prototype.minus = SmallInteger.prototype.subtract; + NativeBigInt.prototype.subtract = function(v) { + return new NativeBigInt(this.value - parseValue(v).value); + }; + NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; + BigInteger.prototype.negate = function() { + return new BigInteger(this.value, !this.sign); + }; + SmallInteger.prototype.negate = function() { + var sign = this.sign; + var small = new SmallInteger(-this.value); + small.sign = !sign; + return small; + }; + NativeBigInt.prototype.negate = function() { + return new NativeBigInt(-this.value); + }; + BigInteger.prototype.abs = function() { + return new BigInteger(this.value, false); + }; + SmallInteger.prototype.abs = function() { + return new SmallInteger(Math.abs(this.value)); + }; + NativeBigInt.prototype.abs = function() { + return new NativeBigInt(this.value >= 0 ? this.value : -this.value); + }; + function multiplyLong(a, b) { + var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE2, product, carry, i2, a_i, b_j; + for (i2 = 0; i2 < a_l; ++i2) { + a_i = a[i2]; + for (var j = 0; j < b_l; ++j) { + b_j = b[j]; + product = a_i * b_j + r[i2 + j]; + carry = Math.floor(product / base); + r[i2 + j] = product - carry * base; + r[i2 + j + 1] += carry; } - slide_hash(s); - more += _w_size; } - if (s.strm.avail_in === 0) { - break; + trim(r); + return r; + } + function multiplySmall(a, b) { + var l = a.length, r = new Array(l), base = BASE2, carry = 0, product, i2; + for (i2 = 0; i2 < l; i2++) { + product = a[i2] * b + carry; + carry = Math.floor(product / base); + r[i2] = product - carry * base; } - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - if (!s.legacy_hash) { - if (s.lookahead + s.insert > MIN_MATCH) { - str = s.strstart - s.insert; - while (s.insert) { - INSERT_STRING(s, str); - str++; - s.insert--; - if (s.lookahead + s.insert <= MIN_MATCH) { - break; + while (carry > 0) { + r[i2++] = carry % base; + carry = Math.floor(carry / base); + } + return r; + } + function shiftLeft(x, n) { + var r = []; + while (n-- > 0) r.push(0); + return r.concat(x); + } + function multiplyKaratsuba(x, y) { + var n = Math.max(x.length, y.length); + if (n <= 30) return multiplyLong(x, y); + n = Math.ceil(n / 2); + var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n); + var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); + var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); + trim(product); + return product; + } + function useKaratsuba(l1, l2) { + return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0; + } + BigInteger.prototype.multiply = function(v) { + var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs; + if (n.isSmall) { + if (b === 0) return Integer[0]; + if (b === 1) return this; + if (b === -1) return this.negate(); + abs = Math.abs(b); + if (abs < BASE2) { + return new BigInteger(multiplySmall(a, abs), sign); + } + b = smallToArray(abs); + } + if (useKaratsuba(a.length, b.length)) + return new BigInteger(multiplyKaratsuba(a, b), sign); + return new BigInteger(multiplyLong(a, b), sign); + }; + BigInteger.prototype.times = BigInteger.prototype.multiply; + function multiplySmallAndArray(a, b, sign) { + if (a < BASE2) { + return new BigInteger(multiplySmall(b, a), sign); + } + return new BigInteger(multiplyLong(b, smallToArray(a)), sign); + } + SmallInteger.prototype._multiplyBySmall = function(a) { + if (isPrecise(a.value * this.value)) { + return new SmallInteger(a.value * this.value); + } + return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); + }; + BigInteger.prototype._multiplyBySmall = function(a) { + if (a.value === 0) return Integer[0]; + if (a.value === 1) return this; + if (a.value === -1) return this.negate(); + return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); + }; + SmallInteger.prototype.multiply = function(v) { + return parseValue(v)._multiplyBySmall(this); + }; + SmallInteger.prototype.times = SmallInteger.prototype.multiply; + NativeBigInt.prototype.multiply = function(v) { + return new NativeBigInt(this.value * parseValue(v).value); + }; + NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; + function square(a) { + var l = a.length, r = createArray(l + l), base = BASE2, product, carry, i2, a_i, a_j; + for (i2 = 0; i2 < l; i2++) { + a_i = a[i2]; + carry = 0 - a_i * a_i; + for (var j = i2; j < l; j++) { + a_j = a[j]; + product = 2 * (a_i * a_j) + r[i2 + j] + carry; + carry = Math.floor(product / base); + r[i2 + j] = product - carry * base; + } + r[i2 + l] = carry; + } + trim(r); + return r; + } + BigInteger.prototype.square = function() { + return new BigInteger(square(this.value), false); + }; + SmallInteger.prototype.square = function() { + var value = this.value * this.value; + if (isPrecise(value)) return new SmallInteger(value); + return new BigInteger(square(smallToArray(Math.abs(this.value))), false); + }; + NativeBigInt.prototype.square = function(v) { + return new NativeBigInt(this.value * this.value); + }; + function divMod1(a, b) { + var a_l = a.length, b_l = b.length, base = BASE2, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q; + if (remainder.length <= a_l) remainder.push(0); + divisor.push(0); + divisorMostSignificantDigit = divisor[b_l - 1]; + for (shift = a_l - b_l; shift >= 0; shift--) { + quotientDigit = base - 1; + if (remainder[shift + b_l] !== divisorMostSignificantDigit) { + quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); + } + carry = 0; + borrow = 0; + l = divisor.length; + for (i2 = 0; i2 < l; i2++) { + carry += quotientDigit * divisor[i2]; + q = Math.floor(carry / base); + borrow += remainder[shift + i2] - (carry - q * base); + carry = q; + if (borrow < 0) { + remainder[shift + i2] = borrow + base; + borrow = -1; + } else { + remainder[shift + i2] = borrow; + borrow = 0; + } + } + while (borrow !== 0) { + quotientDigit -= 1; + carry = 0; + for (i2 = 0; i2 < l; i2++) { + carry += remainder[shift + i2] - base + divisor[i2]; + if (carry < 0) { + remainder[shift + i2] = carry + base; + carry = 0; + } else { + remainder[shift + i2] = carry; + carry = 1; } } + borrow += carry; + } + result[shift] = quotientDigit; + } + remainder = divModSmall(remainder, lambda)[0]; + return [arrayToSmall(result), arrayToSmall(remainder)]; + } + function divMod2(a, b) { + var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE2, guess, xlen, highx, highy, check2; + while (a_l) { + part.unshift(a[--a_l]); + trim(part); + if (compareAbs(part, b) < 0) { + result.push(0); + continue; } - } else if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - s.ins_h = HASH(s, s.ins_h, s.window[str + 1]); - while (s.insert) { - INSERT_STRING(s, str); - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } + xlen = part.length; + highx = part[xlen - 1] * base + part[xlen - 2]; + highy = b[b_l - 1] * base + b[b_l - 2]; + if (xlen > b_l) { + highx = (highx + 1) * base; } + guess = Math.ceil(highx / highy); + do { + check2 = multiplySmall(b, guess); + if (compareAbs(check2, part) <= 0) break; + guess--; + } while (guess); + result.push(guess); + part = subtract(part, check2); } - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - }; - var deflate_stored = (s, flush) => { - let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5; - let len, left, have, last = 0; - let used = s.strm.avail_in; - do { - len = 65535; - have = s.bi_valid + 42 >> 3; - if (s.strm.avail_out < have) { - break; - } - have = s.strm.avail_out - have; - left = s.strstart - s.block_start; - if (len > left + s.strm.avail_in) { - len = left + s.strm.avail_in; - } - if (len > have) { - len = have; + result.reverse(); + return [arrayToSmall(result), arrayToSmall(part)]; + } + function divModSmall(value, lambda) { + var length = value.length, quotient = createArray(length), base = BASE2, i2, q, remainder, divisor; + remainder = 0; + for (i2 = length - 1; i2 >= 0; --i2) { + divisor = remainder * base + value[i2]; + q = truncate(divisor / lambda); + remainder = divisor - q * lambda; + quotient[i2] = q | 0; } - if (len < min_block && (len === 0 && flush !== Z_FINISH || flush === Z_NO_FLUSH || len !== left + s.strm.avail_in)) { - break; + return [quotient, remainder | 0]; + } + function divModAny(self2, v) { + var value, n = parseValue(v); + if (supportsNativeBigInt) { + return [new NativeBigInt(self2.value / n.value), new NativeBigInt(self2.value % n.value)]; } - last = flush === Z_FINISH && len === left + s.strm.avail_in ? 1 : 0; - _tr_stored_block(s, 0, 0, last); - s.pending_buf[s.pending - 4] = len; - s.pending_buf[s.pending - 3] = len >> 8; - s.pending_buf[s.pending - 2] = ~len; - s.pending_buf[s.pending - 1] = ~len >> 8; - flush_pending(s.strm); - if (left) { - if (left > len) { - left = len; + var a = self2.value, b = n.value; + var quotient; + if (b === 0) throw new Error("Cannot divide by zero"); + if (self2.isSmall) { + if (n.isSmall) { + return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; } - s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out); - s.strm.next_out += left; - s.strm.avail_out -= left; - s.strm.total_out += left; - s.block_start += left; - len -= left; - } - if (len) { - read_buf(s.strm, s.strm.output, s.strm.next_out, len); - s.strm.next_out += len; - s.strm.avail_out -= len; - s.strm.total_out += len; + return [Integer[0], self2]; } - } while (last === 0); - used -= s.strm.avail_in; - if (used) { - if (used >= s.w_size) { - s.matches = 2; - s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0); - s.strstart = s.w_size; - s.insert = s.strstart; - } else { - if (s.window_size - s.strstart <= used) { - s.strstart -= s.w_size; - s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); - if (s.matches < 2) { - s.matches++; - } - if (s.insert > s.strstart) { - s.insert = s.strstart; + if (n.isSmall) { + if (b === 1) return [self2, Integer[0]]; + if (b == -1) return [self2.negate(), Integer[0]]; + var abs = Math.abs(b); + if (abs < BASE2) { + value = divModSmall(a, abs); + quotient = arrayToSmall(value[0]); + var remainder = value[1]; + if (self2.sign) remainder = -remainder; + if (typeof quotient === "number") { + if (self2.sign !== n.sign) quotient = -quotient; + return [new SmallInteger(quotient), new SmallInteger(remainder)]; } + return [new BigInteger(quotient, self2.sign !== n.sign), new SmallInteger(remainder)]; } - s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart); - s.strstart += used; - s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used; + b = smallToArray(abs); } - s.block_start = s.strstart; - } - if (s.high_water < s.strstart) { - s.high_water = s.strstart; - } - if (last) { - return BS_FINISH_DONE; - } - if (flush !== Z_NO_FLUSH && flush !== Z_FINISH && s.strm.avail_in === 0 && s.strstart === s.block_start) { - return BS_BLOCK_DONE; + var comparison = compareAbs(a, b); + if (comparison === -1) return [Integer[0], self2]; + if (comparison === 0) return [Integer[self2.sign === n.sign ? 1 : -1], Integer[0]]; + if (a.length + b.length <= 200) + value = divMod1(a, b); + else value = divMod2(a, b); + quotient = value[0]; + var qSign = self2.sign !== n.sign, mod = value[1], mSign = self2.sign; + if (typeof quotient === "number") { + if (qSign) quotient = -quotient; + quotient = new SmallInteger(quotient); + } else quotient = new BigInteger(quotient, qSign); + if (typeof mod === "number") { + if (mSign) mod = -mod; + mod = new SmallInteger(mod); + } else mod = new BigInteger(mod, mSign); + return [quotient, mod]; } - have = s.window_size - s.strstart; - if (s.strm.avail_in > have && s.block_start >= s.w_size) { - s.block_start -= s.w_size; - s.strstart -= s.w_size; - s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); - if (s.matches < 2) { - s.matches++; + BigInteger.prototype.divmod = function(v) { + var result = divModAny(this, v); + return { + quotient: result[0], + remainder: result[1] + }; + }; + NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; + BigInteger.prototype.divide = function(v) { + return divModAny(this, v)[0]; + }; + NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) { + return new NativeBigInt(this.value / parseValue(v).value); + }; + SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; + BigInteger.prototype.mod = function(v) { + return divModAny(this, v)[1]; + }; + NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) { + return new NativeBigInt(this.value % parseValue(v).value); + }; + SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; + BigInteger.prototype.pow = function(v) { + var n = parseValue(v), a = this.value, b = n.value, value, x, y; + if (b === 0) return Integer[1]; + if (a === 0) return Integer[0]; + if (a === 1) return Integer[1]; + if (a === -1) return n.isEven() ? Integer[1] : Integer[-1]; + if (n.sign) { + return Integer[0]; } - have += s.w_size; - if (s.insert > s.strstart) { - s.insert = s.strstart; + if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large."); + if (this.isSmall) { + if (isPrecise(value = Math.pow(a, b))) + return new SmallInteger(truncate(value)); } - } - if (have > s.strm.avail_in) { - have = s.strm.avail_in; - } - if (have) { - read_buf(s.strm, s.window, s.strstart, have); - s.strstart += have; - s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have; - } - if (s.high_water < s.strstart) { - s.high_water = s.strstart; - } - have = s.bi_valid + 42 >> 3; - have = s.pending_buf_size - have > 65535 ? 65535 : s.pending_buf_size - have; - min_block = have > s.w_size ? s.w_size : have; - left = s.strstart - s.block_start; - if (left >= min_block || (left || flush === Z_FINISH) && flush !== Z_NO_FLUSH && s.strm.avail_in === 0 && left <= have) { - len = left > have ? have : left; - last = flush === Z_FINISH && s.strm.avail_in === 0 && len === left ? 1 : 0; - _tr_stored_block(s, s.block_start, len, last); - s.block_start += len; - flush_pending(s.strm); - } - return last ? BS_FINISH_STARTED : BS_NEED_MORE; - }; - var deflate_fast = (s, flush) => { - let hash_head; - let bflush; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; + x = this; + y = Integer[1]; + while (true) { + if (b & true) { + y = y.times(x); + --b; } - if (s.lookahead === 0) { - break; + if (b === 0) break; + b /= 2; + x = x.square(); + } + return y; + }; + SmallInteger.prototype.pow = BigInteger.prototype.pow; + NativeBigInt.prototype.pow = function(v) { + var n = parseValue(v); + var a = this.value, b = n.value; + var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); + if (b === _0) return Integer[1]; + if (a === _0) return Integer[0]; + if (a === _1) return Integer[1]; + if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1]; + if (n.isNegative()) return new NativeBigInt(_0); + var x = this; + var y = Integer[1]; + while (true) { + if ((b & _1) === _1) { + y = y.times(x); + --b; } + if (b === _0) break; + b /= _2; + x = x.square(); } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - hash_head = INSERT_STRING(s, s.strstart); + return y; + }; + BigInteger.prototype.modPow = function(exp, mod) { + exp = parseValue(exp); + mod = parseValue(mod); + if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0"); + var r = Integer[1], base = this.mod(mod); + if (exp.isNegative()) { + exp = exp.multiply(Integer[-1]); + base = base.modInv(mod); } - if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); + while (exp.isPositive()) { + if (base.isZero()) return Integer[0]; + if (exp.isOdd()) r = r.multiply(base).mod(mod); + exp = exp.divide(2); + base = base.square().mod(mod); } - if (s.match_length >= MIN_MATCH) { - bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { - s.match_length--; - do { - s.strstart++; - hash_head = INSERT_STRING(s, s.strstart); - } while (--s.match_length !== 0); - s.strstart++; - } else { - s.strstart += s.match_length; - s.match_length = 0; - if (s.legacy_hash) { - s.ins_h = s.window[s.strstart]; - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]); - } - } - } else { - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; + return r; + }; + NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; + function compareAbs(a, b) { + if (a.length !== b.length) { + return a.length > b.length ? 1 : -1; } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } + for (var i2 = a.length - 1; i2 >= 0; i2--) { + if (a[i2] !== b[i2]) return a[i2] > b[i2] ? 1 : -1; } + return 0; } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; + BigInteger.prototype.compareAbs = function(v) { + var n = parseValue(v), a = this.value, b = n.value; + if (n.isSmall) return 1; + return compareAbs(a, b); + }; + SmallInteger.prototype.compareAbs = function(v) { + var n = parseValue(v), a = Math.abs(this.value), b = n.value; + if (n.isSmall) { + b = Math.abs(b); + return a === b ? 0 : a > b ? 1 : -1; } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; + return -1; + }; + NativeBigInt.prototype.compareAbs = function(v) { + var a = this.value; + var b = parseValue(v).value; + a = a >= 0 ? a : -a; + b = b >= 0 ? b : -b; + return a === b ? 0 : a > b ? 1 : -1; + }; + BigInteger.prototype.compare = function(v) { + if (v === Infinity) { + return -1; } - } - return BS_BLOCK_DONE; - }; - var deflate_slow = (s, flush) => { - let hash_head; - let bflush; - let max_insert; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } + if (v === -Infinity) { + return 1; } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - hash_head = INSERT_STRING(s, s.strstart); + var n = parseValue(v), a = this.value, b = n.value; + if (this.sign !== n.sign) { + return n.sign ? 1 : -1; } - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); - if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { - s.match_length = MIN_MATCH - 1; - } + if (n.isSmall) { + return this.sign ? -1 : 1; } - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - hash_head = INSERT_STRING(s, s.strstart); - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } else if (s.match_available) { - bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); - if (bflush) { - flush_block_only(s, false); - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; + return compareAbs(a, b) * (this.sign ? -1 : 1); + }; + BigInteger.prototype.compareTo = BigInteger.prototype.compare; + SmallInteger.prototype.compare = function(v) { + if (v === Infinity) { + return -1; + } + if (v === -Infinity) { + return 1; + } + var n = parseValue(v), a = this.value, b = n.value; + if (n.isSmall) { + return a == b ? 0 : a > b ? 1 : -1; + } + if (a < 0 !== n.sign) { + return a < 0 ? -1 : 1; + } + return a < 0 ? 1 : -1; + }; + SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; + NativeBigInt.prototype.compare = function(v) { + if (v === Infinity) { + return -1; + } + if (v === -Infinity) { + return 1; + } + var a = this.value; + var b = parseValue(v).value; + return a === b ? 0 : a > b ? 1 : -1; + }; + NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; + BigInteger.prototype.equals = function(v) { + return this.compare(v) === 0; + }; + NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; + BigInteger.prototype.notEquals = function(v) { + return this.compare(v) !== 0; + }; + NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; + BigInteger.prototype.greater = function(v) { + return this.compare(v) > 0; + }; + NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; + BigInteger.prototype.lesser = function(v) { + return this.compare(v) < 0; + }; + NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; + BigInteger.prototype.greaterOrEquals = function(v) { + return this.compare(v) >= 0; + }; + NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; + BigInteger.prototype.lesserOrEquals = function(v) { + return this.compare(v) <= 0; + }; + NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; + BigInteger.prototype.isEven = function() { + return (this.value[0] & 1) === 0; + }; + SmallInteger.prototype.isEven = function() { + return (this.value & 1) === 0; + }; + NativeBigInt.prototype.isEven = function() { + return (this.value & BigInt(1)) === BigInt(0); + }; + BigInteger.prototype.isOdd = function() { + return (this.value[0] & 1) === 1; + }; + SmallInteger.prototype.isOdd = function() { + return (this.value & 1) === 1; + }; + NativeBigInt.prototype.isOdd = function() { + return (this.value & BigInt(1)) === BigInt(1); + }; + BigInteger.prototype.isPositive = function() { + return !this.sign; + }; + SmallInteger.prototype.isPositive = function() { + return this.value > 0; + }; + NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; + BigInteger.prototype.isNegative = function() { + return this.sign; + }; + SmallInteger.prototype.isNegative = function() { + return this.value < 0; + }; + NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; + BigInteger.prototype.isUnit = function() { + return false; + }; + SmallInteger.prototype.isUnit = function() { + return Math.abs(this.value) === 1; + }; + NativeBigInt.prototype.isUnit = function() { + return this.abs().value === BigInt(1); + }; + BigInteger.prototype.isZero = function() { + return false; + }; + SmallInteger.prototype.isZero = function() { + return this.value === 0; + }; + NativeBigInt.prototype.isZero = function() { + return this.value === BigInt(0); + }; + BigInteger.prototype.isDivisibleBy = function(v) { + var n = parseValue(v); + if (n.isZero()) return false; + if (n.isUnit()) return true; + if (n.compareAbs(2) === 0) return this.isEven(); + return this.mod(n).isZero(); + }; + NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; + function isBasicPrime(v) { + var n = v.abs(); + if (n.isUnit()) return false; + if (n.equals(2) || n.equals(3) || n.equals(5)) return true; + if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false; + if (n.lesser(49)) return true; + } + function millerRabinTest(n, a) { + var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x; + while (b.isEven()) b = b.divide(2), r++; + next: for (i2 = 0; i2 < a.length; i2++) { + if (n.lesser(a[i2])) continue; + x = bigInt(a[i2]).modPow(b, n); + if (x.isUnit() || x.equals(nPrev)) continue; + for (d = r - 1; d != 0; d--) { + x = x.square().mod(n); + if (x.isUnit()) return false; + if (x.equals(nPrev)) continue next; } - } else { - s.match_available = 1; - s.strstart++; - s.lookahead--; + return false; } + return true; } - if (s.match_available) { - bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; + BigInteger.prototype.isPrime = function(strict) { + var isPrime = isBasicPrime(this); + if (isPrime !== undefined2) return isPrime; + var n = this.abs(); + var bits = n.bitLength(); + if (bits <= 64) + return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); + var logN = Math.log(2) * bits.toJSNumber(); + var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN); + for (var a = [], i2 = 0; i2 < t; i2++) { + a.push(bigInt(i2 + 2)); } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; + return millerRabinTest(n, a); + }; + NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; + BigInteger.prototype.isProbablePrime = function(iterations, rng) { + var isPrime = isBasicPrime(this); + if (isPrime !== undefined2) return isPrime; + var n = this.abs(); + var t = iterations === undefined2 ? 5 : iterations; + for (var a = [], i2 = 0; i2 < t; i2++) { + a.push(bigInt.randBetween(2, n.minus(2), rng)); } - } - return BS_BLOCK_DONE; - }; - var deflate_rle = (s, flush) => { - let bflush; - let prev; - let scan, strend; - const _win = s.window; - for (; ; ) { - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } + return millerRabinTest(n, a); + }; + NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; + BigInteger.prototype.modInv = function(n) { + var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; + while (!newR.isZero()) { + q = r.divide(newR); + lastT = t; + lastR = r; + t = newT; + r = newR; + newT = lastT.subtract(q.multiply(newT)); + newR = lastR.subtract(q.multiply(newR)); } - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } + if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); + if (t.compare(0) === -1) { + t = t.add(n); } - if (s.match_length >= MIN_MATCH) { - bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; + if (this.isNegative()) { + return t.negate(); } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } + return t; + }; + NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; + BigInteger.prototype.next = function() { + var value = this.value; + if (this.sign) { + return subtractSmall(value, 1, this.sign); } - } - s.insert = 0; - if (flush === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; + return new BigInteger(addSmall(value, 1), this.sign); + }; + SmallInteger.prototype.next = function() { + var value = this.value; + if (value + 1 < MAX_INT) return new SmallInteger(value + 1); + return new BigInteger(MAX_INT_ARR, false); + }; + NativeBigInt.prototype.next = function() { + return new NativeBigInt(this.value + BigInt(1)); + }; + BigInteger.prototype.prev = function() { + var value = this.value; + if (this.sign) { + return new BigInteger(addSmall(value, 1), true); } - return BS_FINISH_DONE; + return subtractSmall(value, 1, this.sign); + }; + SmallInteger.prototype.prev = function() { + var value = this.value; + if (value - 1 > -MAX_INT) return new SmallInteger(value - 1); + return new BigInteger(MAX_INT_ARR, true); + }; + NativeBigInt.prototype.prev = function() { + return new NativeBigInt(this.value - BigInt(1)); + }; + var powersOfTwo = [1]; + while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE2) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); + var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; + function shift_isSmall(n) { + return Math.abs(n) <= BASE2; } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; + BigInteger.prototype.shiftLeft = function(v) { + var n = parseValue(v).toJSNumber(); + if (!shift_isSmall(n)) { + throw new Error(String(n) + " is too large for shifting."); } - } - return BS_BLOCK_DONE; - }; - var deflate_huff = (s, flush) => { - let bflush; - for (; ; ) { - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; - } + if (n < 0) return this.shiftRight(-n); + var result = this; + if (result.isZero()) return result; + while (n >= powers2Length) { + result = result.multiply(highestPower2); + n -= powers2Length - 1; } - s.match_length = 0; - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } + return result.multiply(powersOfTwo[n]); + }; + NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; + BigInteger.prototype.shiftRight = function(v) { + var remQuo; + var n = parseValue(v).toJSNumber(); + if (!shift_isSmall(n)) { + throw new Error(String(n) + " is too large for shifting."); } - } - s.insert = 0; - if (flush === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; + if (n < 0) return this.shiftLeft(-n); + var result = this; + while (n >= powers2Length) { + if (result.isZero() || result.isNegative() && result.isUnit()) return result; + remQuo = divModAny(result, highestPower2); + result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; + n -= powers2Length - 1; } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; + remQuo = divModAny(result, powersOfTwo[n]); + return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; + }; + NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; + function bitwise(x, y, fn) { + y = parseValue(y); + var xSign = x.isNegative(), ySign = y.isNegative(); + var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y; + var xDigit = 0, yDigit = 0; + var xDivMod = null, yDivMod = null; + var result = []; + while (!xRem.isZero() || !yRem.isZero()) { + xDivMod = divModAny(xRem, highestPower2); + xDigit = xDivMod[1].toJSNumber(); + if (xSign) { + xDigit = highestPower2 - 1 - xDigit; + } + yDivMod = divModAny(yRem, highestPower2); + yDigit = yDivMod[1].toJSNumber(); + if (ySign) { + yDigit = highestPower2 - 1 - yDigit; + } + xRem = xDivMod[0]; + yRem = yDivMod[0]; + result.push(fn(xDigit, yDigit)); } + var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); + for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) { + sum = sum.multiply(highestPower2).add(bigInt(result[i2])); + } + return sum; } - return BS_BLOCK_DONE; - }; - function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; - } - var configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), - /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), - /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), - /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), - /* 3 */ - new Config(4, 4, 16, 16, deflate_slow), - /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), - /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), - /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), - /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), - /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) - /* 9 max compression */ - ]; - var lm_init = (s) => { - s.window_size = 2 * s.w_size; - zero(s.head); - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; - }; - function DeflateState() { - this.strm = null; - this.status = 0; - this.pending_buf = null; - this.pending_buf_size = 0; - this.pending_out = 0; - this.pending = 0; - this.wrap = 0; - this.gzhead = null; - this.gzindex = 0; - this.method = Z_DEFLATED; - this.last_flush = -1; - this.w_size = 0; - this.w_bits = 0; - this.w_mask = 0; - this.window = null; - this.window_size = 0; - this.prev = null; - this.head = null; - this.ins_h = 0; - this.legacy_hash = 0; - this.hash_size = 0; - this.hash_bits = 0; - this.hash_mask = 0; - this.hash_shift = 0; - this.block_start = 0; - this.match_length = 0; - this.prev_match = 0; - this.match_available = 0; - this.strstart = 0; - this.match_start = 0; - this.lookahead = 0; - this.prev_length = 0; - this.max_chain_length = 0; - this.max_lazy_match = 0; - this.level = 0; - this.strategy = 0; - this.good_match = 0; - this.nice_match = 0; - this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2); - this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2); - this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - this.l_desc = null; - this.d_desc = null; - this.bl_desc = null; - this.bl_count = new Uint16Array(MAX_BITS + 1); - this.heap = new Uint16Array(2 * L_CODES + 1); - zero(this.heap); - this.heap_len = 0; - this.heap_max = 0; - this.depth = new Uint16Array(2 * L_CODES + 1); - zero(this.depth); - this.sym_buf = 0; - this.lit_bufsize = 0; - this.sym_next = 0; - this.sym_end = 0; - this.opt_len = 0; - this.static_len = 0; - this.matches = 0; - this.insert = 0; - this.bi_buf = 0; - this.bi_valid = 0; - } - var deflateStateCheck = (strm) => { - if (!strm) { - return 1; - } - const s = strm.state; - if (!s || s.strm !== strm || s.status !== INIT_STATE && //#ifdef GZIP - s.status !== GZIP_STATE && //#endif - s.status !== EXTRA_STATE && s.status !== NAME_STATE && s.status !== COMMENT_STATE && s.status !== HCRC_STATE && s.status !== BUSY_STATE && s.status !== FINISH_STATE) { - return 1; - } - return 0; - }; - var deflateResetKeep = (strm) => { - if (deflateStateCheck(strm)) { - return err(strm, Z_STREAM_ERROR); - } - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - const s = strm.state; - s.pending = 0; - s.pending_out = 0; - if (s.wrap < 0) { - s.wrap = -s.wrap; - } - s.status = //#ifdef GZIP - s.wrap === 2 ? GZIP_STATE : ( - //#endif - s.wrap ? INIT_STATE : BUSY_STATE - ); - strm.adler = s.wrap === 2 ? 0 : 1; - s.last_flush = -2; - _tr_init(s); - return Z_OK; - }; - var deflateReset = (strm) => { - const ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; - }; - var deflateSetHeader = (strm, head) => { - if (deflateStateCheck(strm) || strm.state.wrap !== 2) { - return Z_STREAM_ERROR; - } - strm.state.gzhead = head; - return Z_OK; - }; - var deflateInit2 = (strm, level, method, windowBits, memLevel, strategy, legacyHash) => { - if (!strm) { - return Z_STREAM_ERROR; - } - let wrap = 1; - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else if (windowBits > 15) { - wrap = 2; - windowBits -= 16; - } - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED || windowBits === 8 && wrap !== 1) { - return err(strm, Z_STREAM_ERROR); - } - if (windowBits === 8) { - windowBits = 9; - } - const s = new DeflateState(); - strm.state = s; - s.strm = strm; - s.status = INIT_STATE; - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - s.legacy_hash = legacyHash ? 1 : 0; - s.hash_bits = memLevel + 7; - if (!s.legacy_hash && s.hash_bits < 15) { - s.hash_bits = 15; - } - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - s.window = new Uint8Array(s.w_size * 2); - s.head = new Uint16Array(s.hash_size); - s.prev = new Uint16Array(s.w_size); - s.lit_bufsize = 1 << memLevel + 6; - s.pending_buf_size = s.lit_bufsize * 4; - s.pending_buf = new Uint8Array(s.pending_buf_size); - s.sym_buf = s.lit_bufsize; - s.sym_end = (s.lit_bufsize - 1) * 3; - s.level = level; - s.strategy = strategy; - s.method = method; - return deflateReset(strm); - }; - var deflateInit = (strm, level) => { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); - }; - var deflate = (strm, flush) => { - if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - const s = strm.state; - if (!strm.output || strm.avail_in !== 0 && !strm.input || s.status === FINISH_STATE && flush !== Z_FINISH) { - return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR); + BigInteger.prototype.not = function() { + return this.negate().prev(); + }; + NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; + BigInteger.prototype.and = function(n) { + return bitwise(this, n, function(a, b) { + return a & b; + }); + }; + NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; + BigInteger.prototype.or = function(n) { + return bitwise(this, n, function(a, b) { + return a | b; + }); + }; + NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; + BigInteger.prototype.xor = function(n) { + return bitwise(this, n, function(a, b) { + return a ^ b; + }); + }; + NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; + var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE2 & -BASE2) * (BASE2 & -BASE2) | LOBMASK_I; + function roughLOB(n) { + var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE2 | LOBMASK_BI; + return x & -x; } - const old_flush = s.last_flush; - s.last_flush = flush; - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK; + function integerLogarithm(value, base) { + if (base.compareTo(value) <= 0) { + var tmp = integerLogarithm(value, base.square(base)); + var p = tmp.p; + var e = tmp.e; + var t = p.multiply(base); + return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 }; } - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - if (s.status === INIT_STATE && s.wrap === 0) { - s.status = BUSY_STATE; + return { p: bigInt(1), e: 0 }; } - if (s.status === INIT_STATE) { - let header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8; - let level_flags = -1; - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; + BigInteger.prototype.bitLength = function() { + var n = this; + if (n.compareTo(bigInt(0)) < 0) { + n = n.negate().subtract(bigInt(1)); } - header |= level_flags << 6; - if (s.strstart !== 0) { - header |= PRESET_DICT; + if (n.compareTo(bigInt(0)) === 0) { + return bigInt(0); } - header += 31 - header % 31; - putShortMSB(s, header); - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); + return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); + }; + NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; + function max(a, b) { + a = parseValue(a); + b = parseValue(b); + return a.greater(b) ? a : b; + } + function min(a, b) { + a = parseValue(a); + b = parseValue(b); + return a.lesser(b) ? a : b; + } + function gcd(a, b) { + a = parseValue(a).abs(); + b = parseValue(b).abs(); + if (a.equals(b)) return a; + if (a.isZero()) return b; + if (b.isZero()) return a; + var c = Integer[1], d, t; + while (a.isEven() && b.isEven()) { + d = min(roughLOB(a), roughLOB(b)); + a = a.divide(d); + b = b.divide(d); + c = c.multiply(d); } - strm.adler = 1; - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; + while (a.isEven()) { + a = a.divide(roughLOB(a)); } - } - if (s.status === GZIP_STATE) { - strm.adler = 0; - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; - } - } else { - put_byte( - s, - (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 255); - put_byte(s, s.gzhead.time >> 8 & 255); - put_byte(s, s.gzhead.time >> 16 & 255); - put_byte(s, s.gzhead.time >> 24 & 255); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, s.gzhead.os & 255); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 255); - put_byte(s, s.gzhead.extra.length >> 8 & 255); + do { + while (b.isEven()) { + b = b.divide(roughLOB(b)); } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + if (a.greater(b)) { + t = b; + b = a; + a = t; } - s.gzindex = 0; - s.status = EXTRA_STATE; - } + b = b.subtract(a); + } while (!b.isZero()); + return c.isUnit() ? a : a.multiply(c); } - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra) { - let beg = s.pending; - let left = (s.gzhead.extra.length & 65535) - s.gzindex; - while (s.pending + left > s.pending_buf_size) { - let copy = s.pending_buf_size - s.pending; - s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending); - s.pending = s.pending_buf_size; - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - s.gzindex += copy; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; - } - beg = 0; - left -= copy; - } - let gzhead_extra = new Uint8Array(s.gzhead.extra); - s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending); - s.pending += left; - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - s.gzindex = 0; + function lcm(a, b) { + a = parseValue(a).abs(); + b = parseValue(b).abs(); + return a.divide(gcd(a, b)).multiply(b); + } + function randBetween(a, b, rng) { + a = parseValue(a); + b = parseValue(b); + var usedRNG = rng || Math.random; + var low = min(a, b), high = max(a, b); + var range = high.subtract(low).add(1); + if (range.isSmall) return low.add(Math.floor(usedRNG() * range)); + var digits = toBase(range, BASE2).value; + var result = [], restricted = true; + for (var i2 = 0; i2 < digits.length; i2++) { + var top = restricted ? digits[i2] + (i2 + 1 < digits.length ? digits[i2 + 1] / BASE2 : 0) : BASE2; + var digit = truncate(usedRNG() * top); + result.push(digit); + if (digit < digits[i2]) restricted = false; } - s.status = NAME_STATE; + return low.add(Integer.fromArray(result, BASE2, false)); } - if (s.status === NAME_STATE) { - if (s.gzhead.name) { - let beg = s.pending; - let val; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; - } - beg = 0; - } - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; + var parseBase = function(text, base, alphabet, caseSensitive) { + alphabet = alphabet || DEFAULT_ALPHABET; + text = String(text); + if (!caseSensitive) { + text = text.toLowerCase(); + alphabet = alphabet.toLowerCase(); + } + var length = text.length; + var i2; + var absBase = Math.abs(base); + var alphabetValues = {}; + for (i2 = 0; i2 < alphabet.length; i2++) { + alphabetValues[alphabet[i2]] = i2; + } + for (i2 = 0; i2 < length; i2++) { + var c = text[i2]; + if (c === "-") continue; + if (c in alphabetValues) { + if (alphabetValues[c] >= absBase) { + if (c === "1" && absBase === 1) continue; + throw new Error(c + " is not a valid digit in base " + base + "."); } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } - s.gzindex = 0; } - s.status = COMMENT_STATE; + base = parseValue(base); + var digits = []; + var isNegative = text[0] === "-"; + for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) { + var c = text[i2]; + if (c in alphabetValues) digits.push(parseValue(alphabetValues[c])); + else if (c === "<") { + var start = i2; + do { + i2++; + } while (text[i2] !== ">" && i2 < text.length); + digits.push(parseValue(text.slice(start + 1, i2))); + } else throw new Error(c + " is not a valid character"); + } + return parseBaseFromArray(digits, base, isNegative); + }; + function parseBaseFromArray(digits, base, isNegative) { + var val = Integer[0], pow = Integer[1], i2; + for (i2 = digits.length - 1; i2 >= 0; i2--) { + val = val.add(digits[i2].times(pow)); + pow = pow.times(base); + } + return isNegative ? val.negate() : val; } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment) { - let beg = s.pending; - let val; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; - } - beg = 0; - } - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } + function stringify(digit, alphabet) { + alphabet = alphabet || DEFAULT_ALPHABET; + if (digit < alphabet.length) { + return alphabet[digit]; } - s.status = HCRC_STATE; + return "<" + digit + ">"; } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; - } - } - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - strm.adler = 0; + function toBase(n, base) { + base = bigInt(base); + if (base.isZero()) { + if (n.isZero()) return { value: [0], isNegative: false }; + throw new Error("Cannot convert nonzero numbers to base 0."); } - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK; + if (base.equals(-1)) { + if (n.isZero()) return { value: [0], isNegative: false }; + if (n.isNegative()) + return { + value: [].concat.apply( + [], + Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0]) + ), + isNegative: false + }; + var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]); + arr.unshift([1]); + return { + value: [].concat.apply([], arr), + isNegative: false + }; } - } - if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) { - let bstate = s.level === 0 ? deflate_stored(s, flush) : s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush); - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; + var neg = false; + if (n.isNegative() && base.isPositive()) { + neg = true; + n = n.abs(); } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - } - return Z_OK; + if (base.isUnit()) { + if (n.isZero()) return { value: [0], isNegative: false }; + return { + value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1), + isNegative: neg + }; } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - _tr_align(s); - } else if (flush !== Z_BLOCK) { - _tr_stored_block(s, 0, 0, false); - if (flush === Z_FULL_FLUSH) { - zero(s.head); - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK; + var out = []; + var left = n, divmod; + while (left.isNegative() || left.compareAbs(base) >= 0) { + divmod = left.divmod(base); + left = divmod.quotient; + var digit = divmod.remainder; + if (digit.isNegative()) { + digit = base.minus(digit).abs(); + left = left.next(); } + out.push(digit.toJSNumber()); } + out.push(left.toJSNumber()); + return { value: out.reverse(), isNegative: neg }; } - if (flush !== Z_FINISH) { - return Z_OK; - } - if (s.wrap <= 0) { - return Z_STREAM_END; - } - if (s.wrap === 2) { - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - put_byte(s, strm.adler >> 16 & 255); - put_byte(s, strm.adler >> 24 & 255); - put_byte(s, strm.total_in & 255); - put_byte(s, strm.total_in >> 8 & 255); - put_byte(s, strm.total_in >> 16 & 255); - put_byte(s, strm.total_in >> 24 & 255); - } else { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); - } - flush_pending(strm); - if (s.wrap > 0) { - s.wrap = -s.wrap; - } - return s.pending !== 0 ? Z_OK : Z_STREAM_END; - }; - var deflateEnd = (strm) => { - if (deflateStateCheck(strm)) { - return Z_STREAM_ERROR; - } - const status = strm.state.status; - strm.state = null; - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; - }; - var deflateSetDictionary = (strm, dictionary) => { - let dictLength = dictionary.length; - if (deflateStateCheck(strm)) { - return Z_STREAM_ERROR; + function toBaseString(n, base, alphabet) { + var arr = toBase(n, base); + return (arr.isNegative ? "-" : "") + arr.value.map(function(x) { + return stringify(x, alphabet); + }).join(""); } - const s = strm.state; - const wrap = s.wrap; - if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { - return Z_STREAM_ERROR; + BigInteger.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + SmallInteger.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + NativeBigInt.prototype.toArray = function(radix) { + return toBase(this, radix); + }; + BigInteger.prototype.toString = function(radix, alphabet) { + if (radix === undefined2) radix = 10; + if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet); + var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; + while (--l >= 0) { + digit = String(v[l]); + str += zeros.slice(digit.length) + digit; + } + var sign = this.sign ? "-" : ""; + return sign + str; + }; + SmallInteger.prototype.toString = function(radix, alphabet) { + if (radix === undefined2) radix = 10; + if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet); + return String(this.value); + }; + NativeBigInt.prototype.toString = SmallInteger.prototype.toString; + NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() { + return this.toString(); + }; + BigInteger.prototype.valueOf = function() { + return parseInt(this.toString(), 10); + }; + BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; + SmallInteger.prototype.valueOf = function() { + return this.value; + }; + SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; + NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() { + return parseInt(this.toString(), 10); + }; + function parseStringValue(v) { + if (isPrecise(+v)) { + var x = +v; + if (x === truncate(x)) + return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); + throw new Error("Invalid integer: " + v); + } + var sign = v[0] === "-"; + if (sign) v = v.slice(1); + var split = v.split(/e/i); + if (split.length > 2) throw new Error("Invalid integer: " + split.join("e")); + if (split.length === 2) { + var exp = split[1]; + if (exp[0] === "+") exp = exp.slice(1); + exp = +exp; + if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent."); + var text = split[0]; + var decimalPlace = text.indexOf("."); + if (decimalPlace >= 0) { + exp -= text.length - decimalPlace - 1; + text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); + } + if (exp < 0) throw new Error("Cannot include negative exponent part for integers"); + text += new Array(exp + 1).join("0"); + v = text; + } + var isValid = /^([0-9][0-9]*)$/.test(v); + if (!isValid) throw new Error("Invalid integer: " + v); + if (supportsNativeBigInt) { + return new NativeBigInt(BigInt(sign ? "-" + v : v)); + } + var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l; + while (max2 > 0) { + r.push(+v.slice(min2, max2)); + min2 -= l; + if (min2 < 0) min2 = 0; + max2 -= l; + } + trim(r); + return new BigInteger(r, sign); } - if (wrap === 1) { - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + function parseNumberValue(v) { + if (supportsNativeBigInt) { + return new NativeBigInt(BigInt(v)); + } + if (isPrecise(v)) { + if (v !== truncate(v)) throw new Error(v + " is not an integer."); + return new SmallInteger(v); + } + return parseStringValue(v.toString()); } - s.wrap = 0; - if (dictLength >= s.w_size) { - if (wrap === 0) { - zero(s.head); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; + function parseValue(v) { + if (typeof v === "number") { + return parseNumberValue(v); } - let tmpDict = new Uint8Array(s.w_size); - tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0); - dictionary = tmpDict; - dictLength = s.w_size; + if (typeof v === "string") { + return parseStringValue(v); + } + if (typeof v === "bigint") { + return new NativeBigInt(v); + } + return v; } - const avail = strm.avail_in; - const next = strm.next_in; - const input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - let str = s.strstart; - let n = s.lookahead - (MIN_MATCH - 1); - do { - INSERT_STRING(s, str); - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); + for (var i = 0; i < 1e3; i++) { + Integer[i] = parseValue(i); + if (i > 0) Integer[-i] = parseValue(-i); } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; - }; - module2.exports.deflateInit = deflateInit; - module2.exports.deflateInit2 = deflateInit2; - module2.exports.deflateReset = deflateReset; - module2.exports.deflateResetKeep = deflateResetKeep; - module2.exports.deflateSetHeader = deflateSetHeader; - module2.exports.deflate = deflate; - module2.exports.deflateEnd = deflateEnd; - module2.exports.deflateSetDictionary = deflateSetDictionary; - module2.exports.deflateInfo = "pako deflate (from Nodeca project)"; + Integer.one = Integer[1]; + Integer.zero = Integer[0]; + Integer.minusOne = Integer[-1]; + Integer.max = max; + Integer.min = min; + Integer.gcd = gcd; + Integer.lcm = lcm; + Integer.isInstance = function(x) { + return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; + }; + Integer.randBetween = randBetween; + Integer.fromArray = function(digits, base, isNegative) { + return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); + }; + return Integer; + })(); + if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) { + module2.exports = bigInt; + } + if (typeof define === "function" && define.amd) { + define(function() { + return bigInt; + }); + } } }); -// node_modules/pako/lib/utils/common.js -var require_common = __commonJS({ - "node_modules/pako/lib/utils/common.js"(exports2, module2) { +// node_modules/telegram/CryptoFile.js +var require_CryptoFile = __commonJS({ + "node_modules/telegram/CryptoFile.js"(exports2) { "use strict"; init_define_import_meta_env(); - var _has = (obj, key2) => { - return Object.prototype.hasOwnProperty.call(obj, key2); - }; - module2.exports.assign = function(obj) { - const sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - const source = sources.shift(); - if (!source) { - continue; - } - if (typeof source !== "object") { - throw new TypeError(source + "must be non-object"); - } - for (const p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - return obj; - }; - module2.exports.flattenChunks = (chunks) => { - let len = 0; - for (let i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - const result = new Uint8Array(len); - for (let i = 0, pos = 0, l = chunks.length; i < l; i++) { - let chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } + __setModuleDefault2(result, mod); return result; }; + Object.defineProperty(exports2, "__esModule", { value: true }); + var crypto4 = __importStar2(require("crypto")); + exports2.default = crypto4; } }); -// node_modules/pako/lib/utils/strings.js -var require_strings = __commonJS({ - "node_modules/pako/lib/utils/strings.js"(exports2, module2) { +// node_modules/telegram/platform.js +var require_platform = __commonJS({ + "node_modules/telegram/platform.js"(exports2) { "use strict"; init_define_import_meta_env(); - var STR_APPLY_UIA_OK = true; - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (__) { - STR_APPLY_UIA_OK = false; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.isNode = exports2.isBrowser = exports2.isDeno = void 0; + exports2.isDeno = "Deno" in globalThis; + exports2.isBrowser = !exports2.isDeno && typeof window !== "undefined"; + exports2.isNode = !exports2.isBrowser; + } +}); + +// node_modules/telegram/Helpers.js +var require_Helpers = __commonJS({ + "node_modules/telegram/Helpers.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) { + return mod2 && mod2.__esModule ? mod2 : { "default": mod2 }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._EntityType = exports2.TotalList = exports2.sleep = exports2.isArrayLike = void 0; + exports2.readBigIntFromBuffer = readBigIntFromBuffer; + exports2.generateRandomBigInt = generateRandomBigInt; + exports2.escapeRegex = escapeRegex2; + exports2.groupBy = groupBy; + exports2.betterConsoleLog = betterConsoleLog; + exports2.toSignedLittleBuffer = toSignedLittleBuffer; + exports2.readBufferFromBigInt = readBufferFromBigInt; + exports2.generateRandomLong = generateRandomLong; + exports2.mod = mod; + exports2.bigIntMod = bigIntMod; + exports2.generateRandomBytes = generateRandomBytes; + exports2.stripText = stripText; + exports2.generateKeyDataFromNonce = generateKeyDataFromNonce; + exports2.convertToLittle = convertToLittle; + exports2.sha1 = sha1; + exports2.sha256 = sha256; + exports2.modExp = modExp; + exports2.getByteArray = getByteArray; + exports2.returnBigInt = returnBigInt; + exports2.getMinBigInt = getMinBigInt; + exports2.getRandomInt = getRandomInt; + exports2.bufferXor = bufferXor; + exports2.crc32 = crc32; + exports2._entityType = _entityType; + var big_integer_1 = __importDefault2(require_BigInteger()); + var CryptoFile_1 = __importDefault2(require_CryptoFile()); + var platform_1 = require_platform(); + function readBigIntFromBuffer(buffer, little = true, signed = false) { + let randBuffer = Buffer.from(buffer); + const bytesNumber = randBuffer.length; + if (little) { + randBuffer = randBuffer.reverse(); + } + let bigIntVar = (0, big_integer_1.default)(randBuffer.toString("hex"), 16); + if (signed && Math.floor(bigIntVar.toString(2).length / 8) >= bytesNumber) { + bigIntVar = bigIntVar.subtract((0, big_integer_1.default)(2).pow((0, big_integer_1.default)(bytesNumber * 8))); + } + return bigIntVar; } - var _utf8len = new Uint8Array(256); - for (let q = 0; q < 256; q++) { - _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; + function generateRandomBigInt() { + return readBigIntFromBuffer(generateRandomBytes(8), false); } - _utf8len[254] = _utf8len[255] = 1; - module2.exports.string2buf = (str) => { - if (typeof TextEncoder === "function" && TextEncoder.prototype.encode) { - return new TextEncoder().encode(str); - } - let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; - } + function escapeRegex2(string) { + return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); + } + function groupBy(list, keyGetter) { + const map = /* @__PURE__ */ new Map(); + list.forEach((item) => { + const key = keyGetter(item); + const collection = map.get(key); + if (!collection) { + map.set(key, [item]); + } else { + collection.push(item); } - buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; - } - buf = new Uint8Array(buf_len); - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; + }); + return map; + } + function betterConsoleLog(object) { + const toPrint = {}; + for (const key in object) { + if (object.hasOwnProperty(key)) { + if (!key.startsWith("_") && key != "originalArgs") { + toPrint[key] = object[key]; } } - if (c < 128) { - buf[i++] = c; - } else if (c < 2048) { - buf[i++] = 192 | c >>> 6; - buf[i++] = 128 | c & 63; - } else if (c < 65536) { - buf[i++] = 224 | c >>> 12; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } else { - buf[i++] = 240 | c >>> 18; - buf[i++] = 128 | c >>> 12 & 63; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } } - return buf; - }; - var buf2binstring = (buf, len) => { - if (len < 65534) { - if (buf.subarray && STR_APPLY_UIA_OK) { - return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len)); - } + return toPrint; + } + var isArrayLike = (x) => x && typeof x.length === "number" && typeof x !== "function" && typeof x !== "string"; + exports2.isArrayLike = isArrayLike; + function toSignedLittleBuffer(big, number = 8) { + const bigNumber = returnBigInt(big); + const byteArray = []; + for (let i = 0; i < number; i++) { + byteArray[i] = bigNumber.shiftRight(8 * i).and(255); } - let result = ""; - for (let i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); + return Buffer.from(byteArray); + } + function readBufferFromBigInt(bigIntVar, bytesNumber, little = true, signed = false) { + bigIntVar = (0, big_integer_1.default)(bigIntVar); + const bitLength = bigIntVar.bitLength().toJSNumber(); + const bytes = Math.ceil(bitLength / 8); + if (bytesNumber < bytes) { + throw new Error("OverflowError: int too big to convert"); } - return result; - }; - module2.exports.buf2string = (buf, max) => { - const len = max || buf.length; - if (typeof TextDecoder === "function" && TextDecoder.prototype.decode) { - return new TextDecoder().decode(buf.subarray(0, max)); + if (!signed && bigIntVar.lesser((0, big_integer_1.default)(0))) { + throw new Error("Cannot convert to unsigned"); } - let i, out; - const utf16buf = new Array(len * 2); - for (out = 0, i = 0; i < len; ) { - let c = buf[i++]; - if (c < 128) { - utf16buf[out++] = c; - continue; - } - let c_len = _utf8len[c]; - if (c_len > 4) { - utf16buf[out++] = 65533; - i += c_len - 1; - continue; - } - c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; - while (c_len > 1 && i < len) { - c = c << 6 | buf[i++] & 63; - c_len--; - } - if (c_len > 1) { - utf16buf[out++] = 65533; - continue; - } - if (c < 65536) { - utf16buf[out++] = c; - } else { - c -= 65536; - utf16buf[out++] = 55296 | c >> 10 & 1023; - utf16buf[out++] = 56320 | c & 1023; - } + if (signed && bigIntVar.lesser((0, big_integer_1.default)(0))) { + bigIntVar = (0, big_integer_1.default)(2).pow((0, big_integer_1.default)(bytesNumber).multiply(8)).add(bigIntVar); } - return buf2binstring(utf16buf, out); - }; - module2.exports.utf8border = (buf, max) => { - max = max || buf.length; - if (max > buf.length) { - max = buf.length; + const hex = bigIntVar.toString(16).padStart(bytesNumber * 2, "0"); + let buffer = Buffer.from(hex, "hex"); + if (little) { + buffer = buffer.reverse(); } - let pos = max - 1; - while (pos >= 0 && (buf[pos] & 192) === 128) { - pos--; + return buffer; + } + function generateRandomLong(signed = true) { + return readBigIntFromBuffer(generateRandomBytes(8), true, signed); + } + function mod(n, m) { + return (n % m + m) % m; + } + function bigIntMod(n, m) { + return n.remainder(m).add(m).remainder(m); + } + function generateRandomBytes(count) { + return Buffer.from(CryptoFile_1.default.randomBytes(count)); + } + function stripText(text, entities2) { + if (!entities2 || !entities2.length) { + return text.trim(); } - if (pos < 0) { - return max; + while (text && text[text.length - 1].trim() === "") { + const e = entities2[entities2.length - 1]; + if (e.offset + e.length == text.length) { + if (e.length == 1) { + entities2.pop(); + if (!entities2.length) { + return text.trim(); + } + } else { + e.length -= 1; + } + } + text = text.slice(0, -1); } - if (pos === 0) { - return max; + while (text && text[0].trim() === "") { + for (let i = 0; i < entities2.length; i++) { + const e = entities2[i]; + if (e.offset != 0) { + e.offset--; + continue; + } + if (e.length == 1) { + entities2.shift(); + if (!entities2.length) { + return text.trimLeft(); + } + } else { + e.length -= 1; + } + } + text = text.slice(1); } - return pos + _utf8len[buf[pos]] > max ? pos : max; - }; - } -}); - -// node_modules/pako/lib/zlib/zstream.js -var require_zstream = __commonJS({ - "node_modules/pako/lib/zlib/zstream.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - function ZStream() { - this.input = null; - this.next_in = 0; - this.avail_in = 0; - this.total_in = 0; - this.output = null; - this.next_out = 0; - this.avail_out = 0; - this.total_out = 0; - this.msg = ""; - this.state = null; - this.data_type = 2; - this.adler = 0; + return text; } - module2.exports = ZStream; - } -}); - -// node_modules/pako/lib/deflate.js -var require_deflate2 = __commonJS({ - "node_modules/pako/lib/deflate.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - var zlib_deflate = require_deflate(); - var utils = require_common(); - var strings = require_strings(); - var msg = require_messages(); - var ZStream = require_zstream(); - var toString2 = Object.prototype.toString; - var { - Z_NO_FLUSH, - Z_SYNC_FLUSH, - Z_FULL_FLUSH, - Z_FINISH, - Z_OK, - Z_STREAM_END, - Z_DEFAULT_COMPRESSION, - Z_DEFAULT_STRATEGY, - Z_DEFLATED - } = require_constants(); - var defaultOptions2 = { - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - legacyHash: true - }; - function Deflate(options) { - this.options = utils.assign({}, defaultOptions2, options || {}); - let opt = this.options; - if (opt.raw && opt.windowBits > 0) { - opt.windowBits = -opt.windowBits; - } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { - opt.windowBits += 16; + async function generateKeyDataFromNonce(serverNonceBigInt, newNonceBigInt) { + const serverNonce = toSignedLittleBuffer(serverNonceBigInt, 16); + const newNonce = toSignedLittleBuffer(newNonceBigInt, 32); + const [hash1, hash2, hash3] = await Promise.all([ + sha1(Buffer.concat([newNonce, serverNonce])), + sha1(Buffer.concat([serverNonce, newNonce])), + sha1(Buffer.concat([newNonce, newNonce])) + ]); + const keyBuffer = Buffer.concat([hash1, hash2.slice(0, 12)]); + const ivBuffer = Buffer.concat([ + hash2.slice(12, 20), + hash3, + newNonce.slice(0, 4) + ]); + return { + key: keyBuffer, + iv: ivBuffer + }; + } + function convertToLittle(buf) { + const correct = Buffer.alloc(buf.length * 4); + for (let i = 0; i < buf.length; i++) { + correct.writeUInt32BE(buf[i], i * 4); + } + return correct; + } + function sha1(data) { + const shaSum = CryptoFile_1.default.createHash("sha1"); + shaSum.update(data); + return shaSum.digest(); + } + function sha256(data) { + const shaSum = CryptoFile_1.default.createHash("sha256"); + shaSum.update(data); + return shaSum.digest(); + } + function modExp(a, b, n) { + a = a.remainder(n); + let result = big_integer_1.default.one; + let x = a; + while (b.greater(big_integer_1.default.zero)) { + const leastSignificantBit = b.remainder((0, big_integer_1.default)(2)); + b = b.divide((0, big_integer_1.default)(2)); + if (leastSignificantBit.eq(big_integer_1.default.one)) { + result = result.multiply(x); + result = result.remainder(n); + } + x = x.multiply(x); + x = x.remainder(n); } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new ZStream(); - this.strm.avail_out = 0; - let status = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy, - opt.legacyHash - ); - if (status !== Z_OK) { - throw new Error(msg[status]); + return result; + } + function getByteArray(integer, signed = false) { + const bits = integer.toString(2).length; + const byteLength = Math.floor((bits + 8 - 1) / 8); + return readBufferFromBigInt(typeof integer == "number" ? (0, big_integer_1.default)(integer) : integer, byteLength, false, signed); + } + function returnBigInt(num) { + if (big_integer_1.default.isInstance(num)) { + return num; } - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); + if (typeof num == "number") { + return (0, big_integer_1.default)(num); } - if (opt.dictionary) { - let dict; - if (typeof opt.dictionary === "string") { - dict = strings.string2buf(opt.dictionary); - } else if (toString2.call(opt.dictionary) === "[object ArrayBuffer]") { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - status = zlib_deflate.deflateSetDictionary(this.strm, dict); - if (status !== Z_OK) { - throw new Error(msg[status]); - } - this._dict_set = true; + if (typeof num == "bigint") { + return (0, big_integer_1.default)(num); } + return (0, big_integer_1.default)(num); } - Deflate.prototype.push = function(data, flush_mode) { - const strm = this.strm; - const chunkSize = this.options.chunkSize; - let status, _flush_mode; - if (this.ended) { - return false; + function getMinBigInt(arrayOfBigInts) { + if (arrayOfBigInts.length == 0) { + return big_integer_1.default.zero; } - if (flush_mode === ~~flush_mode) _flush_mode = flush_mode; - else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; - if (typeof data === "string") { - strm.input = strings.string2buf(data); - } else if (toString2.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; + if (arrayOfBigInts.length == 1) { + return returnBigInt(arrayOfBigInts[0]); } - strm.next_in = 0; - strm.avail_in = strm.input.length; - for (; ; ) { - if (strm.avail_out === 0) { - strm.output = new Uint8Array(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) { - this.onData(strm.output.subarray(0, strm.next_out)); - strm.avail_out = 0; - continue; - } - status = zlib_deflate.deflate(strm, _flush_mode); - if (status === Z_STREAM_END) { - if (strm.next_out > 0) { - this.onData(strm.output.subarray(0, strm.next_out)); - } - status = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK; - } - if (strm.avail_out === 0) { - this.onData(strm.output); - continue; + let smallest = returnBigInt(arrayOfBigInts[0]); + for (let i = 1; i < arrayOfBigInts.length; i++) { + if (returnBigInt(arrayOfBigInts[i]).lesser(smallest)) { + smallest = returnBigInt(arrayOfBigInts[i]); } - if (_flush_mode > 0 && strm.next_out > 0) { - this.onData(strm.output.subarray(0, strm.next_out)); - strm.avail_out = 0; - continue; + } + return smallest; + } + function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; + } + var sleep4 = (ms, isUnref = false) => new Promise((resolve) => isUnref && platform_1.isNode ? setTimeout(resolve, ms).unref() : setTimeout(resolve, ms)); + exports2.sleep = sleep4; + function bufferXor(a, b) { + const res = []; + for (let i = 0; i < a.length; i++) { + res.push(a[i] ^ b[i]); + } + return Buffer.from(res); + } + function makeCRCTable() { + let c; + const crcTable2 = []; + for (let n = 0; n < 256; n++) { + c = n; + for (let k = 0; k < 8; k++) { + c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; } - if (strm.avail_in === 0) break; + crcTable2[n] = c; + } + return crcTable2; + } + var crcTable = void 0; + function crc32(buf) { + if (!crcTable) { + crcTable = makeCRCTable(); + } + if (!Buffer.isBuffer(buf)) { + buf = Buffer.from(buf); + } + let crc = -1; + for (let index2 = 0; index2 < buf.length; index2++) { + const byte = buf[index2]; + crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8; + } + return (crc ^ -1) >>> 0; + } + var TotalList = class extends Array { + constructor() { + super(); + this.total = 0; } - return true; }; - Deflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); + exports2.TotalList = TotalList; + exports2._EntityType = { + USER: 0, + CHAT: 1, + CHANNEL: 2 }; - Deflate.prototype.onEnd = function(status) { - if (status === Z_OK) { - this.result = utils.flattenChunks(this.chunks); + Object.freeze(exports2._EntityType); + function _entityType(entity) { + if (typeof entity !== "object" || !("SUBCLASS_OF_ID" in entity)) { + throw new Error(`${entity} is not a TLObject, cannot determine entity type`); } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; - }; - function deflate(input, options) { - const deflator = new Deflate(options); - deflator.push(input, true); - if (deflator.err) { - throw deflator.msg || msg[deflator.err]; + if (![ + 47470215, + // crc32('Peer') + 3374092470, + // crc32('InputPeer') + 3865689926, + // crc32('InputUser') + 1089602301, + // crc32('InputChannel') + 765557111, + // crc32('User') + 3316604308, + // crc32('Chat') + 524706233, + // crc32('UserFull') + 3566872215 + // crc32('ChatFull') + ].includes(entity.SUBCLASS_OF_ID)) { + throw new Error(`${entity} does not have any entity type`); } - return deflator.result; - } - function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate(input, options); - } - function gzip2(input, options) { - options = options || {}; - options.gzip = true; - return deflate(input, options); + const name = entity.className; + if (name.includes("User")) { + return exports2._EntityType.USER; + } else if (name.includes("Chat")) { + return exports2._EntityType.CHAT; + } else if (name.includes("Channel")) { + return exports2._EntityType.CHANNEL; + } else if (name.includes("Self")) { + return exports2._EntityType.USER; + } + throw new Error(`${entity} does not have any entity type`); } - module2.exports.Deflate = Deflate; - module2.exports.deflate = deflate; - module2.exports.deflateRaw = deflateRaw; - module2.exports.gzip = gzip2; - module2.exports.constants = require_constants(); } }); -// node_modules/pako/lib/zlib/inffast.js -var require_inffast = __commonJS({ - "node_modules/pako/lib/zlib/inffast.js"(exports2, module2) { +// node_modules/telegram/tl/apiTl.js +var require_apiTl = __commonJS({ + "node_modules/telegram/tl/apiTl.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + module2.exports = `boolFalse#bc799737 = Bool; +boolTrue#997275b5 = Bool; +true#3fedd339 = True; +vector#1cb5c415 {t:Type} # [ t ] = Vector t; +error#c4b9f9bb code:int text:string = Error; +null#56730bcc = Null; +inputPeerEmpty#7f3b18ea = InputPeer; +inputPeerSelf#7da07ec9 = InputPeer; +inputPeerChat#35a95cb9 chat_id:long = InputPeer; +inputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer; +inputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer; +inputPeerUserFromMessage#a87b0a1c peer:InputPeer msg_id:int user_id:long = InputPeer; +inputPeerChannelFromMessage#bd2a0840 peer:InputPeer msg_id:int channel_id:long = InputPeer; +inputUserEmpty#b98886cf = InputUser; +inputUserSelf#f7c1b13f = InputUser; +inputUser#f21158c6 user_id:long access_hash:long = InputUser; +inputUserFromMessage#1da448e2 peer:InputPeer msg_id:int user_id:long = InputUser; +inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; +inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; +inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; +inputFileStoryDocument#62dc8b48 id:InputDocument = InputFile; +inputMediaEmpty#9664f57f = InputMedia; +inputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector<InputDocument> ttl_seconds:flags.1?int = InputMedia; +inputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia; +inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; +inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; +inputMediaUploadedDocument#37c9330 flags:# nosound_video:flags.3?true force_file:flags.4?true spoiler:flags.5?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector<DocumentAttribute> stickers:flags.0?Vector<InputDocument> video_cover:flags.6?InputPhoto video_timestamp:flags.7?int ttl_seconds:flags.1?int = InputMedia; +inputMediaDocument#a8763ab5 flags:# spoiler:flags.2?true id:InputDocument video_cover:flags.3?InputPhoto video_timestamp:flags.4?int ttl_seconds:flags.0?int query:flags.1?string = InputMedia; +inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; +inputMediaPhotoExternal#e5bbfe1a flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int = InputMedia; +inputMediaDocumentExternal#779600f9 flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int video_cover:flags.2?InputPhoto video_timestamp:flags.3?int = InputMedia; +inputMediaGame#d33f43f3 id:InputGame = InputMedia; +inputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:flags.3?string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia; +inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia; +inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia; +inputMediaDice#e66fbf7b emoticon:string = InputMedia; +inputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia; +inputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia; +inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector<InputMedia> payload:flags.0?string = InputMedia; +inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; +inputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto; +inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; +inputGeoPointEmpty#e4c123d6 = InputGeoPoint; +inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint; +inputPhotoEmpty#1cd7bf0d = InputPhoto; +inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; +inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; +inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; +inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; +inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; +inputTakeoutFileLocation#29be5899 = InputFileLocation; +inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; +inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation; +inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation; +inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation; +inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation; +peerUser#59511722 user_id:long = Peer; +peerChat#36c6019a chat_id:long = Peer; +peerChannel#a2a5371e channel_id:long = Peer; +storage.fileUnknown#aa963b05 = storage.FileType; +storage.filePartial#40bc6f52 = storage.FileType; +storage.fileJpeg#7efe0e = storage.FileType; +storage.fileGif#cae1aadf = storage.FileType; +storage.filePng#a4f63c0 = storage.FileType; +storage.filePdf#ae1e508d = storage.FileType; +storage.fileMp3#528a0677 = storage.FileType; +storage.fileMov#4b09ebbc = storage.FileType; +storage.fileMp4#b3cea0e4 = storage.FileType; +storage.fileWebp#1081464c = storage.FileType; +userEmpty#d3bc4b7a id:long = User; +user#4b46c37e flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long = User; +userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; +userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; +userStatusEmpty#9d05049 = UserStatus; +userStatusOnline#edb93949 expires:int = UserStatus; +userStatusOffline#8c703f was_online:int = UserStatus; +userStatusRecently#7b197dc8 flags:# by_me:flags.0?true = UserStatus; +userStatusLastWeek#541a1d1a flags:# by_me:flags.0?true = UserStatus; +userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus; +chatEmpty#29562865 id:long = Chat; +chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; +chatForbidden#6592a1a7 id:long title:string = Chat; +channel#e00998b7 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long = Chat; +channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; +chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; +channelFull#52d6806b flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int = ChatFull; +chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; +chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; +chatParticipants#3cbc93f8 chat_id:long participants:Vector<ChatParticipant> version:int = ChatParticipants; +chatPhotoEmpty#37c1011c = ChatPhoto; +chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto; +messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; +message#96fdbbe9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int = Message; +messageService#d3d28540 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message; +messageMediaEmpty#3ded6320 = MessageMedia; +messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; +messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; +messageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia; +messageMediaUnsupported#9f84f49e = MessageMedia; +messageMediaDocument#52d8ccd9 flags:# nopremium:flags.3?true spoiler:flags.4?true video:flags.6?true round:flags.7?true voice:flags.8?true document:flags.0?Document alt_documents:flags.5?Vector<Document> video_cover:flags.9?Photo video_timestamp:flags.10?int ttl_seconds:flags.2?int = MessageMedia; +messageMediaWebPage#ddf10c3b flags:# force_large_media:flags.0?true force_small_media:flags.1?true manual:flags.3?true safe:flags.4?true webpage:WebPage = MessageMedia; +messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; +messageMediaGame#fdb19008 game:Game = MessageMedia; +messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia; +messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia; +messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; +messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; +messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; +messageMediaGiveaway#aa073beb flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector<long> countries_iso2:flags.1?Vector<string> prize_description:flags.3?string quantity:int months:flags.4?int stars:flags.5?long until_date:int = MessageMedia; +messageMediaGiveawayResults#ceaa3ea1 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector<long> months:flags.4?int stars:flags.5?long prize_description:flags.1?string until_date:int = MessageMedia; +messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector<MessageExtendedMedia> = MessageMedia; +messageActionEmpty#b6aef7b0 = MessageAction; +messageActionChatCreate#bd47cbad title:string users:Vector<long> = MessageAction; +messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; +messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; +messageActionChatDeletePhoto#95e3fbef = MessageAction; +messageActionChatAddUser#15cefd00 users:Vector<long> = MessageAction; +messageActionChatDeleteUser#a43f30cc user_id:long = MessageAction; +messageActionChatJoinedByLink#31224c3 inviter_id:long = MessageAction; +messageActionChannelCreate#95d2ac92 title:string = MessageAction; +messageActionChatMigrateTo#e1037f92 channel_id:long = MessageAction; +messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageAction; +messageActionPinMessage#94bd38ed = MessageAction; +messageActionHistoryClear#9fbab604 = MessageAction; +messageActionGameScore#92a72876 game_id:long score:int = MessageAction; +messageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction; +messageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction; +messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; +messageActionScreenshotTaken#4792929b = MessageAction; +messageActionCustomAction#fae69f56 message:string = MessageAction; +messageActionBotAllowed#c516d679 flags:# attach_menu:flags.1?true from_request:flags.3?true domain:flags.0?string app:flags.2?BotApp = MessageAction; +messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction; +messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction; +messageActionContactSignUp#f3f25f76 = MessageAction; +messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction; +messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction; +messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector<long> = MessageAction; +messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; +messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; +messageActionSetChatTheme#aa786345 emoticon:string = MessageAction; +messageActionChatJoinedByRequest#ebbca3cb = MessageAction; +messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; +messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; +messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction; +messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; +messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; +messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; +messageActionRequestedPeer#31518e9b button_id:int peers:Vector<Peer> = MessageAction; +messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; +messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction; +messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; +messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction; +messageActionBoostApply#cc02aa6d boosts:int = MessageAction; +messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector<RequestedPeer> = MessageAction; +messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; +messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction; +messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; +messageActionStarGift#4717e8a4 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long = MessageAction; +messageActionStarGiftUnique#acdfcb81 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long = MessageAction; +dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; +dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; +photoEmpty#2331b22d id:long = Photo; +photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo; +photoSizeEmpty#e17e23c type:string = PhotoSize; +photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize; +photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize; +photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize; +photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize; +photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize; +geoPointEmpty#1117dd5f = GeoPoint; +geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint; +auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; +auth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode; +auth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization; +auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization; +auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization; +inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; +inputNotifyUsers#193b4417 = InputNotifyPeer; +inputNotifyChats#4a95e84e = InputNotifyPeer; +inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; +inputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer; +inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings; +peerNotifySettings#99622c0c flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_ios_sound:flags.8?NotificationSound stories_android_sound:flags.9?NotificationSound stories_other_sound:flags.10?NotificationSound = PeerNotifySettings; +peerSettings#acd66c5e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string = PeerSettings; +wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; +wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper; +inputReportReasonSpam#58dbcab8 = ReportReason; +inputReportReasonViolence#1e22c78d = ReportReason; +inputReportReasonPornography#2e59d922 = ReportReason; +inputReportReasonChildAbuse#adf44ee3 = ReportReason; +inputReportReasonOther#c1e4a2b1 = ReportReason; +inputReportReasonCopyright#9b89f93a = ReportReason; +inputReportReasonGeoIrrelevant#dbd4feed = ReportReason; +inputReportReasonFake#f5ddd6e7 = ReportReason; +inputReportReasonIllegalDrugs#a8eb2be = ReportReason; +inputReportReasonPersonalDetails#9ec7863d = ReportReason; +userFull#4d975bbc flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification = UserFull; +contact#145ade0b user_id:long mutual:Bool = Contact; +importedContact#c13e3c50 user_id:long client_id:long = ImportedContact; +contactStatus#16d9703b user_id:long status:UserStatus = ContactStatus; +contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; +contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts; +contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts; +contacts.blocked#ade1591 blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked; +contacts.blockedSlice#e1664194 count:int blocked:Vector<PeerBlocked> chats:Vector<Chat> users:Vector<User> = contacts.Blocked; +messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; +messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs; +messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; +messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; +messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; +messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> topics:Vector<ForumTopic> chats:Vector<Chat> users:Vector<User> = messages.Messages; +messages.messagesNotModified#74535f21 count:int = messages.Messages; +messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; +messages.chatsSlice#9cd81144 count:int chats:Vector<Chat> = messages.Chats; +messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; +messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory; +inputMessagesFilterEmpty#57e2f66c = MessagesFilter; +inputMessagesFilterPhotos#9609a51c = MessagesFilter; +inputMessagesFilterVideo#9fc00e65 = MessagesFilter; +inputMessagesFilterPhotoVideo#56e9f0e4 = MessagesFilter; +inputMessagesFilterDocument#9eddf188 = MessagesFilter; +inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; +inputMessagesFilterGif#ffc86587 = MessagesFilter; +inputMessagesFilterVoice#50f5c392 = MessagesFilter; +inputMessagesFilterMusic#3751b49e = MessagesFilter; +inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; +inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter; +inputMessagesFilterRoundVoice#7a7c17a4 = MessagesFilter; +inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; +inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; +inputMessagesFilterGeo#e7026d0d = MessagesFilter; +inputMessagesFilterContacts#e062db83 = MessagesFilter; +inputMessagesFilterPinned#1bb00451 = MessagesFilter; +updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; +updateMessageID#4e90bfd6 id:int random_id:long = Update; +updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update; +updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update; +updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update; +updateChatParticipants#7761198 participants:ChatParticipants = Update; +updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update; +updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector<Username> = Update; +updateNewAuthorization#8951abef flags:# unconfirmed:flags.0?true hash:long date:flags.0?int device:flags.0?string location:flags.0?string = Update; +updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; +updateEncryptedChatTyping#1710f156 chat_id:int = Update; +updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; +updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; +updateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date:int version:int = Update; +updateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update; +updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update; +updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; +updateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update; +updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; +updateUserPhone#5492a13 user_id:long phone:string = Update; +updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update; +updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; +updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; +updateReadMessagesContents#f8227181 flags:# messages:Vector<int> pts:int pts_count:int date:flags.0?int = Update; +updateChannelTooLong#108d941f flags:# channel_id:long pts:flags.0?int = Update; +updateChannel#635b4c09 channel_id:long = Update; +updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; +updateReadChannelInbox#922e6e10 flags:# folder_id:flags.0?int channel_id:long max_id:int still_unread_count:int pts:int = Update; +updateDeleteChannelMessages#c32d5b12 channel_id:long messages:Vector<int> pts:int pts_count:int = Update; +updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update; +updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update; +updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; +updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update; +updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update; +updateSavedGifs#9375341e = Update; +updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update; +updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; +updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; +updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; +updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; +updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; +updateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update; +updateDraftMessage#1b49ec6d flags:# peer:Peer top_msg_id:flags.0?int draft:DraftMessage = Update; +updateReadFeaturedStickers#571d2742 = Update; +updateRecentStickers#9a422c20 = Update; +updateConfig#a229dd06 = Update; +updatePtsChanged#3354678f = Update; +updateChannelWebPage#2f2ba99f channel_id:long webpage:WebPage pts:int pts_count:int = Update; +updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update; +updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector<DialogPeer> = Update; +updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; +updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; +updateBotShippingQuery#b5aefd7d query_id:long user_id:long payload:bytes shipping_address:PostAddress = Update; +updateBotPrecheckoutQuery#8caa9a96 flags:# query_id:long user_id:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; +updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; +updateLangPackTooLong#46560264 lang_code:string = Update; +updateLangPack#56022f4d difference:LangPackDifference = Update; +updateFavedStickers#e511996d = Update; +updateChannelReadMessagesContents#ea29055d flags:# channel_id:long top_msg_id:flags.0?int messages:Vector<int> = Update; +updateContactsReset#7084a7be = Update; +updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update; +updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; +updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update; +updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update; +updateFolderPeers#19360dc0 folder_peers:Vector<FolderPeer> pts:int pts_count:int = Update; +updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update; +updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update; +updateNewScheduledMessage#39a51dfb message:Message = Update; +updateDeleteScheduledMessages#f2a71983 flags:# peer:Peer messages:Vector<int> sent_messages:flags.0?Vector<int> = Update; +updateTheme#8216fba3 theme:Theme = Update; +updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update; +updateLoginToken#564fe691 = Update; +updateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector<bytes> qts:int = Update; +updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update; +updateDialogFilterOrder#a5d72105 order:Vector<int> = Update; +updateDialogFilters#3504914f = Update; +updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update; +updateChannelMessageForwards#d29a27f4 channel_id:long id:int forwards:int = Update; +updateReadChannelDiscussionInbox#d6b19546 flags:# channel_id:long top_msg_id:int read_max_id:int broadcast_id:flags.0?long broadcast_post:flags.0?int = Update; +updateReadChannelDiscussionOutbox#695c9e7c channel_id:long top_msg_id:int read_max_id:int = Update; +updatePeerBlocked#ebe07752 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer = Update; +updateChannelUserTyping#8c88c923 flags:# channel_id:long top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update; +updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update; +updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update; +updateChat#f89a6a4e chat_id:long = Update; +updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update; +updateGroupCall#97d64341 flags:# chat_id:flags.0?long call:GroupCall = Update; +updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update; +updateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update; +updateChannelParticipant#985d3abb flags:# via_chatlist:flags.3?true channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update; +updateBotStopped#c4870a49 user_id:long date:int stopped:Bool qts:int = Update; +updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update; +updateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector<BotCommand> = Update; +updatePendingJoinRequests#7063c3db peer:Peer requests_pending:int recent_requesters:Vector<long> = Update; +updateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:string invite:ExportedChatInvite qts:int = Update; +updateMessageReactions#5e1b3cb8 flags:# peer:Peer msg_id:int top_msg_id:flags.0?int reactions:MessageReactions = Update; +updateAttachMenuBots#17b7a20b = Update; +updateWebViewResultSent#1592b79d query_id:long = Update; +updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update; +updateSavedRingtones#74d8be99 = Update; +updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update; +updateReadFeaturedEmojiStickers#fb4c496c = Update; +updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update; +updateRecentEmojiStatuses#30f443db = Update; +updateRecentReactions#6f7863f4 = Update; +updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update; +updateMessageExtendedMedia#d5a41724 peer:Peer msg_id:int extended_media:Vector<MessageExtendedMedia> = Update; +updateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update; +updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector<int> = Update; +updateUser#20529438 user_id:long = Update; +updateAutoSaveSettings#ec05b097 = Update; +updateStory#75b3b798 peer:Peer story:StoryItem = Update; +updateReadStories#f74e932b peer:Peer max_id:int = Update; +updateStoryID#1bf335b9 id:int random_id:long = Update; +updateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update; +updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update; +updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; +updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; +updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; +updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector<Reaction> new_reactions:Vector<Reaction> qts:int = Update; +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector<ReactionCount> qts:int = Update; +updateSavedDialogPinned#aeaf9e74 flags:# pinned:flags.0?true peer:DialogPeer = Update; +updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector<DialogPeer> = Update; +updateSavedReactionTags#39c67432 = Update; +updateSmsJob#f16269d4 job_id:string = Update; +updateQuickReplies#f9470ab2 quick_replies:Vector<QuickReply> = Update; +updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; +updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; +updateQuickReplyMessage#3e050d0f message:Message = Update; +updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector<int> = Update; +updateBotBusinessConnect#8ae5c97a connection:BotBusinessConnection qts:int = Update; +updateBotNewBusinessMessage#9ddb347c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; +updateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; +updateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector<int> qts:int = Update; +updateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update; +updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update; +updateStarsBalance#4e80a379 balance:StarsAmount = Update; +updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update; +updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update; +updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update; +updatePaidReactionPrivacy#51ca7aec private:Bool = Update; +updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; +updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; +updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> state:updates.State = updates.Difference; +updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference; +updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; +updatesTooLong#e317af7e = Updates; +updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; +updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; +updateShort#78d4dec1 update:Update date:int = Updates; +updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates; +updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates; +updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates; +photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos; +photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos; +photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo; +upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; +upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File; +dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; +config#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config; +nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; +help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate; +help.noAppUpdate#c45a6536 = help.AppUpdate; +help.inviteText#18cb9f78 message:string = help.InviteText; +encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; +encryptedChatWaiting#66b25953 id:int access_hash:long date:int admin_id:long participant_id:long = EncryptedChat; +encryptedChatRequested#48f1d94c flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:long participant_id:long g_a:bytes = EncryptedChat; +encryptedChat#61f0d4c7 id:int access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long = EncryptedChat; +encryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat; +inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; +encryptedFileEmpty#c21f497e = EncryptedFile; +encryptedFile#a8008cd8 id:long access_hash:long size:long dc_id:int key_fingerprint:int = EncryptedFile; +inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; +inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; +inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; +inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; +encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; +encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; +messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig; +messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig; +messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; +messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; +inputDocumentEmpty#72f0eaae = InputDocument; +inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; +documentEmpty#36f8c871 id:long = Document; +document#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document; +help.support#17c6b5f6 phone_number:string user:User = help.Support; +notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; +notifyUsers#b4c83b4c = NotifyPeer; +notifyChats#c007cec3 = NotifyPeer; +notifyBroadcasts#d612e8ef = NotifyPeer; +notifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer; +sendMessageTypingAction#16bf744e = SendMessageAction; +sendMessageCancelAction#fd5ec8f5 = SendMessageAction; +sendMessageRecordVideoAction#a187d66f = SendMessageAction; +sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; +sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; +sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; +sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; +sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; +sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; +sendMessageChooseContactAction#628cbc6f = SendMessageAction; +sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; +sendMessageRecordRoundAction#88f27fbc = SendMessageAction; +sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; +speakingInGroupCallAction#d92c2285 = SendMessageAction; +sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction; +sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction; +sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction; +sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction; +contacts.found#b3134d9d my_results:Vector<Peer> results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; +inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; +inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; +inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; +inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; +inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey; +inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey; +inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey; +inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey; +inputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey; +inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; +inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; +inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey; +privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; +privacyKeyChatInvite#500e6dfa = PrivacyKey; +privacyKeyPhoneCall#3d662b7b = PrivacyKey; +privacyKeyPhoneP2P#39491cc8 = PrivacyKey; +privacyKeyForwards#69ec56a3 = PrivacyKey; +privacyKeyProfilePhoto#96151fed = PrivacyKey; +privacyKeyPhoneNumber#d19ae46d = PrivacyKey; +privacyKeyAddedByPhone#42ffd42b = PrivacyKey; +privacyKeyVoiceMessages#697f414 = PrivacyKey; +privacyKeyAbout#a486b761 = PrivacyKey; +privacyKeyBirthday#2000a518 = PrivacyKey; +privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey; +inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; +inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; +inputPrivacyValueAllowUsers#131cc67f users:Vector<InputUser> = InputPrivacyRule; +inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; +inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; +inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule; +inputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule; +inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule; +inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; +inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; +inputPrivacyValueAllowBots#5a4fcce5 = InputPrivacyRule; +inputPrivacyValueDisallowBots#c4e57915 = InputPrivacyRule; +privacyValueAllowContacts#fffe1bac = PrivacyRule; +privacyValueAllowAll#65427b82 = PrivacyRule; +privacyValueAllowUsers#b8905fb2 users:Vector<long> = PrivacyRule; +privacyValueDisallowContacts#f888fa1a = PrivacyRule; +privacyValueDisallowAll#8b73e763 = PrivacyRule; +privacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule; +privacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule; +privacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule; +privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; +privacyValueAllowPremium#ece9814b = PrivacyRule; +privacyValueAllowBots#21461b5d = PrivacyRule; +privacyValueDisallowBots#f6a5f82f = PrivacyRule; +account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules; +accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; +documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; +documentAttributeAnimated#11b58939 = DocumentAttribute; +documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; +documentAttributeVideo#43c57c48 flags:# round_message:flags.0?true supports_streaming:flags.1?true nosound:flags.3?true duration:double w:int h:int preload_prefix_size:flags.2?int video_start_ts:flags.4?double video_codec:flags.5?string = DocumentAttribute; +documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; +documentAttributeFilename#15590068 file_name:string = DocumentAttribute; +documentAttributeHasStickers#9801d2f7 = DocumentAttribute; +documentAttributeCustomEmoji#fd149899 flags:# free:flags.0?true text_color:flags.1?true alt:string stickerset:InputStickerSet = DocumentAttribute; +messages.stickersNotModified#f1749a22 = messages.Stickers; +messages.stickers#30a6ec7e hash:long stickers:Vector<Document> = messages.Stickers; +stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack; +messages.allStickersNotModified#e86602c3 = messages.AllStickers; +messages.allStickers#cdbbcebb hash:long sets:Vector<StickerSet> = messages.AllStickers; +messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; +webPageEmpty#211a1788 flags:# id:long url:flags.0?string = WebPage; +webPagePending#b0d13e47 flags:# id:long url:flags.0?string date:int = WebPage; +webPage#e89c45b2 flags:# has_large_media:flags.13?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage; +webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage; +authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true unconfirmed:flags.5?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; +account.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector<Authorization> = account.Authorizations; +account.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password; +account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; +account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; +auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; +receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; +chatInviteExported#a22cbd96 flags:# revoked:flags.0?true permanent:flags.5?true request_needed:flags.6?true link:string admin_id:long date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int requested:flags.7?int subscription_expired:flags.10?int title:flags.8?string subscription_pricing:flags.9?StarsSubscriptionPricing = ExportedChatInvite; +chatInvitePublicJoinRequests#ed107ab7 = ExportedChatInvite; +chatInviteAlready#5a686d7c chat:Chat = ChatInvite; +chatInvite#5c9d3702 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true can_refulfill_subscription:flags.11?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector<User> color:int subscription_pricing:flags.10?StarsSubscriptionPricing subscription_form_id:flags.12?long bot_verification:flags.13?BotVerification = ChatInvite; +chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite; +inputStickerSetEmpty#ffb62b95 = InputStickerSet; +inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; +inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; +inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet; +inputStickerSetDice#e67f520e emoticon:string = InputStickerSet; +inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet; +inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet; +inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; +inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; +inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; +inputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet; +stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true creator:flags.11?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; +messages.stickerSet#6e153f16 set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = messages.StickerSet; +messages.stickerSetNotModified#d3f924eb = messages.StickerSet; +botCommand#c27ac8c7 command:string description:string = BotCommand; +botInfo#4d8a0299 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings verifier_settings:flags.9?BotVerifierSettings = BotInfo; +keyboardButton#a2fa4880 text:string = KeyboardButton; +keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; +keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; +keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; +keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; +keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector<InlineQueryPeerType> = KeyboardButton; +keyboardButtonGame#50f41ccf text:string = KeyboardButton; +keyboardButtonBuy#afd93fbb text:string = KeyboardButton; +keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; +inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; +inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; +keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; +keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; +keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; +keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +keyboardButtonCopy#75d2698e text:string copy_text:string = KeyboardButton; +keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow; +replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; +replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup; +replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup; +replyInlineMarkup#48a30254 rows:Vector<KeyboardButtonRow> = ReplyMarkup; +messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; +messageEntityMention#fa04579d offset:int length:int = MessageEntity; +messageEntityHashtag#6f635b0d offset:int length:int = MessageEntity; +messageEntityBotCommand#6cef8ac7 offset:int length:int = MessageEntity; +messageEntityUrl#6ed02538 offset:int length:int = MessageEntity; +messageEntityEmail#64e475c2 offset:int length:int = MessageEntity; +messageEntityBold#bd610bc9 offset:int length:int = MessageEntity; +messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; +messageEntityCode#28a20571 offset:int length:int = MessageEntity; +messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; +messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; +messageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity; +inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; +messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; +messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; +messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity; +messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity; +messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity; +messageEntitySpoiler#32ca960f offset:int length:int = MessageEntity; +messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = MessageEntity; +messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; +inputChannelEmpty#ee8c1e86 = InputChannel; +inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; +inputChannelFromMessage#5b934f9d peer:InputPeer msg_id:int channel_id:long = InputChannel; +contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; +messageRange#ae30253 min_id:int max_id:int = MessageRange; +updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; +updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; +updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference; +channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; +channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector<MessageRange> = ChannelMessagesFilter; +channelParticipant#cb397619 flags:# user_id:long date:int subscription_until_date:flags.0?int = ChannelParticipant; +channelParticipantSelf#4f607bef flags:# via_request:flags.0?true user_id:long inviter_id:long date:int subscription_until_date:flags.1?int = ChannelParticipant; +channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; +channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; +channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; +channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; +channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; +channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; +channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; +channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; +channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; +channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; +channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter; +channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter; +channels.channelParticipants#9ab0feaf count:int participants:Vector<ChannelParticipant> chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipants; +channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; +channels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector<Chat> users:Vector<User> = channels.ChannelParticipant; +help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector<MessageEntity> min_age_confirm:flags.1?int = help.TermsOfService; +messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; +messages.savedGifs#84a02a0d hash:long gifs:Vector<Document> = messages.SavedGifs; +inputBotInlineMessageMediaAuto#3380c786 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaWebPage#bddcc510 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true optional:flags.6?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; +inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; +inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; +inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; +botInlineMessageMediaAuto#764cf810 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaWebPage#809ad9a6 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true manual:flags.7?true safe:flags.8?true message:string entities:flags.1?Vector<MessageEntity> url:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; +botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; +messages.botResults#e021f2f6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM switch_webview:flags.3?InlineBotWebView results:Vector<BotInlineResult> cache_time:int users:Vector<User> = messages.BotResults; +exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; +messageFwdHeader#4e4df4bb flags:# imported:flags.7?true saved_out:flags.11?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int saved_from_id:flags.8?Peer saved_from_name:flags.9?string saved_date:flags.10?int psa_type:flags.6?string = MessageFwdHeader; +auth.codeTypeSms#72a3158c = auth.CodeType; +auth.codeTypeCall#741cd3e3 = auth.CodeType; +auth.codeTypeFlashCall#226ccefb = auth.CodeType; +auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; +auth.codeTypeFragmentSms#6ed998c = auth.CodeType; +auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; +auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; +auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; +auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; +auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType; +auth.sentCodeTypeEmailCode#f450f59b flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int reset_available_period:flags.3?int reset_pending_date:flags.4?int = auth.SentCodeType; +auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; +auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; +auth.sentCodeTypeFirebaseSms#9fd736 flags:# nonce:flags.0?bytes play_integrity_project_id:flags.2?long play_integrity_nonce:flags.2?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType; +auth.sentCodeTypeSmsWord#a416ac81 flags:# beginning:flags.0?string = auth.SentCodeType; +auth.sentCodeTypeSmsPhrase#b37794af flags:# beginning:flags.0?string = auth.SentCodeType; +messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; +messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; +inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; +inputBotInlineMessageID64#b6d915d7 dc_id:int owner_id:long id:int access_hash:long = InputBotInlineMessageID; +inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; +messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs; +topPeer#edcdc05b peer:Peer rating:double = TopPeer; +topPeerCategoryBotsPM#ab661b5b = TopPeerCategory; +topPeerCategoryBotsInline#148677e2 = TopPeerCategory; +topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; +topPeerCategoryGroups#bd17a14a = TopPeerCategory; +topPeerCategoryChannels#161d9628 = TopPeerCategory; +topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; +topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory; +topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory; +topPeerCategoryBotsApp#fd9e7bec = TopPeerCategory; +topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector<TopPeer> = TopPeerCategoryPeers; +contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; +contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers; +contacts.topPeersDisabled#b52c939d = contacts.TopPeers; +draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; +draftMessage#2d65321f flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia date:int effect:flags.7?long = DraftMessage; +messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers; +messages.featuredStickers#be382906 flags:# premium:flags.0?true hash:long count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers; +messages.recentStickersNotModified#b17f890 = messages.RecentStickers; +messages.recentStickers#88d37c56 hash:long packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers; +messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers; +messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; +messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult; +stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; +stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered; +stickerSetFullCovered#40d13c0e set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = StickerSetCovered; +stickerSetNoCovered#77b15d1c set:StickerSet = StickerSetCovered; +maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; +inputStickeredMediaPhoto#4a992157 id:InputPhoto = InputStickeredMedia; +inputStickeredMediaDocument#438865b id:InputDocument = InputStickeredMedia; +game#bdf9653b flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document = Game; +inputGameID#32c3e77 id:long access_hash:long = InputGame; +inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; +highScore#73a379eb pos:int user_id:long score:int = HighScore; +messages.highScores#9a3bfd99 scores:Vector<HighScore> users:Vector<User> = messages.HighScores; +textEmpty#dc3d824f = RichText; +textPlain#744694e0 text:string = RichText; +textBold#6724abc4 text:RichText = RichText; +textItalic#d912a59c text:RichText = RichText; +textUnderline#c12622c4 text:RichText = RichText; +textStrike#9bf8bb95 text:RichText = RichText; +textFixed#6c3f19b9 text:RichText = RichText; +textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; +textEmail#de5a0dd6 text:RichText email:string = RichText; +textConcat#7e6260d7 texts:Vector<RichText> = RichText; +textSubscript#ed6a8504 text:RichText = RichText; +textSuperscript#c7fb5e01 text:RichText = RichText; +textMarked#34b8621 text:RichText = RichText; +textPhone#1ccb966a text:RichText phone:string = RichText; +textImage#81ccf4f document_id:long w:int h:int = RichText; +textAnchor#35553762 text:RichText name:string = RichText; +pageBlockUnsupported#13567e8a = PageBlock; +pageBlockTitle#70abc3fd text:RichText = PageBlock; +pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; +pageBlockAuthorDate#baafe5e0 author:RichText published_date:int = PageBlock; +pageBlockHeader#bfd064ec text:RichText = PageBlock; +pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; +pageBlockParagraph#467a0766 text:RichText = PageBlock; +pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; +pageBlockFooter#48870999 text:RichText = PageBlock; +pageBlockDivider#db20b188 = PageBlock; +pageBlockAnchor#ce0d37b0 name:string = PageBlock; +pageBlockList#e4e88011 items:Vector<PageListItem> = PageBlock; +pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; +pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; +pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; +pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; +pageBlockCover#39f23300 cover:PageBlock = PageBlock; +pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; +pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector<PageBlock> caption:PageCaption = PageBlock; +pageBlockCollage#65a0fa4d items:Vector<PageBlock> caption:PageCaption = PageBlock; +pageBlockSlideshow#31f9590 items:Vector<PageBlock> caption:PageCaption = PageBlock; +pageBlockChannel#ef1751b5 channel:Chat = PageBlock; +pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; +pageBlockKicker#1e148390 text:RichText = PageBlock; +pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector<PageTableRow> = PageBlock; +pageBlockOrderedList#9a8ae1e1 items:Vector<PageListOrderedItem> = PageBlock; +pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector<PageBlock> title:RichText = PageBlock; +pageBlockRelatedArticles#16115a96 title:RichText articles:Vector<PageRelatedArticle> = PageBlock; +pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; +phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; +phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; +phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; +phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; +phoneCallDiscardReasonAllowGroupCall#afe2b839 encrypted_key:bytes = PhoneCallDiscardReason; +dataJSON#7d748d04 data:string = DataJSON; +labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; +invoice#49ee584 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector<LabeledPrice> max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector<long> terms_url:flags.10?string subscription_period:flags.11?int = Invoice; +paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; +postAddress#1e8caaeb street_line1:string street_line2:string city:string state:string country_iso2:string post_code:string = PostAddress; +paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string email:flags.2?string shipping_address:flags.3?PostAddress = PaymentRequestedInfo; +paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; +webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; +webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = WebDocument; +inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector<DocumentAttribute> = InputWebDocument; +inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; +inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; +inputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document:flags.0?InputDocument title:flags.1?string performer:flags.1?string = InputWebFileLocation; +upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; +payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector<PaymentFormMethod> saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector<PaymentSavedCredentials> users:Vector<User> = payments.PaymentForm; +payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector<User> = payments.PaymentForm; +payments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm; +payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; +payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; +payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult; +payments.paymentReceipt#70c4fe03 flags:# date:int bot_id:long provider_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; +payments.paymentReceiptStars#dabbf83a flags:# date:int bot_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice currency:string total_amount:long transaction_id:string users:Vector<User> = payments.PaymentReceipt; +payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; +inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; +inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; +inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; +inputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials; +account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; +shippingOption#b6213cdf id:string title:string prices:Vector<LabeledPrice> = ShippingOption; +inputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords keywords:flags.1?string = InputStickerSetItem; +inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; +phoneCallEmpty#5366c915 id:long = PhoneCall; +phoneCallWaiting#eed42858 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int conference_call:flags.8?InputGroupCall = PhoneCall; +phoneCallRequested#45361c63 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall; +phoneCallAccepted#22fd7181 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall; +phoneCall#3ba5940c flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON conference_call:flags.8?InputGroupCall = PhoneCall; +phoneCallDiscarded#f9d25503 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int conference_call:flags.8?InputGroupCall = PhoneCall; +phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; +phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection; +phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol; +phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall; +upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; +upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; +cdnPublicKey#c982eaba dc_id:int public_key:string = CdnPublicKey; +cdnConfig#5725e40a public_keys:Vector<CdnPublicKey> = CdnConfig; +langPackString#cad181f6 key:string value:string = LangPackString; +langPackStringPluralized#6c47ac9f flags:# key:string zero_value:flags.0?string one_value:flags.1?string two_value:flags.2?string few_value:flags.3?string many_value:flags.4?string other_value:string = LangPackString; +langPackStringDeleted#2979eeb2 key:string = LangPackString; +langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector<LangPackString> = LangPackDifference; +langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage; +channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionEditMessage#709b2405 prev_message:Message new_message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionDeleteMessage#42e047bb message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoin#183040d3 = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantLeave#f89777f2 = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantInvite#e31c34d8 participant:ChannelParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; +channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction; +channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeLinkedChat#50c7ac8 prev_value:long new_value:long = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction; +channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoinByInvite#fe9fc158 flags:# via_chatlist:flags.0?true invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleForum#2cc6383 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleSignatureProfiles#60a79c79 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; +channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; +channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; +popularContact#5ce14175 client_id:long importers:int = PopularContact; +messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; +messages.favedStickers#2cb51097 hash:long packs:Vector<StickerPack> stickers:Vector<Document> = messages.FavedStickers; +recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; +recentMeUrlUser#b92c09e2 url:string user_id:long = RecentMeUrl; +recentMeUrlChat#b2da71d2 url:string chat_id:long = RecentMeUrl; +recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; +recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; +help.recentMeUrls#e0310d7 urls:Vector<RecentMeUrl> chats:Vector<Chat> users:Vector<User> = help.RecentMeUrls; +inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector<MessageEntity> = InputSingleMedia; +webAuthorization#a6f8f452 hash:long bot_id:long domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; +account.webAuthorizations#ed56c9fc authorizations:Vector<WebAuthorization> users:Vector<User> = account.WebAuthorizations; +inputMessageID#a676a322 id:int = InputMessage; +inputMessageReplyTo#bad88395 id:int = InputMessage; +inputMessagePinned#86872538 = InputMessage; +inputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage; +inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; +inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer; +dialogPeer#e56dbf05 peer:Peer = DialogPeer; +dialogPeerFolder#514519e2 folder_id:int = DialogPeer; +messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; +messages.foundStickerSets#8af09dd2 hash:long sets:Vector<StickerSetCovered> = messages.FoundStickerSets; +fileHash#f39b035c offset:long limit:int hash:bytes = FileHash; +inputClientProxy#75588b3f address:string port:int = InputClientProxy; +help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; +help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; +inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; +inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; +secureFileEmpty#64199744 = SecureFile; +secureFile#7d09c27e id:long access_hash:long size:long dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; +secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; +securePlainPhone#7d6099dd phone:string = SecurePlainData; +securePlainEmail#21ec5a5f email:string = SecurePlainData; +secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; +secureValueTypePassport#3dac6a00 = SecureValueType; +secureValueTypeDriverLicense#6e425c4 = SecureValueType; +secureValueTypeIdentityCard#a0d0744b = SecureValueType; +secureValueTypeInternalPassport#99a48f23 = SecureValueType; +secureValueTypeAddress#cbe31e26 = SecureValueType; +secureValueTypeUtilityBill#fc36954e = SecureValueType; +secureValueTypeBankStatement#89137c0d = SecureValueType; +secureValueTypeRentalAgreement#8b883488 = SecureValueType; +secureValueTypePassportRegistration#99e3806a = SecureValueType; +secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; +secureValueTypePhone#b320aadb = SecureValueType; +secureValueTypeEmail#8e3ca7ee = SecureValueType; +secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; +inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector<InputSecureFile> files:flags.4?Vector<InputSecureFile> plain_data:flags.5?SecurePlainData = InputSecureValue; +secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; +secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; +secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError; +secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; +secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError; +secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; +account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm; +account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; +help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; +help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo; +savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; +account.takeout#4dba4501 id:long = account.Takeout; +passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; +passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; +securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; +securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; +securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; +secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; +inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; +inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; +secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; +secureRequiredTypeOneOf#27477b4 types:Vector<SecureRequiredType> = SecureRequiredType; +help.passportConfigNotModified#bfb9f457 = help.PassportConfig; +help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; +inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent; +jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue; +jsonNull#3f6d7b68 = JSONValue; +jsonBool#c7345e6a value:Bool = JSONValue; +jsonNumber#2be0dfa4 value:double = JSONValue; +jsonString#b71e767a value:string = JSONValue; +jsonArray#f7444763 value:Vector<JSONValue> = JSONValue; +jsonObject#99c1d49d value:Vector<JSONObjectValue> = JSONValue; +pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; +pageTableRow#e0c0c5e5 cells:Vector<PageTableCell> = PageTableRow; +pageCaption#6f747657 text:RichText credit:RichText = PageCaption; +pageListItemText#b92fb6cd text:RichText = PageListItem; +pageListItemBlocks#25e073fc blocks:Vector<PageBlock> = PageListItem; +pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; +pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector<PageBlock> = PageListOrderedItem; +pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle; +page#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector<PageBlock> photos:Vector<Photo> documents:Vector<Document> views:flags.3?int = Page; +help.supportName#8c05f1c9 name:string = help.SupportName; +help.userInfoEmpty#f3ae2eed = help.UserInfo; +help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:string date:int = help.UserInfo; +pollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer; +poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll; +pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters; +pollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<Peer> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults; +chatOnlines#f041e250 onlines:int = ChatOnlines; +statsURL#47a971e0 url:string = StatsURL; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true = ChatAdminRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; +inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; +inputWallPaperSlug#72091c80 slug:string = InputWallPaper; +inputWallPaperNoFile#967a462e id:long = InputWallPaper; +account.wallPapersNotModified#1c199183 = account.WallPapers; +account.wallPapers#cdc3858c hash:long wallpapers:Vector<WallPaper> = account.WallPapers; +codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true unknown_number:flags.9?true logout_tokens:flags.6?Vector<bytes> token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; +wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; +autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; +account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings; +emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword; +emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword; +emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference; +emojiURL#a575739d url:string = EmojiURL; +emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage; +folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder; +inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer; +folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; +messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; +urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; +urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; +urlAuthResultDefault#a9d6db1f = UrlAuthResult; +channelLocationEmpty#bfb5ad8b = ChannelLocation; +channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation; +peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated; +peerSelfLocated#f8ec284b expires:int = PeerLocated; +restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason; +inputTheme#3c5693e9 id:long access_hash:long = InputTheme; +inputThemeSlug#f5890df1 slug:string = InputTheme; +theme#a00e67d6 flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?Vector<ThemeSettings> emoticon:flags.6?string installs_count:flags.4?int = Theme; +account.themesNotModified#f41eb622 = account.Themes; +account.themes#9a3d8c6d hash:long themes:Vector<Theme> = account.Themes; +auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken; +auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken; +auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken; +account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings; +messages.inactiveChats#a927fec5 dates:Vector<int> chats:Vector<Chat> users:Vector<User> = messages.InactiveChats; +baseThemeClassic#c3a12462 = BaseTheme; +baseThemeDay#fbd81688 = BaseTheme; +baseThemeNight#b7b31ea8 = BaseTheme; +baseThemeTinted#6d5f77ee = BaseTheme; +baseThemeArctic#5b11125a = BaseTheme; +inputThemeSettings#8fde504f flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; +themeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector<int> wallpaper:flags.1?WallPaper = ThemeSettings; +webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute; +webPageAttributeStory#2e94c3e7 flags:# peer:Peer id:int story:flags.0?StoryItem = WebPageAttribute; +webPageAttributeStickerSet#50cc03d3 flags:# emojis:flags.0?true text_color:flags.1?true stickers:Vector<Document> = WebPageAttribute; +webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute; +messages.votesList#4899484e flags:# count:int votes:Vector<MessagePeerVote> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.VotesList; +bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; +payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData; +dialogFilter#aa472651 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter; +dialogFilterDefault#363293ae = DialogFilter; +dialogFilterChatlist#96537bd7 flags:# has_my_invites:flags.26?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter; +dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; +statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays; +statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev; +statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue; +statsGraphAsync#4a27eb2d token:string = StatsGraph; +statsGraphError#bedc9822 error:string = StatsGraph; +statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; +stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector<PostInteractionCounters> = stats.BroadcastStats; +help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; +help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData; +videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize; +videoSizeEmojiMarkup#f85c413c emoji_id:long background_colors:Vector<int> = VideoSize; +videoSizeStickerMarkup#da082fe stickerset:InputStickerSet sticker_id:long background_colors:Vector<int> = VideoSize; +statsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster; +statsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin; +statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter; +stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats; +globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings; +help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode; +help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector<help.CountryCode> = help.Country; +help.countriesListNotModified#93cc1f32 = help.CountriesList; +help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList; +messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews; +messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> users:Vector<User> = messages.MessageViews; +messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage; +messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int = MessageReplyHeader; +messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; +messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; +peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; +stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; +groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; +groupCall#cdf8d3e3 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int conference_from_call:flags.14?long = GroupCall; +inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall; +groupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant; +phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall; +phone.groupParticipants#f47751b6 count:int participants:Vector<GroupCallParticipant> next_offset:string chats:Vector<Chat> users:Vector<User> version:int = phone.GroupParticipants; +inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType; +inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType; +inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType; +inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType; +inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType; +inlineQueryPeerTypeBotPM#e3b2d0c = InlineQueryPeerType; +messages.historyImport#1662af0b id:long = messages.HistoryImport; +messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed; +messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages; +chatInviteImporter#8c5adfd9 flags:# requested:flags.0?true via_chatlist:flags.3?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter; +messages.exportedChatInvites#bdc62dcc count:int invites:Vector<ExportedChatInvite> users:Vector<User> = messages.ExportedChatInvites; +messages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite; +messages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector<User> = messages.ExportedChatInvite; +messages.chatInviteImporters#81b6b00a count:int importers:Vector<ChatInviteImporter> users:Vector<User> = messages.ChatInviteImporters; +chatAdminWithInvites#f2ecef23 admin_id:long invites_count:int revoked_invites_count:int = ChatAdminWithInvites; +messages.chatAdminsWithInvites#b69b72d7 admins:Vector<ChatAdminWithInvites> users:Vector<User> = messages.ChatAdminsWithInvites; +messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer; +phone.joinAsPeers#afe5623f peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = phone.JoinAsPeers; +phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite; +groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup; +groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo; +stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName; +botCommandScopeDefault#2f6cb2ab = BotCommandScope; +botCommandScopeUsers#3c4f04d8 = BotCommandScope; +botCommandScopeChats#6fe1a881 = BotCommandScope; +botCommandScopeChatAdmins#b9aa606a = BotCommandScope; +botCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope; +botCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope; +botCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope; +account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult; +account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult; +account.resetPasswordOk#e926d63e = account.ResetPasswordResult; +sponsoredMessage#4d93a990 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector<MessageEntity> photo:flags.6?Photo media:flags.14?MessageMedia color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; +messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages; +messages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages; +searchResultsCalendarPeriod#c9b0539f date:int min_msg_id:int max_msg_id:int count:int = SearchResultsCalendarPeriod; +messages.searchResultsCalendar#147ee23c flags:# inexact:flags.0?true count:int min_date:int min_msg_id:int offset_id_offset:flags.1?int periods:Vector<SearchResultsCalendarPeriod> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SearchResultsCalendar; +searchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosition; +messages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResultsPosition> = messages.SearchResultsPositions; +channels.sendAsPeers#f496b0c6 peers:Vector<SendAsPeer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers; +users.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull; +messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Vector<User> = messages.PeerSettings; +auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut; +reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount; +messageReactions#a339f0b flags:# min:flags.0?true can_see_list:flags.2?true reactions_as_tags:flags.3?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> top_reactors:flags.4?Vector<MessageReactor> = MessageReactions; +messages.messageReactionsList#31bd492d flags:# count:int reactions:Vector<MessagePeerReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.MessageReactionsList; +availableReaction#c077ec01 flags:# inactive:flags.0?true premium:flags.2?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction; +messages.availableReactionsNotModified#9f071957 = messages.AvailableReactions; +messages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction> = messages.AvailableReactions; +messagePeerReaction#8c79b63c flags:# big:flags.0?true unread:flags.1?true my:flags.2?true peer_id:Peer date:int reaction:Reaction = MessagePeerReaction; +groupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel; +phone.groupCallStreamChannels#d0e482b2 channels:Vector<GroupCallStreamChannel> = phone.GroupCallStreamChannels; +phone.groupCallStreamRtmpUrl#2dbf3432 url:string key:string = phone.GroupCallStreamRtmpUrl; +attachMenuBotIconColor#4576f3f0 name:string color:int = AttachMenuBotIconColor; +attachMenuBotIcon#b2a7386b flags:# name:string icon:Document colors:flags.0?Vector<AttachMenuBotIconColor> = AttachMenuBotIcon; +attachMenuBot#d90d8dfe flags:# inactive:flags.0?true has_settings:flags.1?true request_write_access:flags.2?true show_in_attach_menu:flags.3?true show_in_side_menu:flags.4?true side_menu_disclaimer_needed:flags.5?true bot_id:long short_name:string peer_types:flags.3?Vector<AttachMenuPeerType> icons:Vector<AttachMenuBotIcon> = AttachMenuBot; +attachMenuBotsNotModified#f1d88a5c = AttachMenuBots; +attachMenuBots#3c4301c0 hash:long bots:Vector<AttachMenuBot> users:Vector<User> = AttachMenuBots; +attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector<User> = AttachMenuBotsBot; +webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true fullscreen:flags.2?true query_id:flags.0?long url:string = WebViewResult; +webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; +botMenuButtonDefault#7533a588 = BotMenuButton; +botMenuButtonCommands#4258c205 = BotMenuButton; +botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; +account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; +account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones; +notificationSoundDefault#97e8bebe = NotificationSound; +notificationSoundNone#6f0c34df = NotificationSound; +notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; +notificationSoundRingtone#ff6c8049 id:long = NotificationSound; +account.savedRingtone#b7263f6d = account.SavedRingtone; +account.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone; +attachMenuPeerTypeSameBotPM#7d6be90e = AttachMenuPeerType; +attachMenuPeerTypeBotPM#c32bfa1a = AttachMenuPeerType; +attachMenuPeerTypePM#f146d31f = AttachMenuPeerType; +attachMenuPeerTypeChat#509113f = AttachMenuPeerType; +attachMenuPeerTypeBroadcast#7bfbdefc = AttachMenuPeerType; +inputInvoiceMessage#c5b56859 peer:InputPeer msg_id:int = InputInvoice; +inputInvoiceSlug#c326caef slug:string = InputInvoice; +inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice; +inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice; +inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice; +inputInvoiceStarGift#e8625e92 flags:# hide_name:flags.0?true include_upgrade:flags.2?true peer:InputPeer gift_id:long message:flags.1?TextWithEntities = InputInvoice; +inputInvoiceStarGiftUpgrade#4d818d5d flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = InputInvoice; +inputInvoiceStarGiftTransfer#4a5f5bd9 stargift:InputSavedStarGift to_id:InputPeer = InputInvoice; +payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; +messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; +help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo; +inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgrade:flags.1?true = InputStorePaymentPurpose; +inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector<InputUser> boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose; +inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose; +premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; +paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod; +emojiStatusEmpty#2de11aae = EmojiStatus; +emojiStatus#e7ff068a flags:# document_id:long until:flags.0?int = EmojiStatus; +emojiStatusCollectible#7184603b flags:# collectible_id:long document_id:long title:string slug:string pattern_document_id:long center_color:int edge_color:int pattern_color:int text_color:int until:flags.0?int = EmojiStatus; +inputEmojiStatusCollectible#7141dbf flags:# collectible_id:long until:flags.0?int = EmojiStatus; +account.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses; +account.emojiStatuses#90c467d1 hash:long statuses:Vector<EmojiStatus> = account.EmojiStatuses; +reactionEmpty#79f5d419 = Reaction; +reactionEmoji#1b2286b8 emoticon:string = Reaction; +reactionCustomEmoji#8935fc73 document_id:long = Reaction; +reactionPaid#523da4eb = Reaction; +chatReactionsNone#eafc32bc = ChatReactions; +chatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions; +chatReactionsSome#661d4037 reactions:Vector<Reaction> = ChatReactions; +messages.reactionsNotModified#b06fdbdf = messages.Reactions; +messages.reactions#eafdf716 hash:long reactions:Vector<Reaction> = messages.Reactions; +emailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose; +emailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose; +emailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose; +emailVerificationCode#922e55a9 code:string = EmailVerification; +emailVerificationGoogle#db909ec2 token:string = EmailVerification; +emailVerificationApple#96d074fd token:string = EmailVerification; +account.emailVerified#2b96cd1b email:string = account.EmailVerified; +account.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified; +premiumSubscriptionOption#5f2d1df2 flags:# current:flags.1?true can_purchase_upgrade:flags.2?true transaction:flags.3?string months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption; +sendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer; +messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia; +messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia; +stickerKeyword#fcfeb29c document_id:long keyword:Vector<string> = StickerKeyword; +username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username; +forumTopicDeleted#23f109b id:int = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; +messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics; +defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; +exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; +requestPeerTypeUser#5f3b8a00 flags:# bot:flags.0?Bool premium:flags.1?Bool = RequestPeerType; +requestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.5?true has_username:flags.3?Bool forum:flags.4?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; +requestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; +emojiListNotModified#481eadfa = EmojiList; +emojiList#7a1e11d1 hash:long document_id:Vector<long> = EmojiList; +emojiGroup#7a9abda9 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup; +emojiGroupGreeting#80d26cc7 title:string icon_emoji_id:long emoticons:Vector<string> = EmojiGroup; +emojiGroupPremium#93bcf34 title:string icon_emoji_id:long = EmojiGroup; +messages.emojiGroupsNotModified#6fb4ad87 = messages.EmojiGroups; +messages.emojiGroups#881fb94b hash:int groups:Vector<EmojiGroup> = messages.EmojiGroups; +textWithEntities#751f3146 text:string entities:Vector<MessageEntity> = TextWithEntities; +messages.translateResult#33db32f8 result:Vector<TextWithEntities> = messages.TranslatedText; +autoSaveSettings#c84834ce flags:# photos:flags.0?true videos:flags.1?true video_max_size:flags.2?long = AutoSaveSettings; +autoSaveException#81602d47 peer:Peer settings:AutoSaveSettings = AutoSaveException; +account.autoSaveSettings#4c3e069d users_settings:AutoSaveSettings chats_settings:AutoSaveSettings broadcasts_settings:AutoSaveSettings exceptions:Vector<AutoSaveException> chats:Vector<Chat> users:Vector<User> = account.AutoSaveSettings; +help.appConfigNotModified#7cde641d = help.AppConfig; +help.appConfig#dd18782e hash:int config:JSONValue = help.AppConfig; +inputBotAppID#a920bd7a id:long access_hash:long = InputBotApp; +inputBotAppShortName#908c0407 bot_id:InputUser short_name:string = InputBotApp; +botAppNotModified#5da674b7 = BotApp; +botApp#95fcd1d6 flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document hash:long = BotApp; +messages.botApp#eb50adf5 flags:# inactive:flags.0?true request_write_access:flags.1?true has_settings:flags.2?true app:BotApp = messages.BotApp; +inlineBotWebView#b57295d5 text:string url:string = InlineBotWebView; +readParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate; +inputChatlistDialogFilter#f3e0da33 filter_id:int = InputChatlist; +exportedChatlistInvite#c5181ac flags:# title:string url:string peers:Vector<Peer> = ExportedChatlistInvite; +chatlists.exportedChatlistInvite#10e6e3a6 filter:DialogFilter invite:ExportedChatlistInvite = chatlists.ExportedChatlistInvite; +chatlists.exportedInvites#10ab6dc7 invites:Vector<ExportedChatlistInvite> chats:Vector<Chat> users:Vector<User> = chatlists.ExportedInvites; +chatlists.chatlistInviteAlready#fa87f659 filter_id:int missing_peers:Vector<Peer> already_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite; +chatlists.chatlistInvite#f10ece2f flags:# title_noanimate:flags.1?true title:TextWithEntities emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite; +chatlists.chatlistUpdates#93bd878d missing_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistUpdates; +bots.botInfo#e8a775b0 name:string about:string description:string = bots.BotInfo; +messagePeerVote#b6cc2d5c peer:Peer option:bytes date:int = MessagePeerVote; +messagePeerVoteInputOption#74cda504 peer:Peer date:int = MessagePeerVote; +messagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector<bytes> date:int = MessagePeerVote; +storyViews#8d595cd6 flags:# has_viewers:flags.1?true views_count:int forwards_count:flags.2?int reactions:flags.3?Vector<ReactionCount> reactions_count:flags.4?int recent_viewers:flags.0?Vector<long> = StoryViews; +storyItemDeleted#51e6ee4f id:int = StoryItem; +storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; +storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia media_areas:flags.14?Vector<MediaArea> privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; +stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; +stories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string peer_stories:Vector<PeerStories> chats:Vector<Chat> users:Vector<User> stealth_mode:StoriesStealthMode = stories.AllStories; +stories.stories#63c3dd0a flags:# count:int stories:Vector<StoryItem> pinned_to_top:flags.0?Vector<int> chats:Vector<Chat> users:Vector<User> = stories.Stories; +storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; +storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; +storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; +stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector<StoryView> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryViewsList; +stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews; +inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int = InputReplyTo; +inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; +exportedStoryLink#3fc9053b link:string = ExportedStoryLink; +storiesStealthMode#712e27fd flags:# active_until_date:flags.0?int cooldown_until_date:flags.1?int = StoriesStealthMode; +mediaAreaCoordinates#cfc9e002 flags:# x:double y:double w:double h:double rotation:double radius:flags.0?double = MediaAreaCoordinates; +mediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MediaArea; +inputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea; +mediaAreaGeoPoint#cad5452d flags:# coordinates:MediaAreaCoordinates geo:GeoPoint address:flags.0?GeoPointAddress = MediaArea; +mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; +mediaAreaUrl#37381085 coordinates:MediaAreaCoordinates url:string = MediaArea; +mediaAreaWeather#49a6549c coordinates:MediaAreaCoordinates emoji:string temperature_c:double color:int = MediaArea; +mediaAreaStarGift#5787686d coordinates:MediaAreaCoordinates slug:string = MediaArea; +peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector<StoryItem> = PeerStories; +stories.peerStories#cae68768 stories:PeerStories chats:Vector<Chat> users:Vector<User> = stories.PeerStories; +messages.webPage#fd5e12bd webpage:WebPage chats:Vector<Chat> users:Vector<User> = messages.WebPage; +premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector<Chat> users:Vector<User> = payments.CheckedGiftCode; +payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; +payments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo; +prepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway; +prepaidStarsGiveaway#9a9d77e0 id:long stars:long quantity:int boosts:int date:int = PrepaidGiveaway; +boost#4b3e14d6 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int stars:flags.6?long = Boost; +premium.boostsList#86f8613c flags:# count:int boosts:Vector<Boost> next_offset:flags.0?string users:Vector<User> = premium.BoostsList; +myBoost#c448415c flags:# slot:int peer:flags.0?Peer date:int expires:int cooldown_until_date:flags.1?int = MyBoost; +premium.myBoosts#9ae228e2 my_boosts:Vector<MyBoost> chats:Vector<Chat> users:Vector<User> = premium.MyBoosts; +premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector<PrepaidGiveaway> my_boost_slots:flags.2?Vector<int> = premium.BoostsStatus; +storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; +postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; +postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; +stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; +publicForwardMessage#1f2bf4a message:Message = PublicForward; +publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; +stats.publicForwards#93037e20 flags:# count:int forwards:Vector<PublicForward> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stats.PublicForwards; +peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; +help.peerColorSet#26219a58 colors:Vector<int> = help.PeerColorSet; +help.peerColorProfileSet#767d61eb palette_colors:Vector<int> bg_colors:Vector<int> story_colors:Vector<int> = help.PeerColorSet; +help.peerColorOption#adec6ebe flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int group_min_level:flags.4?int = help.PeerColorOption; +help.peerColorsNotModified#2ba1f5ce = help.PeerColors; +help.peerColors#f8ed08 hash:int colors:Vector<help.PeerColorOption> = help.PeerColors; +storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; +storyReactionPublicForward#bbab2643 message:Message = StoryReaction; +storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; +stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector<StoryReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = stories.StoryReactionsList; +savedDialog#bd87cb6c flags:# pinned:flags.2?true peer:Peer top_message:int = SavedDialog; +messages.savedDialogs#f83ae221 dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs; +messages.savedDialogsSlice#44ba9dd9 count:int dialogs:Vector<SavedDialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.SavedDialogs; +messages.savedDialogsNotModified#c01f6fe8 count:int = messages.SavedDialogs; +savedReactionTag#cb6ff828 flags:# reaction:Reaction title:flags.0?string count:int = SavedReactionTag; +messages.savedReactionTagsNotModified#889b59ef = messages.SavedReactionTags; +messages.savedReactionTags#3259950a tags:Vector<SavedReactionTag> hash:long = messages.SavedReactionTags; +outboxReadDate#3bb842ac date:int = OutboxReadDate; +smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; +smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; +smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; +businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; +businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector<BusinessWeeklyOpen> = BusinessWorkHours; +businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; +inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> = InputBusinessRecipients; +businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> = BusinessRecipients; +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; +businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; +businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; +inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; +businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; +inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; +businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; +timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; +help.timezonesListNotModified#970708cc = help.TimezonesList; +help.timezonesList#7b74ed71 timezones:Vector<Timezone> hash:int = help.TimezonesList; +quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; +inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; +inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; +messages.quickReplies#c68d6695 quick_replies:Vector<QuickReply> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.QuickReplies; +messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; +connectedBot#bd068601 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessBotRecipients = ConnectedBot; +account.connectedBots#17d7f87b connected_bots:Vector<ConnectedBot> users:Vector<User> = account.ConnectedBots; +messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector<DialogFilter> = messages.DialogFilters; +birthday#6c8e1e06 flags:# day:int month:int year:flags.0?int = Birthday; +botBusinessConnection#896433b4 flags:# can_reply:flags.0?true disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int = BotBusinessConnection; +inputBusinessIntro#9c469cd flags:# title:string description:string sticker:flags.0?InputDocument = InputBusinessIntro; +businessIntro#5a0a066d flags:# title:string description:string sticker:flags.0?Document = BusinessIntro; +messages.myStickers#faff629d count:int sets:Vector<StickerSetCovered> = messages.MyStickers; +inputCollectibleUsername#e39460a9 username:string = InputCollectible; +inputCollectiblePhone#a2e214a4 phone:string = InputCollectible; +fragment.collectibleInfo#6ebdff91 purchase_date:int currency:string amount:long crypto_currency:string crypto_amount:long url:string = fragment.CollectibleInfo; +inputBusinessBotRecipients#c4e5921e flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<InputUser> exclude_users:flags.6?Vector<InputUser> = InputBusinessBotRecipients; +businessBotRecipients#b88cf373 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector<long> exclude_users:flags.6?Vector<long> = BusinessBotRecipients; +contactBirthday#1d998733 contact_id:long birthday:Birthday = ContactBirthday; +contacts.contactBirthdays#114ff30d contacts:Vector<ContactBirthday> users:Vector<User> = contacts.ContactBirthdays; +missingInvitee#628c9224 flags:# premium_would_allow_invite:flags.0?true premium_required_for_pm:flags.1?true user_id:long = MissingInvitee; +messages.invitedUsers#7f5defa6 updates:Updates missing_invitees:Vector<MissingInvitee> = messages.InvitedUsers; +inputBusinessChatLink#11679fa7 flags:# message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string = InputBusinessChatLink; +businessChatLink#b4ae666f flags:# link:string message:string entities:flags.0?Vector<MessageEntity> title:flags.1?string views:int = BusinessChatLink; +account.businessChatLinks#ec43a2d1 links:Vector<BusinessChatLink> chats:Vector<Chat> users:Vector<User> = account.BusinessChatLinks; +account.resolvedBusinessChatLinks#9a23af21 flags:# peer:Peer message:string entities:flags.0?Vector<MessageEntity> chats:Vector<Chat> users:Vector<User> = account.ResolvedBusinessChatLinks; +requestedPeerUser#d62ff46a flags:# user_id:long first_name:flags.0?string last_name:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; +requestedPeerChat#7307544f flags:# chat_id:long title:flags.0?string photo:flags.2?Photo = RequestedPeer; +requestedPeerChannel#8ba403e4 flags:# channel_id:long title:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; +sponsoredMessageReportOption#430d3150 text:string option:bytes = SponsoredMessageReportOption; +channels.sponsoredMessageReportResultChooseOption#846f9e42 title:string options:Vector<SponsoredMessageReportOption> = channels.SponsoredMessageReportResult; +channels.sponsoredMessageReportResultAdsHidden#3e3bcf2f = channels.SponsoredMessageReportResult; +channels.sponsoredMessageReportResultReported#ad798849 = channels.SponsoredMessageReportResult; +stats.broadcastRevenueStats#5407e297 top_hours_graph:StatsGraph revenue_graph:StatsGraph balances:BroadcastRevenueBalances usd_rate:double = stats.BroadcastRevenueStats; +stats.broadcastRevenueWithdrawalUrl#ec659737 url:string = stats.BroadcastRevenueWithdrawalUrl; +broadcastRevenueTransactionProceeds#557e2cc4 amount:long from_date:int to_date:int = BroadcastRevenueTransaction; +broadcastRevenueTransactionWithdrawal#5a590978 flags:# pending:flags.0?true failed:flags.2?true amount:long date:int provider:string transaction_date:flags.1?int transaction_url:flags.1?string = BroadcastRevenueTransaction; +broadcastRevenueTransactionRefund#42d30d2e amount:long date:int provider:string = BroadcastRevenueTransaction; +stats.broadcastRevenueTransactions#87158466 count:int transactions:Vector<BroadcastRevenueTransaction> = stats.BroadcastRevenueTransactions; +reactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom; +reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom; +reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings; +broadcastRevenueBalances#c3ff71e7 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances; +availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect; +messages.availableEffectsNotModified#d1ed9a5b = messages.AvailableEffects; +messages.availableEffects#bddb616e hash:int effects:Vector<AvailableEffect> documents:Vector<Document> = messages.AvailableEffects; +factCheck#b89bfccf flags:# need_check:flags.0?true country:flags.1?string text:flags.1?TextWithEntities hash:long = FactCheck; +starsTransactionPeerUnsupported#95f2bfe4 = StarsTransactionPeer; +starsTransactionPeerAppStore#b457b375 = StarsTransactionPeer; +starsTransactionPeerPlayMarket#7b560a0b = StarsTransactionPeer; +starsTransactionPeerPremiumBot#250dbaf8 = StarsTransactionPeer; +starsTransactionPeerFragment#e92fd902 = StarsTransactionPeer; +starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; +starsTransactionPeerAds#60682812 = StarsTransactionPeer; +starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; +starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; +starsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true id:string stars:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = StarsTransaction; +payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector<StarsSubscription> subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector<StarsTransaction> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.StarsStatus; +foundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory; +stories.foundStories#e2de7737 flags:# count:int stories:Vector<FoundStory> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = stories.FoundStories; +geoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress; +starsRevenueStatus#febe5491 flags:# withdrawal_enabled:flags.0?true current_balance:StarsAmount available_balance:StarsAmount overall_revenue:StarsAmount next_withdrawal_at:flags.1?int = StarsRevenueStatus; +payments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats; +payments.starsRevenueWithdrawalUrl#1dab80b7 url:string = payments.StarsRevenueWithdrawalUrl; +payments.starsRevenueAdsAccountUrl#394e7f21 url:string = payments.StarsRevenueAdsAccountUrl; +inputStarsTransaction#206ae6d1 flags:# refund:flags.0?true id:string = InputStarsTransaction; +starsGiftOption#5e0589f1 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsGiftOption; +bots.popularAppBots#1991b13b flags:# next_offset:flags.0?string users:Vector<User> = bots.PopularAppBots; +botPreviewMedia#23e91ba3 date:int media:MessageMedia = BotPreviewMedia; +bots.previewInfo#ca71d64 media:Vector<BotPreviewMedia> lang_codes:Vector<string> = bots.PreviewInfo; +starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; +starsSubscription#2e6eab1a flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true bot_canceled:flags.7?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string title:flags.4?string photo:flags.5?WebDocument invoice_slug:flags.6?string = StarsSubscription; +messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; +starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector<StarsGiveawayWinnersOption> = StarsGiveawayOption; +starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; +starGift#2cc73c8 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long = StarGift; +starGiftUnique#f2fe7e4a flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift; +payments.starGiftsNotModified#a388a368 = payments.StarGifts; +payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts; +messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption; +reportResultChooseOption#f0e4e0b6 title:string options:Vector<MessageReportOption> = ReportResult; +reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = ReportResult; +reportResultReported#8db33c4b = ReportResult; +messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; +messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector<InlineQueryPeerType> cache_time:int users:Vector<User> = messages.PreparedInlineMessage; +botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; +starRefProgram#dd0c66f2 flags:# bot_id:long commission_permille:int duration_months:flags.0?int end_date:flags.1?int daily_revenue_per_user:flags.2?StarsAmount = StarRefProgram; +connectedBotStarRef#19a13f71 flags:# revoked:flags.1?true url:string date:int bot_id:long commission_permille:int duration_months:flags.0?int participants:long revenue:long = ConnectedBotStarRef; +payments.connectedStarRefBots#98d5ea1d count:int connected_bots:Vector<ConnectedBotStarRef> users:Vector<User> = payments.ConnectedStarRefBots; +payments.suggestedStarRefBots#b4d5d859 flags:# count:int suggested_bots:Vector<StarRefProgram> users:Vector<User> next_offset:flags.0?string = payments.SuggestedStarRefBots; +starsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount; +messages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers; +messages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector<Document> = messages.FoundStickers; +botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true icon:long company:string custom_description:flags.0?string = BotVerifierSettings; +botVerification#f93cd45c bot_id:long icon:long description:string = BotVerification; +starGiftAttributeModel#39d99013 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributePattern#13acff19 name:string document:Document rarity_permille:int = StarGiftAttribute; +starGiftAttributeBackdrop#94271762 name:string center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute; +starGiftAttributeOriginalDetails#e0bff26c flags:# sender_id:flags.0?Peer recipient_id:Peer date:int message:flags.1?TextWithEntities = StarGiftAttribute; +payments.starGiftUpgradePreview#167bd90b sample_attributes:Vector<StarGiftAttribute> = payments.StarGiftUpgradePreview; +users.users#62d706b8 users:Vector<User> = users.Users; +users.usersSlice#315a4974 count:int users:Vector<User> = users.Users; +payments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.UniqueStarGift; +messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview; +savedStarGift#6056dba5 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long = SavedStarGift; +payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector<SavedStarGift> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.SavedStarGifts; +inputSavedStarGiftUser#69279795 msg_id:int = InputSavedStarGift; +inputSavedStarGiftChat#f101aa7f peer:InputPeer saved_id:long = InputSavedStarGift; +payments.starGiftWithdrawalUrl#84aa3a9c url:string = payments.StarGiftWithdrawalUrl; +---functions--- +invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; +invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X; +initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X; +invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; +invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; +invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; +invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; +invokeWithBusinessConnection#dd289f8e {X:Type} connection_id:string query:!X = X; +invokeWithGooglePlayIntegrity#1df92984 {X:Type} nonce:string token:string query:!X = X; +invokeWithApnsSecret#0dae54f8 {X:Type} nonce:string secret:string query:!X = X; +auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode; +auth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization; +auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization; +auth.logOut#3e72ba19 = auth.LoggedOut; +auth.resetAuthorizations#9fab0d1a = Bool; +auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; +auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization; +auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; +auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; +auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; +auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; +auth.recoverPassword#37096c70 flags:# code:string new_settings:flags.0?account.PasswordInputSettings = auth.Authorization; +auth.resendCode#cae47523 flags:# phone_number:string phone_code_hash:string reason:flags.0?string = auth.SentCode; +auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; +auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool; +auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long> = auth.LoginToken; +auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken; +auth.acceptLoginToken#e894ad4d token:bytes = Authorization; +auth.checkRecoveryPassword#d36bf79 code:string = Bool; +auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; +auth.requestFirebaseSms#8e39261e flags:# phone_number:string phone_code_hash:string safety_net_token:flags.0?string play_integrity_token:flags.2?string ios_push_secret:flags.1?string = Bool; +auth.resetLoginEmail#7e960193 phone_number:string phone_code_hash:string = auth.SentCode; +auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:string = Bool; +account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool; +account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool; +account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; +account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; +account.resetNotifySettings#db7e1747 = Bool; +account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; +account.updateStatus#6628562c offline:Bool = Bool; +account.getWallPapers#7967d36 hash:long = account.WallPapers; +account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool; +account.checkUsername#2714d86c username:string = Bool; +account.updateUsername#3e0bdd7c username:string = User; +account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; +account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules; +account.deleteAccount#a2c0cf74 flags:# reason:string password:flags.0?InputCheckPasswordSRP = Bool; +account.getAccountTTL#8fc711d = AccountDaysTTL; +account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; +account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode; +account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; +account.updateDeviceLocked#38df3532 period:int = Bool; +account.getAuthorizations#e320c158 = account.Authorizations; +account.resetAuthorization#df77f3bc hash:long = Bool; +account.getPassword#548a30f5 = account.Password; +account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; +account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; +account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode; +account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; +account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; +account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; +account.resetWebAuthorization#2d01b9ef hash:long = Bool; +account.resetWebAuthorizations#682d2594 = Bool; +account.getAllSecureValues#b288bc7d = Vector<SecureValue>; +account.getSecureValue#73665bc2 types:Vector<SecureValueType> = Vector<SecureValue>; +account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; +account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool; +account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string = account.AuthorizationForm; +account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool; +account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode; +account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; +account.sendVerifyEmailCode#98e037bb purpose:EmailVerifyPurpose email:string = account.SentEmailCode; +account.verifyEmail#32da4cf purpose:EmailVerifyPurpose verification:EmailVerification = account.EmailVerified; +account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout; +account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; +account.confirmPasswordEmail#8fdf1920 code:string = Bool; +account.resendPasswordEmail#7a7f2a15 = Bool; +account.cancelPasswordEmail#c1cbd5b6 = Bool; +account.getContactSignUpNotification#9f07c728 = Bool; +account.setContactSignUpNotification#cff43f61 silent:Bool = Bool; +account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true compare_stories:flags.2?true peer:flags.0?InputNotifyPeer = Updates; +account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper; +account.uploadWallPaper#e39a8f03 flags:# for_chat:flags.0?true file:InputFile mime_type:string settings:WallPaperSettings = WallPaper; +account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool; +account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; +account.resetWallPapers#bb3b9804 = Bool; +account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings; +account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool; +account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document; +account.createTheme#652e4400 flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?Vector<InputThemeSettings> = Theme; +account.updateTheme#2bf40ccc flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?Vector<InputThemeSettings> = Theme; +account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; +account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; +account.getTheme#3a5869ec format:string theme:InputTheme = Theme; +account.getThemes#7206e458 format:string hash:long = account.Themes; +account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool; +account.getContentSettings#8b9b4dae = account.ContentSettings; +account.getMultiWallPapers#65ad71dc wallpapers:Vector<InputWallPaper> = Vector<WallPaper>; +account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings; +account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings; +account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool; +account.resetPassword#9308ce1b = account.ResetPasswordResult; +account.declinePasswordReset#4c9409f6 = Bool; +account.getChatThemes#d638de89 hash:long = account.Themes; +account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool; +account.changeAuthorizationSettings#40f48462 flags:# confirmed:flags.3?true hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool; +account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones; +account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone; +account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document; +account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool; +account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses; +account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses; +account.clearRecentEmojiStatuses#18201aae = Bool; +account.reorderUsernames#ef500eab order:Vector<string> = Bool; +account.toggleUsername#58d6b376 username:string active:Bool = Bool; +account.getDefaultProfilePhotoEmojis#e2750328 hash:long = EmojiList; +account.getDefaultGroupPhotoEmojis#915860ae hash:long = EmojiList; +account.getAutoSaveSettings#adcbbcda = account.AutoSaveSettings; +account.saveAutoSaveSettings#d69b8361 flags:# users:flags.0?true chats:flags.1?true broadcasts:flags.2?true peer:flags.3?InputPeer settings:AutoSaveSettings = Bool; +account.deleteAutoSaveExceptions#53bc0020 = Bool; +account.invalidateSignInCodes#ca8ae8ba codes:Vector<string> = Bool; +account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; +account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; +account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; +account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; +account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; +account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; +account.updateConnectedBot#43d8521d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessBotRecipients = Updates; +account.getConnectedBots#4ea4c80f = account.ConnectedBots; +account.getBotBusinessConnection#76a86270 connection_id:string = Updates; +account.updateBusinessIntro#a614d034 flags:# intro:flags.0?InputBusinessIntro = Bool; +account.toggleConnectedBotPaused#646e1097 peer:InputPeer paused:Bool = Bool; +account.disablePeerConnectedBot#5e437ed9 peer:InputPeer = Bool; +account.updateBirthday#cc6e0c11 flags:# birthday:flags.0?Birthday = Bool; +account.createBusinessChatLink#8851e68e link:InputBusinessChatLink = BusinessChatLink; +account.editBusinessChatLink#8c3410af slug:string link:InputBusinessChatLink = BusinessChatLink; +account.deleteBusinessChatLink#60073674 slug:string = Bool; +account.getBusinessChatLinks#6f70dde1 = account.BusinessChatLinks; +account.resolveBusinessChatLink#5492e5ee slug:string = account.ResolvedBusinessChatLinks; +account.updatePersonalChannel#d94305e0 channel:InputChannel = Bool; +account.toggleSponsoredMessages#b9d9a38d enabled:Bool = Bool; +account.getReactionsNotifySettings#6dd654c = ReactionsNotifySettings; +account.setReactionsNotifySettings#316ce548 settings:ReactionsNotifySettings = ReactionsNotifySettings; +account.getCollectibleEmojiStatuses#2e7b4543 hash:long = account.EmojiStatuses; +users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; +users.getFullUser#b60f5918 id:InputUser = users.UserFull; +users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool; +users.getIsPremiumRequiredToContact#a622aa10 id:Vector<InputUser> = Vector<Bool>; +contacts.getContactIDs#7adc669d hash:long = Vector<int>; +contacts.getStatuses#c4a353ee = Vector<ContactStatus>; +contacts.getContacts#5dd69e12 hash:long = contacts.Contacts; +contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts; +contacts.deleteContacts#96a0e00 id:Vector<InputUser> = Updates; +contacts.deleteByPhones#1013fd9e phones:Vector<string> = Bool; +contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; +contacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; +contacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true offset:int limit:int = contacts.Blocked; +contacts.search#11f812d8 q:string limit:int = contacts.Found; +contacts.resolveUsername#725afbbc flags:# username:string referer:flags.0?string = contacts.ResolvedPeer; +contacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers; +contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; +contacts.resetSaved#879537f1 = Bool; +contacts.getSaved#82f1e39f = Vector<SavedContact>; +contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; +contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates; +contacts.acceptContact#f831a20f id:InputUser = Updates; +contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates; +contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates; +contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; +contacts.exportContactToken#f8654027 = ExportedContactToken; +contacts.importContactToken#13005788 token:string = User; +contacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool; +contacts.setBlocked#94c65c76 flags:# my_stories_from:flags.0?true id:Vector<InputPeer> limit:int = Bool; +contacts.getBirthdays#daeda864 = contacts.ContactBirthdays; +messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages; +messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; +messages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.search#29ee847a flags:# peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector<Reaction> top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; +messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; +messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; +messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; +messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; +messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.forwardMessages#6d74da08 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int = Updates; +messages.reportSpam#cf1592db peer:InputPeer = Bool; +messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; +messages.report#fc78af9b peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult; +messages.getChats#49e9528f id:Vector<long> = messages.Chats; +messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull; +messages.editChatTitle#73783ffd chat_id:long title:string = Updates; +messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates; +messages.addChatUser#cbc6d107 chat_id:long user_id:InputUser fwd_limit:int = messages.InvitedUsers; +messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; +messages.createChat#92ceddd4 flags:# users:Vector<InputUser> title:string ttl_period:flags.0?int = messages.InvitedUsers; +messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; +messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; +messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; +messages.discardEncryption#f393aea0 flags:# delete_history:flags.0?true chat_id:int = Bool; +messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; +messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; +messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; +messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; +messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; +messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; +messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; +messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages; +messages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers; +messages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers; +messages.getWebPagePreview#570d6f6f flags:# message:string entities:flags.3?Vector<MessageEntity> = messages.WebPagePreview; +messages.exportChatInvite#a455de90 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string subscription_pricing:flags.5?StarsSubscriptionPricing = ExportedChatInvite; +messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; +messages.importChatInvite#6c50051c hash:string = Updates; +messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet; +messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; +messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; +messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; +messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews; +messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool; +messages.migrateChat#a2875319 chat_id:long = Updates; +messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +messages.reorderStickerSets#78337739 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Bool; +messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document; +messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs; +messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; +messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; +messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; +messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; +messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; +messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; +messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool; +messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer; +messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; +messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs; +messages.saveDraft#d372c5ce flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia effect:flags.7?long = Bool; +messages.getAllDrafts#6a3f8d65 = Updates; +messages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers; +messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool; +messages.getRecentStickers#9da9403b flags:# attached:flags.0?true hash:long = messages.RecentStickers; +messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; +messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; +messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true emojis:flags.1?true offset_id:long limit:int = messages.ArchivedStickers; +messages.getMaskStickers#640f82b8 hash:long = messages.AllStickers; +messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector<StickerSetCovered>; +messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; +messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; +messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; +messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; +messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats; +messages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage; +messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; +messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector<InputDialogPeer> = Bool; +messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs; +messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool; +messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; +messages.uploadMedia#14967978 flags:# business_connection_id:flags.0?string peer:InputPeer media:InputMedia = MessageMedia; +messages.sendScreenshotNotification#a1405817 peer:InputPeer reply_to:InputReplyTo random_id:long = Updates; +messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers; +messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; +messages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; +messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; +messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; +messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; +messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; +messages.getDialogUnreadMarks#22e24e22 = Vector<DialogPeer>; +messages.clearAllDrafts#7e58ee9c = Bool; +messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates; +messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates; +messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates; +messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines; +messages.editChatAbout#def60797 peer:InputPeer about:string = Bool; +messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates; +messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference; +messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference; +messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector<string> = Vector<EmojiLanguage>; +messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; +messages.getSearchCounters#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector<MessagesFilter> = Vector<messages.SearchCounter>; +messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; +messages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages; +messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector<int> = messages.Messages; +messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector<int> = Updates; +messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector<int> = Updates; +messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList; +messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector<InputStickerSet> = Bool; +messages.getDialogFilters#efd48c89 = messages.DialogFilters; +messages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>; +messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool; +messages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool; +messages.getOldFeaturedStickers#7ed094a1 offset:int limit:int hash:long = messages.FeaturedStickers; +messages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage; +messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool; +messages.unpinAllMessages#ee22b9a8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.deleteChat#5bd0ee50 chat_id:long = Bool; +messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages; +messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed; +messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport; +messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia; +messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool; +messages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites; +messages.getExportedChatInvite#73746f5c peer:InputPeer link:string = messages.ExportedChatInvite; +messages.editExportedChatInvite#bdca2f75 flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int request_needed:flags.3?Bool title:flags.4?string = messages.ExportedChatInvite; +messages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool; +messages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool; +messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithInvites; +messages.getChatInviteImporters#df04dd4e flags:# requested:flags.0?true subscription_expired:flags.3?true peer:InputPeer link:flags.1?string q:flags.2?string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters; +messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates; +messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer; +messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates; +messages.getMessageReadParticipants#31c1c44f peer:InputPeer msg_id:int = Vector<ReadParticipantDate>; +messages.getSearchResultsCalendar#6aa3f6bd flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int offset_date:int = messages.SearchResultsCalendar; +messages.getSearchResultsPositions#9c7f2f10 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int limit:int = messages.SearchResultsPositions; +messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPeer user_id:InputUser = Updates; +messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; +messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; +messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; +messages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates; +messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates; +messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList; +messages.setChatAvailableReactions#864b2581 flags:# peer:InputPeer available_reactions:ChatReactions reactions_limit:flags.0?int paid_enabled:flags.1?Bool = Updates; +messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions; +messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool; +messages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<TextWithEntities> to_lang:string = messages.TranslatedText; +messages.getUnreadReactions#3223495b flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readReactions#54aa7f8e flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = messages.Messages; +messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots; +messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; +messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; +messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; +messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; +messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; +messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; +messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio; +messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_id:long good:Bool = Bool; +messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>; +messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers; +messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers; +messages.reportReaction#3f64c076 peer:InputPeer id:int reaction_peer:InputPeer = Bool; +messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions; +messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions; +messages.clearRecentReactions#9dfeefb4 = Bool; +messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates; +messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; +messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; +messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector<InputPeer> = Updates; +messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; +messages.getEmojiStatusGroups#2ecd56cd hash:int = messages.EmojiGroups; +messages.getEmojiProfilePhotoGroups#21a548f3 hash:int = messages.EmojiGroups; +messages.searchCustomEmoji#2c11c0d7 emoticon:string hash:long = EmojiList; +messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool; +messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; +messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true fullscreen:flags.8?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; +messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; +messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; +messages.getSavedDialogs#5381d21a flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.SavedDialogs; +messages.getSavedHistory#3d9a414d peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.deleteSavedHistory#6e98102b flags:# peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; +messages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs; +messages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; +messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vector<InputDialogPeer> = Bool; +messages.getSavedReactionTags#3637e05b flags:# peer:flags.0?InputPeer hash:long = messages.SavedReactionTags; +messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool; +messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; +messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; +messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; +messages.reorderQuickReplies#60331907 order:Vector<int> = Bool; +messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; +messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; +messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; +messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector<int> hash:long = messages.Messages; +messages.sendQuickReplyMessages#6c750de1 peer:InputPeer shortcut_id:int id:Vector<int> random_id:Vector<long> = Updates; +messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector<int> = Updates; +messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; +messages.getMyStickers#d0b5e1fc offset_id:long limit:int = messages.MyStickers; +messages.getEmojiStickerGroups#1dd840f5 hash:int = messages.EmojiGroups; +messages.getAvailableEffects#dea20a39 hash:int = messages.AvailableEffects; +messages.editFactCheck#589ee75 peer:InputPeer msg_id:int text:TextWithEntities = Updates; +messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; +messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector<int> = Vector<FactCheck>; +messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; +messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bool = Bool; +messages.getPaidReactionPrivacy#472455aa = Updates; +messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool; +messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool; +messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult; +messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; +messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector<InlineQueryPeerType> = messages.BotPreparedInlineMessage; +messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; +messages.searchStickers#29b1c66a flags:# emojis:flags.0?true q:string emoticon:string lang_code:Vector<string> offset:int limit:int hash:long = messages.FoundStickers; +messages.reportMessagesDelivery#5a6d7395 flags:# push:flags.0?true peer:InputPeer id:Vector<int> = Bool; +updates.getState#edd4882a = updates.State; +updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; +updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; +photos.updateProfilePhoto#9e82039 flags:# fallback:flags.0?true bot:flags.1?InputUser id:InputPhoto = photos.Photo; +photos.uploadProfilePhoto#388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo; +photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>; +photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; +photos.uploadContactProfilePhoto#e14c4a71 flags:# suggest:flags.3?true save:flags.4?true user_id:InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.5?VideoSize = photos.Photo; +upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; +upload.getFile#be5335be flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:long limit:int = upload.File; +upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; +upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; +upload.getCdnFile#395f69da file_token:bytes offset:long limit:int = upload.CdnFile; +upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector<FileHash>; +upload.getCdnFileHashes#91dc3f31 file_token:bytes offset:long = Vector<FileHash>; +upload.getFileHashes#9156982a location:InputFileLocation offset:long = Vector<FileHash>; +help.getConfig#c4f9186b = Config; +help.getNearestDc#1fb33026 = NearestDc; +help.getAppUpdate#522d5a7d source:string = help.AppUpdate; +help.getInviteText#4d392343 = help.InviteText; +help.getSupport#9cdf08cd = help.Support; +help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; +help.getCdnConfig#52029342 = CdnConfig; +help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; +help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; +help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; +help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; +help.getAppConfig#61e3f854 hash:int = help.AppConfig; +help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; +help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; +help.getSupportName#d360e72c = help.SupportName; +help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo; +help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo; +help.getPromoData#c0977421 = help.PromoData; +help.hidePromoData#1e251c95 peer:InputPeer = Bool; +help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool; +help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; +help.getPremiumPromo#b81b93d4 = help.PremiumPromo; +help.getPeerColors#da80f42f hash:int = help.PeerColors; +help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; +help.getTimezonesList#49b30240 hash:int = help.TimezonesList; +channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; +channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; +channels.reportSpam#f44a8315 channel:InputChannel participant:InputPeer id:Vector<int> = Bool; +channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages; +channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants; +channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant; +channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; +channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; +channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; +channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; +channels.editTitle#566decd0 channel:InputChannel title:string = Updates; +channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; +channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; +channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; +channels.joinChannel#24b524c5 channel:InputChannel = Updates; +channels.leaveChannel#f836aa95 channel:InputChannel = Updates; +channels.inviteToChannel#c9e33d54 channel:InputChannel users:Vector<InputUser> = messages.InvitedUsers; +channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; +channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink; +channels.toggleSignatures#418d549c flags:# signatures_enabled:flags.0?true profiles_enabled:flags.1?true channel:InputChannel = Updates; +channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true for_personal:flags.2?true = messages.Chats; +channels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates; +channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults; +channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; +channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool; +channels.deleteHistory#9baa9647 flags:# for_everyone:flags.0?true channel:InputChannel max_id:int = Updates; +channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; +channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; +channels.getGroupsForDiscussion#f5dad378 = messages.Chats; +channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; +channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; +channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; +channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; +channels.getInactiveChannels#11e831ee = messages.InactiveChats; +channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; +channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; +channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; +channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates; +channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates; +channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector<string> = Bool; +channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool; +channels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool; +channels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates; +channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; +channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; +channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector<int> = messages.ForumTopics; +channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; +channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; +channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; +channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector<int> = Updates; +channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; +channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; +channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; +channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; +channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; +channels.getChannelRecommendations#25a71742 flags:# channel:flags.0?InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; +channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int = Updates; +channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; +channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; +channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; +bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; +bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool; +bots.resetBotCommands#3d8de0f9 scope:BotCommandScope lang_code:string = Bool; +bots.getBotCommands#e34c0dd6 scope:BotCommandScope lang_code:string = Vector<BotCommand>; +bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool; +bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton; +bots.setBotBroadcastDefaultAdminRights#788464e1 admin_rights:ChatAdminRights = Bool; +bots.setBotGroupDefaultAdminRights#925ec9ea admin_rights:ChatAdminRights = Bool; +bots.setBotInfo#10cf3123 flags:# bot:flags.2?InputUser lang_code:string name:flags.3?string about:flags.0?string description:flags.1?string = Bool; +bots.getBotInfo#dcd914fd flags:# bot:flags.0?InputUser lang_code:string = bots.BotInfo; +bots.reorderUsernames#9709b1c2 bot:InputUser order:Vector<string> = Bool; +bots.toggleUsername#53ca973 bot:InputUser username:string active:Bool = Bool; +bots.canSendMessage#1359f4e6 bot:InputUser = Bool; +bots.allowSendMessage#f132e3ef bot:InputUser = Updates; +bots.invokeWebViewCustomMethod#87fc5e7 bot:InputUser custom_method:string params:DataJSON = DataJSON; +bots.getPopularAppBots#c2510192 offset:string limit:int = bots.PopularAppBots; +bots.addPreviewMedia#17aeb75a bot:InputUser lang_code:string media:InputMedia = BotPreviewMedia; +bots.editPreviewMedia#8525606f bot:InputUser lang_code:string media:InputMedia new_media:InputMedia = BotPreviewMedia; +bots.deletePreviewMedia#2d0135b3 bot:InputUser lang_code:string media:Vector<InputMedia> = Bool; +bots.reorderPreviewMedias#b627f3aa bot:InputUser lang_code:string order:Vector<InputMedia> = Bool; +bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; +bots.getPreviewMedias#a2a5594d bot:InputUser = Vector<BotPreviewMedia>; +bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; +bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; +bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; +bots.getAdminedBots#b0711d83 = Vector<User>; +bots.updateStarRefProgram#778b5ab3 flags:# bot:InputUser commission_permille:int duration_months:flags.0?int = StarRefProgram; +bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?InputUser peer:InputPeer custom_description:flags.2?string = Bool; +bots.getBotRecommendations#a1b70815 bot:InputUser = users.Users; +payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; +payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; +payments.validateRequestedInfo#b6c8f12b flags:# save:flags.0?true invoice:InputInvoice info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; +payments.sendPaymentForm#2d03522f flags:# form_id:long invoice:InputInvoice requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult; +payments.getSavedInfo#227d824b = payments.SavedInfo; +payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; +payments.getBankCardData#2e79d779 number:string = payments.BankCardData; +payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoice; +payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates; +payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates; +payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool; +payments.getPremiumGiftCodeOptions#2757ba54 flags:# boost_peer:flags.0?InputPeer = Vector<PremiumGiftCodeOption>; +payments.checkGiftCode#8e51b4c1 slug:string = payments.CheckedGiftCode; +payments.applyGiftCode#f6e26854 slug:string = Updates; +payments.getGiveawayInfo#f4239425 peer:InputPeer msg_id:int = payments.GiveawayInfo; +payments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose:InputStorePaymentPurpose = Updates; +payments.getStarsTopupOptions#c00ec7d3 = Vector<StarsTopupOption>; +payments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus; +payments.getStarsTransactions#69da4557 flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true subscription_id:flags.3?string peer:InputPeer offset:string limit:int = payments.StarsStatus; +payments.sendStarsForm#7998c914 form_id:long invoice:InputInvoice = payments.PaymentResult; +payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; +payments.getStarsRevenueStats#d91ffad6 flags:# dark:flags.0?true peer:InputPeer = payments.StarsRevenueStats; +payments.getStarsRevenueWithdrawalUrl#13bbe8b3 peer:InputPeer stars:long password:InputCheckPasswordSRP = payments.StarsRevenueWithdrawalUrl; +payments.getStarsRevenueAdsAccountUrl#d1d7efc5 peer:InputPeer = payments.StarsRevenueAdsAccountUrl; +payments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector<InputStarsTransaction> = payments.StarsStatus; +payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector<StarsGiftOption>; +payments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer:InputPeer offset:string = payments.StarsStatus; +payments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool; +payments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool; +payments.getStarsGiveawayOptions#bd1efd3e = Vector<StarsGiveawayOption>; +payments.getStarGifts#c4563590 hash:int = payments.StarGifts; +payments.saveStarGift#2a2a697c flags:# unsave:flags.0?true stargift:InputSavedStarGift = Bool; +payments.convertStarGift#74bf076b stargift:InputSavedStarGift = Bool; +payments.botCancelStarsSubscription#6dfa0622 flags:# restore:flags.0?true user_id:InputUser charge_id:string = Bool; +payments.getConnectedStarRefBots#5869a553 flags:# peer:InputPeer offset_date:flags.2?int offset_link:flags.2?string limit:int = payments.ConnectedStarRefBots; +payments.getConnectedStarRefBot#b7d998f0 peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; +payments.getSuggestedStarRefBots#d6b48f7 flags:# order_by_revenue:flags.0?true order_by_date:flags.1?true peer:InputPeer offset:string limit:int = payments.SuggestedStarRefBots; +payments.connectStarRefBot#7ed5348a peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; +payments.editConnectedStarRefBot#e4fca4a3 flags:# revoked:flags.0?true peer:InputPeer link:string = payments.ConnectedStarRefBots; +payments.getStarGiftUpgradePreview#9c9abcb1 gift_id:long = payments.StarGiftUpgradePreview; +payments.upgradeStarGift#aed6e4f5 flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = Updates; +payments.transferStarGift#7f18176a stargift:InputSavedStarGift to_id:InputPeer = Updates; +payments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift; +payments.getSavedStarGifts#23830de9 flags:# exclude_unsaved:flags.0?true exclude_saved:flags.1?true exclude_unlimited:flags.2?true exclude_limited:flags.3?true exclude_unique:flags.4?true sort_by_value:flags.5?true peer:InputPeer offset:string limit:int = payments.SavedStarGifts; +payments.getSavedStarGift#b455a106 stargift:Vector<InputSavedStarGift> = payments.SavedStarGifts; +payments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl; +payments.toggleChatStarGiftNotifications#60eaefa1 flags:# enabled:flags.0?true peer:InputPeer = Bool; +stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet; +stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; +stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; +stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; +stickers.setStickerSetThumb#a76a5392 flags:# stickerset:InputStickerSet thumb:flags.0?InputDocument thumb_document_id:flags.1?long = messages.StickerSet; +stickers.checkShortName#284b3639 short_name:string = Bool; +stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName; +stickers.changeSticker#f5537ebc flags:# sticker:InputDocument emoji:flags.0?string mask_coords:flags.1?MaskCoords keywords:flags.2?string = messages.StickerSet; +stickers.renameStickerSet#124b1c00 stickerset:InputStickerSet title:string = messages.StickerSet; +stickers.deleteStickerSet#87704394 stickerset:InputStickerSet = Bool; +stickers.replaceSticker#4696459a sticker:InputDocument new_sticker:InputStickerSetItem = messages.StickerSet; +phone.getCallConfig#55451fa9 = DataJSON; +phone.requestCall#a6c4600c flags:# video:flags.0?true user_id:InputUser conference_call:flags.1?InputGroupCall random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; +phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; +phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; +phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; +phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; +phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates; +phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; +phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool; +phone.createGroupCall#48cdc6d8 flags:# rtmp_stream:flags.2?true peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates; +phone.joinGroupCall#d61e1df3 flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string key_fingerprint:flags.3?long params:DataJSON = Updates; +phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates; +phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates; +phone.discardGroupCall#7a777135 call:InputGroupCall = Updates; +phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates; +phone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall; +phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants; +phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector<int> = Vector<int>; +phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates; +phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates; +phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates; +phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers; +phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite; +phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates; +phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates; +phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool; +phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates; +phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates; +phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels; +phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl; +phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool; +phone.createConferenceCall#dfc909ab peer:InputPhoneCall key_fingerprint:long = phone.PhoneCall; +langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; +langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>; +langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference; +langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>; +langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; +folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates; +stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; +stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; +stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; +stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; +stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; +stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; +stats.getBroadcastRevenueStats#f788ee19 flags:# dark:flags.0?true peer:InputPeer = stats.BroadcastRevenueStats; +stats.getBroadcastRevenueWithdrawalUrl#9df4faad peer:InputPeer password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; +stats.getBroadcastRevenueTransactions#70990b6d peer:InputPeer offset:int limit:int = stats.BroadcastRevenueTransactions; +chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector<InputPeer> = chatlists.ExportedChatlistInvite; +chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; +chatlists.editExportedInvite#653db63d flags:# chatlist:InputChatlist slug:string title:flags.1?string peers:flags.2?Vector<InputPeer> = ExportedChatlistInvite; +chatlists.getExportedInvites#ce03da83 chatlist:InputChatlist = chatlists.ExportedInvites; +chatlists.checkChatlistInvite#41c10fff slug:string = chatlists.ChatlistInvite; +chatlists.joinChatlistInvite#a6b1e39a slug:string peers:Vector<InputPeer> = Updates; +chatlists.getChatlistUpdates#89419521 chatlist:InputChatlist = chatlists.ChatlistUpdates; +chatlists.joinChatlistUpdates#e089f8f5 chatlist:InputChatlist peers:Vector<InputPeer> = Updates; +chatlists.hideChatlistUpdates#66e486fb chatlist:InputChatlist = Bool; +chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>; +chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates; +stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; +stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; +stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector<MediaArea> caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates; +stories.deleteStories#ae59db5f peer:InputPeer id:Vector<int> = Vector<int>; +stories.togglePinned#9a75a1ef peer:InputPeer id:Vector<int> pinned:Bool = Vector<int>; +stories.getAllStories#eeb0d625 flags:# next:flags.1?true hidden:flags.2?true state:flags.0?string = stories.AllStories; +stories.getPinnedStories#5821a5dc peer:InputPeer offset_id:int limit:int = stories.Stories; +stories.getStoriesArchive#b4352016 peer:InputPeer offset_id:int limit:int = stories.Stories; +stories.getStoriesByID#5774ca74 peer:InputPeer id:Vector<int> = stories.Stories; +stories.toggleAllStoriesHidden#7c2557c4 hidden:Bool = Bool; +stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector<int>; +stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector<int> = Bool; +stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; +stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector<int> = stories.StoryViews; +stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; +stories.report#19d8eb45 peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult; +stories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates; +stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates; +stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories; +stories.getAllReadPeerStories#9b5ae7f9 = Updates; +stories.getPeerMaxIDs#535983c3 id:Vector<InputPeer> = Vector<int>; +stories.getChatsToSend#a56a8b60 = messages.Chats; +stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; +stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; +stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector<int> = Bool; +stories.searchPosts#d1810907 flags:# hashtag:flags.0?string area:flags.1?MediaArea peer:flags.2?InputPeer offset:string limit:int = stories.FoundStories; +premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; +premium.getMyBoosts#be77b4a = premium.MyBoosts; +premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector<int> peer:InputPeer = premium.MyBoosts; +premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; +premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; +smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; +smsjobs.join#a74ece2d = Bool; +smsjobs.leave#9898ad73 = Bool; +smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; +smsjobs.getStatus#10a698e8 = smsjobs.Status; +smsjobs.getSmsJob#778d902f job_id:string = SmsJob; +smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; +fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; +`; + } +}); + +// node_modules/telegram/tl/schemaTl.js +var require_schemaTl = __commonJS({ + "node_modules/telegram/tl/schemaTl.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var BAD = 16209; - var TYPE = 16191; - module2.exports = function inflate_fast(strm, start) { - let _in; - let last; - let _out; - let beg; - let end; - let dmax; - let wsize; - let whave; - let wnext; - let s_window; - let hold; - let bits; - let lcode; - let dcode; - let lmask; - let dmask; - let here; - let op; - let len; - let dist; - let from; - let from_source; - let input, output; - const state = strm.state; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); - dmax = state.dmax; - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op === 0) { - output[_out++] = here & 65535; - } else if (op & 16) { - len = here & 65535; - op &= 15; - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & (1 << op) - 1; - hold >>>= op; - bits -= op; - } - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op & 16) { - dist = here & 65535; - op &= 15; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & (1 << op) - 1; - if (dist > dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - hold >>>= op; - bits -= op; - op = _out - beg; - if (dist > op) { - op = dist - op; - if (op > whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - } - from = 0; - from_source = s_window; - if (wnext === 0) { - from += wsize - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } else if (wnext < op) { - from += wsize + wnext - op; - op -= wnext; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - } else { - from += wnext - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } else { - from = _out - dist; - do { - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } else if ((op & 64) === 0) { - here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dodist; - } else { - strm.msg = "invalid distance code"; - state.mode = BAD; - break top; - } - break; - } - } else if ((op & 64) === 0) { - here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dolen; - } else if (op & 32) { - state.mode = TYPE; - break top; - } else { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break top; - } - break; - } - } while (_in < last && _out < end); - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); - strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); - state.hold = hold; - state.bits = bits; - return; - }; + module2.exports = ` +resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ; +p_q_inner_data#83c95aec pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; +p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data; +p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data; +p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data; +bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner; +server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params; +server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params; +server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data; +client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data; +dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer; +dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer; +dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer; +destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes; +destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes; +destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; +---functions--- +req_pq#60469778 nonce:int128 = ResPQ; +req_pq_multi#be7e8ef1 nonce:int128 = ResPQ; +req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params; +set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer; +destroy_auth_key#d1435160 = DestroyAuthKeyRes; +---types--- +msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck; +bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification; +bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification; +msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq; +msgs_state_info#04deb57d req_msg_id:long info:string = MsgsStateInfo; +msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo; +msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo; +msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo; +msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq; +rpc_error#2144ca19 error_code:int error_message:string = RpcError; +rpc_answer_unknown#5e2ad36e = RpcDropAnswer; +rpc_answer_dropped_running#cd78e586 = RpcDropAnswer; +rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer; +future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt; +future_salts#ae500895 req_msg_id:long now:int salts:vector<future_salt> = FutureSalts; +pong#347773c5 msg_id:long ping_id:long = Pong; +destroy_session_ok#e22045fc session_id:long = DestroySessionRes; +destroy_session_none#62d350c9 session_id:long = DestroySessionRes; +new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession; +http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; +ipPort#d433ad73 ipv4:int port:int = IpPort; +ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; +accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector<IpPort> = AccessPointRule; +help.configSimple#5a592a6c date:int expires:int rules:vector<AccessPointRule> = help.ConfigSimple; +tlsClientHello blocks:vector<TlsBlock> = TlsClientHello; +tlsBlockString data:string = TlsBlock; +tlsBlockRandom length:int = TlsBlock; +tlsBlockZero length:int = TlsBlock; +tlsBlockDomain = TlsBlock; +tlsBlockGrease seed:int = TlsBlock; +tlsBlockPublicKey = TlsBlock; +tlsBlockScope entries:Vector<TlsBlock> = TlsBlock; +tlsBlockPermutation entries:Vector<Vector<TlsBlock>> = TlsBlock; +---functions--- +rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer; +get_future_salts#b921bd04 num:int = FutureSalts; +ping#7abe77ec ping_id:long = Pong; +ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; +destroy_session#e7512126 session_id:long = DestroySessionRes; +`; } }); -// node_modules/pako/lib/zlib/inftrees.js -var require_inftrees = __commonJS({ - "node_modules/pako/lib/zlib/inftrees.js"(exports2, module2) { +// node_modules/telegram/tl/generationHelpers.js +var require_generationHelpers = __commonJS({ + "node_modules/telegram/tl/generationHelpers.js"(exports2) { "use strict"; init_define_import_meta_env(); - var MAXBITS = 15; - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - var CODES = 0; - var LENS = 1; - var DISTS = 2; - var lbase = new Uint16Array([ - /* Length codes 257..285 base */ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 13, - 15, - 17, - 19, - 23, - 27, - 31, - 35, - 43, - 51, - 59, - 67, - 83, - 99, - 115, - 131, - 163, - 195, - 227, - 258, - 0, - 0 - ]); - var lext = new Uint8Array([ - /* Length codes 257..285 extra */ - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 17, - 17, - 17, - 17, - 18, - 18, - 18, - 18, - 19, - 19, - 19, - 19, - 20, - 20, - 20, - 20, - 21, - 21, - 21, - 21, - 16, - 199, - 75 - ]); - var dbase = new Uint16Array([ - /* Distance codes 0..29 base */ - 1, - 2, - 3, - 4, - 5, - 7, - 9, - 13, - 17, - 25, - 33, - 49, - 65, - 97, - 129, - 193, - 257, - 385, - 513, - 769, - 1025, - 1537, - 2049, - 3073, - 4097, - 6145, - 8193, - 12289, - 16385, - 24577, - 0, - 0 + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.variableSnakeToCamelCase = exports2.snakeToCamelCase = exports2.CORE_TYPES = exports2.fromLine = exports2.parseTl = exports2.findAll = void 0; + exports2.serializeBytes = serializeBytes; + exports2.serializeDate = serializeDate; + exports2.buildArgConfig = buildArgConfig; + var Helpers_1 = require_Helpers(); + var snakeToCamelCase = (name) => { + const result = name.replace(/(?:^|_)([a-z])/g, (_, g) => g.toUpperCase()); + return result.replace(/_/g, ""); + }; + exports2.snakeToCamelCase = snakeToCamelCase; + var variableSnakeToCamelCase = (str) => str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace("-", "").replace("_", "")); + exports2.variableSnakeToCamelCase = variableSnakeToCamelCase; + var CORE_TYPES = /* @__PURE__ */ new Set([ + 3162085175, + // boolFalse#bc799737 = Bool; + 2574415285, + // boolTrue#997275b5 = Bool; + 1072550713, + // true#3fedd339 = True; + 3300522427, + // error#c4b9f9bb code:int text:string = Error; + 1450380236 + // null#56730bcc = Null; ]); - var dext = new Uint8Array([ - /* Distance codes 0..29 extra */ - 16, - 16, - 16, - 16, - 17, - 17, - 18, - 18, - 19, - 19, - 20, - 20, - 21, - 21, - 22, - 22, - 23, - 23, - 24, - 24, - 25, - 25, - 26, - 26, - 27, - 27, - 28, - 28, - 29, - 29, - 64, - 64 + exports2.CORE_TYPES = CORE_TYPES; + var AUTH_KEY_TYPES = /* @__PURE__ */ new Set([ + 85337187, + // resPQ, + 2211011308, + // p_q_inner_data + 2851430293, + // p_q_inner_data_dc + 1013613780, + // p_q_inner_data_temp + 1459478408, + // p_q_inner_data_temp_dc + 3504867164, + // server_DH_params_ok + 3045658042, + // server_DH_inner_data + 1715713620, + // client_DH_inner_data + 3608339646, + // req_DH_params + 4110704415, + // set_client_DH_params + 812830625 + // gzip_packed ]); - var inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) => { - const bits = opts.bits; - let len = 0; - let sym = 0; - let min = 0, max = 0; - let root = 0; - let curr = 0; - let drop = 0; - let left = 0; - let used = 0; - let huff = 0; - let incr; - let fill; - let low; - let mask; - let next; - let base = null; - let match; - const count = new Uint16Array(MAXBITS + 1); - const offs = new Uint16Array(MAXBITS + 1); - let extra = null; - let here_bits, here_op, here_val; - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { - break; - } - } - if (root > max) { - root = max; - } - if (max === 0) { - table[table_index++] = 1 << 24 | 64 << 16 | 0; - table[table_index++] = 1 << 24 | 64 << 16 | 0; - opts.bits = 1; - return 0; - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { - break; - } - } - if (root < min) { - root = min; - } - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; - } - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - if (type === CODES) { - base = extra = work; - match = 20; - } else if (type === LENS) { - base = lbase; - extra = lext; - match = 257; - } else { - base = dbase; - extra = dext; - match = 0; - } - huff = 0; - sym = 0; - len = min; - next = table_index; - curr = root; - drop = 0; - low = -1; - used = 1 << root; - mask = used - 1; - if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { - return 1; - } - for (; ; ) { - here_bits = len - drop; - if (work[sym] + 1 < match) { - here_op = 0; - here_val = work[sym]; - } else if (work[sym] >= match) { - here_op = extra[work[sym] - match]; - here_val = base[work[sym] - match]; - } else { - here_op = 32 + 64; - here_val = 0; - } - incr = 1 << len - drop; - fill = 1 << curr; - min = fill; - do { - fill -= incr; - table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; - } while (fill !== 0); - incr = 1 << len - 1; - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - sym++; - if (--count[len] === 0) { - if (len === max) { - break; - } - len = lens[lens_index + work[sym]]; - } - if (len > root && (huff & mask) !== low) { - if (drop === 0) { - drop = root; - } - next += min; - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { - break; - } - curr++; - left <<= 1; - } - used += 1 << curr; - if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { - return 1; - } - low = huff & mask; - table[low] = root << 24 | curr << 16 | next - table_index | 0; - } - } - if (huff !== 0) { - table[next + huff] = len - drop << 24 | 64 << 16 | 0; + var fromLine = (line, isFunction) => { + const match = line.match(/([\w.]+)(?:#([0-9a-fA-F]+))?(?:\s{?\w+:[\w\d<>#.?!]+}?)*\s=\s([\w\d<>#.?]+);$/); + if (!match) { + throw new Error(`Cannot parse TLObject ${line}`); } - opts.bits = root; - return 0; - }; - module2.exports = inflate_table; - } -}); - -// node_modules/pako/lib/zlib/inflate.js -var require_inflate = __commonJS({ - "node_modules/pako/lib/zlib/inflate.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - var adler32 = require_adler32(); - var crc32 = require_crc32(); - var inflate_fast = require_inffast(); - var inflate_table = require_inftrees(); - var CODES = 0; - var LENS = 1; - var DISTS = 2; - var { - Z_FINISH, - Z_BLOCK, - Z_TREES, - Z_OK, - Z_STREAM_END, - Z_NEED_DICT, - Z_STREAM_ERROR, - Z_DATA_ERROR, - Z_MEM_ERROR, - Z_BUF_ERROR, - Z_DEFLATED - } = require_constants(); - var HEAD = 16180; - var FLAGS = 16181; - var TIME = 16182; - var OS = 16183; - var EXLEN = 16184; - var EXTRA = 16185; - var NAME = 16186; - var COMMENT = 16187; - var HCRC = 16188; - var DICTID = 16189; - var DICT = 16190; - var TYPE = 16191; - var TYPEDO = 16192; - var STORED = 16193; - var COPY_ = 16194; - var COPY = 16195; - var TABLE = 16196; - var LENLENS = 16197; - var CODELENS = 16198; - var LEN_ = 16199; - var LEN = 16200; - var LENEXT = 16201; - var DIST = 16202; - var DISTEXT = 16203; - var MATCH = 16204; - var LIT = 16205; - var CHECK = 16206; - var LENGTH = 16207; - var DONE = 16208; - var BAD = 16209; - var MEM = 16210; - var SYNC = 16211; - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - var MAX_WBITS = 15; - var DEF_WBITS = MAX_WBITS; - var zswap32 = (q) => { - return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); - }; - function InflateState() { - this.strm = null; - this.mode = 0; - this.last = false; - this.wrap = 0; - this.havedict = false; - this.flags = 0; - this.dmax = 0; - this.check = 0; - this.total = 0; - this.head = null; - this.wbits = 0; - this.wsize = 0; - this.whave = 0; - this.wnext = 0; - this.window = null; - this.hold = 0; - this.bits = 0; - this.length = 0; - this.offset = 0; - this.extra = 0; - this.lencode = null; - this.distcode = null; - this.lenbits = 0; - this.distbits = 0; - this.ncode = 0; - this.nlen = 0; - this.ndist = 0; - this.have = 0; - this.next = null; - this.lens = new Uint16Array(320); - this.work = new Uint16Array(288); - this.lendyn = null; - this.distdyn = null; - this.sane = 0; - this.back = 0; - this.was = 0; - } - var inflateStateCheck = (strm) => { - if (!strm) { - return 1; + const argsMatch = findAll3(/({)?(\w+):([\w\d<>#.?!]+)}?/, line); + const currentConfig = { + name: match[1], + constructorId: parseInt(match[2], 16), + argsConfig: {}, + subclassOfId: (0, Helpers_1.crc32)(match[3]), + result: match[3], + isFunction, + namespace: void 0 + }; + if (!currentConfig.constructorId) { + const hexId = ""; + let args; + if (Object.values(currentConfig.argsConfig).length) { + args = ` ${Object.keys(currentConfig.argsConfig).map((arg) => arg.toString()).join(" ")}`; + } else { + args = ""; + } + const representation = `${currentConfig.name}${hexId}${args} = ${currentConfig.result}`.replace(/(:|\?)bytes /g, "$1string ").replace(/</g, " ").replace(/>|{|}/g, "").replace(/ \w+:flags(\d+)?\.\d+\?true/g, ""); + if (currentConfig.name === "inputMediaInvoice") { + if (currentConfig.name === "inputMediaInvoice") { + } + } + currentConfig.constructorId = (0, Helpers_1.crc32)(Buffer.from(representation, "utf8")); } - const state = strm.state; - if (!state || state.strm !== strm || state.mode < HEAD || state.mode > SYNC) { - return 1; + for (const [brace, name, argType] of argsMatch) { + if (brace === void 0) { + currentConfig.argsConfig[variableSnakeToCamelCase(name)] = buildArgConfig(name, argType); + } } - return 0; - }; - var inflateResetKeep = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + if (currentConfig.name.includes(".")) { + [currentConfig.namespace, currentConfig.name] = currentConfig.name.split(/\.(.+)/); } - const state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ""; - if (state.wrap) { - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.flags = -1; - state.dmax = 32768; - state.head = null; - state.hold = 0; - state.bits = 0; - state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS); - state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS); - state.sane = 1; - state.back = -1; - return Z_OK; + currentConfig.name = snakeToCamelCase(currentConfig.name); + return currentConfig; }; - var inflateReset = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + exports2.fromLine = fromLine; + function buildArgConfig(name, argType) { + name = name === "self" ? "is_self" : name; + const currentConfig = { + isVector: false, + isFlag: false, + skipConstructorId: false, + flagName: null, + flagIndex: -1, + flagIndicator: true, + type: null, + useVectorId: null + }; + const canBeInferred = name === "random_id"; + if (argType !== "#") { + currentConfig.flagIndicator = false; + currentConfig.type = argType.replace(/^!+/, ""); + const flagMatch = currentConfig.type.match(/(flags(?:\d+)?).(\d+)\?([\w<>.]+)/); + if (flagMatch) { + currentConfig.isFlag = true; + currentConfig.flagName = flagMatch[1]; + currentConfig.flagIndex = Number(flagMatch[2]); + currentConfig.type = flagMatch[3]; + } + const vectorMatch = currentConfig.type.match(/[Vv]ector<([\w\d.]+)>/); + if (vectorMatch) { + currentConfig.isVector = true; + currentConfig.useVectorId = currentConfig.type.charAt(0) === "V"; + [, currentConfig.type] = vectorMatch; + } + if (/^[a-z]$/.test(currentConfig.type.split(".").pop().charAt(0))) { + currentConfig.skipConstructorId = true; + } } - const state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - }; - var inflateReset2 = (strm, windowBits) => { - let wrap; - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + if (currentConfig.type == "future_salt") { + currentConfig.type = "FutureSalt"; } - const state = strm.state; - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else { - wrap = (windowBits >> 4) + 5; - if (windowBits < 48) { - windowBits &= 15; + return currentConfig; + } + var parseTl = function* (content, layer, methods = [], ignoreIds = CORE_TYPES) { + const methodInfo = (methods || []).reduce((o, m) => Object.assign(Object.assign({}, o), { [m.name]: m }), {}); + const objAll = []; + const objByName = {}; + const objByType = {}; + const file = content; + let isFunction = false; + for (let line of file.split("\n")) { + const commentIndex = line.indexOf("//"); + if (commentIndex !== -1) { + line = line.slice(0, commentIndex); + } + line = line.trim(); + if (!line) { + continue; + } + const match = line.match(/---(\w+)---/); + if (match) { + const [, followingTypes] = match; + isFunction = followingTypes === "functions"; + continue; + } + try { + const result = fromLine(line, isFunction); + if (ignoreIds.has(result.constructorId)) { + continue; + } + objAll.push(result); + if (!result.isFunction) { + if (!objByType[result.result]) { + objByType[result.result] = []; + } + objByName[result.name] = result; + objByType[result.result].push(result); + } + } catch (e) { + if (!e.toString().includes("vector#1cb5c415")) { + throw e; + } } } - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; + for (const obj of objAll) { + if (AUTH_KEY_TYPES.has(obj.constructorId)) { + for (const arg in obj.argsConfig) { + if (obj.argsConfig[arg].type === "string") { + obj.argsConfig[arg].type = "bytes"; + } + } + } } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; + for (const obj of objAll) { + yield obj; } - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); }; - var inflateInit2 = (strm, windowBits) => { - if (!strm) { - return Z_STREAM_ERROR; + exports2.parseTl = parseTl; + var findAll3 = (regex, str, matches = []) => { + if (!regex.flags.includes("g")) { + regex = new RegExp(regex.source, "g"); } - const state = new InflateState(); - strm.state = state; - state.strm = strm; - state.window = null; - state.mode = HEAD; - const ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null; + const res = regex.exec(str); + if (res) { + matches.push(res.slice(1)); + findAll3(regex, str, matches); } - return ret; + return matches; }; - var inflateInit = (strm) => { - return inflateInit2(strm, DEF_WBITS); - }; - var virgin = true; - var lenfix; - var distfix; - var fixedtables = (state) => { - if (virgin) { - lenfix = new Int32Array(512); - distfix = new Int32Array(32); - let sym = 0; - while (sym < 144) { - state.lens[sym++] = 8; - } - while (sym < 256) { - state.lens[sym++] = 9; + exports2.findAll = findAll3; + function serializeBytes(data) { + if (!(data instanceof Buffer)) { + if (typeof data == "string") { + data = Buffer.from(data); + } else { + throw Error(`Bytes or str expected, not ${data.constructor.name}`); } - while (sym < 280) { - state.lens[sym++] = 7; + } + const r = []; + let padding; + if (data.length < 254) { + padding = (data.length + 1) % 4; + if (padding !== 0) { + padding = 4 - padding; } - while (sym < 288) { - state.lens[sym++] = 8; + r.push(Buffer.from([data.length])); + r.push(data); + } else { + padding = data.length % 4; + if (padding !== 0) { + padding = 4 - padding; } - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - sym = 0; - while (sym < 32) { - state.lens[sym++] = 5; + r.push(Buffer.from([ + 254, + data.length % 256, + (data.length >> 8) % 256, + (data.length >> 16) % 256 + ])); + r.push(data); + } + r.push(Buffer.alloc(padding).fill(0)); + return Buffer.concat(r); + } + function serializeDate(dt) { + if (!dt) { + return Buffer.alloc(4).fill(0); + } + if (dt instanceof Date) { + dt = Math.floor((Date.now() - dt.getTime()) / 1e3); + } + if (typeof dt == "number") { + const t = Buffer.alloc(4); + t.writeInt32LE(dt, 0); + return t; + } + throw Error(`Cannot interpret "${dt}" as a date`); + } + } +}); + +// node_modules/telegram/tl/api.js +var require_api = __commonJS({ + "node_modules/telegram/tl/api.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var { inspect } = require_inspect(); + var bigInt = require_BigInteger(); + var { generateRandomBytes, readBigIntFromBuffer, isArrayLike, betterConsoleLog } = require_Helpers(); + var tlContent = require_apiTl(); + var schemeContent = require_schemaTl(); + function generateRandomBigInt() { + return readBigIntFromBuffer(generateRandomBytes(8), false, true); + } + var { parseTl, serializeBytes, serializeDate } = require_generationHelpers(); + var { toSignedLittleBuffer } = require_Helpers(); + var NAMED_AUTO_CASTS = /* @__PURE__ */ new Set(["chatId,int"]); + var AUTO_CASTS = /* @__PURE__ */ new Set([ + "InputPeer", + "InputChannel", + "InputUser", + "InputDialogPeer", + "InputNotifyPeer", + "InputMedia", + "InputPhoto", + "InputMessage", + "InputDocument", + "InputChatPhoto" + ]); + var CastError = class _CastError extends Error { + constructor(objectName, expected, actual, ...params) { + const message = "Found wrong type for " + objectName + ". expected " + expected + " but received " + actual + ".If you think this is a mistake please report it."; + super(message, ...params); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, _CastError); } - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - virgin = false; + this.name = "CastError"; } - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; }; - var updatewindow = (strm, src, end, copy) => { - let dist; - const state = strm.state; - if (state.window === null) { - state.window = new Uint8Array(1 << state.wbits); - } - if (state.wsize === 0) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - } - if (copy >= state.wsize) { - state.window.set(src.subarray(end - state.wsize, end), 0); - state.wnext = 0; - state.whave = state.wsize; + var CACHING_SUPPORTED = typeof self !== "undefined" && self.localStorage !== void 0; + var CACHE_KEY = "GramJs:apiCache"; + function buildApiFromTlSchema() { + let definitions; + const fromCache = CACHING_SUPPORTED && loadFromCache(); + if (fromCache) { + definitions = fromCache; } else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext); - copy -= dist; - if (copy) { - state.window.set(src.subarray(end - copy, end), 0); - state.wnext = copy; - state.whave = state.wsize; - } else { - state.wnext += dist; - if (state.wnext === state.wsize) { - state.wnext = 0; - } - if (state.whave < state.wsize) { - state.whave += dist; - } + definitions = loadFromTlSchemas(); + if (CACHING_SUPPORTED) { + localStorage.setItem(CACHE_KEY, JSON.stringify(definitions)); } } - return 0; - }; - var inflate = (strm, flush) => { - let state; - let input, output; - let next; - let put; - let have, left; - let hold; - let bits; - let _in, _out; - let copy; - let from; - let from_source; - let here = 0; - let here_bits, here_op, here_val; - let last_bits, last_op, last_val; - let len; - let ret; - const hbuf = new Uint8Array(4); - let opts; - let n; - const order = ( - /* permutation of code lengths */ - new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]) - ); - if (inflateStateCheck(strm) || !strm.output || !strm.input && strm.avail_in !== 0) { - return Z_STREAM_ERROR; + return createClasses("all", definitions); + } + function loadFromCache() { + const jsonCache = localStorage.getItem(CACHE_KEY); + return jsonCache && JSON.parse(jsonCache); + } + function loadFromTlSchemas() { + const [constructorParamsApi, functionParamsApi] = extractParams(tlContent); + const [constructorParamsSchema, functionParamsSchema] = extractParams(schemeContent); + const constructors = [].concat(constructorParamsApi, constructorParamsSchema); + const requests = [].concat(functionParamsApi, functionParamsSchema); + return [].concat(constructors, requests); + } + function extractParams(fileContent) { + const f = parseTl(fileContent, 109); + const constructors = []; + const functions = []; + for (const d of f) { + d.isFunction ? functions.push(d) : constructors.push(d); } - state = strm.state; - if (state.mode === TYPE) { - state.mode = TYPEDO; + return [constructors, functions]; + } + function argToBytes(x, type, argName, requestName) { + switch (type) { + case "int": + const i = Buffer.alloc(4); + i.writeInt32LE(x, 0); + return i; + case "long": + return toSignedLittleBuffer(x, 8); + case "int128": + return toSignedLittleBuffer(x, 16); + case "int256": + return toSignedLittleBuffer(x, 32); + case "double": + const d = Buffer.alloc(8); + d.writeDoubleLE(x, 0); + return d; + case "string": + return serializeBytes(x); + case "Bool": + return x ? Buffer.from("b5757299", "hex") : Buffer.from("379779bc", "hex"); + case "true": + return Buffer.alloc(0); + case "bytes": + return serializeBytes(x); + case "date": + return serializeDate(x); + default: + if (x === void 0 || typeof x.getBytes !== "function") { + throw new Error(`Required object ${argName} of ${requestName} is undefined`); + } + return x.getBytes(); } - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - _in = have; - _out = left; - ret = Z_OK; - inf_leave: - for (; ; ) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 2 && hold === 35615) { - if (state.wbits === 0) { - state.wbits = 15; - } - state.check = 0; - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32(state.check, hbuf, 2, 0); - hold = 0; - bits = 0; - state.mode = FLAGS; - break; - } - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 255) << 8) + (hold >> 8)) % 31) { - strm.msg = "incorrect header check"; - state.mode = BAD; - break; - } - if ((hold & 15) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - hold >>>= 4; - bits -= 4; - len = (hold & 15) + 8; - if (state.wbits === 0) { - state.wbits = len; - } - if (len > 15 || len > state.wbits) { - strm.msg = "invalid window size"; - state.mode = BAD; - break; - } - state.dmax = 1 << state.wbits; - state.flags = 0; - strm.adler = state.check = 1; - state.mode = hold & 512 ? DICTID : TYPE; - hold = 0; - bits = 0; - break; - case FLAGS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.flags = hold; - if ((state.flags & 255) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - if (state.flags & 57344) { - strm.msg = "unknown header flags set"; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = hold >> 8 & 1; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = TIME; - /* falls through */ - case TIME: - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.time = hold; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - hbuf[2] = hold >>> 16 & 255; - hbuf[3] = hold >>> 24 & 255; - state.check = crc32(state.check, hbuf, 4, 0); - } - hold = 0; - bits = 0; - state.mode = OS; - /* falls through */ - case OS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.xflags = hold & 255; - state.head.os = hold >> 8; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 1024) { - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - } else if (state.head) { - state.head.extra = null; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 1024) { - copy = state.length; - if (copy > have) { - copy = have; - } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - state.head.extra = new Uint8Array(state.head.extra_len); - } - state.head.extra.set( - input.subarray( - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - next + copy - ), - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - } - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32(state.check, input, copy, next); + } + async function getInputFromResolve(utils, client2, peer, peerType) { + switch (peerType) { + case "InputPeer": + return utils.getInputPeer(await client2.getInputEntity(peer)); + case "InputChannel": + return utils.getInputChannel(await client2.getInputEntity(peer)); + case "InputUser": + return utils.getInputUser(await client2.getInputEntity(peer)); + case "InputDialogPeer": + return await client2._getInputDialog(peer); + case "InputNotifyPeer": + return await client2._getInputNotify(peer); + case "InputMedia": + return utils.getInputMedia(peer); + case "InputPhoto": + return utils.getInputPhoto(peer); + case "InputMessage": + return utils.getInputMessage(peer); + case "InputDocument": + return utils.getInputDocument(peer); + case "InputChatPhoto": + return utils.getInputChatPhoto(peer); + case "chatId,int": + return await client2.getPeerId(peer, false); + default: + throw new Error("unsupported peer type : " + peerType); + } + } + function getArgFromReader(reader, arg) { + if (arg.isVector) { + if (arg.useVectorId) { + reader.readInt(); + } + const temp = []; + const len = reader.readInt(); + arg.isVector = false; + for (let i = 0; i < len; i++) { + temp.push(getArgFromReader(reader, arg)); + } + arg.isVector = true; + return temp; + } else if (arg.flagIndicator) { + return reader.readInt(); + } else { + switch (arg.type) { + case "int": + return reader.readInt(); + case "long": + return reader.readLong(); + case "int128": + return reader.readLargeInt(128); + case "int256": + return reader.readLargeInt(256); + case "double": + return reader.readDouble(); + case "string": + return reader.tgReadString(); + case "Bool": + return reader.tgReadBool(); + case "true": + return true; + case "bytes": + return reader.tgReadBytes(); + case "date": + return reader.tgReadDate(); + default: + if (!arg.skipConstructorId) { + return reader.tgReadObject(); + } else { + return api.constructors[arg.type].fromReader(reader); + } + } + } + } + function compareType(value, type) { + let correct = true; + switch (type) { + case "number": + correct = typeof value === "number" || value === void 0; + break; + case "string": + case "boolean": + correct = typeof value === type; + break; + case "bigInt": + correct = bigInt.isInstance(value) || typeof value === "bigint" || typeof value === "number" || typeof value === "string" || value === void 0; + break; + case "true": + break; + case "buffer": + correct = Buffer.isBuffer(value); + break; + case "date": + correct = value && Object.prototype.toString.call(value) === "[object Date]" && !isNaN(value) || typeof value === "number"; + break; + default: + console.error(new Error("Unknown type." + type)); + } + return correct; + } + function createClasses(classesType, params) { + const classes = {}; + for (const classParams of params) { + const { name, constructorId, subclassOfId, argsConfig, namespace, isFunction, result } = classParams; + const fullName = [namespace, name].join(".").replace(/^\./, ""); + class VirtualClass { + constructor(args) { + this.CONSTRUCTOR_ID = constructorId; + this.SUBCLASS_OF_ID = subclassOfId; + this.className = fullName; + this.classType = isFunction ? "request" : "constructor"; + args = args || {}; + this.originalArgs = args; + this.init(args); + for (const argName in argsConfig) { + if (argName === "randomId" && !args[argName]) { + if (argsConfig[argName].isVector) { + const rands = []; + for (let i = 0; i < args["id"].length; i++) { + rands.push(generateRandomBigInt()); } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { - break inf_leave; + this[argName] = rands; + } else { + this[argName] = generateRandomBigInt(); } + } else { + this[argName] = args[argName]; } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 2048) { - if (have === 0) { - break inf_leave; - } - copy = 0; - do { - len = input[next + copy++]; - if (state.head && len && state.length < 65536) { - state.head.name += String.fromCharCode(len); + } + } + init(args) { + } + static fromReader(reader) { + const args = {}; + for (const argName in argsConfig) { + if (argsConfig.hasOwnProperty(argName)) { + const arg = argsConfig[argName]; + if (arg.isFlag) { + if (arg.type === "true") { + args[argName] = Boolean(args[arg.flagName] & 1 << arg.flagIndex); + continue; } - } while (len && copy < have); - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 4096) { - if (have === 0) { - break inf_leave; - } - copy = 0; - do { - len = input[next + copy++]; - if (state.head && len && state.length < 65536) { - state.head.comment += String.fromCharCode(len); + if (args[arg.flagName] & 1 << arg.flagIndex) { + args[argName] = getArgFromReader(reader, arg); + } else { + args[argName] = null; } - } while (len && copy < have); - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 512) { - while (bits < 16) { - if (have === 0) { - break inf_leave; + } else { + if (arg.flagIndicator) { + arg.name = argName; } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 4 && hold !== (state.check & 65535)) { - strm.msg = "header crc mismatch"; - state.mode = BAD; - break; + args[argName] = getArgFromReader(reader, arg); } - hold = 0; - bits = 0; } - if (state.head) { - state.head.hcrc = state.flags >> 9 & 1; - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - while (bits < 32) { - if (have === 0) { - break inf_leave; + } + return new this(args); + } + validate() { + for (const arg in argsConfig) { + if (argsConfig.hasOwnProperty(arg)) { + if (argsConfig[arg].flagIndicator || argsConfig[arg].isFlag) { + continue; } - have--; - hold += input[next++] << bits; - bits += 8; - } - strm.adler = state.check = zswap32(hold); - hold = 0; - bits = 0; - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - return Z_NEED_DICT; + const currentValue = this[arg]; + this.assertType(arg, argsConfig[arg], currentValue); } - strm.adler = state.check = 1; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { - break inf_leave; + } + } + assertType(objectName, object, value) { + let expected; + if (object["isVector"]) { + if (!isArrayLike(value)) { + console.error(new CastError(objectName, "array", value)); } - /* falls through */ - case TYPEDO: - if (state.last) { - hold >>>= bits & 7; - bits -= bits & 7; - state.mode = CHECK; - break; + if (value == void 0) { + value = []; } - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; + for (const o of value) { + this.assertType(objectName, Object.assign(Object.assign({}, object), { isVector: false }), o); } - state.last = hold & 1; - hold >>>= 1; - bits -= 1; - switch (hold & 3) { - case 0: - state.mode = STORED; + } else { + switch (object["type"]) { + case "int": + expected = "number"; break; - case 1: - fixedtables(state); - state.mode = LEN_; - if (flush === Z_TREES) { - hold >>>= 2; - bits -= 2; - break inf_leave; - } + case "long": + case "int128": + case "int256": + expected = "bigInt"; break; - case 2: - state.mode = TABLE; + case "double": + expected = "number"; break; - case 3: - strm.msg = "invalid block type"; - state.mode = BAD; - } - hold >>>= 2; - bits -= 2; - break; - case STORED: - hold >>>= bits & 7; - bits -= bits & 7; - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { - strm.msg = "invalid stored block lengths"; - state.mode = BAD; - break; - } - state.length = hold & 65535; - hold = 0; - bits = 0; - state.mode = COPY_; - if (flush === Z_TREES) { - break inf_leave; - } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { - copy = have; - } - if (copy > left) { - copy = left; - } - if (copy === 0) { - break inf_leave; - } - output.set(input.subarray(next, next + copy), put); - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - state.mode = TYPE; - break; - case TABLE: - while (bits < 14) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.nlen = (hold & 31) + 257; - hold >>>= 5; - bits -= 5; - state.ndist = (hold & 31) + 1; - hold >>>= 5; - bits -= 5; - state.ncode = (hold & 15) + 4; - hold >>>= 4; - bits -= 4; - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = "too many length or distance symbols"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.lens[order[state.have++]] = hold & 7; - hold >>>= 3; - bits -= 3; - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - state.lencode = state.lendyn; - state.lenbits = 7; - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid code lengths set"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_val < 16) { - hold >>>= here_bits; - bits -= here_bits; - state.lens[state.have++] = here_val; - } else { - if (here_val === 16) { - n = here_bits + 2; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - if (state.have === 0) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 3); - hold >>>= 2; - bits -= 2; - } else if (here_val === 17) { - n = here_bits + 3; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy = 3 + (hold & 7); - hold >>>= 3; - bits -= 3; - } else { - n = here_bits + 7; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy = 11 + (hold & 127); - hold >>>= 7; - bits -= 7; - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - if (state.mode === BAD) { - break; - } - if (state.lens[256] === 0) { - strm.msg = "invalid code -- missing end-of-block"; - state.mode = BAD; - break; - } - state.lenbits = 9; - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid literal/lengths set"; - state.mode = BAD; - break; - } - state.distbits = 6; - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - state.distbits = opts.bits; - if (ret) { - strm.msg = "invalid distances set"; - state.mode = BAD; - break; - } - state.mode = LEN_; - if (flush === Z_TREES) { - break inf_leave; - } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - inflate_fast(strm, _out); - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { + case "string": + expected = "string"; break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_op && (here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; - } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - state.mode = LIT; - break; - } - if (here_op & 32) { - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (; ; ) { - here = state.distcode[hold & (1 << state.distbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { + case "Bool": + expected = "boolean"; + break; + case "true": + expected = "true"; + break; + case "bytes": + expected = "buffer"; break; + case "date": + expected = "date"; + break; + default: + expected = "object"; + } + if (expected === "object") { + } else { + const isCorrectType = compareType(value, expected); + if (isCorrectType !== true) { + console.error(new CastError(objectName, expected, value)); } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; } - if ((here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; + } + } + getBytes() { + try { + this.validate(); + } catch (e) { + } + const idForBytes = this.CONSTRUCTOR_ID; + const c = Buffer.alloc(4); + c.writeUInt32LE(idForBytes, 0); + const buffers = [c]; + for (const arg in argsConfig) { + if (argsConfig.hasOwnProperty(arg)) { + if (argsConfig[arg].isFlag) { + if (this[arg] === false && argsConfig[arg].type !== "Bool" || this[arg] === null || this[arg] === void 0 || argsConfig[arg].type === "true") { + continue; } - if (have === 0) { - break inf_leave; + } + if (argsConfig[arg].isVector) { + if (argsConfig[arg].useVectorId) { + buffers.push(Buffer.from("15c4b51c", "hex")); + } + const l = Buffer.alloc(4); + l.writeInt32LE(this[arg].length, 0); + buffers.push(l, Buffer.concat(this[arg].map((x) => argToBytes(x, argsConfig[arg].type, fullName)))); + } else if (argsConfig[arg].flagIndicator) { + if (!Object.values(argsConfig).some((f) => f.isFlag)) { + buffers.push(Buffer.alloc(4)); + } else { + let flagCalculate = 0; + for (const f2 in argsConfig) { + if (argsConfig[f2].isFlag && arg === argsConfig[f2].flagName) { + if (this[f2] === false && argsConfig[f2].type !== "Bool" || this[f2] === void 0 || this[f2] === null) { + flagCalculate |= 0; + } else { + flagCalculate |= 1 << argsConfig[f2].flagIndex; + } + } + } + const f = Buffer.alloc(4); + f.writeUInt32LE(flagCalculate, 0); + buffers.push(f); + } + } else { + buffers.push(argToBytes(this[arg], argsConfig[arg].type, arg, fullName)); + if (this[arg] && typeof this[arg].getBytes === "function") { + let boxed = argsConfig[arg].type.charAt(argsConfig[arg].type.indexOf(".") + 1); + boxed = boxed === boxed.toUpperCase(); + if (!boxed) { + buffers.shift(); + } } - have--; - hold += input[next++] << bits; - bits += 8; } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - if (here_op & 64) { - strm.msg = "invalid distance code"; - state.mode = BAD; - break; + } + return Buffer.concat(buffers); + } + readResult(reader) { + if (!isFunction) { + throw new Error("`readResult()` called for non-request instance"); + } + const m = result.match(/Vector<(int|long)>/); + if (m) { + reader.readInt(); + const temp = []; + const len = reader.readInt(); + if (m[1] === "int") { + for (let i = 0; i < len; i++) { + temp.push(reader.readInt()); + } + } else { + for (let i = 0; i < len; i++) { + temp.push(reader.readLong()); + } } - state.offset = here_val; - state.extra = here_op & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; + return temp; + } else { + return reader.tgReadObject(); + } + } + async resolve(client2, utils) { + if (!isFunction) { + throw new Error("`resolve()` called for non-request instance"); + } + for (const arg in argsConfig) { + if (argsConfig.hasOwnProperty(arg)) { + if (!AUTO_CASTS.has(argsConfig[arg].type)) { + if (!NAMED_AUTO_CASTS.has(`${argsConfig[arg].name},${argsConfig[arg].type}`)) { + continue; } - have--; - hold += input[next++] << bits; - bits += 8; } - state.offset += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - if (state.offset > state.dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { - break inf_leave; - } - copy = _out - left; - if (state.offset > copy) { - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; + if (argsConfig[arg].isFlag) { + if (!this[arg]) { + continue; } } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; + if (argsConfig[arg].isVector) { + const temp = []; + for (const x of this[arg]) { + temp.push(await getInputFromResolve(utils, client2, x, argsConfig[arg].type)); + } + this[arg] = temp; } else { - from = state.wnext - copy; - } - if (copy > state.length) { - copy = state.length; + this[arg] = await getInputFromResolve(utils, client2, this[arg], argsConfig[arg].type); } - from_source = state.window; - } else { - from_source = output; - from = put - state.offset; - copy = state.length; } - if (copy > left) { - copy = left; + } + } + [inspect.custom]() { + return betterConsoleLog(this); + } + toJSON() { + return Object.assign(Object.assign({}, this.originalArgs), { className: fullName }); + } + } + VirtualClass.CONSTRUCTOR_ID = constructorId; + VirtualClass.SUBCLASS_OF_ID = subclassOfId; + VirtualClass.className = fullName; + VirtualClass.classType = isFunction ? "request" : "constructor"; + if (namespace) { + if (!classes[namespace]) { + classes[namespace] = {}; + } + classes[namespace][name] = VirtualClass; + } else { + classes[name] = VirtualClass; + } + } + return classes; + } + var api = buildApiFromTlSchema(); + module2.exports = { Api: api }; + } +}); + +// node_modules/telegram/tl/custom/chatGetter.js +var require_chatGetter = __commonJS({ + "node_modules/telegram/tl/custom/chatGetter.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ChatGetter = void 0; + var __1 = require_telegram(); + var api_1 = require_api(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var ChatGetter = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + static initChatClass(c, { chatPeer, inputChat, chat, broadcast }) { + c._chatPeer = chatPeer; + c._inputChat = inputChat; + c._chat = chat; + c._broadcast = broadcast; + c._client = void 0; + } + get chat() { + return this._chat; + } + async getChat() { + var _a; + if (!this._chat || "min" in this._chat && await this.getInputChat()) { + try { + if (this._inputChat) { + this._chat = await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.getEntity(this._inputChat)); + } + } catch (e) { + await this._refetchChat(); + } + } + return this._chat; + } + get inputChat() { + if (!this._inputChat && this._chatPeer && this._client) { + try { + this._inputChat = this._client._entityCache.get(__1.utils.getPeerId(this._chatPeer)); + } catch (e) { + } + } + return this._inputChat; + } + async getInputChat() { + var _a, e_1, _b, _c; + if (!this.inputChat && this.chatId && this._client) { + try { + const target = this.chatId; + try { + for (var _d = true, _e = __asyncValues2(this._client.iterDialogs({ + limit: 100 + })), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { + _c = _f.value; + _d = false; + const dialog = _c; + if (dialog.id.eq(target)) { + this._chat = dialog.entity; + this._inputChat = dialog.inputEntity; + break; + } } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { - state.mode = LEN; + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (!_d && !_a && (_b = _e.return)) await _b.call(_e); + } finally { + if (e_1) throw e_1.error; } - break; - case LIT: - if (left === 0) { - break inf_leave; + } + } catch (e) { + } + return this._inputChat; + } + return this._inputChat; + } + get chatId() { + return this._chatPeer ? (0, Helpers_1.returnBigInt)(__1.utils.getPeerId(this._chatPeer)) : void 0; + } + get isPrivate() { + return this._chatPeer ? this._chatPeer instanceof api_1.Api.PeerUser : void 0; + } + get isGroup() { + if (!this._broadcast && this.chat && "broadcast" in this.chat) { + this._broadcast = Boolean(this.chat.broadcast); + } + if (this._chatPeer instanceof api_1.Api.PeerChannel) { + if (this._broadcast === void 0) { + return void 0; + } else { + return !this._broadcast; + } + } + return this._chatPeer instanceof api_1.Api.PeerChat; + } + get isChannel() { + return this._chatPeer instanceof api_1.Api.PeerChannel; + } + async _refetchChat() { + } + }; + exports2.ChatGetter = ChatGetter; + } +}); + +// node_modules/telegram/tl/custom/senderGetter.js +var require_senderGetter = __commonJS({ + "node_modules/telegram/tl/custom/senderGetter.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SenderGetter = void 0; + var api_1 = require_api(); + var Helpers_1 = require_Helpers(); + var chatGetter_1 = require_chatGetter(); + var inspect_1 = require_inspect(); + var SenderGetter = class extends chatGetter_1.ChatGetter { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + static initSenderClass(c, { senderId, sender, inputSender }) { + c._senderId = senderId; + c._sender = sender; + c._inputSender = inputSender; + c._client = void 0; + } + get sender() { + return this._sender; + } + async getSender() { + if (this._client && (!this._sender || this._sender instanceof api_1.Api.Channel && this._sender.min) && await this.getInputSender()) { + try { + this._sender = await this._client.getEntity(this._inputSender); + } catch (e) { + await this._refetchSender(); + } + } + return this._sender; + } + get inputSender() { + if (!this._inputSender && this._senderId && this._client) { + try { + this._inputSender = this._client._entityCache.get(this._senderId); + } catch (e) { + } + } + return this._inputSender; + } + async getInputSender() { + if (!this.inputSender && this._senderId && this._client) { + await this._refetchSender(); + } + return this._inputSender; + } + get senderId() { + return this._senderId; + } + async _refetchSender() { + } + }; + exports2.SenderGetter = SenderGetter; + } +}); + +// node_modules/mime/Mime.js +var require_Mime = __commonJS({ + "node_modules/mime/Mime.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + function Mime() { + this._types = /* @__PURE__ */ Object.create(null); + this._extensions = /* @__PURE__ */ Object.create(null); + for (let i = 0; i < arguments.length; i++) { + this.define(arguments[i]); + } + this.define = this.define.bind(this); + this.getType = this.getType.bind(this); + this.getExtension = this.getExtension.bind(this); + } + Mime.prototype.define = function(typeMap, force) { + for (let type in typeMap) { + let extensions = typeMap[type].map(function(t) { + return t.toLowerCase(); + }); + type = type.toLowerCase(); + for (let i = 0; i < extensions.length; i++) { + const ext = extensions[i]; + if (ext[0] === "*") { + continue; + } + if (!force && ext in this._types) { + throw new Error( + 'Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".' + ); + } + this._types[ext] = type; + } + if (force || !this._extensions[type]) { + const ext = extensions[0]; + this._extensions[type] = ext[0] !== "*" ? ext : ext.substr(1); + } + } + }; + Mime.prototype.getType = function(path2) { + path2 = String(path2); + let last = path2.replace(/^.*[/\\]/, "").toLowerCase(); + let ext = last.replace(/^.*\./, "").toLowerCase(); + let hasPath = last.length < path2.length; + let hasDot = ext.length < last.length - 1; + return (hasDot || !hasPath) && this._types[ext] || null; + }; + Mime.prototype.getExtension = function(type) { + type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; + return type && this._extensions[type.toLowerCase()] || null; + }; + module2.exports = Mime; + } +}); + +// node_modules/mime/types/standard.js +var require_standard = __commonJS({ + "node_modules/mime/types/standard.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] }; + } +}); + +// node_modules/mime/types/other.js +var require_other = __commonJS({ + "node_modules/mime/types/other.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = { "application/prs.cww": ["cww"], "application/vnd.1000minds.decision-model+xml": ["1km"], "application/vnd.3gpp.pic-bw-large": ["plb"], "application/vnd.3gpp.pic-bw-small": ["psb"], "application/vnd.3gpp.pic-bw-var": ["pvb"], "application/vnd.3gpp2.tcap": ["tcap"], "application/vnd.3m.post-it-notes": ["pwn"], "application/vnd.accpac.simply.aso": ["aso"], "application/vnd.accpac.simply.imp": ["imp"], "application/vnd.acucobol": ["acu"], "application/vnd.acucorp": ["atc", "acutc"], "application/vnd.adobe.air-application-installer-package+zip": ["air"], "application/vnd.adobe.formscentral.fcdt": ["fcdt"], "application/vnd.adobe.fxp": ["fxp", "fxpl"], "application/vnd.adobe.xdp+xml": ["xdp"], "application/vnd.adobe.xfdf": ["xfdf"], "application/vnd.ahead.space": ["ahead"], "application/vnd.airzip.filesecure.azf": ["azf"], "application/vnd.airzip.filesecure.azs": ["azs"], "application/vnd.amazon.ebook": ["azw"], "application/vnd.americandynamics.acc": ["acc"], "application/vnd.amiga.ami": ["ami"], "application/vnd.android.package-archive": ["apk"], "application/vnd.anser-web-certificate-issue-initiation": ["cii"], "application/vnd.anser-web-funds-transfer-initiation": ["fti"], "application/vnd.antix.game-component": ["atx"], "application/vnd.apple.installer+xml": ["mpkg"], "application/vnd.apple.keynote": ["key"], "application/vnd.apple.mpegurl": ["m3u8"], "application/vnd.apple.numbers": ["numbers"], "application/vnd.apple.pages": ["pages"], "application/vnd.apple.pkpass": ["pkpass"], "application/vnd.aristanetworks.swi": ["swi"], "application/vnd.astraea-software.iota": ["iota"], "application/vnd.audiograph": ["aep"], "application/vnd.balsamiq.bmml+xml": ["bmml"], "application/vnd.blueice.multipass": ["mpm"], "application/vnd.bmi": ["bmi"], "application/vnd.businessobjects": ["rep"], "application/vnd.chemdraw+xml": ["cdxml"], "application/vnd.chipnuts.karaoke-mmd": ["mmd"], "application/vnd.cinderella": ["cdy"], "application/vnd.citationstyles.style+xml": ["csl"], "application/vnd.claymore": ["cla"], "application/vnd.cloanto.rp9": ["rp9"], "application/vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"], "application/vnd.cluetrust.cartomobile-config": ["c11amc"], "application/vnd.cluetrust.cartomobile-config-pkg": ["c11amz"], "application/vnd.commonspace": ["csp"], "application/vnd.contact.cmsg": ["cdbcmsg"], "application/vnd.cosmocaller": ["cmc"], "application/vnd.crick.clicker": ["clkx"], "application/vnd.crick.clicker.keyboard": ["clkk"], "application/vnd.crick.clicker.palette": ["clkp"], "application/vnd.crick.clicker.template": ["clkt"], "application/vnd.crick.clicker.wordbank": ["clkw"], "application/vnd.criticaltools.wbs+xml": ["wbs"], "application/vnd.ctc-posml": ["pml"], "application/vnd.cups-ppd": ["ppd"], "application/vnd.curl.car": ["car"], "application/vnd.curl.pcurl": ["pcurl"], "application/vnd.dart": ["dart"], "application/vnd.data-vision.rdz": ["rdz"], "application/vnd.dbf": ["dbf"], "application/vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"], "application/vnd.dece.ttml+xml": ["uvt", "uvvt"], "application/vnd.dece.unspecified": ["uvx", "uvvx"], "application/vnd.dece.zip": ["uvz", "uvvz"], "application/vnd.denovo.fcselayout-link": ["fe_launch"], "application/vnd.dna": ["dna"], "application/vnd.dolby.mlp": ["mlp"], "application/vnd.dpgraph": ["dpg"], "application/vnd.dreamfactory": ["dfac"], "application/vnd.ds-keypoint": ["kpxx"], "application/vnd.dvb.ait": ["ait"], "application/vnd.dvb.service": ["svc"], "application/vnd.dynageo": ["geo"], "application/vnd.ecowin.chart": ["mag"], "application/vnd.enliven": ["nml"], "application/vnd.epson.esf": ["esf"], "application/vnd.epson.msf": ["msf"], "application/vnd.epson.quickanime": ["qam"], "application/vnd.epson.salt": ["slt"], "application/vnd.epson.ssf": ["ssf"], "application/vnd.eszigno3+xml": ["es3", "et3"], "application/vnd.ezpix-album": ["ez2"], "application/vnd.ezpix-package": ["ez3"], "application/vnd.fdf": ["fdf"], "application/vnd.fdsn.mseed": ["mseed"], "application/vnd.fdsn.seed": ["seed", "dataless"], "application/vnd.flographit": ["gph"], "application/vnd.fluxtime.clip": ["ftc"], "application/vnd.framemaker": ["fm", "frame", "maker", "book"], "application/vnd.frogans.fnc": ["fnc"], "application/vnd.frogans.ltf": ["ltf"], "application/vnd.fsc.weblaunch": ["fsc"], "application/vnd.fujitsu.oasys": ["oas"], "application/vnd.fujitsu.oasys2": ["oa2"], "application/vnd.fujitsu.oasys3": ["oa3"], "application/vnd.fujitsu.oasysgp": ["fg5"], "application/vnd.fujitsu.oasysprs": ["bh2"], "application/vnd.fujixerox.ddd": ["ddd"], "application/vnd.fujixerox.docuworks": ["xdw"], "application/vnd.fujixerox.docuworks.binder": ["xbd"], "application/vnd.fuzzysheet": ["fzs"], "application/vnd.genomatix.tuxedo": ["txd"], "application/vnd.geogebra.file": ["ggb"], "application/vnd.geogebra.tool": ["ggt"], "application/vnd.geometry-explorer": ["gex", "gre"], "application/vnd.geonext": ["gxt"], "application/vnd.geoplan": ["g2w"], "application/vnd.geospace": ["g3w"], "application/vnd.gmx": ["gmx"], "application/vnd.google-apps.document": ["gdoc"], "application/vnd.google-apps.presentation": ["gslides"], "application/vnd.google-apps.spreadsheet": ["gsheet"], "application/vnd.google-earth.kml+xml": ["kml"], "application/vnd.google-earth.kmz": ["kmz"], "application/vnd.grafeq": ["gqf", "gqs"], "application/vnd.groove-account": ["gac"], "application/vnd.groove-help": ["ghf"], "application/vnd.groove-identity-message": ["gim"], "application/vnd.groove-injector": ["grv"], "application/vnd.groove-tool-message": ["gtm"], "application/vnd.groove-tool-template": ["tpl"], "application/vnd.groove-vcard": ["vcg"], "application/vnd.hal+xml": ["hal"], "application/vnd.handheld-entertainment+xml": ["zmm"], "application/vnd.hbci": ["hbci"], "application/vnd.hhe.lesson-player": ["les"], "application/vnd.hp-hpgl": ["hpgl"], "application/vnd.hp-hpid": ["hpid"], "application/vnd.hp-hps": ["hps"], "application/vnd.hp-jlyt": ["jlt"], "application/vnd.hp-pcl": ["pcl"], "application/vnd.hp-pclxl": ["pclxl"], "application/vnd.hydrostatix.sof-data": ["sfd-hdstx"], "application/vnd.ibm.minipay": ["mpy"], "application/vnd.ibm.modcap": ["afp", "listafp", "list3820"], "application/vnd.ibm.rights-management": ["irm"], "application/vnd.ibm.secure-container": ["sc"], "application/vnd.iccprofile": ["icc", "icm"], "application/vnd.igloader": ["igl"], "application/vnd.immervision-ivp": ["ivp"], "application/vnd.immervision-ivu": ["ivu"], "application/vnd.insors.igm": ["igm"], "application/vnd.intercon.formnet": ["xpw", "xpx"], "application/vnd.intergeo": ["i2g"], "application/vnd.intu.qbo": ["qbo"], "application/vnd.intu.qfx": ["qfx"], "application/vnd.ipunplugged.rcprofile": ["rcprofile"], "application/vnd.irepository.package+xml": ["irp"], "application/vnd.is-xpr": ["xpr"], "application/vnd.isac.fcs": ["fcs"], "application/vnd.jam": ["jam"], "application/vnd.jcp.javame.midlet-rms": ["rms"], "application/vnd.jisp": ["jisp"], "application/vnd.joost.joda-archive": ["joda"], "application/vnd.kahootz": ["ktz", "ktr"], "application/vnd.kde.karbon": ["karbon"], "application/vnd.kde.kchart": ["chrt"], "application/vnd.kde.kformula": ["kfo"], "application/vnd.kde.kivio": ["flw"], "application/vnd.kde.kontour": ["kon"], "application/vnd.kde.kpresenter": ["kpr", "kpt"], "application/vnd.kde.kspread": ["ksp"], "application/vnd.kde.kword": ["kwd", "kwt"], "application/vnd.kenameaapp": ["htke"], "application/vnd.kidspiration": ["kia"], "application/vnd.kinar": ["kne", "knp"], "application/vnd.koan": ["skp", "skd", "skt", "skm"], "application/vnd.kodak-descriptor": ["sse"], "application/vnd.las.las+xml": ["lasxml"], "application/vnd.llamagraphics.life-balance.desktop": ["lbd"], "application/vnd.llamagraphics.life-balance.exchange+xml": ["lbe"], "application/vnd.lotus-1-2-3": ["123"], "application/vnd.lotus-approach": ["apr"], "application/vnd.lotus-freelance": ["pre"], "application/vnd.lotus-notes": ["nsf"], "application/vnd.lotus-organizer": ["org"], "application/vnd.lotus-screencam": ["scm"], "application/vnd.lotus-wordpro": ["lwp"], "application/vnd.macports.portpkg": ["portpkg"], "application/vnd.mapbox-vector-tile": ["mvt"], "application/vnd.mcd": ["mcd"], "application/vnd.medcalcdata": ["mc1"], "application/vnd.mediastation.cdkey": ["cdkey"], "application/vnd.mfer": ["mwf"], "application/vnd.mfmp": ["mfm"], "application/vnd.micrografx.flo": ["flo"], "application/vnd.micrografx.igx": ["igx"], "application/vnd.mif": ["mif"], "application/vnd.mobius.daf": ["daf"], "application/vnd.mobius.dis": ["dis"], "application/vnd.mobius.mbk": ["mbk"], "application/vnd.mobius.mqy": ["mqy"], "application/vnd.mobius.msl": ["msl"], "application/vnd.mobius.plc": ["plc"], "application/vnd.mobius.txf": ["txf"], "application/vnd.mophun.application": ["mpn"], "application/vnd.mophun.certificate": ["mpc"], "application/vnd.mozilla.xul+xml": ["xul"], "application/vnd.ms-artgalry": ["cil"], "application/vnd.ms-cab-compressed": ["cab"], "application/vnd.ms-excel": ["xls", "xlm", "xla", "xlc", "xlt", "xlw"], "application/vnd.ms-excel.addin.macroenabled.12": ["xlam"], "application/vnd.ms-excel.sheet.binary.macroenabled.12": ["xlsb"], "application/vnd.ms-excel.sheet.macroenabled.12": ["xlsm"], "application/vnd.ms-excel.template.macroenabled.12": ["xltm"], "application/vnd.ms-fontobject": ["eot"], "application/vnd.ms-htmlhelp": ["chm"], "application/vnd.ms-ims": ["ims"], "application/vnd.ms-lrm": ["lrm"], "application/vnd.ms-officetheme": ["thmx"], "application/vnd.ms-outlook": ["msg"], "application/vnd.ms-pki.seccat": ["cat"], "application/vnd.ms-pki.stl": ["*stl"], "application/vnd.ms-powerpoint": ["ppt", "pps", "pot"], "application/vnd.ms-powerpoint.addin.macroenabled.12": ["ppam"], "application/vnd.ms-powerpoint.presentation.macroenabled.12": ["pptm"], "application/vnd.ms-powerpoint.slide.macroenabled.12": ["sldm"], "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ["ppsm"], "application/vnd.ms-powerpoint.template.macroenabled.12": ["potm"], "application/vnd.ms-project": ["mpp", "mpt"], "application/vnd.ms-word.document.macroenabled.12": ["docm"], "application/vnd.ms-word.template.macroenabled.12": ["dotm"], "application/vnd.ms-works": ["wps", "wks", "wcm", "wdb"], "application/vnd.ms-wpl": ["wpl"], "application/vnd.ms-xpsdocument": ["xps"], "application/vnd.mseq": ["mseq"], "application/vnd.musician": ["mus"], "application/vnd.muvee.style": ["msty"], "application/vnd.mynfc": ["taglet"], "application/vnd.neurolanguage.nlu": ["nlu"], "application/vnd.nitf": ["ntf", "nitf"], "application/vnd.noblenet-directory": ["nnd"], "application/vnd.noblenet-sealer": ["nns"], "application/vnd.noblenet-web": ["nnw"], "application/vnd.nokia.n-gage.ac+xml": ["*ac"], "application/vnd.nokia.n-gage.data": ["ngdat"], "application/vnd.nokia.n-gage.symbian.install": ["n-gage"], "application/vnd.nokia.radio-preset": ["rpst"], "application/vnd.nokia.radio-presets": ["rpss"], "application/vnd.novadigm.edm": ["edm"], "application/vnd.novadigm.edx": ["edx"], "application/vnd.novadigm.ext": ["ext"], "application/vnd.oasis.opendocument.chart": ["odc"], "application/vnd.oasis.opendocument.chart-template": ["otc"], "application/vnd.oasis.opendocument.database": ["odb"], "application/vnd.oasis.opendocument.formula": ["odf"], "application/vnd.oasis.opendocument.formula-template": ["odft"], "application/vnd.oasis.opendocument.graphics": ["odg"], "application/vnd.oasis.opendocument.graphics-template": ["otg"], "application/vnd.oasis.opendocument.image": ["odi"], "application/vnd.oasis.opendocument.image-template": ["oti"], "application/vnd.oasis.opendocument.presentation": ["odp"], "application/vnd.oasis.opendocument.presentation-template": ["otp"], "application/vnd.oasis.opendocument.spreadsheet": ["ods"], "application/vnd.oasis.opendocument.spreadsheet-template": ["ots"], "application/vnd.oasis.opendocument.text": ["odt"], "application/vnd.oasis.opendocument.text-master": ["odm"], "application/vnd.oasis.opendocument.text-template": ["ott"], "application/vnd.oasis.opendocument.text-web": ["oth"], "application/vnd.olpc-sugar": ["xo"], "application/vnd.oma.dd2+xml": ["dd2"], "application/vnd.openblox.game+xml": ["obgx"], "application/vnd.openofficeorg.extension": ["oxt"], "application/vnd.openstreetmap.data+xml": ["osm"], "application/vnd.openxmlformats-officedocument.presentationml.presentation": ["pptx"], "application/vnd.openxmlformats-officedocument.presentationml.slide": ["sldx"], "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ["ppsx"], "application/vnd.openxmlformats-officedocument.presentationml.template": ["potx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ["xltx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ["dotx"], "application/vnd.osgeo.mapguide.package": ["mgp"], "application/vnd.osgi.dp": ["dp"], "application/vnd.osgi.subsystem": ["esa"], "application/vnd.palm": ["pdb", "pqa", "oprc"], "application/vnd.pawaafile": ["paw"], "application/vnd.pg.format": ["str"], "application/vnd.pg.osasli": ["ei6"], "application/vnd.picsel": ["efif"], "application/vnd.pmi.widget": ["wg"], "application/vnd.pocketlearn": ["plf"], "application/vnd.powerbuilder6": ["pbd"], "application/vnd.previewsystems.box": ["box"], "application/vnd.proteus.magazine": ["mgz"], "application/vnd.publishare-delta-tree": ["qps"], "application/vnd.pvi.ptid1": ["ptid"], "application/vnd.quark.quarkxpress": ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"], "application/vnd.rar": ["rar"], "application/vnd.realvnc.bed": ["bed"], "application/vnd.recordare.musicxml": ["mxl"], "application/vnd.recordare.musicxml+xml": ["musicxml"], "application/vnd.rig.cryptonote": ["cryptonote"], "application/vnd.rim.cod": ["cod"], "application/vnd.rn-realmedia": ["rm"], "application/vnd.rn-realmedia-vbr": ["rmvb"], "application/vnd.route66.link66+xml": ["link66"], "application/vnd.sailingtracker.track": ["st"], "application/vnd.seemail": ["see"], "application/vnd.sema": ["sema"], "application/vnd.semd": ["semd"], "application/vnd.semf": ["semf"], "application/vnd.shana.informed.formdata": ["ifm"], "application/vnd.shana.informed.formtemplate": ["itp"], "application/vnd.shana.informed.interchange": ["iif"], "application/vnd.shana.informed.package": ["ipk"], "application/vnd.simtech-mindmapper": ["twd", "twds"], "application/vnd.smaf": ["mmf"], "application/vnd.smart.teacher": ["teacher"], "application/vnd.software602.filler.form+xml": ["fo"], "application/vnd.solent.sdkm+xml": ["sdkm", "sdkd"], "application/vnd.spotfire.dxp": ["dxp"], "application/vnd.spotfire.sfs": ["sfs"], "application/vnd.stardivision.calc": ["sdc"], "application/vnd.stardivision.draw": ["sda"], "application/vnd.stardivision.impress": ["sdd"], "application/vnd.stardivision.math": ["smf"], "application/vnd.stardivision.writer": ["sdw", "vor"], "application/vnd.stardivision.writer-global": ["sgl"], "application/vnd.stepmania.package": ["smzip"], "application/vnd.stepmania.stepchart": ["sm"], "application/vnd.sun.wadl+xml": ["wadl"], "application/vnd.sun.xml.calc": ["sxc"], "application/vnd.sun.xml.calc.template": ["stc"], "application/vnd.sun.xml.draw": ["sxd"], "application/vnd.sun.xml.draw.template": ["std"], "application/vnd.sun.xml.impress": ["sxi"], "application/vnd.sun.xml.impress.template": ["sti"], "application/vnd.sun.xml.math": ["sxm"], "application/vnd.sun.xml.writer": ["sxw"], "application/vnd.sun.xml.writer.global": ["sxg"], "application/vnd.sun.xml.writer.template": ["stw"], "application/vnd.sus-calendar": ["sus", "susp"], "application/vnd.svd": ["svd"], "application/vnd.symbian.install": ["sis", "sisx"], "application/vnd.syncml+xml": ["xsm"], "application/vnd.syncml.dm+wbxml": ["bdm"], "application/vnd.syncml.dm+xml": ["xdm"], "application/vnd.syncml.dmddf+xml": ["ddf"], "application/vnd.tao.intent-module-archive": ["tao"], "application/vnd.tcpdump.pcap": ["pcap", "cap", "dmp"], "application/vnd.tmobile-livetv": ["tmo"], "application/vnd.trid.tpt": ["tpt"], "application/vnd.triscape.mxs": ["mxs"], "application/vnd.trueapp": ["tra"], "application/vnd.ufdl": ["ufd", "ufdl"], "application/vnd.uiq.theme": ["utz"], "application/vnd.umajin": ["umj"], "application/vnd.unity": ["unityweb"], "application/vnd.uoml+xml": ["uoml"], "application/vnd.vcx": ["vcx"], "application/vnd.visio": ["vsd", "vst", "vss", "vsw"], "application/vnd.visionary": ["vis"], "application/vnd.vsf": ["vsf"], "application/vnd.wap.wbxml": ["wbxml"], "application/vnd.wap.wmlc": ["wmlc"], "application/vnd.wap.wmlscriptc": ["wmlsc"], "application/vnd.webturbo": ["wtb"], "application/vnd.wolfram.player": ["nbp"], "application/vnd.wordperfect": ["wpd"], "application/vnd.wqd": ["wqd"], "application/vnd.wt.stf": ["stf"], "application/vnd.xara": ["xar"], "application/vnd.xfdl": ["xfdl"], "application/vnd.yamaha.hv-dic": ["hvd"], "application/vnd.yamaha.hv-script": ["hvs"], "application/vnd.yamaha.hv-voice": ["hvp"], "application/vnd.yamaha.openscoreformat": ["osf"], "application/vnd.yamaha.openscoreformat.osfpvg+xml": ["osfpvg"], "application/vnd.yamaha.smaf-audio": ["saf"], "application/vnd.yamaha.smaf-phrase": ["spf"], "application/vnd.yellowriver-custom-menu": ["cmp"], "application/vnd.zul": ["zir", "zirz"], "application/vnd.zzazz.deck+xml": ["zaz"], "application/x-7z-compressed": ["7z"], "application/x-abiword": ["abw"], "application/x-ace-compressed": ["ace"], "application/x-apple-diskimage": ["*dmg"], "application/x-arj": ["arj"], "application/x-authorware-bin": ["aab", "x32", "u32", "vox"], "application/x-authorware-map": ["aam"], "application/x-authorware-seg": ["aas"], "application/x-bcpio": ["bcpio"], "application/x-bdoc": ["*bdoc"], "application/x-bittorrent": ["torrent"], "application/x-blorb": ["blb", "blorb"], "application/x-bzip": ["bz"], "application/x-bzip2": ["bz2", "boz"], "application/x-cbr": ["cbr", "cba", "cbt", "cbz", "cb7"], "application/x-cdlink": ["vcd"], "application/x-cfs-compressed": ["cfs"], "application/x-chat": ["chat"], "application/x-chess-pgn": ["pgn"], "application/x-chrome-extension": ["crx"], "application/x-cocoa": ["cco"], "application/x-conference": ["nsc"], "application/x-cpio": ["cpio"], "application/x-csh": ["csh"], "application/x-debian-package": ["*deb", "udeb"], "application/x-dgc-compressed": ["dgc"], "application/x-director": ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"], "application/x-doom": ["wad"], "application/x-dtbncx+xml": ["ncx"], "application/x-dtbook+xml": ["dtb"], "application/x-dtbresource+xml": ["res"], "application/x-dvi": ["dvi"], "application/x-envoy": ["evy"], "application/x-eva": ["eva"], "application/x-font-bdf": ["bdf"], "application/x-font-ghostscript": ["gsf"], "application/x-font-linux-psf": ["psf"], "application/x-font-pcf": ["pcf"], "application/x-font-snf": ["snf"], "application/x-font-type1": ["pfa", "pfb", "pfm", "afm"], "application/x-freearc": ["arc"], "application/x-futuresplash": ["spl"], "application/x-gca-compressed": ["gca"], "application/x-glulx": ["ulx"], "application/x-gnumeric": ["gnumeric"], "application/x-gramps-xml": ["gramps"], "application/x-gtar": ["gtar"], "application/x-hdf": ["hdf"], "application/x-httpd-php": ["php"], "application/x-install-instructions": ["install"], "application/x-iso9660-image": ["*iso"], "application/x-iwork-keynote-sffkey": ["*key"], "application/x-iwork-numbers-sffnumbers": ["*numbers"], "application/x-iwork-pages-sffpages": ["*pages"], "application/x-java-archive-diff": ["jardiff"], "application/x-java-jnlp-file": ["jnlp"], "application/x-keepass2": ["kdbx"], "application/x-latex": ["latex"], "application/x-lua-bytecode": ["luac"], "application/x-lzh-compressed": ["lzh", "lha"], "application/x-makeself": ["run"], "application/x-mie": ["mie"], "application/x-mobipocket-ebook": ["prc", "mobi"], "application/x-ms-application": ["application"], "application/x-ms-shortcut": ["lnk"], "application/x-ms-wmd": ["wmd"], "application/x-ms-wmz": ["wmz"], "application/x-ms-xbap": ["xbap"], "application/x-msaccess": ["mdb"], "application/x-msbinder": ["obd"], "application/x-mscardfile": ["crd"], "application/x-msclip": ["clp"], "application/x-msdos-program": ["*exe"], "application/x-msdownload": ["*exe", "*dll", "com", "bat", "*msi"], "application/x-msmediaview": ["mvb", "m13", "m14"], "application/x-msmetafile": ["*wmf", "*wmz", "*emf", "emz"], "application/x-msmoney": ["mny"], "application/x-mspublisher": ["pub"], "application/x-msschedule": ["scd"], "application/x-msterminal": ["trm"], "application/x-mswrite": ["wri"], "application/x-netcdf": ["nc", "cdf"], "application/x-ns-proxy-autoconfig": ["pac"], "application/x-nzb": ["nzb"], "application/x-perl": ["pl", "pm"], "application/x-pilot": ["*prc", "*pdb"], "application/x-pkcs12": ["p12", "pfx"], "application/x-pkcs7-certificates": ["p7b", "spc"], "application/x-pkcs7-certreqresp": ["p7r"], "application/x-rar-compressed": ["*rar"], "application/x-redhat-package-manager": ["rpm"], "application/x-research-info-systems": ["ris"], "application/x-sea": ["sea"], "application/x-sh": ["sh"], "application/x-shar": ["shar"], "application/x-shockwave-flash": ["swf"], "application/x-silverlight-app": ["xap"], "application/x-sql": ["sql"], "application/x-stuffit": ["sit"], "application/x-stuffitx": ["sitx"], "application/x-subrip": ["srt"], "application/x-sv4cpio": ["sv4cpio"], "application/x-sv4crc": ["sv4crc"], "application/x-t3vm-image": ["t3"], "application/x-tads": ["gam"], "application/x-tar": ["tar"], "application/x-tcl": ["tcl", "tk"], "application/x-tex": ["tex"], "application/x-tex-tfm": ["tfm"], "application/x-texinfo": ["texinfo", "texi"], "application/x-tgif": ["*obj"], "application/x-ustar": ["ustar"], "application/x-virtualbox-hdd": ["hdd"], "application/x-virtualbox-ova": ["ova"], "application/x-virtualbox-ovf": ["ovf"], "application/x-virtualbox-vbox": ["vbox"], "application/x-virtualbox-vbox-extpack": ["vbox-extpack"], "application/x-virtualbox-vdi": ["vdi"], "application/x-virtualbox-vhd": ["vhd"], "application/x-virtualbox-vmdk": ["vmdk"], "application/x-wais-source": ["src"], "application/x-web-app-manifest+json": ["webapp"], "application/x-x509-ca-cert": ["der", "crt", "pem"], "application/x-xfig": ["fig"], "application/x-xliff+xml": ["*xlf"], "application/x-xpinstall": ["xpi"], "application/x-xz": ["xz"], "application/x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"], "audio/vnd.dece.audio": ["uva", "uvva"], "audio/vnd.digital-winds": ["eol"], "audio/vnd.dra": ["dra"], "audio/vnd.dts": ["dts"], "audio/vnd.dts.hd": ["dtshd"], "audio/vnd.lucent.voice": ["lvp"], "audio/vnd.ms-playready.media.pya": ["pya"], "audio/vnd.nuera.ecelp4800": ["ecelp4800"], "audio/vnd.nuera.ecelp7470": ["ecelp7470"], "audio/vnd.nuera.ecelp9600": ["ecelp9600"], "audio/vnd.rip": ["rip"], "audio/x-aac": ["aac"], "audio/x-aiff": ["aif", "aiff", "aifc"], "audio/x-caf": ["caf"], "audio/x-flac": ["flac"], "audio/x-m4a": ["*m4a"], "audio/x-matroska": ["mka"], "audio/x-mpegurl": ["m3u"], "audio/x-ms-wax": ["wax"], "audio/x-ms-wma": ["wma"], "audio/x-pn-realaudio": ["ram", "ra"], "audio/x-pn-realaudio-plugin": ["rmp"], "audio/x-realaudio": ["*ra"], "audio/x-wav": ["*wav"], "chemical/x-cdx": ["cdx"], "chemical/x-cif": ["cif"], "chemical/x-cmdf": ["cmdf"], "chemical/x-cml": ["cml"], "chemical/x-csml": ["csml"], "chemical/x-xyz": ["xyz"], "image/prs.btif": ["btif"], "image/prs.pti": ["pti"], "image/vnd.adobe.photoshop": ["psd"], "image/vnd.airzip.accelerator.azv": ["azv"], "image/vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"], "image/vnd.djvu": ["djvu", "djv"], "image/vnd.dvb.subtitle": ["*sub"], "image/vnd.dwg": ["dwg"], "image/vnd.dxf": ["dxf"], "image/vnd.fastbidsheet": ["fbs"], "image/vnd.fpx": ["fpx"], "image/vnd.fst": ["fst"], "image/vnd.fujixerox.edmics-mmr": ["mmr"], "image/vnd.fujixerox.edmics-rlc": ["rlc"], "image/vnd.microsoft.icon": ["ico"], "image/vnd.ms-dds": ["dds"], "image/vnd.ms-modi": ["mdi"], "image/vnd.ms-photo": ["wdp"], "image/vnd.net-fpx": ["npx"], "image/vnd.pco.b16": ["b16"], "image/vnd.tencent.tap": ["tap"], "image/vnd.valve.source.texture": ["vtf"], "image/vnd.wap.wbmp": ["wbmp"], "image/vnd.xiff": ["xif"], "image/vnd.zbrush.pcx": ["pcx"], "image/x-3ds": ["3ds"], "image/x-cmu-raster": ["ras"], "image/x-cmx": ["cmx"], "image/x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"], "image/x-icon": ["*ico"], "image/x-jng": ["jng"], "image/x-mrsid-image": ["sid"], "image/x-ms-bmp": ["*bmp"], "image/x-pcx": ["*pcx"], "image/x-pict": ["pic", "pct"], "image/x-portable-anymap": ["pnm"], "image/x-portable-bitmap": ["pbm"], "image/x-portable-graymap": ["pgm"], "image/x-portable-pixmap": ["ppm"], "image/x-rgb": ["rgb"], "image/x-tga": ["tga"], "image/x-xbitmap": ["xbm"], "image/x-xpixmap": ["xpm"], "image/x-xwindowdump": ["xwd"], "message/vnd.wfa.wsc": ["wsc"], "model/vnd.collada+xml": ["dae"], "model/vnd.dwf": ["dwf"], "model/vnd.gdl": ["gdl"], "model/vnd.gtw": ["gtw"], "model/vnd.mts": ["mts"], "model/vnd.opengex": ["ogex"], "model/vnd.parasolid.transmit.binary": ["x_b"], "model/vnd.parasolid.transmit.text": ["x_t"], "model/vnd.sap.vds": ["vds"], "model/vnd.usdz+zip": ["usdz"], "model/vnd.valve.source.compiled-map": ["bsp"], "model/vnd.vtu": ["vtu"], "text/prs.lines.tag": ["dsc"], "text/vnd.curl": ["curl"], "text/vnd.curl.dcurl": ["dcurl"], "text/vnd.curl.mcurl": ["mcurl"], "text/vnd.curl.scurl": ["scurl"], "text/vnd.dvb.subtitle": ["sub"], "text/vnd.fly": ["fly"], "text/vnd.fmi.flexstor": ["flx"], "text/vnd.graphviz": ["gv"], "text/vnd.in3d.3dml": ["3dml"], "text/vnd.in3d.spot": ["spot"], "text/vnd.sun.j2me.app-descriptor": ["jad"], "text/vnd.wap.wml": ["wml"], "text/vnd.wap.wmlscript": ["wmls"], "text/x-asm": ["s", "asm"], "text/x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"], "text/x-component": ["htc"], "text/x-fortran": ["f", "for", "f77", "f90"], "text/x-handlebars-template": ["hbs"], "text/x-java-source": ["java"], "text/x-lua": ["lua"], "text/x-markdown": ["mkd"], "text/x-nfo": ["nfo"], "text/x-opml": ["opml"], "text/x-org": ["*org"], "text/x-pascal": ["p", "pas"], "text/x-processing": ["pde"], "text/x-sass": ["sass"], "text/x-scss": ["scss"], "text/x-setext": ["etx"], "text/x-sfv": ["sfv"], "text/x-suse-ymp": ["ymp"], "text/x-uuencode": ["uu"], "text/x-vcalendar": ["vcs"], "text/x-vcard": ["vcf"], "video/vnd.dece.hd": ["uvh", "uvvh"], "video/vnd.dece.mobile": ["uvm", "uvvm"], "video/vnd.dece.pd": ["uvp", "uvvp"], "video/vnd.dece.sd": ["uvs", "uvvs"], "video/vnd.dece.video": ["uvv", "uvvv"], "video/vnd.dvb.file": ["dvb"], "video/vnd.fvt": ["fvt"], "video/vnd.mpegurl": ["mxu", "m4u"], "video/vnd.ms-playready.media.pyv": ["pyv"], "video/vnd.uvvu.mp4": ["uvu", "uvvu"], "video/vnd.vivo": ["viv"], "video/x-f4v": ["f4v"], "video/x-fli": ["fli"], "video/x-flv": ["flv"], "video/x-m4v": ["m4v"], "video/x-matroska": ["mkv", "mk3d", "mks"], "video/x-mng": ["mng"], "video/x-ms-asf": ["asf", "asx"], "video/x-ms-vob": ["vob"], "video/x-ms-wm": ["wm"], "video/x-ms-wmv": ["wmv"], "video/x-ms-wmx": ["wmx"], "video/x-ms-wvx": ["wvx"], "video/x-msvideo": ["avi"], "video/x-sgi-movie": ["movie"], "video/x-smv": ["smv"], "x-conference/x-cooltalk": ["ice"] }; + } +}); + +// node_modules/mime/index.js +var require_mime3 = __commonJS({ + "node_modules/mime/index.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var Mime = require_Mime(); + module2.exports = new Mime(require_standard(), require_other()); + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/decode.json +var require_decode3 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/decode.json"(exports2, module2) { + module2.exports = { "0": 65533, "128": 8364, "130": 8218, "131": 402, "132": 8222, "133": 8230, "134": 8224, "135": 8225, "136": 710, "137": 8240, "138": 352, "139": 8249, "140": 338, "142": 381, "145": 8216, "146": 8217, "147": 8220, "148": 8221, "149": 8226, "150": 8211, "151": 8212, "152": 732, "153": 8482, "154": 353, "155": 8250, "156": 339, "158": 382, "159": 376 }; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +var require_decode_codepoint3 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + var decode_json_1 = __importDefault2(require_decode3()); + var fromCodePoint = ( + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + String.fromCodePoint || function(codePoint) { + var output = ""; + if (codePoint > 65535) { + codePoint -= 65536; + output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); + codePoint = 56320 | codePoint & 1023; + } + output += String.fromCharCode(codePoint); + return output; + } + ); + function decodeCodePoint(codePoint) { + if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { + return "\uFFFD"; + } + if (codePoint in decode_json_1.default) { + codePoint = decode_json_1.default[codePoint]; + } + return fromCodePoint(codePoint); + } + exports2.default = decodeCodePoint; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/entities.json +var require_entities = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/entities.json"(exports2, module2) { + module2.exports = { Aacute: "\xC1", aacute: "\xE1", Abreve: "\u0102", abreve: "\u0103", ac: "\u223E", acd: "\u223F", acE: "\u223E\u0333", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", Acy: "\u0410", acy: "\u0430", AElig: "\xC6", aelig: "\xE6", af: "\u2061", Afr: "\u{1D504}", afr: "\u{1D51E}", Agrave: "\xC0", agrave: "\xE0", alefsym: "\u2135", aleph: "\u2135", Alpha: "\u0391", alpha: "\u03B1", Amacr: "\u0100", amacr: "\u0101", amalg: "\u2A3F", amp: "&", AMP: "&", andand: "\u2A55", And: "\u2A53", and: "\u2227", andd: "\u2A5C", andslope: "\u2A58", andv: "\u2A5A", ang: "\u2220", ange: "\u29A4", angle: "\u2220", angmsdaa: "\u29A8", angmsdab: "\u29A9", angmsdac: "\u29AA", angmsdad: "\u29AB", angmsdae: "\u29AC", angmsdaf: "\u29AD", angmsdag: "\u29AE", angmsdah: "\u29AF", angmsd: "\u2221", angrt: "\u221F", angrtvb: "\u22BE", angrtvbd: "\u299D", angsph: "\u2222", angst: "\xC5", angzarr: "\u237C", Aogon: "\u0104", aogon: "\u0105", Aopf: "\u{1D538}", aopf: "\u{1D552}", apacir: "\u2A6F", ap: "\u2248", apE: "\u2A70", ape: "\u224A", apid: "\u224B", apos: "'", ApplyFunction: "\u2061", approx: "\u2248", approxeq: "\u224A", Aring: "\xC5", aring: "\xE5", Ascr: "\u{1D49C}", ascr: "\u{1D4B6}", Assign: "\u2254", ast: "*", asymp: "\u2248", asympeq: "\u224D", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", awconint: "\u2233", awint: "\u2A11", backcong: "\u224C", backepsilon: "\u03F6", backprime: "\u2035", backsim: "\u223D", backsimeq: "\u22CD", Backslash: "\u2216", Barv: "\u2AE7", barvee: "\u22BD", barwed: "\u2305", Barwed: "\u2306", barwedge: "\u2305", bbrk: "\u23B5", bbrktbrk: "\u23B6", bcong: "\u224C", Bcy: "\u0411", bcy: "\u0431", bdquo: "\u201E", becaus: "\u2235", because: "\u2235", Because: "\u2235", bemptyv: "\u29B0", bepsi: "\u03F6", bernou: "\u212C", Bernoullis: "\u212C", Beta: "\u0392", beta: "\u03B2", beth: "\u2136", between: "\u226C", Bfr: "\u{1D505}", bfr: "\u{1D51F}", bigcap: "\u22C2", bigcirc: "\u25EF", bigcup: "\u22C3", bigodot: "\u2A00", bigoplus: "\u2A01", bigotimes: "\u2A02", bigsqcup: "\u2A06", bigstar: "\u2605", bigtriangledown: "\u25BD", bigtriangleup: "\u25B3", biguplus: "\u2A04", bigvee: "\u22C1", bigwedge: "\u22C0", bkarow: "\u290D", blacklozenge: "\u29EB", blacksquare: "\u25AA", blacktriangle: "\u25B4", blacktriangledown: "\u25BE", blacktriangleleft: "\u25C2", blacktriangleright: "\u25B8", blank: "\u2423", blk12: "\u2592", blk14: "\u2591", blk34: "\u2593", block: "\u2588", bne: "=\u20E5", bnequiv: "\u2261\u20E5", bNot: "\u2AED", bnot: "\u2310", Bopf: "\u{1D539}", bopf: "\u{1D553}", bot: "\u22A5", bottom: "\u22A5", bowtie: "\u22C8", boxbox: "\u29C9", boxdl: "\u2510", boxdL: "\u2555", boxDl: "\u2556", boxDL: "\u2557", boxdr: "\u250C", boxdR: "\u2552", boxDr: "\u2553", boxDR: "\u2554", boxh: "\u2500", boxH: "\u2550", boxhd: "\u252C", boxHd: "\u2564", boxhD: "\u2565", boxHD: "\u2566", boxhu: "\u2534", boxHu: "\u2567", boxhU: "\u2568", boxHU: "\u2569", boxminus: "\u229F", boxplus: "\u229E", boxtimes: "\u22A0", boxul: "\u2518", boxuL: "\u255B", boxUl: "\u255C", boxUL: "\u255D", boxur: "\u2514", boxuR: "\u2558", boxUr: "\u2559", boxUR: "\u255A", boxv: "\u2502", boxV: "\u2551", boxvh: "\u253C", boxvH: "\u256A", boxVh: "\u256B", boxVH: "\u256C", boxvl: "\u2524", boxvL: "\u2561", boxVl: "\u2562", boxVL: "\u2563", boxvr: "\u251C", boxvR: "\u255E", boxVr: "\u255F", boxVR: "\u2560", bprime: "\u2035", breve: "\u02D8", Breve: "\u02D8", brvbar: "\xA6", bscr: "\u{1D4B7}", Bscr: "\u212C", bsemi: "\u204F", bsim: "\u223D", bsime: "\u22CD", bsolb: "\u29C5", bsol: "\\", bsolhsub: "\u27C8", bull: "\u2022", bullet: "\u2022", bump: "\u224E", bumpE: "\u2AAE", bumpe: "\u224F", Bumpeq: "\u224E", bumpeq: "\u224F", Cacute: "\u0106", cacute: "\u0107", capand: "\u2A44", capbrcup: "\u2A49", capcap: "\u2A4B", cap: "\u2229", Cap: "\u22D2", capcup: "\u2A47", capdot: "\u2A40", CapitalDifferentialD: "\u2145", caps: "\u2229\uFE00", caret: "\u2041", caron: "\u02C7", Cayleys: "\u212D", ccaps: "\u2A4D", Ccaron: "\u010C", ccaron: "\u010D", Ccedil: "\xC7", ccedil: "\xE7", Ccirc: "\u0108", ccirc: "\u0109", Cconint: "\u2230", ccups: "\u2A4C", ccupssm: "\u2A50", Cdot: "\u010A", cdot: "\u010B", cedil: "\xB8", Cedilla: "\xB8", cemptyv: "\u29B2", cent: "\xA2", centerdot: "\xB7", CenterDot: "\xB7", cfr: "\u{1D520}", Cfr: "\u212D", CHcy: "\u0427", chcy: "\u0447", check: "\u2713", checkmark: "\u2713", Chi: "\u03A7", chi: "\u03C7", circ: "\u02C6", circeq: "\u2257", circlearrowleft: "\u21BA", circlearrowright: "\u21BB", circledast: "\u229B", circledcirc: "\u229A", circleddash: "\u229D", CircleDot: "\u2299", circledR: "\xAE", circledS: "\u24C8", CircleMinus: "\u2296", CirclePlus: "\u2295", CircleTimes: "\u2297", cir: "\u25CB", cirE: "\u29C3", cire: "\u2257", cirfnint: "\u2A10", cirmid: "\u2AEF", cirscir: "\u29C2", ClockwiseContourIntegral: "\u2232", CloseCurlyDoubleQuote: "\u201D", CloseCurlyQuote: "\u2019", clubs: "\u2663", clubsuit: "\u2663", colon: ":", Colon: "\u2237", Colone: "\u2A74", colone: "\u2254", coloneq: "\u2254", comma: ",", commat: "@", comp: "\u2201", compfn: "\u2218", complement: "\u2201", complexes: "\u2102", cong: "\u2245", congdot: "\u2A6D", Congruent: "\u2261", conint: "\u222E", Conint: "\u222F", ContourIntegral: "\u222E", copf: "\u{1D554}", Copf: "\u2102", coprod: "\u2210", Coproduct: "\u2210", copy: "\xA9", COPY: "\xA9", copysr: "\u2117", CounterClockwiseContourIntegral: "\u2233", crarr: "\u21B5", cross: "\u2717", Cross: "\u2A2F", Cscr: "\u{1D49E}", cscr: "\u{1D4B8}", csub: "\u2ACF", csube: "\u2AD1", csup: "\u2AD0", csupe: "\u2AD2", ctdot: "\u22EF", cudarrl: "\u2938", cudarrr: "\u2935", cuepr: "\u22DE", cuesc: "\u22DF", cularr: "\u21B6", cularrp: "\u293D", cupbrcap: "\u2A48", cupcap: "\u2A46", CupCap: "\u224D", cup: "\u222A", Cup: "\u22D3", cupcup: "\u2A4A", cupdot: "\u228D", cupor: "\u2A45", cups: "\u222A\uFE00", curarr: "\u21B7", curarrm: "\u293C", curlyeqprec: "\u22DE", curlyeqsucc: "\u22DF", curlyvee: "\u22CE", curlywedge: "\u22CF", curren: "\xA4", curvearrowleft: "\u21B6", curvearrowright: "\u21B7", cuvee: "\u22CE", cuwed: "\u22CF", cwconint: "\u2232", cwint: "\u2231", cylcty: "\u232D", dagger: "\u2020", Dagger: "\u2021", daleth: "\u2138", darr: "\u2193", Darr: "\u21A1", dArr: "\u21D3", dash: "\u2010", Dashv: "\u2AE4", dashv: "\u22A3", dbkarow: "\u290F", dblac: "\u02DD", Dcaron: "\u010E", dcaron: "\u010F", Dcy: "\u0414", dcy: "\u0434", ddagger: "\u2021", ddarr: "\u21CA", DD: "\u2145", dd: "\u2146", DDotrahd: "\u2911", ddotseq: "\u2A77", deg: "\xB0", Del: "\u2207", Delta: "\u0394", delta: "\u03B4", demptyv: "\u29B1", dfisht: "\u297F", Dfr: "\u{1D507}", dfr: "\u{1D521}", dHar: "\u2965", dharl: "\u21C3", dharr: "\u21C2", DiacriticalAcute: "\xB4", DiacriticalDot: "\u02D9", DiacriticalDoubleAcute: "\u02DD", DiacriticalGrave: "`", DiacriticalTilde: "\u02DC", diam: "\u22C4", diamond: "\u22C4", Diamond: "\u22C4", diamondsuit: "\u2666", diams: "\u2666", die: "\xA8", DifferentialD: "\u2146", digamma: "\u03DD", disin: "\u22F2", div: "\xF7", divide: "\xF7", divideontimes: "\u22C7", divonx: "\u22C7", DJcy: "\u0402", djcy: "\u0452", dlcorn: "\u231E", dlcrop: "\u230D", dollar: "$", Dopf: "\u{1D53B}", dopf: "\u{1D555}", Dot: "\xA8", dot: "\u02D9", DotDot: "\u20DC", doteq: "\u2250", doteqdot: "\u2251", DotEqual: "\u2250", dotminus: "\u2238", dotplus: "\u2214", dotsquare: "\u22A1", doublebarwedge: "\u2306", DoubleContourIntegral: "\u222F", DoubleDot: "\xA8", DoubleDownArrow: "\u21D3", DoubleLeftArrow: "\u21D0", DoubleLeftRightArrow: "\u21D4", DoubleLeftTee: "\u2AE4", DoubleLongLeftArrow: "\u27F8", DoubleLongLeftRightArrow: "\u27FA", DoubleLongRightArrow: "\u27F9", DoubleRightArrow: "\u21D2", DoubleRightTee: "\u22A8", DoubleUpArrow: "\u21D1", DoubleUpDownArrow: "\u21D5", DoubleVerticalBar: "\u2225", DownArrowBar: "\u2913", downarrow: "\u2193", DownArrow: "\u2193", Downarrow: "\u21D3", DownArrowUpArrow: "\u21F5", DownBreve: "\u0311", downdownarrows: "\u21CA", downharpoonleft: "\u21C3", downharpoonright: "\u21C2", DownLeftRightVector: "\u2950", DownLeftTeeVector: "\u295E", DownLeftVectorBar: "\u2956", DownLeftVector: "\u21BD", DownRightTeeVector: "\u295F", DownRightVectorBar: "\u2957", DownRightVector: "\u21C1", DownTeeArrow: "\u21A7", DownTee: "\u22A4", drbkarow: "\u2910", drcorn: "\u231F", drcrop: "\u230C", Dscr: "\u{1D49F}", dscr: "\u{1D4B9}", DScy: "\u0405", dscy: "\u0455", dsol: "\u29F6", Dstrok: "\u0110", dstrok: "\u0111", dtdot: "\u22F1", dtri: "\u25BF", dtrif: "\u25BE", duarr: "\u21F5", duhar: "\u296F", dwangle: "\u29A6", DZcy: "\u040F", dzcy: "\u045F", dzigrarr: "\u27FF", Eacute: "\xC9", eacute: "\xE9", easter: "\u2A6E", Ecaron: "\u011A", ecaron: "\u011B", Ecirc: "\xCA", ecirc: "\xEA", ecir: "\u2256", ecolon: "\u2255", Ecy: "\u042D", ecy: "\u044D", eDDot: "\u2A77", Edot: "\u0116", edot: "\u0117", eDot: "\u2251", ee: "\u2147", efDot: "\u2252", Efr: "\u{1D508}", efr: "\u{1D522}", eg: "\u2A9A", Egrave: "\xC8", egrave: "\xE8", egs: "\u2A96", egsdot: "\u2A98", el: "\u2A99", Element: "\u2208", elinters: "\u23E7", ell: "\u2113", els: "\u2A95", elsdot: "\u2A97", Emacr: "\u0112", emacr: "\u0113", empty: "\u2205", emptyset: "\u2205", EmptySmallSquare: "\u25FB", emptyv: "\u2205", EmptyVerySmallSquare: "\u25AB", emsp13: "\u2004", emsp14: "\u2005", emsp: "\u2003", ENG: "\u014A", eng: "\u014B", ensp: "\u2002", Eogon: "\u0118", eogon: "\u0119", Eopf: "\u{1D53C}", eopf: "\u{1D556}", epar: "\u22D5", eparsl: "\u29E3", eplus: "\u2A71", epsi: "\u03B5", Epsilon: "\u0395", epsilon: "\u03B5", epsiv: "\u03F5", eqcirc: "\u2256", eqcolon: "\u2255", eqsim: "\u2242", eqslantgtr: "\u2A96", eqslantless: "\u2A95", Equal: "\u2A75", equals: "=", EqualTilde: "\u2242", equest: "\u225F", Equilibrium: "\u21CC", equiv: "\u2261", equivDD: "\u2A78", eqvparsl: "\u29E5", erarr: "\u2971", erDot: "\u2253", escr: "\u212F", Escr: "\u2130", esdot: "\u2250", Esim: "\u2A73", esim: "\u2242", Eta: "\u0397", eta: "\u03B7", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", euro: "\u20AC", excl: "!", exist: "\u2203", Exists: "\u2203", expectation: "\u2130", exponentiale: "\u2147", ExponentialE: "\u2147", fallingdotseq: "\u2252", Fcy: "\u0424", fcy: "\u0444", female: "\u2640", ffilig: "\uFB03", fflig: "\uFB00", ffllig: "\uFB04", Ffr: "\u{1D509}", ffr: "\u{1D523}", filig: "\uFB01", FilledSmallSquare: "\u25FC", FilledVerySmallSquare: "\u25AA", fjlig: "fj", flat: "\u266D", fllig: "\uFB02", fltns: "\u25B1", fnof: "\u0192", Fopf: "\u{1D53D}", fopf: "\u{1D557}", forall: "\u2200", ForAll: "\u2200", fork: "\u22D4", forkv: "\u2AD9", Fouriertrf: "\u2131", fpartint: "\u2A0D", frac12: "\xBD", frac13: "\u2153", frac14: "\xBC", frac15: "\u2155", frac16: "\u2159", frac18: "\u215B", frac23: "\u2154", frac25: "\u2156", frac34: "\xBE", frac35: "\u2157", frac38: "\u215C", frac45: "\u2158", frac56: "\u215A", frac58: "\u215D", frac78: "\u215E", frasl: "\u2044", frown: "\u2322", fscr: "\u{1D4BB}", Fscr: "\u2131", gacute: "\u01F5", Gamma: "\u0393", gamma: "\u03B3", Gammad: "\u03DC", gammad: "\u03DD", gap: "\u2A86", Gbreve: "\u011E", gbreve: "\u011F", Gcedil: "\u0122", Gcirc: "\u011C", gcirc: "\u011D", Gcy: "\u0413", gcy: "\u0433", Gdot: "\u0120", gdot: "\u0121", ge: "\u2265", gE: "\u2267", gEl: "\u2A8C", gel: "\u22DB", geq: "\u2265", geqq: "\u2267", geqslant: "\u2A7E", gescc: "\u2AA9", ges: "\u2A7E", gesdot: "\u2A80", gesdoto: "\u2A82", gesdotol: "\u2A84", gesl: "\u22DB\uFE00", gesles: "\u2A94", Gfr: "\u{1D50A}", gfr: "\u{1D524}", gg: "\u226B", Gg: "\u22D9", ggg: "\u22D9", gimel: "\u2137", GJcy: "\u0403", gjcy: "\u0453", gla: "\u2AA5", gl: "\u2277", glE: "\u2A92", glj: "\u2AA4", gnap: "\u2A8A", gnapprox: "\u2A8A", gne: "\u2A88", gnE: "\u2269", gneq: "\u2A88", gneqq: "\u2269", gnsim: "\u22E7", Gopf: "\u{1D53E}", gopf: "\u{1D558}", grave: "`", GreaterEqual: "\u2265", GreaterEqualLess: "\u22DB", GreaterFullEqual: "\u2267", GreaterGreater: "\u2AA2", GreaterLess: "\u2277", GreaterSlantEqual: "\u2A7E", GreaterTilde: "\u2273", Gscr: "\u{1D4A2}", gscr: "\u210A", gsim: "\u2273", gsime: "\u2A8E", gsiml: "\u2A90", gtcc: "\u2AA7", gtcir: "\u2A7A", gt: ">", GT: ">", Gt: "\u226B", gtdot: "\u22D7", gtlPar: "\u2995", gtquest: "\u2A7C", gtrapprox: "\u2A86", gtrarr: "\u2978", gtrdot: "\u22D7", gtreqless: "\u22DB", gtreqqless: "\u2A8C", gtrless: "\u2277", gtrsim: "\u2273", gvertneqq: "\u2269\uFE00", gvnE: "\u2269\uFE00", Hacek: "\u02C7", hairsp: "\u200A", half: "\xBD", hamilt: "\u210B", HARDcy: "\u042A", hardcy: "\u044A", harrcir: "\u2948", harr: "\u2194", hArr: "\u21D4", harrw: "\u21AD", Hat: "^", hbar: "\u210F", Hcirc: "\u0124", hcirc: "\u0125", hearts: "\u2665", heartsuit: "\u2665", hellip: "\u2026", hercon: "\u22B9", hfr: "\u{1D525}", Hfr: "\u210C", HilbertSpace: "\u210B", hksearow: "\u2925", hkswarow: "\u2926", hoarr: "\u21FF", homtht: "\u223B", hookleftarrow: "\u21A9", hookrightarrow: "\u21AA", hopf: "\u{1D559}", Hopf: "\u210D", horbar: "\u2015", HorizontalLine: "\u2500", hscr: "\u{1D4BD}", Hscr: "\u210B", hslash: "\u210F", Hstrok: "\u0126", hstrok: "\u0127", HumpDownHump: "\u224E", HumpEqual: "\u224F", hybull: "\u2043", hyphen: "\u2010", Iacute: "\xCD", iacute: "\xED", ic: "\u2063", Icirc: "\xCE", icirc: "\xEE", Icy: "\u0418", icy: "\u0438", Idot: "\u0130", IEcy: "\u0415", iecy: "\u0435", iexcl: "\xA1", iff: "\u21D4", ifr: "\u{1D526}", Ifr: "\u2111", Igrave: "\xCC", igrave: "\xEC", ii: "\u2148", iiiint: "\u2A0C", iiint: "\u222D", iinfin: "\u29DC", iiota: "\u2129", IJlig: "\u0132", ijlig: "\u0133", Imacr: "\u012A", imacr: "\u012B", image: "\u2111", ImaginaryI: "\u2148", imagline: "\u2110", imagpart: "\u2111", imath: "\u0131", Im: "\u2111", imof: "\u22B7", imped: "\u01B5", Implies: "\u21D2", incare: "\u2105", in: "\u2208", infin: "\u221E", infintie: "\u29DD", inodot: "\u0131", intcal: "\u22BA", int: "\u222B", Int: "\u222C", integers: "\u2124", Integral: "\u222B", intercal: "\u22BA", Intersection: "\u22C2", intlarhk: "\u2A17", intprod: "\u2A3C", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "\u0401", iocy: "\u0451", Iogon: "\u012E", iogon: "\u012F", Iopf: "\u{1D540}", iopf: "\u{1D55A}", Iota: "\u0399", iota: "\u03B9", iprod: "\u2A3C", iquest: "\xBF", iscr: "\u{1D4BE}", Iscr: "\u2110", isin: "\u2208", isindot: "\u22F5", isinE: "\u22F9", isins: "\u22F4", isinsv: "\u22F3", isinv: "\u2208", it: "\u2062", Itilde: "\u0128", itilde: "\u0129", Iukcy: "\u0406", iukcy: "\u0456", Iuml: "\xCF", iuml: "\xEF", Jcirc: "\u0134", jcirc: "\u0135", Jcy: "\u0419", jcy: "\u0439", Jfr: "\u{1D50D}", jfr: "\u{1D527}", jmath: "\u0237", Jopf: "\u{1D541}", jopf: "\u{1D55B}", Jscr: "\u{1D4A5}", jscr: "\u{1D4BF}", Jsercy: "\u0408", jsercy: "\u0458", Jukcy: "\u0404", jukcy: "\u0454", Kappa: "\u039A", kappa: "\u03BA", kappav: "\u03F0", Kcedil: "\u0136", kcedil: "\u0137", Kcy: "\u041A", kcy: "\u043A", Kfr: "\u{1D50E}", kfr: "\u{1D528}", kgreen: "\u0138", KHcy: "\u0425", khcy: "\u0445", KJcy: "\u040C", kjcy: "\u045C", Kopf: "\u{1D542}", kopf: "\u{1D55C}", Kscr: "\u{1D4A6}", kscr: "\u{1D4C0}", lAarr: "\u21DA", Lacute: "\u0139", lacute: "\u013A", laemptyv: "\u29B4", lagran: "\u2112", Lambda: "\u039B", lambda: "\u03BB", lang: "\u27E8", Lang: "\u27EA", langd: "\u2991", langle: "\u27E8", lap: "\u2A85", Laplacetrf: "\u2112", laquo: "\xAB", larrb: "\u21E4", larrbfs: "\u291F", larr: "\u2190", Larr: "\u219E", lArr: "\u21D0", larrfs: "\u291D", larrhk: "\u21A9", larrlp: "\u21AB", larrpl: "\u2939", larrsim: "\u2973", larrtl: "\u21A2", latail: "\u2919", lAtail: "\u291B", lat: "\u2AAB", late: "\u2AAD", lates: "\u2AAD\uFE00", lbarr: "\u290C", lBarr: "\u290E", lbbrk: "\u2772", lbrace: "{", lbrack: "[", lbrke: "\u298B", lbrksld: "\u298F", lbrkslu: "\u298D", Lcaron: "\u013D", lcaron: "\u013E", Lcedil: "\u013B", lcedil: "\u013C", lceil: "\u2308", lcub: "{", Lcy: "\u041B", lcy: "\u043B", ldca: "\u2936", ldquo: "\u201C", ldquor: "\u201E", ldrdhar: "\u2967", ldrushar: "\u294B", ldsh: "\u21B2", le: "\u2264", lE: "\u2266", LeftAngleBracket: "\u27E8", LeftArrowBar: "\u21E4", leftarrow: "\u2190", LeftArrow: "\u2190", Leftarrow: "\u21D0", LeftArrowRightArrow: "\u21C6", leftarrowtail: "\u21A2", LeftCeiling: "\u2308", LeftDoubleBracket: "\u27E6", LeftDownTeeVector: "\u2961", LeftDownVectorBar: "\u2959", LeftDownVector: "\u21C3", LeftFloor: "\u230A", leftharpoondown: "\u21BD", leftharpoonup: "\u21BC", leftleftarrows: "\u21C7", leftrightarrow: "\u2194", LeftRightArrow: "\u2194", Leftrightarrow: "\u21D4", leftrightarrows: "\u21C6", leftrightharpoons: "\u21CB", leftrightsquigarrow: "\u21AD", LeftRightVector: "\u294E", LeftTeeArrow: "\u21A4", LeftTee: "\u22A3", LeftTeeVector: "\u295A", leftthreetimes: "\u22CB", LeftTriangleBar: "\u29CF", LeftTriangle: "\u22B2", LeftTriangleEqual: "\u22B4", LeftUpDownVector: "\u2951", LeftUpTeeVector: "\u2960", LeftUpVectorBar: "\u2958", LeftUpVector: "\u21BF", LeftVectorBar: "\u2952", LeftVector: "\u21BC", lEg: "\u2A8B", leg: "\u22DA", leq: "\u2264", leqq: "\u2266", leqslant: "\u2A7D", lescc: "\u2AA8", les: "\u2A7D", lesdot: "\u2A7F", lesdoto: "\u2A81", lesdotor: "\u2A83", lesg: "\u22DA\uFE00", lesges: "\u2A93", lessapprox: "\u2A85", lessdot: "\u22D6", lesseqgtr: "\u22DA", lesseqqgtr: "\u2A8B", LessEqualGreater: "\u22DA", LessFullEqual: "\u2266", LessGreater: "\u2276", lessgtr: "\u2276", LessLess: "\u2AA1", lesssim: "\u2272", LessSlantEqual: "\u2A7D", LessTilde: "\u2272", lfisht: "\u297C", lfloor: "\u230A", Lfr: "\u{1D50F}", lfr: "\u{1D529}", lg: "\u2276", lgE: "\u2A91", lHar: "\u2962", lhard: "\u21BD", lharu: "\u21BC", lharul: "\u296A", lhblk: "\u2584", LJcy: "\u0409", ljcy: "\u0459", llarr: "\u21C7", ll: "\u226A", Ll: "\u22D8", llcorner: "\u231E", Lleftarrow: "\u21DA", llhard: "\u296B", lltri: "\u25FA", Lmidot: "\u013F", lmidot: "\u0140", lmoustache: "\u23B0", lmoust: "\u23B0", lnap: "\u2A89", lnapprox: "\u2A89", lne: "\u2A87", lnE: "\u2268", lneq: "\u2A87", lneqq: "\u2268", lnsim: "\u22E6", loang: "\u27EC", loarr: "\u21FD", lobrk: "\u27E6", longleftarrow: "\u27F5", LongLeftArrow: "\u27F5", Longleftarrow: "\u27F8", longleftrightarrow: "\u27F7", LongLeftRightArrow: "\u27F7", Longleftrightarrow: "\u27FA", longmapsto: "\u27FC", longrightarrow: "\u27F6", LongRightArrow: "\u27F6", Longrightarrow: "\u27F9", looparrowleft: "\u21AB", looparrowright: "\u21AC", lopar: "\u2985", Lopf: "\u{1D543}", lopf: "\u{1D55D}", loplus: "\u2A2D", lotimes: "\u2A34", lowast: "\u2217", lowbar: "_", LowerLeftArrow: "\u2199", LowerRightArrow: "\u2198", loz: "\u25CA", lozenge: "\u25CA", lozf: "\u29EB", lpar: "(", lparlt: "\u2993", lrarr: "\u21C6", lrcorner: "\u231F", lrhar: "\u21CB", lrhard: "\u296D", lrm: "\u200E", lrtri: "\u22BF", lsaquo: "\u2039", lscr: "\u{1D4C1}", Lscr: "\u2112", lsh: "\u21B0", Lsh: "\u21B0", lsim: "\u2272", lsime: "\u2A8D", lsimg: "\u2A8F", lsqb: "[", lsquo: "\u2018", lsquor: "\u201A", Lstrok: "\u0141", lstrok: "\u0142", ltcc: "\u2AA6", ltcir: "\u2A79", lt: "<", LT: "<", Lt: "\u226A", ltdot: "\u22D6", lthree: "\u22CB", ltimes: "\u22C9", ltlarr: "\u2976", ltquest: "\u2A7B", ltri: "\u25C3", ltrie: "\u22B4", ltrif: "\u25C2", ltrPar: "\u2996", lurdshar: "\u294A", luruhar: "\u2966", lvertneqq: "\u2268\uFE00", lvnE: "\u2268\uFE00", macr: "\xAF", male: "\u2642", malt: "\u2720", maltese: "\u2720", Map: "\u2905", map: "\u21A6", mapsto: "\u21A6", mapstodown: "\u21A7", mapstoleft: "\u21A4", mapstoup: "\u21A5", marker: "\u25AE", mcomma: "\u2A29", Mcy: "\u041C", mcy: "\u043C", mdash: "\u2014", mDDot: "\u223A", measuredangle: "\u2221", MediumSpace: "\u205F", Mellintrf: "\u2133", Mfr: "\u{1D510}", mfr: "\u{1D52A}", mho: "\u2127", micro: "\xB5", midast: "*", midcir: "\u2AF0", mid: "\u2223", middot: "\xB7", minusb: "\u229F", minus: "\u2212", minusd: "\u2238", minusdu: "\u2A2A", MinusPlus: "\u2213", mlcp: "\u2ADB", mldr: "\u2026", mnplus: "\u2213", models: "\u22A7", Mopf: "\u{1D544}", mopf: "\u{1D55E}", mp: "\u2213", mscr: "\u{1D4C2}", Mscr: "\u2133", mstpos: "\u223E", Mu: "\u039C", mu: "\u03BC", multimap: "\u22B8", mumap: "\u22B8", nabla: "\u2207", Nacute: "\u0143", nacute: "\u0144", nang: "\u2220\u20D2", nap: "\u2249", napE: "\u2A70\u0338", napid: "\u224B\u0338", napos: "\u0149", napprox: "\u2249", natural: "\u266E", naturals: "\u2115", natur: "\u266E", nbsp: "\xA0", nbump: "\u224E\u0338", nbumpe: "\u224F\u0338", ncap: "\u2A43", Ncaron: "\u0147", ncaron: "\u0148", Ncedil: "\u0145", ncedil: "\u0146", ncong: "\u2247", ncongdot: "\u2A6D\u0338", ncup: "\u2A42", Ncy: "\u041D", ncy: "\u043D", ndash: "\u2013", nearhk: "\u2924", nearr: "\u2197", neArr: "\u21D7", nearrow: "\u2197", ne: "\u2260", nedot: "\u2250\u0338", NegativeMediumSpace: "\u200B", NegativeThickSpace: "\u200B", NegativeThinSpace: "\u200B", NegativeVeryThinSpace: "\u200B", nequiv: "\u2262", nesear: "\u2928", nesim: "\u2242\u0338", NestedGreaterGreater: "\u226B", NestedLessLess: "\u226A", NewLine: "\n", nexist: "\u2204", nexists: "\u2204", Nfr: "\u{1D511}", nfr: "\u{1D52B}", ngE: "\u2267\u0338", nge: "\u2271", ngeq: "\u2271", ngeqq: "\u2267\u0338", ngeqslant: "\u2A7E\u0338", nges: "\u2A7E\u0338", nGg: "\u22D9\u0338", ngsim: "\u2275", nGt: "\u226B\u20D2", ngt: "\u226F", ngtr: "\u226F", nGtv: "\u226B\u0338", nharr: "\u21AE", nhArr: "\u21CE", nhpar: "\u2AF2", ni: "\u220B", nis: "\u22FC", nisd: "\u22FA", niv: "\u220B", NJcy: "\u040A", njcy: "\u045A", nlarr: "\u219A", nlArr: "\u21CD", nldr: "\u2025", nlE: "\u2266\u0338", nle: "\u2270", nleftarrow: "\u219A", nLeftarrow: "\u21CD", nleftrightarrow: "\u21AE", nLeftrightarrow: "\u21CE", nleq: "\u2270", nleqq: "\u2266\u0338", nleqslant: "\u2A7D\u0338", nles: "\u2A7D\u0338", nless: "\u226E", nLl: "\u22D8\u0338", nlsim: "\u2274", nLt: "\u226A\u20D2", nlt: "\u226E", nltri: "\u22EA", nltrie: "\u22EC", nLtv: "\u226A\u0338", nmid: "\u2224", NoBreak: "\u2060", NonBreakingSpace: "\xA0", nopf: "\u{1D55F}", Nopf: "\u2115", Not: "\u2AEC", not: "\xAC", NotCongruent: "\u2262", NotCupCap: "\u226D", NotDoubleVerticalBar: "\u2226", NotElement: "\u2209", NotEqual: "\u2260", NotEqualTilde: "\u2242\u0338", NotExists: "\u2204", NotGreater: "\u226F", NotGreaterEqual: "\u2271", NotGreaterFullEqual: "\u2267\u0338", NotGreaterGreater: "\u226B\u0338", NotGreaterLess: "\u2279", NotGreaterSlantEqual: "\u2A7E\u0338", NotGreaterTilde: "\u2275", NotHumpDownHump: "\u224E\u0338", NotHumpEqual: "\u224F\u0338", notin: "\u2209", notindot: "\u22F5\u0338", notinE: "\u22F9\u0338", notinva: "\u2209", notinvb: "\u22F7", notinvc: "\u22F6", NotLeftTriangleBar: "\u29CF\u0338", NotLeftTriangle: "\u22EA", NotLeftTriangleEqual: "\u22EC", NotLess: "\u226E", NotLessEqual: "\u2270", NotLessGreater: "\u2278", NotLessLess: "\u226A\u0338", NotLessSlantEqual: "\u2A7D\u0338", NotLessTilde: "\u2274", NotNestedGreaterGreater: "\u2AA2\u0338", NotNestedLessLess: "\u2AA1\u0338", notni: "\u220C", notniva: "\u220C", notnivb: "\u22FE", notnivc: "\u22FD", NotPrecedes: "\u2280", NotPrecedesEqual: "\u2AAF\u0338", NotPrecedesSlantEqual: "\u22E0", NotReverseElement: "\u220C", NotRightTriangleBar: "\u29D0\u0338", NotRightTriangle: "\u22EB", NotRightTriangleEqual: "\u22ED", NotSquareSubset: "\u228F\u0338", NotSquareSubsetEqual: "\u22E2", NotSquareSuperset: "\u2290\u0338", NotSquareSupersetEqual: "\u22E3", NotSubset: "\u2282\u20D2", NotSubsetEqual: "\u2288", NotSucceeds: "\u2281", NotSucceedsEqual: "\u2AB0\u0338", NotSucceedsSlantEqual: "\u22E1", NotSucceedsTilde: "\u227F\u0338", NotSuperset: "\u2283\u20D2", NotSupersetEqual: "\u2289", NotTilde: "\u2241", NotTildeEqual: "\u2244", NotTildeFullEqual: "\u2247", NotTildeTilde: "\u2249", NotVerticalBar: "\u2224", nparallel: "\u2226", npar: "\u2226", nparsl: "\u2AFD\u20E5", npart: "\u2202\u0338", npolint: "\u2A14", npr: "\u2280", nprcue: "\u22E0", nprec: "\u2280", npreceq: "\u2AAF\u0338", npre: "\u2AAF\u0338", nrarrc: "\u2933\u0338", nrarr: "\u219B", nrArr: "\u21CF", nrarrw: "\u219D\u0338", nrightarrow: "\u219B", nRightarrow: "\u21CF", nrtri: "\u22EB", nrtrie: "\u22ED", nsc: "\u2281", nsccue: "\u22E1", nsce: "\u2AB0\u0338", Nscr: "\u{1D4A9}", nscr: "\u{1D4C3}", nshortmid: "\u2224", nshortparallel: "\u2226", nsim: "\u2241", nsime: "\u2244", nsimeq: "\u2244", nsmid: "\u2224", nspar: "\u2226", nsqsube: "\u22E2", nsqsupe: "\u22E3", nsub: "\u2284", nsubE: "\u2AC5\u0338", nsube: "\u2288", nsubset: "\u2282\u20D2", nsubseteq: "\u2288", nsubseteqq: "\u2AC5\u0338", nsucc: "\u2281", nsucceq: "\u2AB0\u0338", nsup: "\u2285", nsupE: "\u2AC6\u0338", nsupe: "\u2289", nsupset: "\u2283\u20D2", nsupseteq: "\u2289", nsupseteqq: "\u2AC6\u0338", ntgl: "\u2279", Ntilde: "\xD1", ntilde: "\xF1", ntlg: "\u2278", ntriangleleft: "\u22EA", ntrianglelefteq: "\u22EC", ntriangleright: "\u22EB", ntrianglerighteq: "\u22ED", Nu: "\u039D", nu: "\u03BD", num: "#", numero: "\u2116", numsp: "\u2007", nvap: "\u224D\u20D2", nvdash: "\u22AC", nvDash: "\u22AD", nVdash: "\u22AE", nVDash: "\u22AF", nvge: "\u2265\u20D2", nvgt: ">\u20D2", nvHarr: "\u2904", nvinfin: "\u29DE", nvlArr: "\u2902", nvle: "\u2264\u20D2", nvlt: "<\u20D2", nvltrie: "\u22B4\u20D2", nvrArr: "\u2903", nvrtrie: "\u22B5\u20D2", nvsim: "\u223C\u20D2", nwarhk: "\u2923", nwarr: "\u2196", nwArr: "\u21D6", nwarrow: "\u2196", nwnear: "\u2927", Oacute: "\xD3", oacute: "\xF3", oast: "\u229B", Ocirc: "\xD4", ocirc: "\xF4", ocir: "\u229A", Ocy: "\u041E", ocy: "\u043E", odash: "\u229D", Odblac: "\u0150", odblac: "\u0151", odiv: "\u2A38", odot: "\u2299", odsold: "\u29BC", OElig: "\u0152", oelig: "\u0153", ofcir: "\u29BF", Ofr: "\u{1D512}", ofr: "\u{1D52C}", ogon: "\u02DB", Ograve: "\xD2", ograve: "\xF2", ogt: "\u29C1", ohbar: "\u29B5", ohm: "\u03A9", oint: "\u222E", olarr: "\u21BA", olcir: "\u29BE", olcross: "\u29BB", oline: "\u203E", olt: "\u29C0", Omacr: "\u014C", omacr: "\u014D", Omega: "\u03A9", omega: "\u03C9", Omicron: "\u039F", omicron: "\u03BF", omid: "\u29B6", ominus: "\u2296", Oopf: "\u{1D546}", oopf: "\u{1D560}", opar: "\u29B7", OpenCurlyDoubleQuote: "\u201C", OpenCurlyQuote: "\u2018", operp: "\u29B9", oplus: "\u2295", orarr: "\u21BB", Or: "\u2A54", or: "\u2228", ord: "\u2A5D", order: "\u2134", orderof: "\u2134", ordf: "\xAA", ordm: "\xBA", origof: "\u22B6", oror: "\u2A56", orslope: "\u2A57", orv: "\u2A5B", oS: "\u24C8", Oscr: "\u{1D4AA}", oscr: "\u2134", Oslash: "\xD8", oslash: "\xF8", osol: "\u2298", Otilde: "\xD5", otilde: "\xF5", otimesas: "\u2A36", Otimes: "\u2A37", otimes: "\u2297", Ouml: "\xD6", ouml: "\xF6", ovbar: "\u233D", OverBar: "\u203E", OverBrace: "\u23DE", OverBracket: "\u23B4", OverParenthesis: "\u23DC", para: "\xB6", parallel: "\u2225", par: "\u2225", parsim: "\u2AF3", parsl: "\u2AFD", part: "\u2202", PartialD: "\u2202", Pcy: "\u041F", pcy: "\u043F", percnt: "%", period: ".", permil: "\u2030", perp: "\u22A5", pertenk: "\u2031", Pfr: "\u{1D513}", pfr: "\u{1D52D}", Phi: "\u03A6", phi: "\u03C6", phiv: "\u03D5", phmmat: "\u2133", phone: "\u260E", Pi: "\u03A0", pi: "\u03C0", pitchfork: "\u22D4", piv: "\u03D6", planck: "\u210F", planckh: "\u210E", plankv: "\u210F", plusacir: "\u2A23", plusb: "\u229E", pluscir: "\u2A22", plus: "+", plusdo: "\u2214", plusdu: "\u2A25", pluse: "\u2A72", PlusMinus: "\xB1", plusmn: "\xB1", plussim: "\u2A26", plustwo: "\u2A27", pm: "\xB1", Poincareplane: "\u210C", pointint: "\u2A15", popf: "\u{1D561}", Popf: "\u2119", pound: "\xA3", prap: "\u2AB7", Pr: "\u2ABB", pr: "\u227A", prcue: "\u227C", precapprox: "\u2AB7", prec: "\u227A", preccurlyeq: "\u227C", Precedes: "\u227A", PrecedesEqual: "\u2AAF", PrecedesSlantEqual: "\u227C", PrecedesTilde: "\u227E", preceq: "\u2AAF", precnapprox: "\u2AB9", precneqq: "\u2AB5", precnsim: "\u22E8", pre: "\u2AAF", prE: "\u2AB3", precsim: "\u227E", prime: "\u2032", Prime: "\u2033", primes: "\u2119", prnap: "\u2AB9", prnE: "\u2AB5", prnsim: "\u22E8", prod: "\u220F", Product: "\u220F", profalar: "\u232E", profline: "\u2312", profsurf: "\u2313", prop: "\u221D", Proportional: "\u221D", Proportion: "\u2237", propto: "\u221D", prsim: "\u227E", prurel: "\u22B0", Pscr: "\u{1D4AB}", pscr: "\u{1D4C5}", Psi: "\u03A8", psi: "\u03C8", puncsp: "\u2008", Qfr: "\u{1D514}", qfr: "\u{1D52E}", qint: "\u2A0C", qopf: "\u{1D562}", Qopf: "\u211A", qprime: "\u2057", Qscr: "\u{1D4AC}", qscr: "\u{1D4C6}", quaternions: "\u210D", quatint: "\u2A16", quest: "?", questeq: "\u225F", quot: '"', QUOT: '"', rAarr: "\u21DB", race: "\u223D\u0331", Racute: "\u0154", racute: "\u0155", radic: "\u221A", raemptyv: "\u29B3", rang: "\u27E9", Rang: "\u27EB", rangd: "\u2992", range: "\u29A5", rangle: "\u27E9", raquo: "\xBB", rarrap: "\u2975", rarrb: "\u21E5", rarrbfs: "\u2920", rarrc: "\u2933", rarr: "\u2192", Rarr: "\u21A0", rArr: "\u21D2", rarrfs: "\u291E", rarrhk: "\u21AA", rarrlp: "\u21AC", rarrpl: "\u2945", rarrsim: "\u2974", Rarrtl: "\u2916", rarrtl: "\u21A3", rarrw: "\u219D", ratail: "\u291A", rAtail: "\u291C", ratio: "\u2236", rationals: "\u211A", rbarr: "\u290D", rBarr: "\u290F", RBarr: "\u2910", rbbrk: "\u2773", rbrace: "}", rbrack: "]", rbrke: "\u298C", rbrksld: "\u298E", rbrkslu: "\u2990", Rcaron: "\u0158", rcaron: "\u0159", Rcedil: "\u0156", rcedil: "\u0157", rceil: "\u2309", rcub: "}", Rcy: "\u0420", rcy: "\u0440", rdca: "\u2937", rdldhar: "\u2969", rdquo: "\u201D", rdquor: "\u201D", rdsh: "\u21B3", real: "\u211C", realine: "\u211B", realpart: "\u211C", reals: "\u211D", Re: "\u211C", rect: "\u25AD", reg: "\xAE", REG: "\xAE", ReverseElement: "\u220B", ReverseEquilibrium: "\u21CB", ReverseUpEquilibrium: "\u296F", rfisht: "\u297D", rfloor: "\u230B", rfr: "\u{1D52F}", Rfr: "\u211C", rHar: "\u2964", rhard: "\u21C1", rharu: "\u21C0", rharul: "\u296C", Rho: "\u03A1", rho: "\u03C1", rhov: "\u03F1", RightAngleBracket: "\u27E9", RightArrowBar: "\u21E5", rightarrow: "\u2192", RightArrow: "\u2192", Rightarrow: "\u21D2", RightArrowLeftArrow: "\u21C4", rightarrowtail: "\u21A3", RightCeiling: "\u2309", RightDoubleBracket: "\u27E7", RightDownTeeVector: "\u295D", RightDownVectorBar: "\u2955", RightDownVector: "\u21C2", RightFloor: "\u230B", rightharpoondown: "\u21C1", rightharpoonup: "\u21C0", rightleftarrows: "\u21C4", rightleftharpoons: "\u21CC", rightrightarrows: "\u21C9", rightsquigarrow: "\u219D", RightTeeArrow: "\u21A6", RightTee: "\u22A2", RightTeeVector: "\u295B", rightthreetimes: "\u22CC", RightTriangleBar: "\u29D0", RightTriangle: "\u22B3", RightTriangleEqual: "\u22B5", RightUpDownVector: "\u294F", RightUpTeeVector: "\u295C", RightUpVectorBar: "\u2954", RightUpVector: "\u21BE", RightVectorBar: "\u2953", RightVector: "\u21C0", ring: "\u02DA", risingdotseq: "\u2253", rlarr: "\u21C4", rlhar: "\u21CC", rlm: "\u200F", rmoustache: "\u23B1", rmoust: "\u23B1", rnmid: "\u2AEE", roang: "\u27ED", roarr: "\u21FE", robrk: "\u27E7", ropar: "\u2986", ropf: "\u{1D563}", Ropf: "\u211D", roplus: "\u2A2E", rotimes: "\u2A35", RoundImplies: "\u2970", rpar: ")", rpargt: "\u2994", rppolint: "\u2A12", rrarr: "\u21C9", Rrightarrow: "\u21DB", rsaquo: "\u203A", rscr: "\u{1D4C7}", Rscr: "\u211B", rsh: "\u21B1", Rsh: "\u21B1", rsqb: "]", rsquo: "\u2019", rsquor: "\u2019", rthree: "\u22CC", rtimes: "\u22CA", rtri: "\u25B9", rtrie: "\u22B5", rtrif: "\u25B8", rtriltri: "\u29CE", RuleDelayed: "\u29F4", ruluhar: "\u2968", rx: "\u211E", Sacute: "\u015A", sacute: "\u015B", sbquo: "\u201A", scap: "\u2AB8", Scaron: "\u0160", scaron: "\u0161", Sc: "\u2ABC", sc: "\u227B", sccue: "\u227D", sce: "\u2AB0", scE: "\u2AB4", Scedil: "\u015E", scedil: "\u015F", Scirc: "\u015C", scirc: "\u015D", scnap: "\u2ABA", scnE: "\u2AB6", scnsim: "\u22E9", scpolint: "\u2A13", scsim: "\u227F", Scy: "\u0421", scy: "\u0441", sdotb: "\u22A1", sdot: "\u22C5", sdote: "\u2A66", searhk: "\u2925", searr: "\u2198", seArr: "\u21D8", searrow: "\u2198", sect: "\xA7", semi: ";", seswar: "\u2929", setminus: "\u2216", setmn: "\u2216", sext: "\u2736", Sfr: "\u{1D516}", sfr: "\u{1D530}", sfrown: "\u2322", sharp: "\u266F", SHCHcy: "\u0429", shchcy: "\u0449", SHcy: "\u0428", shcy: "\u0448", ShortDownArrow: "\u2193", ShortLeftArrow: "\u2190", shortmid: "\u2223", shortparallel: "\u2225", ShortRightArrow: "\u2192", ShortUpArrow: "\u2191", shy: "\xAD", Sigma: "\u03A3", sigma: "\u03C3", sigmaf: "\u03C2", sigmav: "\u03C2", sim: "\u223C", simdot: "\u2A6A", sime: "\u2243", simeq: "\u2243", simg: "\u2A9E", simgE: "\u2AA0", siml: "\u2A9D", simlE: "\u2A9F", simne: "\u2246", simplus: "\u2A24", simrarr: "\u2972", slarr: "\u2190", SmallCircle: "\u2218", smallsetminus: "\u2216", smashp: "\u2A33", smeparsl: "\u29E4", smid: "\u2223", smile: "\u2323", smt: "\u2AAA", smte: "\u2AAC", smtes: "\u2AAC\uFE00", SOFTcy: "\u042C", softcy: "\u044C", solbar: "\u233F", solb: "\u29C4", sol: "/", Sopf: "\u{1D54A}", sopf: "\u{1D564}", spades: "\u2660", spadesuit: "\u2660", spar: "\u2225", sqcap: "\u2293", sqcaps: "\u2293\uFE00", sqcup: "\u2294", sqcups: "\u2294\uFE00", Sqrt: "\u221A", sqsub: "\u228F", sqsube: "\u2291", sqsubset: "\u228F", sqsubseteq: "\u2291", sqsup: "\u2290", sqsupe: "\u2292", sqsupset: "\u2290", sqsupseteq: "\u2292", square: "\u25A1", Square: "\u25A1", SquareIntersection: "\u2293", SquareSubset: "\u228F", SquareSubsetEqual: "\u2291", SquareSuperset: "\u2290", SquareSupersetEqual: "\u2292", SquareUnion: "\u2294", squarf: "\u25AA", squ: "\u25A1", squf: "\u25AA", srarr: "\u2192", Sscr: "\u{1D4AE}", sscr: "\u{1D4C8}", ssetmn: "\u2216", ssmile: "\u2323", sstarf: "\u22C6", Star: "\u22C6", star: "\u2606", starf: "\u2605", straightepsilon: "\u03F5", straightphi: "\u03D5", strns: "\xAF", sub: "\u2282", Sub: "\u22D0", subdot: "\u2ABD", subE: "\u2AC5", sube: "\u2286", subedot: "\u2AC3", submult: "\u2AC1", subnE: "\u2ACB", subne: "\u228A", subplus: "\u2ABF", subrarr: "\u2979", subset: "\u2282", Subset: "\u22D0", subseteq: "\u2286", subseteqq: "\u2AC5", SubsetEqual: "\u2286", subsetneq: "\u228A", subsetneqq: "\u2ACB", subsim: "\u2AC7", subsub: "\u2AD5", subsup: "\u2AD3", succapprox: "\u2AB8", succ: "\u227B", succcurlyeq: "\u227D", Succeeds: "\u227B", SucceedsEqual: "\u2AB0", SucceedsSlantEqual: "\u227D", SucceedsTilde: "\u227F", succeq: "\u2AB0", succnapprox: "\u2ABA", succneqq: "\u2AB6", succnsim: "\u22E9", succsim: "\u227F", SuchThat: "\u220B", sum: "\u2211", Sum: "\u2211", sung: "\u266A", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", sup: "\u2283", Sup: "\u22D1", supdot: "\u2ABE", supdsub: "\u2AD8", supE: "\u2AC6", supe: "\u2287", supedot: "\u2AC4", Superset: "\u2283", SupersetEqual: "\u2287", suphsol: "\u27C9", suphsub: "\u2AD7", suplarr: "\u297B", supmult: "\u2AC2", supnE: "\u2ACC", supne: "\u228B", supplus: "\u2AC0", supset: "\u2283", Supset: "\u22D1", supseteq: "\u2287", supseteqq: "\u2AC6", supsetneq: "\u228B", supsetneqq: "\u2ACC", supsim: "\u2AC8", supsub: "\u2AD4", supsup: "\u2AD6", swarhk: "\u2926", swarr: "\u2199", swArr: "\u21D9", swarrow: "\u2199", swnwar: "\u292A", szlig: "\xDF", Tab: " ", target: "\u2316", Tau: "\u03A4", tau: "\u03C4", tbrk: "\u23B4", Tcaron: "\u0164", tcaron: "\u0165", Tcedil: "\u0162", tcedil: "\u0163", Tcy: "\u0422", tcy: "\u0442", tdot: "\u20DB", telrec: "\u2315", Tfr: "\u{1D517}", tfr: "\u{1D531}", there4: "\u2234", therefore: "\u2234", Therefore: "\u2234", Theta: "\u0398", theta: "\u03B8", thetasym: "\u03D1", thetav: "\u03D1", thickapprox: "\u2248", thicksim: "\u223C", ThickSpace: "\u205F\u200A", ThinSpace: "\u2009", thinsp: "\u2009", thkap: "\u2248", thksim: "\u223C", THORN: "\xDE", thorn: "\xFE", tilde: "\u02DC", Tilde: "\u223C", TildeEqual: "\u2243", TildeFullEqual: "\u2245", TildeTilde: "\u2248", timesbar: "\u2A31", timesb: "\u22A0", times: "\xD7", timesd: "\u2A30", tint: "\u222D", toea: "\u2928", topbot: "\u2336", topcir: "\u2AF1", top: "\u22A4", Topf: "\u{1D54B}", topf: "\u{1D565}", topfork: "\u2ADA", tosa: "\u2929", tprime: "\u2034", trade: "\u2122", TRADE: "\u2122", triangle: "\u25B5", triangledown: "\u25BF", triangleleft: "\u25C3", trianglelefteq: "\u22B4", triangleq: "\u225C", triangleright: "\u25B9", trianglerighteq: "\u22B5", tridot: "\u25EC", trie: "\u225C", triminus: "\u2A3A", TripleDot: "\u20DB", triplus: "\u2A39", trisb: "\u29CD", tritime: "\u2A3B", trpezium: "\u23E2", Tscr: "\u{1D4AF}", tscr: "\u{1D4C9}", TScy: "\u0426", tscy: "\u0446", TSHcy: "\u040B", tshcy: "\u045B", Tstrok: "\u0166", tstrok: "\u0167", twixt: "\u226C", twoheadleftarrow: "\u219E", twoheadrightarrow: "\u21A0", Uacute: "\xDA", uacute: "\xFA", uarr: "\u2191", Uarr: "\u219F", uArr: "\u21D1", Uarrocir: "\u2949", Ubrcy: "\u040E", ubrcy: "\u045E", Ubreve: "\u016C", ubreve: "\u016D", Ucirc: "\xDB", ucirc: "\xFB", Ucy: "\u0423", ucy: "\u0443", udarr: "\u21C5", Udblac: "\u0170", udblac: "\u0171", udhar: "\u296E", ufisht: "\u297E", Ufr: "\u{1D518}", ufr: "\u{1D532}", Ugrave: "\xD9", ugrave: "\xF9", uHar: "\u2963", uharl: "\u21BF", uharr: "\u21BE", uhblk: "\u2580", ulcorn: "\u231C", ulcorner: "\u231C", ulcrop: "\u230F", ultri: "\u25F8", Umacr: "\u016A", umacr: "\u016B", uml: "\xA8", UnderBar: "_", UnderBrace: "\u23DF", UnderBracket: "\u23B5", UnderParenthesis: "\u23DD", Union: "\u22C3", UnionPlus: "\u228E", Uogon: "\u0172", uogon: "\u0173", Uopf: "\u{1D54C}", uopf: "\u{1D566}", UpArrowBar: "\u2912", uparrow: "\u2191", UpArrow: "\u2191", Uparrow: "\u21D1", UpArrowDownArrow: "\u21C5", updownarrow: "\u2195", UpDownArrow: "\u2195", Updownarrow: "\u21D5", UpEquilibrium: "\u296E", upharpoonleft: "\u21BF", upharpoonright: "\u21BE", uplus: "\u228E", UpperLeftArrow: "\u2196", UpperRightArrow: "\u2197", upsi: "\u03C5", Upsi: "\u03D2", upsih: "\u03D2", Upsilon: "\u03A5", upsilon: "\u03C5", UpTeeArrow: "\u21A5", UpTee: "\u22A5", upuparrows: "\u21C8", urcorn: "\u231D", urcorner: "\u231D", urcrop: "\u230E", Uring: "\u016E", uring: "\u016F", urtri: "\u25F9", Uscr: "\u{1D4B0}", uscr: "\u{1D4CA}", utdot: "\u22F0", Utilde: "\u0168", utilde: "\u0169", utri: "\u25B5", utrif: "\u25B4", uuarr: "\u21C8", Uuml: "\xDC", uuml: "\xFC", uwangle: "\u29A7", vangrt: "\u299C", varepsilon: "\u03F5", varkappa: "\u03F0", varnothing: "\u2205", varphi: "\u03D5", varpi: "\u03D6", varpropto: "\u221D", varr: "\u2195", vArr: "\u21D5", varrho: "\u03F1", varsigma: "\u03C2", varsubsetneq: "\u228A\uFE00", varsubsetneqq: "\u2ACB\uFE00", varsupsetneq: "\u228B\uFE00", varsupsetneqq: "\u2ACC\uFE00", vartheta: "\u03D1", vartriangleleft: "\u22B2", vartriangleright: "\u22B3", vBar: "\u2AE8", Vbar: "\u2AEB", vBarv: "\u2AE9", Vcy: "\u0412", vcy: "\u0432", vdash: "\u22A2", vDash: "\u22A8", Vdash: "\u22A9", VDash: "\u22AB", Vdashl: "\u2AE6", veebar: "\u22BB", vee: "\u2228", Vee: "\u22C1", veeeq: "\u225A", vellip: "\u22EE", verbar: "|", Verbar: "\u2016", vert: "|", Vert: "\u2016", VerticalBar: "\u2223", VerticalLine: "|", VerticalSeparator: "\u2758", VerticalTilde: "\u2240", VeryThinSpace: "\u200A", Vfr: "\u{1D519}", vfr: "\u{1D533}", vltri: "\u22B2", vnsub: "\u2282\u20D2", vnsup: "\u2283\u20D2", Vopf: "\u{1D54D}", vopf: "\u{1D567}", vprop: "\u221D", vrtri: "\u22B3", Vscr: "\u{1D4B1}", vscr: "\u{1D4CB}", vsubnE: "\u2ACB\uFE00", vsubne: "\u228A\uFE00", vsupnE: "\u2ACC\uFE00", vsupne: "\u228B\uFE00", Vvdash: "\u22AA", vzigzag: "\u299A", Wcirc: "\u0174", wcirc: "\u0175", wedbar: "\u2A5F", wedge: "\u2227", Wedge: "\u22C0", wedgeq: "\u2259", weierp: "\u2118", Wfr: "\u{1D51A}", wfr: "\u{1D534}", Wopf: "\u{1D54E}", wopf: "\u{1D568}", wp: "\u2118", wr: "\u2240", wreath: "\u2240", Wscr: "\u{1D4B2}", wscr: "\u{1D4CC}", xcap: "\u22C2", xcirc: "\u25EF", xcup: "\u22C3", xdtri: "\u25BD", Xfr: "\u{1D51B}", xfr: "\u{1D535}", xharr: "\u27F7", xhArr: "\u27FA", Xi: "\u039E", xi: "\u03BE", xlarr: "\u27F5", xlArr: "\u27F8", xmap: "\u27FC", xnis: "\u22FB", xodot: "\u2A00", Xopf: "\u{1D54F}", xopf: "\u{1D569}", xoplus: "\u2A01", xotime: "\u2A02", xrarr: "\u27F6", xrArr: "\u27F9", Xscr: "\u{1D4B3}", xscr: "\u{1D4CD}", xsqcup: "\u2A06", xuplus: "\u2A04", xutri: "\u25B3", xvee: "\u22C1", xwedge: "\u22C0", Yacute: "\xDD", yacute: "\xFD", YAcy: "\u042F", yacy: "\u044F", Ycirc: "\u0176", ycirc: "\u0177", Ycy: "\u042B", ycy: "\u044B", yen: "\xA5", Yfr: "\u{1D51C}", yfr: "\u{1D536}", YIcy: "\u0407", yicy: "\u0457", Yopf: "\u{1D550}", yopf: "\u{1D56A}", Yscr: "\u{1D4B4}", yscr: "\u{1D4CE}", YUcy: "\u042E", yucy: "\u044E", yuml: "\xFF", Yuml: "\u0178", Zacute: "\u0179", zacute: "\u017A", Zcaron: "\u017D", zcaron: "\u017E", Zcy: "\u0417", zcy: "\u0437", Zdot: "\u017B", zdot: "\u017C", zeetrf: "\u2128", ZeroWidthSpace: "\u200B", Zeta: "\u0396", zeta: "\u03B6", zfr: "\u{1D537}", Zfr: "\u2128", ZHcy: "\u0416", zhcy: "\u0436", zigrarr: "\u21DD", zopf: "\u{1D56B}", Zopf: "\u2124", Zscr: "\u{1D4B5}", zscr: "\u{1D4CF}", zwj: "\u200D", zwnj: "\u200C" }; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/legacy.json +var require_legacy2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/legacy.json"(exports2, module2) { + module2.exports = { Aacute: "\xC1", aacute: "\xE1", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", AElig: "\xC6", aelig: "\xE6", Agrave: "\xC0", agrave: "\xE0", amp: "&", AMP: "&", Aring: "\xC5", aring: "\xE5", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", brvbar: "\xA6", Ccedil: "\xC7", ccedil: "\xE7", cedil: "\xB8", cent: "\xA2", copy: "\xA9", COPY: "\xA9", curren: "\xA4", deg: "\xB0", divide: "\xF7", Eacute: "\xC9", eacute: "\xE9", Ecirc: "\xCA", ecirc: "\xEA", Egrave: "\xC8", egrave: "\xE8", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", frac12: "\xBD", frac14: "\xBC", frac34: "\xBE", gt: ">", GT: ">", Iacute: "\xCD", iacute: "\xED", Icirc: "\xCE", icirc: "\xEE", iexcl: "\xA1", Igrave: "\xCC", igrave: "\xEC", iquest: "\xBF", Iuml: "\xCF", iuml: "\xEF", laquo: "\xAB", lt: "<", LT: "<", macr: "\xAF", micro: "\xB5", middot: "\xB7", nbsp: "\xA0", not: "\xAC", Ntilde: "\xD1", ntilde: "\xF1", Oacute: "\xD3", oacute: "\xF3", Ocirc: "\xD4", ocirc: "\xF4", Ograve: "\xD2", ograve: "\xF2", ordf: "\xAA", ordm: "\xBA", Oslash: "\xD8", oslash: "\xF8", Otilde: "\xD5", otilde: "\xF5", Ouml: "\xD6", ouml: "\xF6", para: "\xB6", plusmn: "\xB1", pound: "\xA3", quot: '"', QUOT: '"', raquo: "\xBB", reg: "\xAE", REG: "\xAE", sect: "\xA7", shy: "\xAD", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", szlig: "\xDF", THORN: "\xDE", thorn: "\xFE", times: "\xD7", Uacute: "\xDA", uacute: "\xFA", Ucirc: "\xDB", ucirc: "\xFB", Ugrave: "\xD9", ugrave: "\xF9", uml: "\xA8", Uuml: "\xDC", uuml: "\xFC", Yacute: "\xDD", yacute: "\xFD", yen: "\xA5", yuml: "\xFF" }; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/xml.json +var require_xml = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/maps/xml.json"(exports2, module2) { + module2.exports = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/lib/Tokenizer.js +var require_Tokenizer2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/lib/Tokenizer.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + var decode_codepoint_1 = __importDefault2(require_decode_codepoint3()); + var entities_json_1 = __importDefault2(require_entities()); + var legacy_json_1 = __importDefault2(require_legacy2()); + var xml_json_1 = __importDefault2(require_xml()); + function whitespace2(c) { + return c === " " || c === "\n" || c === " " || c === "\f" || c === "\r"; + } + function isASCIIAlpha(c) { + return c >= "a" && c <= "z" || c >= "A" && c <= "Z"; + } + function ifElseState(upper, SUCCESS, FAILURE) { + var lower = upper.toLowerCase(); + if (upper === lower) { + return function(t, c) { + if (c === lower) { + t._state = SUCCESS; + } else { + t._state = FAILURE; + t._index--; + } + }; + } + return function(t, c) { + if (c === lower || c === upper) { + t._state = SUCCESS; + } else { + t._state = FAILURE; + t._index--; + } + }; + } + function consumeSpecialNameChar(upper, NEXT_STATE) { + var lower = upper.toLowerCase(); + return function(t, c) { + if (c === lower || c === upper) { + t._state = NEXT_STATE; + } else { + t._state = 3; + t._index--; + } + }; + } + var stateBeforeCdata1 = ifElseState( + "C", + 24, + 16 + /* InDeclaration */ + ); + var stateBeforeCdata2 = ifElseState( + "D", + 25, + 16 + /* InDeclaration */ + ); + var stateBeforeCdata3 = ifElseState( + "A", + 26, + 16 + /* InDeclaration */ + ); + var stateBeforeCdata4 = ifElseState( + "T", + 27, + 16 + /* InDeclaration */ + ); + var stateBeforeCdata5 = ifElseState( + "A", + 28, + 16 + /* InDeclaration */ + ); + var stateBeforeScript1 = consumeSpecialNameChar( + "R", + 35 + /* BeforeScript2 */ + ); + var stateBeforeScript2 = consumeSpecialNameChar( + "I", + 36 + /* BeforeScript3 */ + ); + var stateBeforeScript3 = consumeSpecialNameChar( + "P", + 37 + /* BeforeScript4 */ + ); + var stateBeforeScript4 = consumeSpecialNameChar( + "T", + 38 + /* BeforeScript5 */ + ); + var stateAfterScript1 = ifElseState( + "R", + 40, + 1 + /* Text */ + ); + var stateAfterScript2 = ifElseState( + "I", + 41, + 1 + /* Text */ + ); + var stateAfterScript3 = ifElseState( + "P", + 42, + 1 + /* Text */ + ); + var stateAfterScript4 = ifElseState( + "T", + 43, + 1 + /* Text */ + ); + var stateBeforeStyle1 = consumeSpecialNameChar( + "Y", + 45 + /* BeforeStyle2 */ + ); + var stateBeforeStyle2 = consumeSpecialNameChar( + "L", + 46 + /* BeforeStyle3 */ + ); + var stateBeforeStyle3 = consumeSpecialNameChar( + "E", + 47 + /* BeforeStyle4 */ + ); + var stateAfterStyle1 = ifElseState( + "Y", + 49, + 1 + /* Text */ + ); + var stateAfterStyle2 = ifElseState( + "L", + 50, + 1 + /* Text */ + ); + var stateAfterStyle3 = ifElseState( + "E", + 51, + 1 + /* Text */ + ); + var stateBeforeSpecialT = consumeSpecialNameChar( + "I", + 54 + /* BeforeTitle1 */ + ); + var stateBeforeTitle1 = consumeSpecialNameChar( + "T", + 55 + /* BeforeTitle2 */ + ); + var stateBeforeTitle2 = consumeSpecialNameChar( + "L", + 56 + /* BeforeTitle3 */ + ); + var stateBeforeTitle3 = consumeSpecialNameChar( + "E", + 57 + /* BeforeTitle4 */ + ); + var stateAfterSpecialTEnd = ifElseState( + "I", + 58, + 1 + /* Text */ + ); + var stateAfterTitle1 = ifElseState( + "T", + 59, + 1 + /* Text */ + ); + var stateAfterTitle2 = ifElseState( + "L", + 60, + 1 + /* Text */ + ); + var stateAfterTitle3 = ifElseState( + "E", + 61, + 1 + /* Text */ + ); + var stateBeforeEntity = ifElseState( + "#", + 63, + 64 + /* InNamedEntity */ + ); + var stateBeforeNumericEntity = ifElseState( + "X", + 66, + 65 + /* InNumericEntity */ + ); + var Tokenizer = ( + /** @class */ + (function() { + function Tokenizer2(options, cbs) { + var _a; + this._state = 1; + this.buffer = ""; + this.sectionStart = 0; + this._index = 0; + this.bufferOffset = 0; + this.baseState = 1; + this.special = 1; + this.running = true; + this.ended = false; + this.cbs = cbs; + this.xmlMode = !!(options === null || options === void 0 ? void 0 : options.xmlMode); + this.decodeEntities = (_a = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a !== void 0 ? _a : true; + } + Tokenizer2.prototype.reset = function() { + this._state = 1; + this.buffer = ""; + this.sectionStart = 0; + this._index = 0; + this.bufferOffset = 0; + this.baseState = 1; + this.special = 1; + this.running = true; + this.ended = false; + }; + Tokenizer2.prototype.write = function(chunk) { + if (this.ended) + this.cbs.onerror(Error(".write() after done!")); + this.buffer += chunk; + this.parse(); + }; + Tokenizer2.prototype.end = function(chunk) { + if (this.ended) + this.cbs.onerror(Error(".end() after done!")); + if (chunk) + this.write(chunk); + this.ended = true; + if (this.running) + this.finish(); + }; + Tokenizer2.prototype.pause = function() { + this.running = false; + }; + Tokenizer2.prototype.resume = function() { + this.running = true; + if (this._index < this.buffer.length) { + this.parse(); + } + if (this.ended) { + this.finish(); + } + }; + Tokenizer2.prototype.getAbsoluteIndex = function() { + return this.bufferOffset + this._index; + }; + Tokenizer2.prototype.stateText = function(c) { + if (c === "<") { + if (this._index > this.sectionStart) { + this.cbs.ontext(this.getSection()); + } + this._state = 2; + this.sectionStart = this._index; + } else if (this.decodeEntities && c === "&" && (this.special === 1 || this.special === 4)) { + if (this._index > this.sectionStart) { + this.cbs.ontext(this.getSection()); + } + this.baseState = 1; + this._state = 62; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.isTagStartChar = function(c) { + return isASCIIAlpha(c) || this.xmlMode && !whitespace2(c) && c !== "/" && c !== ">"; + }; + Tokenizer2.prototype.stateBeforeTagName = function(c) { + if (c === "/") { + this._state = 5; + } else if (c === "<") { + this.cbs.ontext(this.getSection()); + this.sectionStart = this._index; + } else if (c === ">" || this.special !== 1 || whitespace2(c)) { + this._state = 1; + } else if (c === "!") { + this._state = 15; + this.sectionStart = this._index + 1; + } else if (c === "?") { + this._state = 17; + this.sectionStart = this._index + 1; + } else if (!this.isTagStartChar(c)) { + this._state = 1; + } else { + this._state = !this.xmlMode && (c === "s" || c === "S") ? 32 : !this.xmlMode && (c === "t" || c === "T") ? 52 : 3; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateInTagName = function(c) { + if (c === "/" || c === ">" || whitespace2(c)) { + this.emitToken("onopentagname"); + this._state = 8; + this._index--; + } + }; + Tokenizer2.prototype.stateBeforeClosingTagName = function(c) { + if (whitespace2(c)) { + } else if (c === ">") { + this._state = 1; + } else if (this.special !== 1) { + if (this.special !== 4 && (c === "s" || c === "S")) { + this._state = 33; + } else if (this.special === 4 && (c === "t" || c === "T")) { + this._state = 53; + } else { + this._state = 1; + this._index--; + } + } else if (!this.isTagStartChar(c)) { + this._state = 20; + this.sectionStart = this._index; + } else { + this._state = 6; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateInClosingTagName = function(c) { + if (c === ">" || whitespace2(c)) { + this.emitToken("onclosetag"); + this._state = 7; + this._index--; + } + }; + Tokenizer2.prototype.stateAfterClosingTagName = function(c) { + if (c === ">") { + this._state = 1; + this.sectionStart = this._index + 1; + } + }; + Tokenizer2.prototype.stateBeforeAttributeName = function(c) { + if (c === ">") { + this.cbs.onopentagend(); + this._state = 1; + this.sectionStart = this._index + 1; + } else if (c === "/") { + this._state = 4; + } else if (!whitespace2(c)) { + this._state = 9; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateInSelfClosingTag = function(c) { + if (c === ">") { + this.cbs.onselfclosingtag(); + this._state = 1; + this.sectionStart = this._index + 1; + this.special = 1; + } else if (!whitespace2(c)) { + this._state = 8; + this._index--; + } + }; + Tokenizer2.prototype.stateInAttributeName = function(c) { + if (c === "=" || c === "/" || c === ">" || whitespace2(c)) { + this.cbs.onattribname(this.getSection()); + this.sectionStart = -1; + this._state = 10; + this._index--; + } + }; + Tokenizer2.prototype.stateAfterAttributeName = function(c) { + if (c === "=") { + this._state = 11; + } else if (c === "/" || c === ">") { + this.cbs.onattribend(void 0); + this._state = 8; + this._index--; + } else if (!whitespace2(c)) { + this.cbs.onattribend(void 0); + this._state = 9; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateBeforeAttributeValue = function(c) { + if (c === '"') { + this._state = 12; + this.sectionStart = this._index + 1; + } else if (c === "'") { + this._state = 13; + this.sectionStart = this._index + 1; + } else if (!whitespace2(c)) { + this._state = 14; + this.sectionStart = this._index; + this._index--; + } + }; + Tokenizer2.prototype.handleInAttributeValue = function(c, quote) { + if (c === quote) { + this.emitToken("onattribdata"); + this.cbs.onattribend(quote); + this._state = 8; + } else if (this.decodeEntities && c === "&") { + this.emitToken("onattribdata"); + this.baseState = this._state; + this._state = 62; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateInAttributeValueDoubleQuotes = function(c) { + this.handleInAttributeValue(c, '"'); + }; + Tokenizer2.prototype.stateInAttributeValueSingleQuotes = function(c) { + this.handleInAttributeValue(c, "'"); + }; + Tokenizer2.prototype.stateInAttributeValueNoQuotes = function(c) { + if (whitespace2(c) || c === ">") { + this.emitToken("onattribdata"); + this.cbs.onattribend(null); + this._state = 8; + this._index--; + } else if (this.decodeEntities && c === "&") { + this.emitToken("onattribdata"); + this.baseState = this._state; + this._state = 62; + this.sectionStart = this._index; + } + }; + Tokenizer2.prototype.stateBeforeDeclaration = function(c) { + this._state = c === "[" ? 23 : c === "-" ? 18 : 16; + }; + Tokenizer2.prototype.stateInDeclaration = function(c) { + if (c === ">") { + this.cbs.ondeclaration(this.getSection()); + this._state = 1; + this.sectionStart = this._index + 1; + } + }; + Tokenizer2.prototype.stateInProcessingInstruction = function(c) { + if (c === ">") { + this.cbs.onprocessinginstruction(this.getSection()); + this._state = 1; + this.sectionStart = this._index + 1; + } + }; + Tokenizer2.prototype.stateBeforeComment = function(c) { + if (c === "-") { + this._state = 19; + this.sectionStart = this._index + 1; + } else { + this._state = 16; + } + }; + Tokenizer2.prototype.stateInComment = function(c) { + if (c === "-") + this._state = 21; + }; + Tokenizer2.prototype.stateInSpecialComment = function(c) { + if (c === ">") { + this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index)); + this._state = 1; + this.sectionStart = this._index + 1; + } + }; + Tokenizer2.prototype.stateAfterComment1 = function(c) { + if (c === "-") { + this._state = 22; + } else { + this._state = 19; + } + }; + Tokenizer2.prototype.stateAfterComment2 = function(c) { + if (c === ">") { + this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2)); + this._state = 1; + this.sectionStart = this._index + 1; + } else if (c !== "-") { + this._state = 19; + } + }; + Tokenizer2.prototype.stateBeforeCdata6 = function(c) { + if (c === "[") { + this._state = 29; + this.sectionStart = this._index + 1; + } else { + this._state = 16; + this._index--; + } + }; + Tokenizer2.prototype.stateInCdata = function(c) { + if (c === "]") + this._state = 30; + }; + Tokenizer2.prototype.stateAfterCdata1 = function(c) { + if (c === "]") + this._state = 31; + else + this._state = 29; + }; + Tokenizer2.prototype.stateAfterCdata2 = function(c) { + if (c === ">") { + this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2)); + this._state = 1; + this.sectionStart = this._index + 1; + } else if (c !== "]") { + this._state = 29; + } + }; + Tokenizer2.prototype.stateBeforeSpecialS = function(c) { + if (c === "c" || c === "C") { + this._state = 34; + } else if (c === "t" || c === "T") { + this._state = 44; + } else { + this._state = 3; + this._index--; + } + }; + Tokenizer2.prototype.stateBeforeSpecialSEnd = function(c) { + if (this.special === 2 && (c === "c" || c === "C")) { + this._state = 39; + } else if (this.special === 3 && (c === "t" || c === "T")) { + this._state = 48; + } else + this._state = 1; + }; + Tokenizer2.prototype.stateBeforeSpecialLast = function(c, special) { + if (c === "/" || c === ">" || whitespace2(c)) { + this.special = special; + } + this._state = 3; + this._index--; + }; + Tokenizer2.prototype.stateAfterSpecialLast = function(c, sectionStartOffset) { + if (c === ">" || whitespace2(c)) { + this.special = 1; + this._state = 6; + this.sectionStart = this._index - sectionStartOffset; + this._index--; + } else + this._state = 1; + }; + Tokenizer2.prototype.parseFixedEntity = function(map) { + if (map === void 0) { + map = this.xmlMode ? xml_json_1.default : entities_json_1.default; + } + if (this.sectionStart + 1 < this._index) { + var entity = this.buffer.substring(this.sectionStart + 1, this._index); + if (Object.prototype.hasOwnProperty.call(map, entity)) { + this.emitPartial(map[entity]); + this.sectionStart = this._index + 1; + } + } + }; + Tokenizer2.prototype.parseLegacyEntity = function() { + var start = this.sectionStart + 1; + var limit = Math.min(this._index - start, 6); + while (limit >= 2) { + var entity = this.buffer.substr(start, limit); + if (Object.prototype.hasOwnProperty.call(legacy_json_1.default, entity)) { + this.emitPartial(legacy_json_1.default[entity]); + this.sectionStart += limit + 1; + return; + } + limit--; + } + }; + Tokenizer2.prototype.stateInNamedEntity = function(c) { + if (c === ";") { + this.parseFixedEntity(); + if (this.baseState === 1 && this.sectionStart + 1 < this._index && !this.xmlMode) { + this.parseLegacyEntity(); + } + this._state = this.baseState; + } else if ((c < "0" || c > "9") && !isASCIIAlpha(c)) { + if (this.xmlMode || this.sectionStart + 1 === this._index) { + } else if (this.baseState !== 1) { + if (c !== "=") { + this.parseFixedEntity(legacy_json_1.default); } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold |= input[next++] << bits; - bits += 8; - } - _out -= left; - strm.total_out += _out; - state.total += _out; - if (state.wrap & 4 && _out) { - strm.adler = state.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/ - state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out); - } - _out = left; - if (state.wrap & 4 && (state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = "incorrect data check"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; + } else { + this.parseLegacyEntity(); + } + this._state = this.baseState; + this._index--; + } + }; + Tokenizer2.prototype.decodeNumericEntity = function(offset, base, strict) { + var sectionStart = this.sectionStart + offset; + if (sectionStart !== this._index) { + var entity = this.buffer.substring(sectionStart, this._index); + var parsed = parseInt(entity, base); + this.emitPartial(decode_codepoint_1.default(parsed)); + this.sectionStart = strict ? this._index + 1 : this._index; + } + this._state = this.baseState; + }; + Tokenizer2.prototype.stateInNumericEntity = function(c) { + if (c === ";") { + this.decodeNumericEntity(2, 10, true); + } else if (c < "0" || c > "9") { + if (!this.xmlMode) { + this.decodeNumericEntity(2, 10, false); + } else { + this._state = this.baseState; + } + this._index--; + } + }; + Tokenizer2.prototype.stateInHexEntity = function(c) { + if (c === ";") { + this.decodeNumericEntity(3, 16, true); + } else if ((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")) { + if (!this.xmlMode) { + this.decodeNumericEntity(3, 16, false); + } else { + this._state = this.baseState; + } + this._index--; + } + }; + Tokenizer2.prototype.cleanup = function() { + if (this.sectionStart < 0) { + this.buffer = ""; + this.bufferOffset += this._index; + this._index = 0; + } else if (this.running) { + if (this._state === 1) { + if (this.sectionStart !== this._index) { + this.cbs.ontext(this.buffer.substr(this.sectionStart)); } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 4 && hold !== (state.total & 4294967295)) { - strm.msg = "incorrect length check"; - state.mode = BAD; - break; + this.buffer = ""; + this.bufferOffset += this._index; + this._index = 0; + } else if (this.sectionStart === this._index) { + this.buffer = ""; + this.bufferOffset += this._index; + this._index = 0; + } else { + this.buffer = this.buffer.substr(this.sectionStart); + this._index -= this.sectionStart; + this.bufferOffset += this.sectionStart; + } + this.sectionStart = 0; + } + }; + Tokenizer2.prototype.parse = function() { + while (this._index < this.buffer.length && this.running) { + var c = this.buffer.charAt(this._index); + if (this._state === 1) { + this.stateText(c); + } else if (this._state === 12) { + this.stateInAttributeValueDoubleQuotes(c); + } else if (this._state === 9) { + this.stateInAttributeName(c); + } else if (this._state === 19) { + this.stateInComment(c); + } else if (this._state === 20) { + this.stateInSpecialComment(c); + } else if (this._state === 8) { + this.stateBeforeAttributeName(c); + } else if (this._state === 3) { + this.stateInTagName(c); + } else if (this._state === 6) { + this.stateInClosingTagName(c); + } else if (this._state === 2) { + this.stateBeforeTagName(c); + } else if (this._state === 10) { + this.stateAfterAttributeName(c); + } else if (this._state === 13) { + this.stateInAttributeValueSingleQuotes(c); + } else if (this._state === 11) { + this.stateBeforeAttributeValue(c); + } else if (this._state === 5) { + this.stateBeforeClosingTagName(c); + } else if (this._state === 7) { + this.stateAfterClosingTagName(c); + } else if (this._state === 32) { + this.stateBeforeSpecialS(c); + } else if (this._state === 21) { + this.stateAfterComment1(c); + } else if (this._state === 14) { + this.stateInAttributeValueNoQuotes(c); + } else if (this._state === 4) { + this.stateInSelfClosingTag(c); + } else if (this._state === 16) { + this.stateInDeclaration(c); + } else if (this._state === 15) { + this.stateBeforeDeclaration(c); + } else if (this._state === 22) { + this.stateAfterComment2(c); + } else if (this._state === 18) { + this.stateBeforeComment(c); + } else if (this._state === 33) { + this.stateBeforeSpecialSEnd(c); + } else if (this._state === 53) { + stateAfterSpecialTEnd(this, c); + } else if (this._state === 39) { + stateAfterScript1(this, c); + } else if (this._state === 40) { + stateAfterScript2(this, c); + } else if (this._state === 41) { + stateAfterScript3(this, c); + } else if (this._state === 34) { + stateBeforeScript1(this, c); + } else if (this._state === 35) { + stateBeforeScript2(this, c); + } else if (this._state === 36) { + stateBeforeScript3(this, c); + } else if (this._state === 37) { + stateBeforeScript4(this, c); + } else if (this._state === 38) { + this.stateBeforeSpecialLast( + c, + 2 + /* Script */ + ); + } else if (this._state === 42) { + stateAfterScript4(this, c); + } else if (this._state === 43) { + this.stateAfterSpecialLast(c, 6); + } else if (this._state === 44) { + stateBeforeStyle1(this, c); + } else if (this._state === 29) { + this.stateInCdata(c); + } else if (this._state === 45) { + stateBeforeStyle2(this, c); + } else if (this._state === 46) { + stateBeforeStyle3(this, c); + } else if (this._state === 47) { + this.stateBeforeSpecialLast( + c, + 3 + /* Style */ + ); + } else if (this._state === 48) { + stateAfterStyle1(this, c); + } else if (this._state === 49) { + stateAfterStyle2(this, c); + } else if (this._state === 50) { + stateAfterStyle3(this, c); + } else if (this._state === 51) { + this.stateAfterSpecialLast(c, 5); + } else if (this._state === 52) { + stateBeforeSpecialT(this, c); + } else if (this._state === 54) { + stateBeforeTitle1(this, c); + } else if (this._state === 55) { + stateBeforeTitle2(this, c); + } else if (this._state === 56) { + stateBeforeTitle3(this, c); + } else if (this._state === 57) { + this.stateBeforeSpecialLast( + c, + 4 + /* Title */ + ); + } else if (this._state === 58) { + stateAfterTitle1(this, c); + } else if (this._state === 59) { + stateAfterTitle2(this, c); + } else if (this._state === 60) { + stateAfterTitle3(this, c); + } else if (this._state === 61) { + this.stateAfterSpecialLast(c, 5); + } else if (this._state === 17) { + this.stateInProcessingInstruction(c); + } else if (this._state === 64) { + this.stateInNamedEntity(c); + } else if (this._state === 23) { + stateBeforeCdata1(this, c); + } else if (this._state === 62) { + stateBeforeEntity(this, c); + } else if (this._state === 24) { + stateBeforeCdata2(this, c); + } else if (this._state === 25) { + stateBeforeCdata3(this, c); + } else if (this._state === 30) { + this.stateAfterCdata1(c); + } else if (this._state === 31) { + this.stateAfterCdata2(c); + } else if (this._state === 26) { + stateBeforeCdata4(this, c); + } else if (this._state === 27) { + stateBeforeCdata5(this, c); + } else if (this._state === 28) { + this.stateBeforeCdata6(c); + } else if (this._state === 66) { + this.stateInHexEntity(c); + } else if (this._state === 65) { + this.stateInNumericEntity(c); + } else if (this._state === 63) { + stateBeforeNumericEntity(this, c); + } else { + this.cbs.onerror(Error("unknown _state"), this._state); + } + this._index++; + } + this.cleanup(); + }; + Tokenizer2.prototype.finish = function() { + if (this.sectionStart < this._index) { + this.handleTrailingData(); + } + this.cbs.onend(); + }; + Tokenizer2.prototype.handleTrailingData = function() { + var data = this.buffer.substr(this.sectionStart); + if (this._state === 29 || this._state === 30 || this._state === 31) { + this.cbs.oncdata(data); + } else if (this._state === 19 || this._state === 21 || this._state === 22) { + this.cbs.oncomment(data); + } else if (this._state === 64 && !this.xmlMode) { + this.parseLegacyEntity(); + if (this.sectionStart < this._index) { + this._state = this.baseState; + this.handleTrailingData(); + } + } else if (this._state === 65 && !this.xmlMode) { + this.decodeNumericEntity(2, 10, false); + if (this.sectionStart < this._index) { + this._state = this.baseState; + this.handleTrailingData(); + } + } else if (this._state === 66 && !this.xmlMode) { + this.decodeNumericEntity(3, 16, false); + if (this.sectionStart < this._index) { + this._state = this.baseState; + this.handleTrailingData(); + } + } else if (this._state !== 3 && this._state !== 8 && this._state !== 11 && this._state !== 10 && this._state !== 9 && this._state !== 13 && this._state !== 12 && this._state !== 14 && this._state !== 6) { + this.cbs.ontext(data); + } + }; + Tokenizer2.prototype.getSection = function() { + return this.buffer.substring(this.sectionStart, this._index); + }; + Tokenizer2.prototype.emitToken = function(name) { + this.cbs[name](this.getSection()); + this.sectionStart = -1; + }; + Tokenizer2.prototype.emitPartial = function(value) { + if (this.baseState !== 1) { + this.cbs.onattribdata(value); + } else { + this.cbs.ontext(value); + } + }; + return Tokenizer2; + })() + ); + exports2.default = Tokenizer; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/lib/Parser.js +var require_Parser2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/lib/Parser.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Parser = void 0; + var Tokenizer_1 = __importDefault2(require_Tokenizer2()); + var formTags = /* @__PURE__ */ new Set([ + "input", + "option", + "optgroup", + "select", + "button", + "datalist", + "textarea" + ]); + var pTag = /* @__PURE__ */ new Set(["p"]); + var openImpliesClose = { + tr: /* @__PURE__ */ new Set(["tr", "th", "td"]), + th: /* @__PURE__ */ new Set(["th"]), + td: /* @__PURE__ */ new Set(["thead", "th", "td"]), + body: /* @__PURE__ */ new Set(["head", "link", "script"]), + li: /* @__PURE__ */ new Set(["li"]), + p: pTag, + h1: pTag, + h2: pTag, + h3: pTag, + h4: pTag, + h5: pTag, + h6: pTag, + select: formTags, + input: formTags, + output: formTags, + button: formTags, + datalist: formTags, + textarea: formTags, + option: /* @__PURE__ */ new Set(["option"]), + optgroup: /* @__PURE__ */ new Set(["optgroup", "option"]), + dd: /* @__PURE__ */ new Set(["dt", "dd"]), + dt: /* @__PURE__ */ new Set(["dt", "dd"]), + address: pTag, + article: pTag, + aside: pTag, + blockquote: pTag, + details: pTag, + div: pTag, + dl: pTag, + fieldset: pTag, + figcaption: pTag, + figure: pTag, + footer: pTag, + form: pTag, + header: pTag, + hr: pTag, + main: pTag, + nav: pTag, + ol: pTag, + pre: pTag, + section: pTag, + table: pTag, + ul: pTag, + rt: /* @__PURE__ */ new Set(["rt", "rp"]), + rp: /* @__PURE__ */ new Set(["rt", "rp"]), + tbody: /* @__PURE__ */ new Set(["thead", "tbody"]), + tfoot: /* @__PURE__ */ new Set(["thead", "tbody"]) + }; + var voidElements2 = /* @__PURE__ */ new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr" + ]); + var foreignContextElements = /* @__PURE__ */ new Set(["math", "svg"]); + var htmlIntegrationElements = /* @__PURE__ */ new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignObject", + "desc", + "title" + ]); + var reNameEnd = /\s|\//; + var Parser = ( + /** @class */ + (function() { + function Parser2(cbs, options) { + if (options === void 0) { + options = {}; + } + var _a, _b, _c, _d, _e; + this.startIndex = 0; + this.endIndex = null; + this.tagname = ""; + this.attribname = ""; + this.attribvalue = ""; + this.attribs = null; + this.stack = []; + this.foreignContext = []; + this.options = options; + this.cbs = cbs !== null && cbs !== void 0 ? cbs : {}; + this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode; + this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode; + this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer_1.default)(this.options, this); + (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this); + } + Parser2.prototype.updatePosition = function(initialOffset) { + if (this.endIndex === null) { + if (this.tokenizer.sectionStart <= initialOffset) { + this.startIndex = 0; + } else { + this.startIndex = this.tokenizer.sectionStart - initialOffset; + } + } else { + this.startIndex = this.endIndex + 1; + } + this.endIndex = this.tokenizer.getAbsoluteIndex(); + }; + Parser2.prototype.ontext = function(data) { + var _a, _b; + this.updatePosition(1); + this.endIndex--; + (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data); + }; + Parser2.prototype.onopentagname = function(name) { + var _a, _b; + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + this.tagname = name; + if (!this.options.xmlMode && Object.prototype.hasOwnProperty.call(openImpliesClose, name)) { + var el = void 0; + while (this.stack.length > 0 && openImpliesClose[name].has(el = this.stack[this.stack.length - 1])) { + this.onclosetag(el); + } + } + if (this.options.xmlMode || !voidElements2.has(name)) { + this.stack.push(name); + if (foreignContextElements.has(name)) { + this.foreignContext.push(true); + } else if (htmlIntegrationElements.has(name)) { + this.foreignContext.push(false); + } + } + (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, name); + if (this.cbs.onopentag) + this.attribs = {}; + }; + Parser2.prototype.onopentagend = function() { + var _a, _b; + this.updatePosition(1); + if (this.attribs) { + (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs); + this.attribs = null; + } + if (!this.options.xmlMode && this.cbs.onclosetag && voidElements2.has(this.tagname)) { + this.cbs.onclosetag(this.tagname); + } + this.tagname = ""; + }; + Parser2.prototype.onclosetag = function(name) { + this.updatePosition(1); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + if (foreignContextElements.has(name) || htmlIntegrationElements.has(name)) { + this.foreignContext.pop(); + } + if (this.stack.length && (this.options.xmlMode || !voidElements2.has(name))) { + var pos = this.stack.lastIndexOf(name); + if (pos !== -1) { + if (this.cbs.onclosetag) { + pos = this.stack.length - pos; + while (pos--) { + this.cbs.onclosetag(this.stack.pop()); } - hold = 0; - bits = 0; - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; + } else + this.stack.length = pos; + } else if (name === "p" && !this.options.xmlMode) { + this.onopentagname(name); + this.closeCurrentTag(); + } + } else if (!this.options.xmlMode && (name === "br" || name === "p")) { + this.onopentagname(name); + this.closeCurrentTag(); + } + }; + Parser2.prototype.onselfclosingtag = function() { + if (this.options.xmlMode || this.options.recognizeSelfClosing || this.foreignContext[this.foreignContext.length - 1]) { + this.closeCurrentTag(); + } else { + this.onopentagend(); + } + }; + Parser2.prototype.closeCurrentTag = function() { + var _a, _b; + var name = this.tagname; + this.onopentagend(); + if (this.stack[this.stack.length - 1] === name) { + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name); + this.stack.pop(); + } + }; + Parser2.prototype.onattribname = function(name) { + if (this.lowerCaseAttributeNames) { + name = name.toLowerCase(); + } + this.attribname = name; + }; + Parser2.prototype.onattribdata = function(value) { + this.attribvalue += value; + }; + Parser2.prototype.onattribend = function(quote) { + var _a, _b; + (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote); + if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) { + this.attribs[this.attribname] = this.attribvalue; + } + this.attribname = ""; + this.attribvalue = ""; + }; + Parser2.prototype.getInstructionName = function(value) { + var idx = value.search(reNameEnd); + var name = idx < 0 ? value : value.substr(0, idx); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + return name; + }; + Parser2.prototype.ondeclaration = function(value) { + if (this.cbs.onprocessinginstruction) { + var name_1 = this.getInstructionName(value); + this.cbs.onprocessinginstruction("!" + name_1, "!" + value); + } + }; + Parser2.prototype.onprocessinginstruction = function(value) { + if (this.cbs.onprocessinginstruction) { + var name_2 = this.getInstructionName(value); + this.cbs.onprocessinginstruction("?" + name_2, "?" + value); + } + }; + Parser2.prototype.oncomment = function(value) { + var _a, _b, _c, _d; + this.updatePosition(4); + (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, value); + (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c); + }; + Parser2.prototype.oncdata = function(value) { + var _a, _b, _c, _d, _e, _f; + this.updatePosition(1); + if (this.options.xmlMode || this.options.recognizeCDATA) { + (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a); + (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value); + (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e); + } else { + this.oncomment("[CDATA[" + value + "]]"); + } + }; + Parser2.prototype.onerror = function(err) { + var _a, _b; + (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, err); + }; + Parser2.prototype.onend = function() { + var _a, _b; + if (this.cbs.onclosetag) { + for (var i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i])) + ; + } + (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a); + }; + Parser2.prototype.reset = function() { + var _a, _b, _c, _d; + (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a); + this.tokenizer.reset(); + this.tagname = ""; + this.attribname = ""; + this.attribs = null; + this.stack = []; + (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this); + }; + Parser2.prototype.parseComplete = function(data) { + this.reset(); + this.end(data); + }; + Parser2.prototype.write = function(chunk) { + this.tokenizer.write(chunk); + }; + Parser2.prototype.end = function(chunk) { + this.tokenizer.end(chunk); + }; + Parser2.prototype.pause = function() { + this.tokenizer.pause(); + }; + Parser2.prototype.resume = function() { + this.tokenizer.resume(); + }; + Parser2.prototype.parseChunk = function(chunk) { + this.write(chunk); + }; + Parser2.prototype.done = function(chunk) { + this.end(chunk); + }; + return Parser2; + })() + ); + exports2.Parser = Parser; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/node.js +var require_node5 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/node.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ (function() { + var extendStatics2 = function(d, b) { + extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics2(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics2(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __assign2 = exports2 && exports2.__assign || function() { + __assign2 = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign2.apply(this, arguments); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.cloneNode = exports2.hasChildren = exports2.isDocument = exports2.isDirective = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = exports2.Element = exports2.Document = exports2.NodeWithChildren = exports2.ProcessingInstruction = exports2.Comment = exports2.Text = exports2.DataNode = exports2.Node = void 0; + var domelementtype_1 = require_lib5(); + var nodeTypes = /* @__PURE__ */ new Map([ + [domelementtype_1.ElementType.Tag, 1], + [domelementtype_1.ElementType.Script, 1], + [domelementtype_1.ElementType.Style, 1], + [domelementtype_1.ElementType.Directive, 1], + [domelementtype_1.ElementType.Text, 3], + [domelementtype_1.ElementType.CDATA, 4], + [domelementtype_1.ElementType.Comment, 8], + [domelementtype_1.ElementType.Root, 9] + ]); + var Node = ( + /** @class */ + (function() { + function Node2(type) { + this.type = type; + this.parent = null; + this.prev = null; + this.next = null; + this.startIndex = null; + this.endIndex = null; + } + Object.defineProperty(Node2.prototype, "nodeType", { + // Read-only aliases + /** + * [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible + * node {@link type}. + */ + get: function() { + var _a; + return (_a = nodeTypes.get(this.type)) !== null && _a !== void 0 ? _a : 1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Node2.prototype, "parentNode", { + // Read-write aliases for properties + /** + * Same as {@link parent}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.parent; + }, + set: function(parent) { + this.parent = parent; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Node2.prototype, "previousSibling", { + /** + * Same as {@link prev}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.prev; + }, + set: function(prev) { + this.prev = prev; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Node2.prototype, "nextSibling", { + /** + * Same as {@link next}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.next; + }, + set: function(next) { + this.next = next; + }, + enumerable: false, + configurable: true + }); + Node2.prototype.cloneNode = function(recursive) { + if (recursive === void 0) { + recursive = false; + } + return cloneNode(this, recursive); + }; + return Node2; + })() + ); + exports2.Node = Node; + var DataNode = ( + /** @class */ + (function(_super) { + __extends2(DataNode2, _super); + function DataNode2(type, data) { + var _this = _super.call(this, type) || this; + _this.data = data; + return _this; + } + Object.defineProperty(DataNode2.prototype, "nodeValue", { + /** + * Same as {@link data}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.data; + }, + set: function(data) { + this.data = data; + }, + enumerable: false, + configurable: true + }); + return DataNode2; + })(Node) + ); + exports2.DataNode = DataNode; + var Text4 = ( + /** @class */ + (function(_super) { + __extends2(Text5, _super); + function Text5(data) { + return _super.call(this, domelementtype_1.ElementType.Text, data) || this; + } + return Text5; + })(DataNode) + ); + exports2.Text = Text4; + var Comment4 = ( + /** @class */ + (function(_super) { + __extends2(Comment5, _super); + function Comment5(data) { + return _super.call(this, domelementtype_1.ElementType.Comment, data) || this; + } + return Comment5; + })(DataNode) + ); + exports2.Comment = Comment4; + var ProcessingInstruction = ( + /** @class */ + (function(_super) { + __extends2(ProcessingInstruction2, _super); + function ProcessingInstruction2(name, data) { + var _this = _super.call(this, domelementtype_1.ElementType.Directive, data) || this; + _this.name = name; + return _this; + } + return ProcessingInstruction2; + })(DataNode) + ); + exports2.ProcessingInstruction = ProcessingInstruction; + var NodeWithChildren = ( + /** @class */ + (function(_super) { + __extends2(NodeWithChildren2, _super); + function NodeWithChildren2(type, children) { + var _this = _super.call(this, type) || this; + _this.children = children; + return _this; + } + Object.defineProperty(NodeWithChildren2.prototype, "firstChild", { + // Aliases + /** First child of the node. */ + get: function() { + var _a; + return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NodeWithChildren2.prototype, "lastChild", { + /** Last child of the node. */ + get: function() { + return this.children.length > 0 ? this.children[this.children.length - 1] : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NodeWithChildren2.prototype, "childNodes", { + /** + * Same as {@link children}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.children; + }, + set: function(children) { + this.children = children; + }, + enumerable: false, + configurable: true + }); + return NodeWithChildren2; + })(Node) + ); + exports2.NodeWithChildren = NodeWithChildren; + var Document = ( + /** @class */ + (function(_super) { + __extends2(Document2, _super); + function Document2(children) { + return _super.call(this, domelementtype_1.ElementType.Root, children) || this; + } + return Document2; + })(NodeWithChildren) + ); + exports2.Document = Document; + var Element = ( + /** @class */ + (function(_super) { + __extends2(Element2, _super); + function Element2(name, attribs, children, type) { + if (children === void 0) { + children = []; + } + if (type === void 0) { + type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag; + } + var _this = _super.call(this, type, children) || this; + _this.name = name; + _this.attribs = attribs; + return _this; + } + Object.defineProperty(Element2.prototype, "tagName", { + // DOM Level 1 aliases + /** + * Same as {@link name}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get: function() { + return this.name; + }, + set: function(name) { + this.name = name; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Element2.prototype, "attributes", { + get: function() { + var _this = this; + return Object.keys(this.attribs).map(function(name) { + var _a, _b; + return { + name, + value: _this.attribs[name], + namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name], + prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name] + }; + }); + }, + enumerable: false, + configurable: true + }); + return Element2; + })(NodeWithChildren) + ); + exports2.Element = Element; + function isTag3(node) { + return (0, domelementtype_1.isTag)(node); + } + exports2.isTag = isTag3; + function isCDATA2(node) { + return node.type === domelementtype_1.ElementType.CDATA; + } + exports2.isCDATA = isCDATA2; + function isText2(node) { + return node.type === domelementtype_1.ElementType.Text; + } + exports2.isText = isText2; + function isComment2(node) { + return node.type === domelementtype_1.ElementType.Comment; + } + exports2.isComment = isComment2; + function isDirective(node) { + return node.type === domelementtype_1.ElementType.Directive; + } + exports2.isDirective = isDirective; + function isDocument(node) { + return node.type === domelementtype_1.ElementType.Root; + } + exports2.isDocument = isDocument; + function hasChildren2(node) { + return Object.prototype.hasOwnProperty.call(node, "children"); + } + exports2.hasChildren = hasChildren2; + function cloneNode(node, recursive) { + if (recursive === void 0) { + recursive = false; + } + var result; + if (isText2(node)) { + result = new Text4(node.data); + } else if (isComment2(node)) { + result = new Comment4(node.data); + } else if (isTag3(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_1 = new Element(node.name, __assign2({}, node.attribs), children); + children.forEach(function(child) { + return child.parent = clone_1; + }); + if (node.namespace != null) { + clone_1.namespace = node.namespace; + } + if (node["x-attribsNamespace"]) { + clone_1["x-attribsNamespace"] = __assign2({}, node["x-attribsNamespace"]); + } + if (node["x-attribsPrefix"]) { + clone_1["x-attribsPrefix"] = __assign2({}, node["x-attribsPrefix"]); + } + result = clone_1; + } else if (isCDATA2(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_2 = new NodeWithChildren(domelementtype_1.ElementType.CDATA, children); + children.forEach(function(child) { + return child.parent = clone_2; + }); + result = clone_2; + } else if (isDocument(node)) { + var children = recursive ? cloneChildren(node.children) : []; + var clone_3 = new Document(children); + children.forEach(function(child) { + return child.parent = clone_3; + }); + if (node["x-mode"]) { + clone_3["x-mode"] = node["x-mode"]; + } + result = clone_3; + } else if (isDirective(node)) { + var instruction = new ProcessingInstruction(node.name, node.data); + if (node["x-name"] != null) { + instruction["x-name"] = node["x-name"]; + instruction["x-publicId"] = node["x-publicId"]; + instruction["x-systemId"] = node["x-systemId"]; + } + result = instruction; + } else { + throw new Error("Not implemented yet: ".concat(node.type)); + } + result.startIndex = node.startIndex; + result.endIndex = node.endIndex; + if (node.sourceCodeLocation != null) { + result.sourceCodeLocation = node.sourceCodeLocation; + } + return result; + } + exports2.cloneNode = cloneNode; + function cloneChildren(childs) { + var children = childs.map(function(child) { + return cloneNode(child, true); + }); + for (var i = 1; i < children.length; i++) { + children[i].prev = children[i - 1]; + children[i - 1].next = children[i]; + } + return children; + } + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/index.js +var require_lib11 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domhandler/lib/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DomHandler = void 0; + var domelementtype_1 = require_lib5(); + var node_1 = require_node5(); + __exportStar2(require_node5(), exports2); + var reWhitespace = /\s+/g; + var defaultOpts = { + normalizeWhitespace: false, + withStartIndices: false, + withEndIndices: false, + xmlMode: false + }; + var DomHandler = ( + /** @class */ + (function() { + function DomHandler2(callback, options, elementCB) { + this.dom = []; + this.root = new node_1.Document(this.dom); + this.done = false; + this.tagStack = [this.root]; + this.lastNode = null; + this.parser = null; + if (typeof options === "function") { + elementCB = options; + options = defaultOpts; + } + if (typeof callback === "object") { + options = callback; + callback = void 0; + } + this.callback = callback !== null && callback !== void 0 ? callback : null; + this.options = options !== null && options !== void 0 ? options : defaultOpts; + this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null; + } + DomHandler2.prototype.onparserinit = function(parser) { + this.parser = parser; + }; + DomHandler2.prototype.onreset = function() { + this.dom = []; + this.root = new node_1.Document(this.dom); + this.done = false; + this.tagStack = [this.root]; + this.lastNode = null; + this.parser = null; + }; + DomHandler2.prototype.onend = function() { + if (this.done) + return; + this.done = true; + this.parser = null; + this.handleCallback(null); + }; + DomHandler2.prototype.onerror = function(error) { + this.handleCallback(error); + }; + DomHandler2.prototype.onclosetag = function() { + this.lastNode = null; + var elem = this.tagStack.pop(); + if (this.options.withEndIndices) { + elem.endIndex = this.parser.endIndex; + } + if (this.elementCB) + this.elementCB(elem); + }; + DomHandler2.prototype.onopentag = function(name, attribs) { + var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0; + var element = new node_1.Element(name, attribs, void 0, type); + this.addNode(element); + this.tagStack.push(element); + }; + DomHandler2.prototype.ontext = function(data) { + var normalizeWhitespace = this.options.normalizeWhitespace; + var lastNode = this.lastNode; + if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) { + if (normalizeWhitespace) { + lastNode.data = (lastNode.data + data).replace(reWhitespace, " "); + } else { + lastNode.data += data; + } + if (this.options.withEndIndices) { + lastNode.endIndex = this.parser.endIndex; + } + } else { + if (normalizeWhitespace) { + data = data.replace(reWhitespace, " "); + } + var node = new node_1.Text(data); + this.addNode(node); + this.lastNode = node; + } + }; + DomHandler2.prototype.oncomment = function(data) { + if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) { + this.lastNode.data += data; + return; + } + var node = new node_1.Comment(data); + this.addNode(node); + this.lastNode = node; + }; + DomHandler2.prototype.oncommentend = function() { + this.lastNode = null; + }; + DomHandler2.prototype.oncdatastart = function() { + var text = new node_1.Text(""); + var node = new node_1.NodeWithChildren(domelementtype_1.ElementType.CDATA, [text]); + this.addNode(node); + text.parent = node; + this.lastNode = text; + }; + DomHandler2.prototype.oncdataend = function() { + this.lastNode = null; + }; + DomHandler2.prototype.onprocessinginstruction = function(name, data) { + var node = new node_1.ProcessingInstruction(name, data); + this.addNode(node); + }; + DomHandler2.prototype.handleCallback = function(error) { + if (typeof this.callback === "function") { + this.callback(error, this.dom); + } else if (error) { + throw error; + } + }; + DomHandler2.prototype.addNode = function(node) { + var parent = this.tagStack[this.tagStack.length - 1]; + var previousSibling = parent.children[parent.children.length - 1]; + if (this.options.withStartIndices) { + node.startIndex = this.parser.startIndex; + } + if (this.options.withEndIndices) { + node.endIndex = this.parser.endIndex; + } + parent.children.push(node); + if (previousSibling) { + node.prev = previousSibling; + previousSibling.next = node; + } + node.parent = parent; + this.lastNode = null; + }; + return DomHandler2; + })() + ); + exports2.DomHandler = DomHandler; + exports2.default = DomHandler; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode.js +var require_decode4 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/decode.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decodeHTML = exports2.decodeHTMLStrict = exports2.decodeXML = void 0; + var entities_json_1 = __importDefault2(require_entities()); + var legacy_json_1 = __importDefault2(require_legacy2()); + var xml_json_1 = __importDefault2(require_xml()); + var decode_codepoint_1 = __importDefault2(require_decode_codepoint3()); + var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; + exports2.decodeXML = getStrictDecoder(xml_json_1.default); + exports2.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); + function getStrictDecoder(map) { + var replace = getReplacer(map); + return function(str) { + return String(str).replace(strictEntityRe, replace); + }; + } + var sorter = function(a, b) { + return a < b ? 1 : -1; + }; + exports2.decodeHTML = (function() { + var legacy = Object.keys(legacy_json_1.default).sort(sorter); + var keys = Object.keys(entities_json_1.default).sort(sorter); + for (var i = 0, j = 0; i < keys.length; i++) { + if (legacy[j] === keys[i]) { + keys[i] += ";?"; + j++; + } else { + keys[i] += ";"; + } + } + var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); + var replace = getReplacer(entities_json_1.default); + function replacer(str) { + if (str.substr(-1) !== ";") + str += ";"; + return replace(str); + } + return function(str) { + return String(str).replace(re, replacer); + }; + })(); + function getReplacer(map) { + return function replace(str) { + if (str.charAt(1) === "#") { + var secondChar = str.charAt(2); + if (secondChar === "X" || secondChar === "x") { + return decode_codepoint_1.default(parseInt(str.substr(3), 16)); } + return decode_codepoint_1.default(parseInt(str.substr(2), 10)); } - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; + return map[str.slice(1, -1)] || str; + }; + } + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/encode.js +var require_encode2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/encode.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.escapeUTF8 = exports2.escape = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.encodeXML = void 0; + var xml_json_1 = __importDefault2(require_xml()); + var inverseXML = getInverseObj(xml_json_1.default); + var xmlReplacer = getInverseReplacer(inverseXML); + exports2.encodeXML = getASCIIEncoder(inverseXML); + var entities_json_1 = __importDefault2(require_entities()); + var inverseHTML = getInverseObj(entities_json_1.default); + var htmlReplacer = getInverseReplacer(inverseHTML); + exports2.encodeHTML = getInverse(inverseHTML, htmlReplacer); + exports2.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); + function getInverseObj(obj) { + return Object.keys(obj).sort().reduce(function(inverse, name) { + inverse[obj[name]] = "&" + name + ";"; + return inverse; + }, {}); + } + function getInverseReplacer(inverse) { + var single = []; + var multiple = []; + for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { + var k = _a[_i]; + if (k.length === 1) { + single.push("\\" + k); + } else { + multiple.push(k); } } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap & 4 && _out) { - strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/ - state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out); + single.sort(); + for (var start = 0; start < single.length - 1; start++) { + var end = start; + while (end < single.length - 1 && single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { + end += 1; + } + var count = 1 + end - start; + if (count < 3) + continue; + single.splice(start, count, single[start] + "-" + single[end]); } - strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; + multiple.unshift("[" + single.join("") + "]"); + return new RegExp(multiple.join("|"), "g"); + } + var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; + var getCodePoint = ( + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + String.prototype.codePointAt != null ? ( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + function(str) { + return str.codePointAt(0); + } + ) : ( + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function(c) { + return (c.charCodeAt(0) - 55296) * 1024 + c.charCodeAt(1) - 56320 + 65536; + } + ) + ); + function singleCharReplacer(c) { + return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)).toString(16).toUpperCase() + ";"; + } + function getInverse(inverse, re) { + return function(data) { + return data.replace(re, function(name) { + return inverse[name]; + }).replace(reNonASCII, singleCharReplacer); + }; + } + var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); + function escape3(data) { + return data.replace(reEscapeChars, singleCharReplacer); + } + exports2.escape = escape3; + function escapeUTF82(data) { + return data.replace(xmlReplacer, singleCharReplacer); + } + exports2.escapeUTF8 = escapeUTF82; + function getASCIIEncoder(obj) { + return function(data) { + return data.replace(reEscapeChars, function(c) { + return obj[c] || singleCharReplacer(c); + }); + }; + } + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/index.js +var require_lib12 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/entities/lib/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decodeXMLStrict = exports2.decodeHTML5Strict = exports2.decodeHTML4Strict = exports2.decodeHTML5 = exports2.decodeHTML4 = exports2.decodeHTMLStrict = exports2.decodeHTML = exports2.decodeXML = exports2.encodeHTML5 = exports2.encodeHTML4 = exports2.escapeUTF8 = exports2.escape = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.encodeXML = exports2.encode = exports2.decodeStrict = exports2.decode = void 0; + var decode_1 = require_decode4(); + var encode_1 = require_encode2(); + function decode(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); + } + exports2.decode = decode; + function decodeStrict(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); + } + exports2.decodeStrict = decodeStrict; + function encode(data, level) { + return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); + } + exports2.encode = encode; + var encode_2 = require_encode2(); + Object.defineProperty(exports2, "encodeXML", { enumerable: true, get: function() { + return encode_2.encodeXML; + } }); + Object.defineProperty(exports2, "encodeHTML", { enumerable: true, get: function() { + return encode_2.encodeHTML; + } }); + Object.defineProperty(exports2, "encodeNonAsciiHTML", { enumerable: true, get: function() { + return encode_2.encodeNonAsciiHTML; + } }); + Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { + return encode_2.escape; + } }); + Object.defineProperty(exports2, "escapeUTF8", { enumerable: true, get: function() { + return encode_2.escapeUTF8; + } }); + Object.defineProperty(exports2, "encodeHTML4", { enumerable: true, get: function() { + return encode_2.encodeHTML; + } }); + Object.defineProperty(exports2, "encodeHTML5", { enumerable: true, get: function() { + return encode_2.encodeHTML; + } }); + var decode_2 = require_decode4(); + Object.defineProperty(exports2, "decodeXML", { enumerable: true, get: function() { + return decode_2.decodeXML; + } }); + Object.defineProperty(exports2, "decodeHTML", { enumerable: true, get: function() { + return decode_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTMLStrict", { enumerable: true, get: function() { + return decode_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeHTML4", { enumerable: true, get: function() { + return decode_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTML5", { enumerable: true, get: function() { + return decode_2.decodeHTML; + } }); + Object.defineProperty(exports2, "decodeHTML4Strict", { enumerable: true, get: function() { + return decode_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeHTML5Strict", { enumerable: true, get: function() { + return decode_2.decodeHTMLStrict; + } }); + Object.defineProperty(exports2, "decodeXMLStrict", { enumerable: true, get: function() { + return decode_2.decodeXML; + } }); + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js +var require_foreignNames2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/foreignNames.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.attributeNames = exports2.elementNames = void 0; + exports2.elementNames = /* @__PURE__ */ new Map([ + ["altglyph", "altGlyph"], + ["altglyphdef", "altGlyphDef"], + ["altglyphitem", "altGlyphItem"], + ["animatecolor", "animateColor"], + ["animatemotion", "animateMotion"], + ["animatetransform", "animateTransform"], + ["clippath", "clipPath"], + ["feblend", "feBlend"], + ["fecolormatrix", "feColorMatrix"], + ["fecomponenttransfer", "feComponentTransfer"], + ["fecomposite", "feComposite"], + ["feconvolvematrix", "feConvolveMatrix"], + ["fediffuselighting", "feDiffuseLighting"], + ["fedisplacementmap", "feDisplacementMap"], + ["fedistantlight", "feDistantLight"], + ["fedropshadow", "feDropShadow"], + ["feflood", "feFlood"], + ["fefunca", "feFuncA"], + ["fefuncb", "feFuncB"], + ["fefuncg", "feFuncG"], + ["fefuncr", "feFuncR"], + ["fegaussianblur", "feGaussianBlur"], + ["feimage", "feImage"], + ["femerge", "feMerge"], + ["femergenode", "feMergeNode"], + ["femorphology", "feMorphology"], + ["feoffset", "feOffset"], + ["fepointlight", "fePointLight"], + ["fespecularlighting", "feSpecularLighting"], + ["fespotlight", "feSpotLight"], + ["fetile", "feTile"], + ["feturbulence", "feTurbulence"], + ["foreignobject", "foreignObject"], + ["glyphref", "glyphRef"], + ["lineargradient", "linearGradient"], + ["radialgradient", "radialGradient"], + ["textpath", "textPath"] + ]); + exports2.attributeNames = /* @__PURE__ */ new Map([ + ["definitionurl", "definitionURL"], + ["attributename", "attributeName"], + ["attributetype", "attributeType"], + ["basefrequency", "baseFrequency"], + ["baseprofile", "baseProfile"], + ["calcmode", "calcMode"], + ["clippathunits", "clipPathUnits"], + ["diffuseconstant", "diffuseConstant"], + ["edgemode", "edgeMode"], + ["filterunits", "filterUnits"], + ["glyphref", "glyphRef"], + ["gradienttransform", "gradientTransform"], + ["gradientunits", "gradientUnits"], + ["kernelmatrix", "kernelMatrix"], + ["kernelunitlength", "kernelUnitLength"], + ["keypoints", "keyPoints"], + ["keysplines", "keySplines"], + ["keytimes", "keyTimes"], + ["lengthadjust", "lengthAdjust"], + ["limitingconeangle", "limitingConeAngle"], + ["markerheight", "markerHeight"], + ["markerunits", "markerUnits"], + ["markerwidth", "markerWidth"], + ["maskcontentunits", "maskContentUnits"], + ["maskunits", "maskUnits"], + ["numoctaves", "numOctaves"], + ["pathlength", "pathLength"], + ["patterncontentunits", "patternContentUnits"], + ["patterntransform", "patternTransform"], + ["patternunits", "patternUnits"], + ["pointsatx", "pointsAtX"], + ["pointsaty", "pointsAtY"], + ["pointsatz", "pointsAtZ"], + ["preservealpha", "preserveAlpha"], + ["preserveaspectratio", "preserveAspectRatio"], + ["primitiveunits", "primitiveUnits"], + ["refx", "refX"], + ["refy", "refY"], + ["repeatcount", "repeatCount"], + ["repeatdur", "repeatDur"], + ["requiredextensions", "requiredExtensions"], + ["requiredfeatures", "requiredFeatures"], + ["specularconstant", "specularConstant"], + ["specularexponent", "specularExponent"], + ["spreadmethod", "spreadMethod"], + ["startoffset", "startOffset"], + ["stddeviation", "stdDeviation"], + ["stitchtiles", "stitchTiles"], + ["surfacescale", "surfaceScale"], + ["systemlanguage", "systemLanguage"], + ["tablevalues", "tableValues"], + ["targetx", "targetX"], + ["targety", "targetY"], + ["textlength", "textLength"], + ["viewbox", "viewBox"], + ["viewtarget", "viewTarget"], + ["xchannelselector", "xChannelSelector"], + ["ychannelselector", "yChannelSelector"], + ["zoomandpan", "zoomAndPan"] + ]); + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js +var require_lib13 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __assign2 = exports2 && exports2.__assign || function() { + __assign2 = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign2.apply(this, arguments); + }; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - return ret; + __setModuleDefault2(result, mod); + return result; }; - var inflateEnd = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + Object.defineProperty(exports2, "__esModule", { value: true }); + var ElementType4 = __importStar2(require_lib5()); + var entities_1 = require_lib12(); + var foreignNames_1 = require_foreignNames2(); + var unencodedElements2 = /* @__PURE__ */ new Set([ + "style", + "script", + "xmp", + "iframe", + "noembed", + "noframes", + "plaintext", + "noscript" + ]); + function formatAttributes2(attributes, opts) { + if (!attributes) + return; + return Object.keys(attributes).map(function(key) { + var _a, _b; + var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : ""; + if (opts.xmlMode === "foreign") { + key = (_b = foreignNames_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key; + } + if (!opts.emptyAttrs && !opts.xmlMode && value === "") { + return key; + } + return key + '="' + (opts.decodeEntities !== false ? entities_1.encodeXML(value) : value.replace(/"/g, """)) + '"'; + }).join(" "); + } + var singleTag = /* @__PURE__ */ new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr" + ]); + function render2(node, options) { + if (options === void 0) { + options = {}; + } + var nodes = "length" in node ? node : [node]; + var output = ""; + for (var i = 0; i < nodes.length; i++) { + output += renderNode2(nodes[i], options); + } + return output; + } + exports2.default = render2; + function renderNode2(node, options) { + switch (node.type) { + case ElementType4.Root: + return render2(node.children, options); + case ElementType4.Directive: + case ElementType4.Doctype: + return renderDirective(node); + case ElementType4.Comment: + return renderComment(node); + case ElementType4.CDATA: + return renderCdata(node); + case ElementType4.Script: + case ElementType4.Style: + case ElementType4.Tag: + return renderTag2(node, options); + case ElementType4.Text: + return renderText(node, options); + } + } + var foreignModeIntegrationPoints2 = /* @__PURE__ */ new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignObject", + "desc", + "title" + ]); + var foreignElements2 = /* @__PURE__ */ new Set(["svg", "math"]); + function renderTag2(elem, opts) { + var _a; + if (opts.xmlMode === "foreign") { + elem.name = (_a = foreignNames_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name; + if (elem.parent && foreignModeIntegrationPoints2.has(elem.parent.name)) { + opts = __assign2(__assign2({}, opts), { xmlMode: false }); + } + } + if (!opts.xmlMode && foreignElements2.has(elem.name)) { + opts = __assign2(__assign2({}, opts), { xmlMode: "foreign" }); + } + var tag = "<" + elem.name; + var attribs = formatAttributes2(elem.attribs, opts); + if (attribs) { + tag += " " + attribs; + } + if (elem.children.length === 0 && (opts.xmlMode ? ( + // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags + opts.selfClosingTags !== false + ) : ( + // User explicitly asked for self-closing tags, even in HTML mode + opts.selfClosingTags && singleTag.has(elem.name) + ))) { + if (!opts.xmlMode) + tag += " "; + tag += "/>"; + } else { + tag += ">"; + if (elem.children.length > 0) { + tag += render2(elem.children, opts); + } + if (opts.xmlMode || !singleTag.has(elem.name)) { + tag += "</" + elem.name + ">"; + } + } + return tag; + } + function renderDirective(elem) { + return "<" + elem.data + ">"; + } + function renderText(elem, opts) { + var data = elem.data || ""; + if (opts.decodeEntities !== false && !(!opts.xmlMode && elem.parent && unencodedElements2.has(elem.parent.name))) { + data = entities_1.encodeXML(data); + } + return data; + } + function renderCdata(elem) { + return "<![CDATA[" + elem.children[0].data + "]]>"; + } + function renderComment(elem) { + return "<!--" + elem.data + "-->"; + } + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +var require_stringify4 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.innerText = exports2.textContent = exports2.getText = exports2.getInnerHTML = exports2.getOuterHTML = void 0; + var domhandler_1 = require_lib11(); + var dom_serializer_1 = __importDefault2(require_lib13()); + var domelementtype_1 = require_lib5(); + function getOuterHTML2(node, options) { + return (0, dom_serializer_1.default)(node, options); + } + exports2.getOuterHTML = getOuterHTML2; + function getInnerHTML2(node, options) { + return (0, domhandler_1.hasChildren)(node) ? node.children.map(function(node2) { + return getOuterHTML2(node2, options); + }).join("") : ""; + } + exports2.getInnerHTML = getInnerHTML2; + function getText2(node) { + if (Array.isArray(node)) + return node.map(getText2).join(""); + if ((0, domhandler_1.isTag)(node)) + return node.name === "br" ? "\n" : getText2(node.children); + if ((0, domhandler_1.isCDATA)(node)) + return getText2(node.children); + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } + exports2.getText = getText2; + function textContent2(node) { + if (Array.isArray(node)) + return node.map(textContent2).join(""); + if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) { + return textContent2(node.children); + } + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } + exports2.textContent = textContent2; + function innerText2(node) { + if (Array.isArray(node)) + return node.map(innerText2).join(""); + if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) { + return innerText2(node.children); + } + if ((0, domhandler_1.isText)(node)) + return node.data; + return ""; + } + exports2.innerText = innerText2; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +var require_traversal2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.prevElementSibling = exports2.nextElementSibling = exports2.getName = exports2.hasAttrib = exports2.getAttributeValue = exports2.getSiblings = exports2.getParent = exports2.getChildren = void 0; + var domhandler_1 = require_lib11(); + var emptyArray = []; + function getChildren2(elem) { + var _a; + return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray; + } + exports2.getChildren = getChildren2; + function getParent2(elem) { + return elem.parent || null; + } + exports2.getParent = getParent2; + function getSiblings2(elem) { + var _a, _b; + var parent = getParent2(elem); + if (parent != null) + return getChildren2(parent); + var siblings = [elem]; + var prev = elem.prev, next = elem.next; + while (prev != null) { + siblings.unshift(prev); + _a = prev, prev = _a.prev; } - let state = strm.state; - if (state.window) { - state.window = null; + while (next != null) { + siblings.push(next); + _b = next, next = _b.next; + } + return siblings; + } + exports2.getSiblings = getSiblings2; + function getAttributeValue2(elem, name) { + var _a; + return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name]; + } + exports2.getAttributeValue = getAttributeValue2; + function hasAttrib2(elem, name) { + return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null; + } + exports2.hasAttrib = hasAttrib2; + function getName2(elem) { + return elem.name; + } + exports2.getName = getName2; + function nextElementSibling2(elem) { + var _a; + var next = elem.next; + while (next !== null && !(0, domhandler_1.isTag)(next)) + _a = next, next = _a.next; + return next; + } + exports2.nextElementSibling = nextElementSibling2; + function prevElementSibling2(elem) { + var _a; + var prev = elem.prev; + while (prev !== null && !(0, domhandler_1.isTag)(prev)) + _a = prev, prev = _a.prev; + return prev; + } + exports2.prevElementSibling = prevElementSibling2; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +var require_manipulation2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.prepend = exports2.prependChild = exports2.append = exports2.appendChild = exports2.replaceElement = exports2.removeElement = void 0; + function removeElement2(elem) { + if (elem.prev) + elem.prev.next = elem.next; + if (elem.next) + elem.next.prev = elem.prev; + if (elem.parent) { + var childs = elem.parent.children; + childs.splice(childs.lastIndexOf(elem), 1); } - strm.state = null; - return Z_OK; - }; - var inflateGetHeader = (strm, head) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + } + exports2.removeElement = removeElement2; + function replaceElement2(elem, replacement) { + var prev = replacement.prev = elem.prev; + if (prev) { + prev.next = replacement; } - const state = strm.state; - if ((state.wrap & 2) === 0) { - return Z_STREAM_ERROR; + var next = replacement.next = elem.next; + if (next) { + next.prev = replacement; } - state.head = head; - head.done = false; - return Z_OK; - }; - var inflateSetDictionary = (strm, dictionary) => { - const dictLength = dictionary.length; - let state; - let dictid; - let ret; - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR; + var parent = replacement.parent = elem.parent; + if (parent) { + var childs = parent.children; + childs[childs.lastIndexOf(elem)] = replacement; } - state = strm.state; - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; + } + exports2.replaceElement = replaceElement2; + function appendChild2(elem, child) { + removeElement2(child); + child.next = null; + child.parent = elem; + if (elem.children.push(child) > 1) { + var sibling = elem.children[elem.children.length - 2]; + sibling.next = child; + child.prev = sibling; + } else { + child.prev = null; } - if (state.mode === DICT) { - dictid = 1; - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; + } + exports2.appendChild = appendChild2; + function append2(elem, next) { + removeElement2(next); + var parent = elem.parent; + var currNext = elem.next; + next.next = currNext; + next.prev = elem; + elem.next = next; + next.parent = parent; + if (currNext) { + currNext.prev = next; + if (parent) { + var childs = parent.children; + childs.splice(childs.lastIndexOf(currNext), 0, next); } + } else if (parent) { + parent.children.push(next); } - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; + } + exports2.append = append2; + function prependChild2(elem, child) { + removeElement2(child); + child.parent = elem; + child.prev = null; + if (elem.children.unshift(child) !== 1) { + var sibling = elem.children[1]; + sibling.prev = child; + child.next = sibling; + } else { + child.next = null; } - state.havedict = 1; - return Z_OK; - }; - module2.exports.inflateReset = inflateReset; - module2.exports.inflateReset2 = inflateReset2; - module2.exports.inflateResetKeep = inflateResetKeep; - module2.exports.inflateInit = inflateInit; - module2.exports.inflateInit2 = inflateInit2; - module2.exports.inflate = inflate; - module2.exports.inflateEnd = inflateEnd; - module2.exports.inflateGetHeader = inflateGetHeader; - module2.exports.inflateSetDictionary = inflateSetDictionary; - module2.exports.inflateInfo = "pako inflate (from Nodeca project)"; - } -}); - -// node_modules/pako/lib/zlib/gzheader.js -var require_gzheader = __commonJS({ - "node_modules/pako/lib/zlib/gzheader.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - function GZheader() { - this.text = 0; - this.time = 0; - this.xflags = 0; - this.os = 0; - this.extra = null; - this.extra_len = 0; - this.name = ""; - this.comment = ""; - this.hcrc = 0; - this.done = false; } - module2.exports = GZheader; + exports2.prependChild = prependChild2; + function prepend2(elem, prev) { + removeElement2(prev); + var parent = elem.parent; + if (parent) { + var childs = parent.children; + childs.splice(childs.indexOf(elem), 0, prev); + } + if (elem.prev) { + elem.prev.next = prev; + } + prev.parent = parent; + prev.prev = elem.prev; + prev.next = elem; + elem.prev = prev; + } + exports2.prepend = prepend2; } }); -// node_modules/pako/lib/inflate.js -var require_inflate2 = __commonJS({ - "node_modules/pako/lib/inflate.js"(exports2, module2) { +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +var require_querying2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/querying.js"(exports2) { "use strict"; init_define_import_meta_env(); - var zlib_inflate = require_inflate(); - var utils = require_common(); - var strings = require_strings(); - var msg = require_messages(); - var ZStream = require_zstream(); - var GZheader = require_gzheader(); - var toString2 = Object.prototype.toString; - var { - Z_NO_FLUSH, - Z_FINISH, - Z_OK, - Z_STREAM_END, - Z_NEED_DICT, - Z_STREAM_ERROR, - Z_DATA_ERROR, - Z_MEM_ERROR, - Z_BUF_ERROR - } = require_constants(); - var defaultOptions2 = { - chunkSize: 1024 * 64, - windowBits: 15, - to: "" - }; - function Inflate(options) { - this.options = utils.assign({}, defaultOptions2, options || {}); - const opt = this.options; - if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { - opt.windowBits = -15; - } - } - if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { - opt.windowBits += 32; - } - if (opt.windowBits > 15 && opt.windowBits < 48) { - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.findAll = exports2.existsOne = exports2.findOne = exports2.findOneChild = exports2.find = exports2.filter = void 0; + var domhandler_1 = require_lib11(); + function filter2(test, node, recurse, limit) { + if (recurse === void 0) { + recurse = true; } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new ZStream(); - this.strm.avail_out = 0; - let status = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - if (status !== Z_OK) { - throw new Error(msg[status]); + if (limit === void 0) { + limit = Infinity; } - this.header = new GZheader(); - zlib_inflate.inflateGetHeader(this.strm, this.header); - if (opt.dictionary) { - if (typeof opt.dictionary === "string") { - opt.dictionary = strings.string2buf(opt.dictionary); - } else if (toString2.call(opt.dictionary) === "[object ArrayBuffer]") { - opt.dictionary = new Uint8Array(opt.dictionary); + if (!Array.isArray(node)) + node = [node]; + return find2(test, node, recurse, limit); + } + exports2.filter = filter2; + function find2(test, nodes, recurse, limit) { + var result = []; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var elem = nodes_1[_i]; + if (test(elem)) { + result.push(elem); + if (--limit <= 0) + break; } - if (opt.raw) { - status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); - if (status !== Z_OK) { - throw new Error(msg[status]); - } + if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) { + var children = find2(test, elem.children, recurse, limit); + result.push.apply(result, children); + limit -= children.length; + if (limit <= 0) + break; } } + return result; } - Inflate.prototype.push = function(data, flush_mode) { - const strm = this.strm; - const chunkSize = this.options.chunkSize; - const dictionary = this.options.dictionary; - let status, _flush_mode, last_avail_out; - if (this.ended) return false; - if (flush_mode === ~~flush_mode) _flush_mode = flush_mode; - else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; - if (toString2.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; + exports2.find = find2; + function findOneChild(test, nodes) { + return nodes.find(test); + } + exports2.findOneChild = findOneChild; + function findOne3(test, nodes, recurse) { + if (recurse === void 0) { + recurse = true; } - strm.next_in = 0; - strm.avail_in = strm.input.length; - for (; ; ) { - if (strm.avail_out === 0) { - strm.output = new Uint8Array(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = zlib_inflate.inflate(strm, _flush_mode); - if (status === Z_NEED_DICT && dictionary) { - status = zlib_inflate.inflateSetDictionary(strm, dictionary); - if (status === Z_OK) { - status = zlib_inflate.inflate(strm, _flush_mode); - } else if (status === Z_DATA_ERROR) { - status = Z_NEED_DICT; - } - } - while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap & 2 && strm.state.flags !== 0 && strm.input[strm.next_in] !== 0) { - zlib_inflate.inflateReset(strm); - status = zlib_inflate.inflate(strm, _flush_mode); + var elem = null; + for (var i = 0; i < nodes.length && !elem; i++) { + var checked = nodes[i]; + if (!(0, domhandler_1.isTag)(checked)) { + continue; + } else if (test(checked)) { + elem = checked; + } else if (recurse && checked.children.length > 0) { + elem = findOne3(test, checked.children); } - switch (status) { - case Z_STREAM_ERROR: - case Z_DATA_ERROR: - case Z_NEED_DICT: - case Z_MEM_ERROR: - this.onEnd(status); - this.ended = true; - return false; + } + return elem; + } + exports2.findOne = findOne3; + function existsOne2(test, nodes) { + return nodes.some(function(checked) { + return (0, domhandler_1.isTag)(checked) && (test(checked) || checked.children.length > 0 && existsOne2(test, checked.children)); + }); + } + exports2.existsOne = existsOne2; + function findAll3(test, nodes) { + var _a; + var result = []; + var stack = nodes.filter(domhandler_1.isTag); + var elem; + while (elem = stack.shift()) { + var children = (_a = elem.children) === null || _a === void 0 ? void 0 : _a.filter(domhandler_1.isTag); + if (children && children.length > 0) { + stack.unshift.apply(stack, children); } - last_avail_out = strm.avail_out; - if (strm.next_out) { - if (strm.avail_out === 0 || status === Z_STREAM_END || _flush_mode > 0) { - if (this.options.to === "string") { - let next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - let tail = strm.next_out - next_out_utf8; - let utf8str = strings.buf2string(strm.output, next_out_utf8); - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0); - this.onData(utf8str); - } else { - this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out)); - strm.avail_out = 0; - strm.next_out = 0; - } - } + if (test(elem)) + result.push(elem); + } + return result; + } + exports2.findAll = findAll3; + } +}); + +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +var require_legacy3 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getElementsByTagType = exports2.getElementsByTagName = exports2.getElementById = exports2.getElements = exports2.testElement = void 0; + var domhandler_1 = require_lib11(); + var querying_1 = require_querying2(); + var Checks2 = { + tag_name: function(name) { + if (typeof name === "function") { + return function(elem) { + return (0, domhandler_1.isTag)(elem) && name(elem.name); + }; + } else if (name === "*") { + return domhandler_1.isTag; } - if ((status === Z_OK || status === Z_BUF_ERROR) && last_avail_out === 0) continue; - if (status === Z_STREAM_END) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return true; + return function(elem) { + return (0, domhandler_1.isTag)(elem) && elem.name === name; + }; + }, + tag_type: function(type) { + if (typeof type === "function") { + return function(elem) { + return type(elem.type); + }; } - if (strm.avail_in === 0) { - if (_flush_mode === Z_FINISH) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status === Z_OK ? Z_BUF_ERROR : status); - this.ended = true; - return false; - } - break; + return function(elem) { + return elem.type === type; + }; + }, + tag_contains: function(data) { + if (typeof data === "function") { + return function(elem) { + return (0, domhandler_1.isText)(elem) && data(elem.data); + }; } + return function(elem) { + return (0, domhandler_1.isText)(elem) && elem.data === data; + }; } - return true; - }; - Inflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); }; - Inflate.prototype.onEnd = function(status) { - if (status === Z_OK) { - if (this.options.to === "string") { - this.result = this.chunks.join(""); - } else { - this.result = utils.flattenChunks(this.chunks); - } + function getAttribCheck2(attrib, value) { + if (typeof value === "function") { + return function(elem) { + return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]); + }; } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; - }; - function inflate(input, options) { - const inflator = new Inflate(options); - inflator.push(input, true); - if (inflator.err) throw inflator.msg || msg[inflator.err]; - return inflator.result; + return function(elem) { + return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value; + }; } - function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate(input, options); + function combineFuncs2(a, b) { + return function(elem) { + return a(elem) || b(elem); + }; } - module2.exports.Inflate = Inflate; - module2.exports.inflate = inflate; - module2.exports.inflateRaw = inflateRaw; - module2.exports.ungzip = inflate; - module2.exports.constants = require_constants(); + function compileTest2(options) { + var funcs = Object.keys(options).map(function(key) { + var value = options[key]; + return Object.prototype.hasOwnProperty.call(Checks2, key) ? Checks2[key](value) : getAttribCheck2(key, value); + }); + return funcs.length === 0 ? null : funcs.reduce(combineFuncs2); + } + function testElement2(options, node) { + var test = compileTest2(options); + return test ? test(node) : true; + } + exports2.testElement = testElement2; + function getElements2(options, nodes, recurse, limit) { + if (limit === void 0) { + limit = Infinity; + } + var test = compileTest2(options); + return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : []; + } + exports2.getElements = getElements2; + function getElementById2(id, nodes, recurse) { + if (recurse === void 0) { + recurse = true; + } + if (!Array.isArray(nodes)) + nodes = [nodes]; + return (0, querying_1.findOne)(getAttribCheck2("id", id), nodes, recurse); + } + exports2.getElementById = getElementById2; + function getElementsByTagName2(tagName, nodes, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return (0, querying_1.filter)(Checks2.tag_name(tagName), nodes, recurse, limit); + } + exports2.getElementsByTagName = getElementsByTagName2; + function getElementsByTagType2(type, nodes, recurse, limit) { + if (recurse === void 0) { + recurse = true; + } + if (limit === void 0) { + limit = Infinity; + } + return (0, querying_1.filter)(Checks2.tag_type(type), nodes, recurse, limit); + } + exports2.getElementsByTagType = getElementsByTagType2; } }); -// node_modules/pako/index.js -var require_pako = __commonJS({ - "node_modules/pako/index.js"(exports2, module2) { +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +var require_helpers2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js"(exports2) { "use strict"; init_define_import_meta_env(); - var { Deflate, deflate, deflateRaw, gzip: gzip2 } = require_deflate2(); - var { Inflate, inflate, inflateRaw, ungzip } = require_inflate2(); - var constants = require_constants(); - module2.exports.Deflate = Deflate; - module2.exports.deflate = deflate; - module2.exports.deflateRaw = deflateRaw; - module2.exports.gzip = gzip2; - module2.exports.Inflate = Inflate; - module2.exports.inflate = inflate; - module2.exports.inflateRaw = inflateRaw; - module2.exports.ungzip = ungzip; - module2.exports.constants = constants; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.uniqueSort = exports2.compareDocumentPosition = exports2.removeSubsets = void 0; + var domhandler_1 = require_lib11(); + function removeSubsets2(nodes) { + var idx = nodes.length; + while (--idx >= 0) { + var node = nodes[idx]; + if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) { + nodes.splice(idx, 1); + continue; + } + for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) { + if (nodes.includes(ancestor)) { + nodes.splice(idx, 1); + break; + } + } + } + return nodes; + } + exports2.removeSubsets = removeSubsets2; + function compareDocumentPosition2(nodeA, nodeB) { + var aParents = []; + var bParents = []; + if (nodeA === nodeB) { + return 0; + } + var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent; + while (current) { + aParents.unshift(current); + current = current.parent; + } + current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent; + while (current) { + bParents.unshift(current); + current = current.parent; + } + var maxIdx = Math.min(aParents.length, bParents.length); + var idx = 0; + while (idx < maxIdx && aParents[idx] === bParents[idx]) { + idx++; + } + if (idx === 0) { + return 1; + } + var sharedParent = aParents[idx - 1]; + var siblings = sharedParent.children; + var aSibling = aParents[idx]; + var bSibling = bParents[idx]; + if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { + if (sharedParent === nodeB) { + return 4 | 16; + } + return 4; + } + if (sharedParent === nodeA) { + return 2 | 8; + } + return 2; + } + exports2.compareDocumentPosition = compareDocumentPosition2; + function uniqueSort2(nodes) { + nodes = nodes.filter(function(node, i, arr) { + return !arr.includes(node, i + 1); + }); + nodes.sort(function(a, b) { + var relative = compareDocumentPosition2(a, b); + if (relative & 2) { + return -1; + } else if (relative & 4) { + return 1; + } + return 0; + }); + return nodes; + } + exports2.uniqueSort = uniqueSort2; } }); -// node_modules/telegram/tl/core/GZIPPacked.js -var require_GZIPPacked = __commonJS({ - "node_modules/telegram/tl/core/GZIPPacked.js"(exports2) { +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js +var require_feeds2 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js"(exports2) { "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GZIPPacked = void 0; - var __1 = require_tl(); - var pako_1 = require_pako(); - var GZIPPacked = class _GZIPPacked { - constructor(data) { - this.data = data; - this.CONSTRUCTOR_ID = 812830625; - this.classType = "constructor"; - } - static async gzipIfSmaller(contentRelated, data) { - if (contentRelated && data.length > 512) { - const gzipped = await new _GZIPPacked(data).toBytes(); - if (gzipped.length < data.length) { - return gzipped; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getFeed = void 0; + var stringify_1 = require_stringify4(); + var legacy_1 = require_legacy3(); + function getFeed2(doc) { + var feedRoot = getOneElement2(isValidFeed2, doc); + return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed2(feedRoot) : getRssFeed2(feedRoot); + } + exports2.getFeed = getFeed2; + function getAtomFeed2(feedRoot) { + var _a; + var childs = feedRoot.children; + var feed = { + type: "atom", + items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function(item) { + var _a2; + var children = item.children; + var entry = { media: getMediaElements2(children) }; + addConditionally2(entry, "id", "id", children); + addConditionally2(entry, "title", "title", children); + var href2 = (_a2 = getOneElement2("link", children)) === null || _a2 === void 0 ? void 0 : _a2.attribs.href; + if (href2) { + entry.link = href2; } - } - return data; - } - static gzip(input) { - return Buffer.from(input); + var description = fetch3("summary", children) || fetch3("content", children); + if (description) { + entry.description = description; + } + var pubDate = fetch3("updated", children); + if (pubDate) { + entry.pubDate = new Date(pubDate); + } + return entry; + }) + }; + addConditionally2(feed, "id", "id", childs); + addConditionally2(feed, "title", "title", childs); + var href = (_a = getOneElement2("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs.href; + if (href) { + feed.link = href; } - static ungzip(input) { - return Buffer.from((0, pako_1.inflate)(input)); + addConditionally2(feed, "description", "subtitle", childs); + var updated = fetch3("updated", childs); + if (updated) { + feed.updated = new Date(updated); } - async toBytes() { - const g = Buffer.alloc(4); - g.writeUInt32LE(_GZIPPacked.CONSTRUCTOR_ID, 0); - return Buffer.concat([ - g, - (0, __1.serializeBytes)(await _GZIPPacked.gzip(this.data)) - ]); + addConditionally2(feed, "author", "email", childs, true); + return feed; + } + function getRssFeed2(feedRoot) { + var _a, _b; + var childs = (_b = (_a = getOneElement2("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; + var feed = { + type: feedRoot.name.substr(0, 3), + id: "", + items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function(item) { + var children = item.children; + var entry = { media: getMediaElements2(children) }; + addConditionally2(entry, "id", "guid", children); + addConditionally2(entry, "title", "title", children); + addConditionally2(entry, "link", "link", children); + addConditionally2(entry, "description", "description", children); + var pubDate = fetch3("pubDate", children); + if (pubDate) + entry.pubDate = new Date(pubDate); + return entry; + }) + }; + addConditionally2(feed, "title", "title", childs); + addConditionally2(feed, "link", "link", childs); + addConditionally2(feed, "description", "description", childs); + var updated = fetch3("lastBuildDate", childs); + if (updated) { + feed.updated = new Date(updated); } - static async read(reader) { - const constructor = reader.readInt(false); - if (constructor !== _GZIPPacked.CONSTRUCTOR_ID) { - throw new Error("not equal"); + addConditionally2(feed, "author", "managingEditor", childs, true); + return feed; + } + var MEDIA_KEYS_STRING2 = ["url", "type", "lang"]; + var MEDIA_KEYS_INT2 = [ + "fileSize", + "bitrate", + "framerate", + "samplingrate", + "channels", + "duration", + "height", + "width" + ]; + function getMediaElements2(where) { + return (0, legacy_1.getElementsByTagName)("media:content", where).map(function(elem) { + var attribs = elem.attribs; + var media = { + medium: attribs.medium, + isDefault: !!attribs.isDefault + }; + for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING2; _i < MEDIA_KEYS_STRING_1.length; _i++) { + var attrib = MEDIA_KEYS_STRING_1[_i]; + if (attribs[attrib]) { + media[attrib] = attribs[attrib]; + } } - return _GZIPPacked.gzip(reader.tgReadBytes()); + for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT2; _a < MEDIA_KEYS_INT_1.length; _a++) { + var attrib = MEDIA_KEYS_INT_1[_a]; + if (attribs[attrib]) { + media[attrib] = parseInt(attribs[attrib], 10); + } + } + if (attribs.expression) { + media.expression = attribs.expression; + } + return media; + }); + } + function getOneElement2(tagName, node) { + return (0, legacy_1.getElementsByTagName)(tagName, node, true, 1)[0]; + } + function fetch3(tagName, where, recurse) { + if (recurse === void 0) { + recurse = false; } - static async fromReader(reader) { - const data = reader.tgReadBytes(); - return new _GZIPPacked(await _GZIPPacked.ungzip(data)); + return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName, where, recurse, 1)).trim(); + } + function addConditionally2(obj, prop, tagName, where, recurse) { + if (recurse === void 0) { + recurse = false; } - }; - exports2.GZIPPacked = GZIPPacked; - GZIPPacked.CONSTRUCTOR_ID = 812830625; - GZIPPacked.classType = "constructor"; + var val = fetch3(tagName, where, recurse); + if (val) + obj[prop] = val; + } + function isValidFeed2(value) { + return value === "rss" || value === "feed" || value === "rdf:RDF"; + } } }); -// node_modules/telegram/tl/core/index.js -var require_core = __commonJS({ - "node_modules/telegram/tl/core/index.js"(exports2) { +// node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/index.js +var require_lib14 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/node_modules/domutils/lib/index.js"(exports2) { "use strict"; init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GZIPPacked = exports2.MessageContainer = exports2.TLMessage = exports2.RPCResult = exports2.coreObjects = void 0; - var TLMessage_1 = require_TLMessage(); - Object.defineProperty(exports2, "TLMessage", { enumerable: true, get: function() { - return TLMessage_1.TLMessage; + exports2.hasChildren = exports2.isDocument = exports2.isComment = exports2.isText = exports2.isCDATA = exports2.isTag = void 0; + __exportStar2(require_stringify4(), exports2); + __exportStar2(require_traversal2(), exports2); + __exportStar2(require_manipulation2(), exports2); + __exportStar2(require_querying2(), exports2); + __exportStar2(require_legacy3(), exports2); + __exportStar2(require_helpers2(), exports2); + __exportStar2(require_feeds2(), exports2); + var domhandler_1 = require_lib11(); + Object.defineProperty(exports2, "isTag", { enumerable: true, get: function() { + return domhandler_1.isTag; } }); - var RPCResult_1 = require_RPCResult(); - Object.defineProperty(exports2, "RPCResult", { enumerable: true, get: function() { - return RPCResult_1.RPCResult; + Object.defineProperty(exports2, "isCDATA", { enumerable: true, get: function() { + return domhandler_1.isCDATA; } }); - var MessageContainer_1 = require_MessageContainer(); - Object.defineProperty(exports2, "MessageContainer", { enumerable: true, get: function() { - return MessageContainer_1.MessageContainer; + Object.defineProperty(exports2, "isText", { enumerable: true, get: function() { + return domhandler_1.isText; } }); - var GZIPPacked_1 = require_GZIPPacked(); - Object.defineProperty(exports2, "GZIPPacked", { enumerable: true, get: function() { - return GZIPPacked_1.GZIPPacked; + Object.defineProperty(exports2, "isComment", { enumerable: true, get: function() { + return domhandler_1.isComment; + } }); + Object.defineProperty(exports2, "isDocument", { enumerable: true, get: function() { + return domhandler_1.isDocument; + } }); + Object.defineProperty(exports2, "hasChildren", { enumerable: true, get: function() { + return domhandler_1.hasChildren; } }); - exports2.coreObjects = /* @__PURE__ */ new Map([ - [RPCResult_1.RPCResult.CONSTRUCTOR_ID, RPCResult_1.RPCResult], - [GZIPPacked_1.GZIPPacked.CONSTRUCTOR_ID, GZIPPacked_1.GZIPPacked], - [MessageContainer_1.MessageContainer.CONSTRUCTOR_ID, MessageContainer_1.MessageContainer] - ]); } }); -// node_modules/telegram/tl/AllTLObjects.js -var require_AllTLObjects = __commonJS({ - "node_modules/telegram/tl/AllTLObjects.js"(exports2) { +// node_modules/telegram/node_modules/htmlparser2/lib/FeedHandler.js +var require_FeedHandler = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/lib/FeedHandler.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.tlobjects = exports2.LAYER = void 0; - exports2.LAYER = 198; - var _1 = require_tl(); - var tlobjects = {}; - exports2.tlobjects = tlobjects; - for (const tl of Object.values(_1.Api)) { - if ("CONSTRUCTOR_ID" in tl) { - tlobjects[tl.CONSTRUCTOR_ID] = tl; - } else { - for (const sub of Object.values(tl)) { - tlobjects[sub.CONSTRUCTOR_ID] = sub; + var __extends2 = exports2 && exports2.__extends || /* @__PURE__ */ (function() { + var extendStatics2 = function(d, b) { + extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics2(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics2(d, b); + function __() { + this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - } - } -}); - -// node_modules/telegram/extensions/BinaryReader.js -var require_BinaryReader = __commonJS({ - "node_modules/telegram/extensions/BinaryReader.js"(exports2) { - "use strict"; - init_define_import_meta_env(); + __setModuleDefault2(result, mod); + return result; + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.BinaryReader = void 0; - var errors_1 = require_errors(); - var core_1 = require_core(); - var AllTLObjects_1 = require_AllTLObjects(); - var Helpers_1 = require_Helpers(); - var BinaryReader = class { - /** - * Small utility class to read binary data. - * @param data {Buffer} - */ - constructor(data) { - this.stream = data; - this._last = void 0; - this.offset = 0; - } - // region Reading - // "All numbers are written as little endian." - // https://core.telegram.org/mtproto - /** - * Reads a single byte value. - */ - readByte() { - return this.read(1)[0]; - } - /** - * Reads an integer (4 bytes or 32 bits) value. - * @param signed {Boolean} - */ - readInt(signed = true) { - let res; - if (signed) { - res = this.stream.readInt32LE(this.offset); - } else { - res = this.stream.readUInt32LE(this.offset); + exports2.parseFeed = exports2.FeedHandler = void 0; + var domhandler_1 = __importDefault2(require_lib11()); + var DomUtils = __importStar2(require_lib14()); + var Parser_1 = require_Parser2(); + var FeedItemMediaMedium; + (function(FeedItemMediaMedium2) { + FeedItemMediaMedium2[FeedItemMediaMedium2["image"] = 0] = "image"; + FeedItemMediaMedium2[FeedItemMediaMedium2["audio"] = 1] = "audio"; + FeedItemMediaMedium2[FeedItemMediaMedium2["video"] = 2] = "video"; + FeedItemMediaMedium2[FeedItemMediaMedium2["document"] = 3] = "document"; + FeedItemMediaMedium2[FeedItemMediaMedium2["executable"] = 4] = "executable"; + })(FeedItemMediaMedium || (FeedItemMediaMedium = {})); + var FeedItemMediaExpression; + (function(FeedItemMediaExpression2) { + FeedItemMediaExpression2[FeedItemMediaExpression2["sample"] = 0] = "sample"; + FeedItemMediaExpression2[FeedItemMediaExpression2["full"] = 1] = "full"; + FeedItemMediaExpression2[FeedItemMediaExpression2["nonstop"] = 2] = "nonstop"; + })(FeedItemMediaExpression || (FeedItemMediaExpression = {})); + var FeedHandler = ( + /** @class */ + (function(_super) { + __extends2(FeedHandler2, _super); + function FeedHandler2(callback, options) { + var _this = this; + if (typeof callback === "object") { + callback = void 0; + options = callback; + } + _this = _super.call(this, callback, options) || this; + return _this; } - this.offset += 4; - return res; - } - /** - * Reads a long integer (8 bytes or 64 bits) value. - * @param signed - * @returns {BigInteger} - */ - readLong(signed = true) { - return this.readLargeInt(64, signed); - } - /** - * Reads a real floating point (4 bytes) value. - * @returns {number} - */ - readFloat() { - return this.read(4).readFloatLE(0); - } - /** - * Reads a real floating point (8 bytes) value. - * @returns {BigInteger} - */ - readDouble() { - return this.read(8).readDoubleLE(0); - } - /** - * Reads a n-bits long integer value. - * @param bits - * @param signed {Boolean} - */ - readLargeInt(bits, signed = true) { - const buffer = this.read(Math.floor(bits / 8)); - return (0, Helpers_1.readBigIntFromBuffer)(buffer, true, signed); - } - /** - * Read the given amount of bytes, or -1 to read all remaining. - * @param length {number} - * @param checkLength {boolean} whether to check if the length overflows or not. - */ - read(length = -1, checkLength = true) { - if (length === -1) { - length = this.stream.length - this.offset; + FeedHandler2.prototype.onend = function() { + var _a, _b; + var feedRoot = getOneElement2(isValidFeed2, this.dom); + if (!feedRoot) { + this.handleCallback(new Error("couldn't find root of feed")); + return; + } + var feed = {}; + if (feedRoot.name === "feed") { + var childs = feedRoot.children; + feed.type = "atom"; + addConditionally2(feed, "id", "id", childs); + addConditionally2(feed, "title", "title", childs); + var href = getAttribute("href", getOneElement2("link", childs)); + if (href) { + feed.link = href; + } + addConditionally2(feed, "description", "subtitle", childs); + var updated = fetch3("updated", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally2(feed, "author", "email", childs, true); + feed.items = getElements2("entry", childs).map(function(item) { + var entry = {}; + var children = item.children; + addConditionally2(entry, "id", "id", children); + addConditionally2(entry, "title", "title", children); + var href2 = getAttribute("href", getOneElement2("link", children)); + if (href2) { + entry.link = href2; + } + var description = fetch3("summary", children) || fetch3("content", children); + if (description) { + entry.description = description; + } + var pubDate = fetch3("updated", children); + if (pubDate) { + entry.pubDate = new Date(pubDate); + } + entry.media = getMediaElements2(children); + return entry; + }); + } else { + var childs = (_b = (_a = getOneElement2("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; + feed.type = feedRoot.name.substr(0, 3); + feed.id = ""; + addConditionally2(feed, "title", "title", childs); + addConditionally2(feed, "link", "link", childs); + addConditionally2(feed, "description", "description", childs); + var updated = fetch3("lastBuildDate", childs); + if (updated) { + feed.updated = new Date(updated); + } + addConditionally2(feed, "author", "managingEditor", childs, true); + feed.items = getElements2("item", feedRoot.children).map(function(item) { + var entry = {}; + var children = item.children; + addConditionally2(entry, "id", "guid", children); + addConditionally2(entry, "title", "title", children); + addConditionally2(entry, "link", "link", children); + addConditionally2(entry, "description", "description", children); + var pubDate = fetch3("pubDate", children); + if (pubDate) + entry.pubDate = new Date(pubDate); + entry.media = getMediaElements2(children); + return entry; + }); + } + this.feed = feed; + this.handleCallback(null); + }; + return FeedHandler2; + })(domhandler_1.default) + ); + exports2.FeedHandler = FeedHandler; + function getMediaElements2(where) { + return getElements2("media:content", where).map(function(elem) { + var media = { + medium: elem.attribs.medium, + isDefault: !!elem.attribs.isDefault + }; + if (elem.attribs.url) { + media.url = elem.attribs.url; } - const result = this.stream.slice(this.offset, this.offset + length); - this.offset += length; - if (checkLength && result.length !== length) { - throw Error(`No more data left to read (need ${length}, got ${result.length}: ${result}); last read ${this._last}`); + if (elem.attribs.fileSize) { + media.fileSize = parseInt(elem.attribs.fileSize, 10); } - this._last = result; - return result; - } - /** - * Gets the byte array representing the current buffer as a whole. - * @returns {Buffer} - */ - getBuffer() { - return this.stream; - } - // endregion - // region Telegram custom reading - /** - * Reads a Telegram-encoded byte array, without the need of - * specifying its length. - * @returns {Buffer} - */ - tgReadBytes() { - const firstByte = this.readByte(); - let padding; - let length; - if (firstByte === 254) { - length = this.readByte() | this.readByte() << 8 | this.readByte() << 16; - padding = length % 4; - } else { - length = firstByte; - padding = (length + 1) % 4; + if (elem.attribs.type) { + media.type = elem.attribs.type; } - const data = this.read(length); - if (padding > 0) { - padding = 4 - padding; - this.read(padding); + if (elem.attribs.expression) { + media.expression = elem.attribs.expression; } - return data; - } - /** - * Reads a Telegram-encoded string. - * @returns {string} - */ - tgReadString() { - return this.tgReadBytes().toString("utf-8"); - } - /** - * Reads a Telegram boolean value. - * @returns {boolean} - */ - tgReadBool() { - const value = this.readInt(false); - if (value === 2574415285) { - return true; - } else if (value === 3162085175) { - return false; - } else { - throw new Error(`Invalid boolean code ${value.toString(16)}`); + if (elem.attribs.bitrate) { + media.bitrate = parseInt(elem.attribs.bitrate, 10); } - } - /** - * Reads and converts Unix time (used by Telegram) - * into a Javascript {Date} object. - * @returns {Date} - */ - tgReadDate() { - const value = this.readInt(); - return new Date(value * 1e3); - } - /** - * Reads a Telegram object. - */ - tgReadObject() { - const constructorId = this.readInt(false); - let clazz = AllTLObjects_1.tlobjects[constructorId]; - if (clazz === void 0) { - const value = constructorId; - if (value === 2574415285) { - return true; - } else if (value === 3162085175) { - return false; - } else if (value === 481674261) { - const temp = []; - const length = this.readInt(); - for (let i = 0; i < length; i++) { - temp.push(this.tgReadObject()); - } - return temp; - } - clazz = core_1.coreObjects.get(constructorId); - if (clazz === void 0) { - this.seek(-4); - const pos = this.tellPosition(); - const error = new errors_1.TypeNotFoundError(constructorId, this.read()); - this.setPosition(pos); - throw error; - } + if (elem.attribs.framerate) { + media.framerate = parseInt(elem.attribs.framerate, 10); } - return clazz.fromReader(this); - } - /** - * Reads a vector (a list) of Telegram objects. - * @returns {[Buffer]} - */ - tgReadVector() { - if (this.readInt(false) !== 481674261) { - throw new Error("Invalid constructor code, vector was expected"); + if (elem.attribs.samplingrate) { + media.samplingrate = parseInt(elem.attribs.samplingrate, 10); } - const count = this.readInt(); - const temp = []; - for (let i = 0; i < count; i++) { - temp.push(this.tgReadObject()); + if (elem.attribs.channels) { + media.channels = parseInt(elem.attribs.channels, 10); + } + if (elem.attribs.duration) { + media.duration = parseInt(elem.attribs.duration, 10); + } + if (elem.attribs.height) { + media.height = parseInt(elem.attribs.height, 10); + } + if (elem.attribs.width) { + media.width = parseInt(elem.attribs.width, 10); + } + if (elem.attribs.lang) { + media.lang = elem.attribs.lang; } - return temp; + return media; + }); + } + function getElements2(tagName, where) { + return DomUtils.getElementsByTagName(tagName, where, true); + } + function getOneElement2(tagName, node) { + return DomUtils.getElementsByTagName(tagName, node, true, 1)[0]; + } + function fetch3(tagName, where, recurse) { + if (recurse === void 0) { + recurse = false; } - // endregion - // region Position related - /** - * Tells the current position on the stream. - * @returns {number} - */ - tellPosition() { - return this.offset; + return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim(); + } + function getAttribute(name, elem) { + if (!elem) { + return null; } - /** - * Sets the current position on the stream. - * @param position - */ - setPosition(position) { - this.offset = position; + var attribs = elem.attribs; + return attribs[name]; + } + function addConditionally2(obj, prop, what, where, recurse) { + if (recurse === void 0) { + recurse = false; } - /** - * Seeks the stream position given an offset from the current position. - * The offset may be negative. - * @param offset - */ - seek(offset) { - this.offset += offset; + var tmp = fetch3(what, where, recurse); + if (tmp) + obj[prop] = tmp; + } + function isValidFeed2(value) { + return value === "rss" || value === "feed" || value === "rdf:RDF"; + } + function parseFeed(feed, options) { + if (options === void 0) { + options = { xmlMode: true }; } - }; - exports2.BinaryReader = BinaryReader; + var handler = new FeedHandler(options); + new Parser_1.Parser(handler, options).end(feed); + return handler.feed; + } + exports2.parseFeed = parseFeed; } }); -// node_modules/ms/index.js -var require_ms3 = __commonJS({ - "node_modules/ms/index.js"(exports2, module2) { +// node_modules/telegram/node_modules/htmlparser2/lib/index.js +var require_lib15 = __commonJS({ + "node_modules/telegram/node_modules/htmlparser2/lib/index.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var s = 1e3; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - module2.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === "string" && val.length > 0) { - return parse5(val); - } else if (type === "number" && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - throw new Error( - "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) - ); + __setModuleDefault2(result, mod); + return result; }; - function parse5(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || "ms").toLowerCase(); - switch (type) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * y; - case "days": - case "day": - case "d": - return n * d; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * h; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * m; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * s; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - default: - return void 0; - } - } - function fmtShort(ms) { - if (ms >= d) { - return Math.round(ms / d) + "d"; - } - if (ms >= h) { - return Math.round(ms / h) + "h"; - } - if (ms >= m) { - return Math.round(ms / m) + "m"; - } - if (ms >= s) { - return Math.round(ms / s) + "s"; - } - return ms + "ms"; - } - function fmtLong(ms) { - return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms"; - } - function plural(ms, n, name) { - if (ms < n) { - return; - } - if (ms < n * 1.5) { - return Math.floor(ms / n) + " " + name; - } - return Math.ceil(ms / n) + " " + name + "s"; - } + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RssHandler = exports2.DefaultHandler = exports2.DomUtils = exports2.ElementType = exports2.Tokenizer = exports2.createDomStream = exports2.parseDOM = exports2.parseDocument = exports2.DomHandler = exports2.Parser = void 0; + var Parser_1 = require_Parser2(); + Object.defineProperty(exports2, "Parser", { enumerable: true, get: function() { + return Parser_1.Parser; + } }); + var domhandler_1 = require_lib11(); + Object.defineProperty(exports2, "DomHandler", { enumerable: true, get: function() { + return domhandler_1.DomHandler; + } }); + Object.defineProperty(exports2, "DefaultHandler", { enumerable: true, get: function() { + return domhandler_1.DomHandler; + } }); + function parseDocument(data, options) { + var handler = new domhandler_1.DomHandler(void 0, options); + new Parser_1.Parser(handler, options).end(data); + return handler.root; + } + exports2.parseDocument = parseDocument; + function parseDOM(data, options) { + return parseDocument(data, options).children; + } + exports2.parseDOM = parseDOM; + function createDomStream(cb, options, elementCb) { + var handler = new domhandler_1.DomHandler(cb, options, elementCb); + return new Parser_1.Parser(handler, options); + } + exports2.createDomStream = createDomStream; + var Tokenizer_1 = require_Tokenizer2(); + Object.defineProperty(exports2, "Tokenizer", { enumerable: true, get: function() { + return __importDefault2(Tokenizer_1).default; + } }); + var ElementType4 = __importStar2(require_lib5()); + exports2.ElementType = ElementType4; + __exportStar2(require_FeedHandler(), exports2); + exports2.DomUtils = __importStar2(require_lib14()); + var FeedHandler_1 = require_FeedHandler(); + Object.defineProperty(exports2, "RssHandler", { enumerable: true, get: function() { + return FeedHandler_1.FeedHandler; + } }); } }); -// node_modules/debug/src/debug.js -var require_debug2 = __commonJS({ - "node_modules/debug/src/debug.js"(exports2, module2) { +// node_modules/telegram/extensions/html.js +var require_html = __commonJS({ + "node_modules/telegram/extensions/html.js"(exports2) { + "use strict"; init_define_import_meta_env(); - exports2 = module2.exports = createDebug.debug = createDebug["default"] = createDebug; - exports2.coerce = coerce; - exports2.disable = disable; - exports2.enable = enable; - exports2.enabled = enabled; - exports2.humanize = require_ms3(); - exports2.names = []; - exports2.skips = []; - exports2.formatters = {}; - var prevTime; - function selectColor(namespace) { - var hash2 = 0, i; - for (i in namespace) { - hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i); - hash2 |= 0; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HTMLParser = void 0; + var htmlparser2_1 = require_lib15(); + var tl_1 = require_tl(); + var index_1 = require_telegram(); + var HTMLToTelegramParser = class { + constructor() { + this.text = ""; + this.entities = []; + this._buildingEntities = /* @__PURE__ */ new Map(); + this._openTags = []; + this._openTagsMeta = []; } - return exports2.colors[Math.abs(hash2) % exports2.colors.length]; - } - function createDebug(namespace) { - function debug() { - if (!debug.enabled) return; - var self2 = debug; - var curr = +/* @__PURE__ */ new Date(); - var ms = curr - (prevTime || curr); - self2.diff = ms; - self2.prev = prevTime; - self2.curr = curr; - prevTime = curr; - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; + onopentag(name, attributes) { + this._openTags.unshift(name); + this._openTagsMeta.unshift(void 0); + let EntityType; + const args = {}; + if (name == "strong" || name == "b") { + EntityType = tl_1.Api.MessageEntityBold; + } else if (name == "spoiler") { + EntityType = tl_1.Api.MessageEntitySpoiler; + } else if (name == "em" || name == "i") { + EntityType = tl_1.Api.MessageEntityItalic; + } else if (name == "u") { + EntityType = tl_1.Api.MessageEntityUnderline; + } else if (name == "del" || name == "s") { + EntityType = tl_1.Api.MessageEntityStrike; + } else if (name == "blockquote") { + EntityType = tl_1.Api.MessageEntityBlockquote; + if (attributes.expandable !== void 0) { + args.collapsed = true; + } + } else if (name == "code") { + const pre = this._buildingEntities.get("pre"); + if (pre && pre instanceof tl_1.Api.MessageEntityPre) { + try { + pre.language = attributes.class.slice("language-".length, attributes.class.length); + } catch (e) { + } + } else { + EntityType = tl_1.Api.MessageEntityCode; + } + } else if (name == "pre") { + EntityType = tl_1.Api.MessageEntityPre; + args["language"] = ""; + } else if (name == "a") { + let url = attributes.href; + if (!url) { + return; + } + if (url.startsWith("mailto:")) { + url = url.slice("mailto:".length, url.length); + EntityType = tl_1.Api.MessageEntityEmail; + } else { + EntityType = tl_1.Api.MessageEntityTextUrl; + args["url"] = url; + url = void 0; + } + this._openTagsMeta.shift(); + this._openTagsMeta.unshift(url); + } else if (name == "tg-emoji") { + EntityType = tl_1.Api.MessageEntityCustomEmoji; + args["documentId"] = attributes["emoji-id"]; } - args[0] = exports2.coerce(args[0]); - if ("string" !== typeof args[0]) { - args.unshift("%O"); + if (EntityType && !this._buildingEntities.has(name)) { + this._buildingEntities.set(name, new EntityType(Object.assign({ offset: this.text.length, length: 0 }, args))); } - var index2 = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { - if (match === "%%") return match; - index2++; - var formatter = exports2.formatters[format]; - if ("function" === typeof formatter) { - var val = args[index2]; - match = formatter.call(self2, val); - args.splice(index2, 1); - index2--; - } - return match; - }); - exports2.formatArgs.call(self2, args); - var logFn = debug.log || exports2.log || console.log.bind(console); - logFn.apply(self2, args); - } - debug.namespace = namespace; - debug.enabled = exports2.enabled(namespace); - debug.useColors = exports2.useColors(); - debug.color = selectColor(namespace); - if ("function" === typeof exports2.init) { - exports2.init(debug); } - return debug; - } - function enable(namespaces) { - exports2.save(namespaces); - exports2.names = []; - exports2.skips = []; - var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); - var len = split.length; - for (var i = 0; i < len; i++) { - if (!split[i]) continue; - namespaces = split[i].replace(/\*/g, ".*?"); - if (namespaces[0] === "-") { - exports2.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); - } else { - exports2.names.push(new RegExp("^" + namespaces + "$")); + ontext(text) { + const previousTag = this._openTags.length > 0 ? this._openTags[0] : ""; + if (previousTag == "a") { + const url = this._openTagsMeta[0]; + if (url) { + text = url; + } } - } - } - function disable() { - exports2.enable(""); - } - function enabled(name) { - var i, len; - for (i = 0, len = exports2.skips.length; i < len; i++) { - if (exports2.skips[i].test(name)) { - return false; + for (let [tag, entity] of this._buildingEntities) { + entity.length += text.length; } + this.text += text; } - for (i = 0, len = exports2.names.length; i < len; i++) { - if (exports2.names[i].test(name)) { - return true; + onclosetag(tagname) { + this._openTagsMeta.shift(); + this._openTags.shift(); + const entity = this._buildingEntities.get(tagname); + if (entity) { + this._buildingEntities.delete(tagname); + this.entities.push(entity); } } - return false; - } - function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; - } - } -}); - -// node_modules/debug/src/browser.js -var require_browser2 = __commonJS({ - "node_modules/debug/src/browser.js"(exports2, module2) { - init_define_import_meta_env(); - exports2 = module2.exports = require_debug2(); - exports2.log = log; - exports2.formatArgs = formatArgs; - exports2.save = save; - exports2.load = load; - exports2.useColors = useColors; - exports2.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage(); - exports2.colors = [ - "lightseagreen", - "forestgreen", - "goldenrod", - "dodgerblue", - "darkorchid", - "crimson" - ]; - function useColors() { - if (typeof window !== "undefined" && window.process && window.process.type === "renderer") { - return true; + onattribute(name, value, quote) { } - return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker - typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - exports2.formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (err) { - return "[UnexpectedJSONParseError]: " + err.message; + oncdataend() { } - }; - function formatArgs(args) { - var useColors2 = this.useColors; - args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports2.humanize(this.diff); - if (!useColors2) return; - var c = "color: " + this.color; - args.splice(1, 0, c, "color: inherit"); - var index2 = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function(match) { - if ("%%" === match) return; - index2++; - if ("%c" === match) { - lastC = index2; - } - }); - args.splice(lastC, 0, c); - } - function log() { - return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); - } - function save(namespaces) { - try { - if (null == namespaces) { - exports2.storage.removeItem("debug"); - } else { - exports2.storage.debug = namespaces; - } - } catch (e) { + oncdatastart() { } - } - function load() { - var r; - try { - r = exports2.storage.debug; - } catch (e) { + oncomment(data) { } - if (!r && typeof process !== "undefined" && "env" in process) { - r = process.env.DEBUG; + oncommentend() { } - return r; - } - exports2.enable(load()); - function localstorage() { - try { - return window.localStorage; - } catch (e) { + onend() { } - } - } -}); - -// node_modules/debug/src/node.js -var require_node3 = __commonJS({ - "node_modules/debug/src/node.js"(exports2, module2) { - init_define_import_meta_env(); - var tty = require("tty"); - var util = require("util"); - exports2 = module2.exports = require_debug2(); - exports2.init = init; - exports2.log = log; - exports2.formatArgs = formatArgs; - exports2.save = save; - exports2.load = load; - exports2.useColors = useColors; - exports2.colors = [6, 2, 3, 4, 5, 1]; - exports2.inspectOpts = Object.keys(process.env).filter(function(key2) { - return /^debug_/i.test(key2); - }).reduce(function(obj, key2) { - var prop2 = key2.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { - return k.toUpperCase(); - }); - var val = process.env[key2]; - if (/^(yes|on|true|enabled)$/i.test(val)) val = true; - else if (/^(no|off|false|disabled)$/i.test(val)) val = false; - else if (val === "null") val = null; - else val = Number(val); - obj[prop2] = val; - return obj; - }, {}); - var fd = parseInt(process.env.DEBUG_FD, 10) || 2; - if (1 !== fd && 2 !== fd) { - util.deprecate(function() { - }, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")(); - } - var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd); - function useColors() { - return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(fd); - } - exports2.formatters.o = function(v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts).split("\n").map(function(str) { - return str.trim(); - }).join(" "); - }; - exports2.formatters.O = function(v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); - }; - function formatArgs(args) { - var name = this.namespace; - var useColors2 = this.useColors; - if (useColors2) { - var c = this.color; - var prefix = " \x1B[3" + c + ";1m" + name + " \x1B[0m"; - args[0] = prefix + args[0].split("\n").join("\n" + prefix); - args.push("\x1B[3" + c + "m+" + exports2.humanize(this.diff) + "\x1B[0m"); - } else { - args[0] = (/* @__PURE__ */ new Date()).toUTCString() + " " + name + " " + args[0]; + onerror(error) { + } + onopentagname(name) { + } + onparserinit(parser) { + } + onprocessinginstruction(name, data) { } - } - function log() { - return stream.write(util.format.apply(util, arguments) + "\n"); - } - function save(namespaces) { - if (null == namespaces) { - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; + onreset() { } - } - function load() { - return process.env.DEBUG; - } - function createWritableStdioStream(fd2) { - var stream2; - var tty_wrap = process.binding("tty_wrap"); - switch (tty_wrap.guessHandleType(fd2)) { - case "TTY": - stream2 = new tty.WriteStream(fd2); - stream2._type = "tty"; - if (stream2._handle && stream2._handle.unref) { - stream2._handle.unref(); + }; + var HTMLParser = class { + static parse(html) { + if (!html) { + return [html, []]; + } + const handler = new HTMLToTelegramParser(); + const parser = new htmlparser2_1.Parser(handler); + parser.write(html); + parser.end(); + const text = index_1.helpers.stripText(handler.text, handler.entities); + return [text, handler.entities]; + } + static unparse(text, entities2, _offset = 0, _length) { + if (!text || !entities2 || !entities2.length) { + return text; + } + if (_length == void 0) { + _length = text.length; + } + const html = []; + let lastOffset = 0; + for (let i = 0; i < entities2.length; i++) { + const entity = entities2[i]; + if (entity.offset >= _offset + _length) { + break; } - break; - case "FILE": - var fs = require("fs"); - stream2 = new fs.SyncWriteStream(fd2, { autoClose: false }); - stream2._type = "fs"; - break; - case "PIPE": - case "TCP": - var net = require("net"); - stream2 = new net.Socket({ - fd: fd2, - readable: false, - writable: true - }); - stream2.readable = false; - stream2.read = null; - stream2._type = "pipe"; - if (stream2._handle && stream2._handle.unref) { - stream2._handle.unref(); + let relativeOffset = entity.offset - _offset; + if (relativeOffset > lastOffset) { + html.push(text.slice(lastOffset, relativeOffset)); + } else if (relativeOffset < lastOffset) { + continue; } - break; - default: - throw new Error("Implement me. Unknown stream file type!"); - } - stream2.fd = fd2; - stream2._isStdio = true; - return stream2; - } - function init(debug) { - debug.inspectOpts = {}; - var keys2 = Object.keys(exports2.inspectOpts); - for (var i = 0; i < keys2.length; i++) { - debug.inspectOpts[keys2[i]] = exports2.inspectOpts[keys2[i]]; + let skipEntity = false; + let length = entity.length; + let entityText = this.unparse(text.slice(relativeOffset, relativeOffset + length), entities2.slice(i + 1, entities2.length), entity.offset, length); + if (entity instanceof tl_1.Api.MessageEntityBold) { + html.push(`<strong>${entityText}</strong>`); + } else if (entity instanceof tl_1.Api.MessageEntitySpoiler) { + html.push(`<spoiler>${entityText}</spoiler>`); + } else if (entity instanceof tl_1.Api.MessageEntityItalic) { + html.push(`<em>${entityText}</em>`); + } else if (entity instanceof tl_1.Api.MessageEntityCode) { + html.push(`<code>${entityText}</code>`); + } else if (entity instanceof tl_1.Api.MessageEntityUnderline) { + html.push(`<u>${entityText}</u>`); + } else if (entity instanceof tl_1.Api.MessageEntityStrike) { + html.push(`<del>${entityText}</del>`); + } else if (entity instanceof tl_1.Api.MessageEntityBlockquote) { + html.push(`<blockquote>${entityText}</blockquote>`); + } else if (entity instanceof tl_1.Api.MessageEntityPre) { + if (entity.language) { + html.push(`<pre><code class="language-${entity.language}">${entityText}</code></pre>`); + } else { + html.push(`<pre>${entityText}</pre>`); + } + } else if (entity instanceof tl_1.Api.MessageEntityEmail) { + html.push(`<a href="mailto:${entityText}">${entityText}</a>`); + } else if (entity instanceof tl_1.Api.MessageEntityUrl) { + html.push(`<a href="${entityText}">${entityText}</a>`); + } else if (entity instanceof tl_1.Api.MessageEntityTextUrl) { + html.push(`<a href="${entity.url}">${entityText}</a>`); + } else if (entity instanceof tl_1.Api.MessageEntityMentionName) { + html.push(`<a href="tg://user?id=${entity.userId}">${entityText}</a>`); + } else if (entity instanceof tl_1.Api.MessageEntityCustomEmoji) { + html.push(`<tg-emoji emoji-id="${entity.documentId}">${entityText}</tg-emoji>`); + } else { + skipEntity = true; + } + lastOffset = relativeOffset + (skipEntity ? 0 : length); + } + html.push(text.slice(lastOffset, text.length)); + return html.join(""); } - } - exports2.enable(load()); - } -}); - -// node_modules/debug/src/index.js -var require_src2 = __commonJS({ - "node_modules/debug/src/index.js"(exports2, module2) { - init_define_import_meta_env(); - if (typeof process !== "undefined" && process.type === "renderer") { - module2.exports = require_browser2(); - } else { - module2.exports = require_node3(); - } + }; + exports2.HTMLParser = HTMLParser; } }); -// node_modules/websocket/lib/utils.js -var require_utils4 = __commonJS({ - "node_modules/websocket/lib/utils.js"(exports2) { +// node_modules/telegram/client/messageParse.js +var require_messageParse = __commonJS({ + "node_modules/telegram/client/messageParse.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var noop = exports2.noop = function() { - }; - exports2.extend = function extend(dest, source) { - for (var prop2 in source) { - dest[prop2] = source[prop2]; - } - }; - exports2.eventEmitterListenerCount = require("events").EventEmitter.listenerCount || function(emitter, type) { - return emitter.listeners(type).length; - }; - exports2.bufferAllocUnsafe = Buffer.allocUnsafe ? Buffer.allocUnsafe : function oldBufferAllocUnsafe(size) { - return new Buffer(size); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - exports2.bufferFromString = Buffer.from ? Buffer.from : function oldBufferFromString(string, encoding) { - return new Buffer(string, encoding); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DEFAULT_DELIMITERS = void 0; + exports2._replaceWithMention = _replaceWithMention; + exports2._parseMessageText = _parseMessageText; + exports2._getResponseMessage = _getResponseMessage; + var Utils_1 = require_Utils(); + var api_1 = require_api(); + var index_1 = require_telegram(); + var Helpers_1 = require_Helpers(); + var big_integer_1 = __importDefault2(require_BigInteger()); + exports2.DEFAULT_DELIMITERS = { + "**": api_1.Api.MessageEntityBold, + __: api_1.Api.MessageEntityItalic, + "~~": api_1.Api.MessageEntityStrike, + "`": api_1.Api.MessageEntityCode, + "```": api_1.Api.MessageEntityPre }; - exports2.BufferingLogger = function createBufferingLogger(identifier, uniqueID) { - var logFunction = require_src2()(identifier); - if (logFunction.enabled) { - var logger = new BufferingLogger(identifier, uniqueID, logFunction); - var debug = logger.log.bind(logger); - debug.printOutput = logger.printOutput.bind(logger); - debug.enabled = logFunction.enabled; - return debug; + async function _replaceWithMention(client2, entities2, i, user) { + try { + entities2[i] = new api_1.Api.InputMessageEntityMentionName({ + offset: entities2[i].offset, + length: entities2[i].length, + userId: await client2.getInputEntity(user) + }); + return true; + } catch (e) { + return false; } - logFunction.printOutput = noop; - return logFunction; - }; - function BufferingLogger(identifier, uniqueID, logFunction) { - this.logFunction = logFunction; - this.identifier = identifier; - this.uniqueID = uniqueID; - this.buffer = []; } - BufferingLogger.prototype.log = function() { - this.buffer.push([/* @__PURE__ */ new Date(), Array.prototype.slice.call(arguments)]); - return this; - }; - BufferingLogger.prototype.clear = function() { - this.buffer = []; - return this; - }; - BufferingLogger.prototype.printOutput = function(logFunction) { - if (!logFunction) { - logFunction = this.logFunction; + async function _parseMessageText(client2, message, parseMode) { + if (parseMode == false) { + return [message, []]; } - var uniqueID = this.uniqueID; - this.buffer.forEach(function(entry) { - var date = entry[0].toLocaleString(); - var args = entry[1].slice(); - var formatString = args[0]; - if (formatString !== void 0 && formatString !== null) { - formatString = "%s - %s - " + formatString.toString(); - args.splice(0, 1, formatString, date, uniqueID); - logFunction.apply(global, args); + if (parseMode == void 0) { + if (client2.parseMode == void 0) { + return [message, []]; } - }); - }; - } -}); - -// node_modules/node-gyp-build/node-gyp-build.js -var require_node_gyp_build = __commonJS({ - "node_modules/node-gyp-build/node-gyp-build.js"(exports2, module2) { - init_define_import_meta_env(); - var fs = require("fs"); - var path2 = require("path"); - var os = require("os"); - var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; - var vars = process.config && process.config.variables || {}; - var prebuildsOnly = !!process.env.PREBUILDS_ONLY; - var abi = process.versions.modules; - var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node"; - var arch = process.env.npm_config_arch || os.arch(); - var platform = process.env.npm_config_platform || os.platform(); - var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc"); - var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || ""; - var uv = (process.versions.uv || "").split(".")[0]; - module2.exports = load; - function load(dir) { - return runtimeRequire(load.resolve(dir)); + parseMode = client2.parseMode; + } else if (typeof parseMode === "string") { + parseMode = (0, Utils_1.sanitizeParseMode)(parseMode); + } + const [rawMessage, msgEntities] = parseMode.parse(message); + for (let i = msgEntities.length - 1; i >= 0; i--) { + const e = msgEntities[i]; + if (e instanceof api_1.Api.MessageEntityTextUrl) { + const m = /^@|\+|tg:\/\/user\?id=(\d+)/.exec(e.url); + if (m) { + const userIdOrUsername = m[1] ? Number(m[1]) : e.url; + const isMention = await _replaceWithMention(client2, msgEntities, i, userIdOrUsername); + if (!isMention) { + msgEntities.splice(i, 1); + } + } + } + } + return [rawMessage, msgEntities]; } - load.resolve = load.path = function(dir) { - dir = path2.resolve(dir || "."); - try { - var name = runtimeRequire(path2.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_"); - if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"]; - } catch (err) { + function _getResponseMessage(client2, request, result, inputChat) { + let updates = []; + let entities2 = /* @__PURE__ */ new Map(); + if (result instanceof api_1.Api.UpdateShort) { + updates = [result.update]; + } else if (result instanceof api_1.Api.Updates || result instanceof api_1.Api.UpdatesCombined) { + updates = result.updates; + for (const x of [...result.users, ...result.chats]) { + entities2.set(index_1.utils.getPeerId(x), x); + } + } else { + return; } - if (!prebuildsOnly) { - var release = getFirst(path2.join(dir, "build/Release"), matchBuild); - if (release) return release; - var debug = getFirst(path2.join(dir, "build/Debug"), matchBuild); - if (debug) return debug; + const randomToId = /* @__PURE__ */ new Map(); + const idToMessage = /* @__PURE__ */ new Map(); + let schedMessage; + for (const update of updates) { + if (update instanceof api_1.Api.UpdateMessageID) { + randomToId.set(update.randomId.toString(), update.id); + } else if (update instanceof api_1.Api.UpdateNewChannelMessage || update instanceof api_1.Api.UpdateNewMessage) { + update.message._finishInit(client2, entities2, inputChat); + if ("randomId" in request || (0, Helpers_1.isArrayLike)(request)) { + idToMessage.set(update.message.id, update.message); + } else { + return update.message; + } + } else if (update instanceof api_1.Api.UpdateEditMessage && "peer" in request && (0, Helpers_1._entityType)(request.peer) != Helpers_1._EntityType.CHANNEL) { + update.message._finishInit(client2, entities2, inputChat); + if ("randomId" in request) { + idToMessage.set(update.message.id, update.message); + } else if ("id" in request && request.id === update.message.id) { + return update.message; + } + } else if (update instanceof api_1.Api.UpdateEditChannelMessage && "peer" in request && (0, Utils_1.getPeerId)(request.peer) == (0, Utils_1.getPeerId)(update.message.peerId)) { + if (request.id == update.message.id) { + update.message._finishInit(client2, entities2, inputChat); + return update.message; + } + } else if (update instanceof api_1.Api.UpdateNewScheduledMessage) { + update.message._finishInit(client2, entities2, inputChat); + schedMessage = update.message; + idToMessage.set(update.message.id, update.message); + } else if (update instanceof api_1.Api.UpdateMessagePoll) { + if (request.media.poll.id == update.pollId) { + const m = new api_1.Api.Message({ + id: request.id, + peerId: index_1.utils.getPeerId(request.peer), + media: new api_1.Api.MessageMediaPoll({ + poll: update.poll, + results: update.results + }), + message: "", + date: 0 + }); + m._finishInit(client2, entities2, inputChat); + return m; + } + } } - var prebuild = resolve(dir); - if (prebuild) return prebuild; - var nearby = resolve(path2.dirname(process.execPath)); - if (nearby) return nearby; - var target = [ - "platform=" + platform, - "arch=" + arch, - "runtime=" + runtime, - "abi=" + abi, - "uv=" + uv, - armv ? "armv=" + armv : "", - "libc=" + libc, - "node=" + process.versions.node, - process.versions.electron ? "electron=" + process.versions.electron : "", - typeof __webpack_require__ === "function" ? "webpack=true" : "" - // eslint-disable-line - ].filter(Boolean).join(" "); - throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n"); - function resolve(dir2) { - var tuples = readdirSync(path2.join(dir2, "prebuilds")).map(parseTuple); - var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0]; - if (!tuple) return; - var prebuilds = path2.join(dir2, "prebuilds", tuple.name); - var parsed = readdirSync(prebuilds).map(parseTags); - var candidates = parsed.filter(matchTags(runtime, abi)); - var winner = candidates.sort(compareTags(runtime))[0]; - if (winner) return path2.join(prebuilds, winner.file); + if (request == void 0) { + return idToMessage; } - }; - function readdirSync(dir) { - try { - return fs.readdirSync(dir); - } catch (err) { - return []; + let randomId; + if ((0, Helpers_1.isArrayLike)(request) || typeof request == "number" || big_integer_1.default.isInstance(request)) { + randomId = request; + } else { + randomId = request.randomId; } - } - function getFirst(dir, filter3) { - var files = readdirSync(dir).filter(filter3); - return files[0] && path2.join(dir, files[0]); - } - function matchBuild(name) { - return /\.node$/.test(name); - } - function parseTuple(name) { - var arr = name.split("-"); - if (arr.length !== 2) return; - var platform2 = arr[0]; - var architectures = arr[1].split("+"); - if (!platform2) return; - if (!architectures.length) return; - if (!architectures.every(Boolean)) return; - return { name, platform: platform2, architectures }; - } - function matchTuple(platform2, arch2) { - return function(tuple) { - if (tuple == null) return false; - if (tuple.platform !== platform2) return false; - return tuple.architectures.includes(arch2); - }; - } - function compareTuples(a, b) { - return a.architectures.length - b.architectures.length; - } - function parseTags(file) { - var arr = file.split("."); - var extension = arr.pop(); - var tags = { file, specificity: 0 }; - if (extension !== "node") return; - for (var i = 0; i < arr.length; i++) { - var tag = arr[i]; - if (tag === "node" || tag === "electron" || tag === "node-webkit") { - tags.runtime = tag; - } else if (tag === "napi") { - tags.napi = true; - } else if (tag.slice(0, 3) === "abi") { - tags.abi = tag.slice(3); - } else if (tag.slice(0, 2) === "uv") { - tags.uv = tag.slice(2); - } else if (tag.slice(0, 4) === "armv") { - tags.armv = tag.slice(4); - } else if (tag === "glibc" || tag === "musl") { - tags.libc = tag; - } else { - continue; + if (!randomId) { + if (schedMessage) { + return schedMessage; } - tags.specificity++; + client2._log.warn(`No randomId in ${request} to map to. returning undefined for ${result} (Message was empty)`); + return void 0; } - return tags; - } - function matchTags(runtime2, abi2) { - return function(tags) { - if (tags == null) return false; - if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false; - if (tags.abi && tags.abi !== abi2 && !tags.napi) return false; - if (tags.uv && tags.uv !== uv) return false; - if (tags.armv && tags.armv !== armv) return false; - if (tags.libc && tags.libc !== libc) return false; - return true; - }; - } - function runtimeAgnostic(tags) { - return tags.runtime === "node" && tags.napi; - } - function compareTags(runtime2) { - return function(a, b) { - if (a.runtime !== b.runtime) { - return a.runtime === runtime2 ? -1 : 1; - } else if (a.abi !== b.abi) { - return a.abi ? -1 : 1; - } else if (a.specificity !== b.specificity) { - return a.specificity > b.specificity ? -1 : 1; - } else { - return 0; + if (!(0, Helpers_1.isArrayLike)(randomId)) { + let msg = idToMessage.get(randomToId.get(randomId.toString())); + if (!msg) { + client2._log.warn(`Request ${request.className} had missing message mapping ${result.className} (Message was empty)`); } - }; - } - function isNwjs() { - return !!(process.versions && process.versions.nw); - } - function isElectron() { - if (process.versions && process.versions.electron) return true; - if (process.env.ELECTRON_RUN_AS_NODE) return true; - return typeof window !== "undefined" && window.process && window.process.type === "renderer"; - } - function isAlpine(platform2) { - return platform2 === "linux" && fs.existsSync("/etc/alpine-release"); + return msg; + } + const final = []; + let warned = false; + for (const rnd of randomId) { + const tmp = randomToId.get(rnd.toString()); + if (!tmp) { + warned = true; + break; + } + const tmp2 = idToMessage.get(tmp); + if (!tmp2) { + warned = true; + break; + } + final.push(tmp2); + } + if (warned) { + client2._log.warn(`Request ${request.className} had missing message mapping ${result.className} (Message was empty)`); + } + const finalToReturn = []; + for (const rnd of randomId) { + finalToReturn.push(idToMessage.get(randomToId.get(rnd.toString()))); + } + return finalToReturn; } - load.parseTags = parseTags; - load.matchTags = matchTags; - load.compareTags = compareTags; - load.parseTuple = parseTuple; - load.matchTuple = matchTuple; - load.compareTuples = compareTuples; } }); -// node_modules/node-gyp-build/index.js -var require_node_gyp_build2 = __commonJS({ - "node_modules/node-gyp-build/index.js"(exports2, module2) { +// node_modules/telegram/extensions/markdown.js +var require_markdown = __commonJS({ + "node_modules/telegram/extensions/markdown.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; - if (typeof runtimeRequire.addon === "function") { - module2.exports = runtimeRequire.addon.bind(runtimeRequire); - } else { - module2.exports = require_node_gyp_build(); - } + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MarkdownParser = void 0; + var messageParse_1 = require_messageParse(); + var MarkdownParser = class { + // TODO maybe there is a better way :shrug: + static parse(message) { + let i = 0; + const keys = {}; + for (const k in messageParse_1.DEFAULT_DELIMITERS) { + keys[k] = false; + } + const entities2 = []; + const tempEntities = {}; + while (i < message.length) { + let foundIndex = -1; + let foundDelim = void 0; + for (const key of Object.keys(messageParse_1.DEFAULT_DELIMITERS)) { + const index2 = message.indexOf(key, i); + if (index2 > -1 && (foundIndex === -1 || index2 < foundIndex)) { + foundIndex = index2; + foundDelim = key; + } + } + if (foundIndex === -1 || foundDelim == void 0) { + break; + } + if (!keys[foundDelim]) { + tempEntities[foundDelim] = new messageParse_1.DEFAULT_DELIMITERS[foundDelim]({ + offset: foundIndex, + length: -1, + language: "" + }); + keys[foundDelim] = true; + } else { + keys[foundDelim] = false; + tempEntities[foundDelim].length = foundIndex - tempEntities[foundDelim].offset; + entities2.push(tempEntities[foundDelim]); + } + message = message.toString().replace(foundDelim, ""); + i = foundIndex; + } + return [message, entities2]; + } + static unparse(text, entities2) { + const delimiters = messageParse_1.DEFAULT_DELIMITERS; + if (!text || !entities2) { + return text; + } + let insertAt = []; + const tempDelimiters = /* @__PURE__ */ new Map(); + Object.keys(delimiters).forEach((key) => { + tempDelimiters.set(delimiters[key].className, key); + }); + for (const entity of entities2) { + const s = entity.offset; + const e = entity.offset + entity.length; + const delimiter = tempDelimiters.get(entity.className); + if (delimiter) { + insertAt.push([s, delimiter]); + insertAt.push([e, delimiter]); + } + } + insertAt = insertAt.sort((a, b) => { + return a[0] - b[0]; + }); + while (insertAt.length) { + const [at, what] = insertAt.pop(); + text = text.slice(0, at) + what + text.slice(at); + } + return text; + } + }; + exports2.MarkdownParser = MarkdownParser; } }); -// node_modules/bufferutil/fallback.js -var require_fallback = __commonJS({ - "node_modules/bufferutil/fallback.js"(exports2, module2) { +// node_modules/telegram/extensions/markdownv2.js +var require_markdownv2 = __commonJS({ + "node_modules/telegram/extensions/markdownv2.js"(exports2) { "use strict"; init_define_import_meta_env(); - var mask = (source, mask2, output, offset, length) => { - for (var i = 0; i < length; i++) { - output[offset + i] = source[i] ^ mask2[i & 3]; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MarkdownV2Parser = void 0; + var html_1 = require_html(); + var MarkdownV2Parser = class { + static parse(message) { + message = message.replace(/\*(.*?)\*/g, "<b>$1</b>"); + message = message.replace(/__(.*?)__/g, "<u>$1</u>"); + message = message.replace(/~(.*?)~/g, "<s>$1</s>"); + message = message.replace(/-(.*?)-/g, "<i>$1</i>"); + message = message.replace(/```([\s\S]*?)```/g, "<pre>$1</pre>"); + message = message.replace(/`(.*?)`/g, "<code>$1</code>"); + message = message.replace(/\|\|(.*?)\|\|/g, "<spoiler>$1</spoiler>"); + message = message.replace(/(?<!\!)\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>'); + message = message.replace(/!\[([^\]]+)\]\(tg:\/\/emoji\?id=(\d+)\)/g, '<tg-emoji emoji-id="$2">$1</tg-emoji>'); + return html_1.HTMLParser.parse(message); } - }; - var unmask = (buffer, mask2) => { - const length = buffer.length; - for (var i = 0; i < length; i++) { - buffer[i] ^= mask2[i & 3]; + static unparse(text, entities2) { + text = html_1.HTMLParser.unparse(text, entities2); + text = text.replace(/<b>(.*?)<\/b>/g, "*$1*"); + text = text.replace(/<u>(.*?)<\/u>/g, "__$1__"); + text = text.replace(/<code>(.*?)<\/code>/g, "`$1`"); + text = text.replace(/<pre>(.*?)<\/pre>/g, "```$1```"); + text = text.replace(/<s>(.*?)<\/s>/g, "~$1~"); + text = text.replace(/<i>(.*?)<\/i>/g, "-$1-"); + text = text.replace(/<spoiler>(.*?)<\/spoiler>/g, "||$1||"); + text = text.replace(/<a href="([^"]+)">([^<]+)<\/a>/g, "[$2]($1)"); + text = text.replace(/<tg-emoji emoji-id="(\d+)">([^<]+)<\/tg-emoji>/g, "![$2](tg://emoji?id=$1)"); + return text; } }; - module2.exports = { mask, unmask }; + exports2.MarkdownV2Parser = MarkdownV2Parser; } }); -// node_modules/bufferutil/index.js -var require_bufferutil = __commonJS({ - "node_modules/bufferutil/index.js"(exports2, module2) { +// node_modules/telegram/Utils.js +var require_Utils = __commonJS({ + "node_modules/telegram/Utils.js"(exports2) { "use strict"; init_define_import_meta_env(); - try { - module2.exports = require_node_gyp_build2()(__dirname); - } catch (e) { - module2.exports = require_fallback(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getFileInfo = getFileInfo; + exports2.chunks = chunks; + exports2.getInputPeer = getInputPeer; + exports2._photoSizeByteCount = _photoSizeByteCount; + exports2._getEntityPair = _getEntityPair; + exports2.getInnerText = getInnerText; + exports2.getInputChannel = getInputChannel; + exports2.getInputUser = getInputUser; + exports2.getInputMessage = getInputMessage; + exports2.getInputChatPhoto = getInputChatPhoto; + exports2.strippedPhotoToJpg = strippedPhotoToJpg; + exports2.getInputPhoto = getInputPhoto; + exports2.getInputDocument = getInputDocument; + exports2.isAudio = isAudio; + exports2.isImage = isImage; + exports2.getExtension = getExtension; + exports2.getAttributes = getAttributes; + exports2.getInputGeo = getInputGeo; + exports2.getInputMedia = getInputMedia; + exports2.getAppropriatedPartSize = getAppropriatedPartSize; + exports2.getPeer = getPeer; + exports2.sanitizeParseMode = sanitizeParseMode; + exports2.getPeerId = getPeerId; + exports2.resolveId = resolveId; + exports2.getMessageId = getMessageId; + exports2.parsePhone = parsePhone; + exports2.parseID = parseID; + exports2.resolveInviteLink = resolveInviteLink; + exports2.parseUsername = parseUsername; + exports2.rtrim = rtrim; + exports2.getDisplayName = getDisplayName; + var big_integer_1 = __importDefault2(require_BigInteger()); + var mime_1 = __importDefault2(require_mime3()); + var html_1 = require_html(); + var markdown_1 = require_markdown(); + var markdownv2_1 = require_markdownv2(); + var Helpers_1 = require_Helpers(); + var tl_1 = require_tl(); + function getFileInfo(fileLocation) { + if (!fileLocation || !fileLocation.SUBCLASS_OF_ID) { + _raiseCastFail(fileLocation, "InputFileLocation"); + } + if (fileLocation.SUBCLASS_OF_ID == 354669666) { + return { + dcId: void 0, + location: fileLocation, + size: void 0 + }; + } + let location; + if (fileLocation instanceof tl_1.Api.Message) { + location = fileLocation.media; + } + if (fileLocation instanceof tl_1.Api.MessageMediaDocument) { + location = fileLocation.document; + } else if (fileLocation instanceof tl_1.Api.MessageMediaPhoto) { + location = fileLocation.photo; + } + if (location instanceof tl_1.Api.Document) { + return { + dcId: location.dcId, + location: new tl_1.Api.InputDocumentFileLocation({ + id: location.id, + accessHash: location.accessHash, + fileReference: location.fileReference, + thumbSize: "" + }), + size: location.size + }; + } else if (location instanceof tl_1.Api.Photo) { + return { + dcId: location.dcId, + location: new tl_1.Api.InputPhotoFileLocation({ + id: location.id, + accessHash: location.accessHash, + fileReference: location.fileReference, + thumbSize: location.sizes[location.sizes.length - 1].type + }), + size: (0, big_integer_1.default)(_photoSizeByteCount(location.sizes[location.sizes.length - 1]) || 0) + }; + } + _raiseCastFail(fileLocation, "InputFileLocation"); } - } -}); - -// node_modules/websocket/lib/WebSocketFrame.js -var require_WebSocketFrame = __commonJS({ - "node_modules/websocket/lib/WebSocketFrame.js"(exports2, module2) { - init_define_import_meta_env(); - var bufferUtil = require_bufferutil(); - var bufferAllocUnsafe = require_utils4().bufferAllocUnsafe; - var DECODE_HEADER = 1; - var WAITING_FOR_16_BIT_LENGTH = 2; - var WAITING_FOR_64_BIT_LENGTH = 3; - var WAITING_FOR_MASK_KEY = 4; - var WAITING_FOR_PAYLOAD = 5; - var COMPLETE = 6; - function WebSocketFrame(maskBytes, frameHeader, config) { - this.maskBytes = maskBytes; - this.frameHeader = frameHeader; - this.config = config; - this.maxReceivedFrameSize = config.maxReceivedFrameSize; - this.protocolError = false; - this.frameTooLarge = false; - this.invalidCloseFrameLength = false; - this.parseState = DECODE_HEADER; - this.closeStatus = -1; + function* chunks(arr, size = 100) { + for (let i = 0; i < arr.length; i += size) { + yield arr.slice(i, i + size); + } } - WebSocketFrame.prototype.addData = function(bufferList) { - if (this.parseState === DECODE_HEADER) { - if (bufferList.length >= 2) { - bufferList.joinInto(this.frameHeader, 0, 0, 2); - bufferList.advance(2); - var firstByte = this.frameHeader[0]; - var secondByte = this.frameHeader[1]; - this.fin = Boolean(firstByte & 128); - this.rsv1 = Boolean(firstByte & 64); - this.rsv2 = Boolean(firstByte & 32); - this.rsv3 = Boolean(firstByte & 16); - this.mask = Boolean(secondByte & 128); - this.opcode = firstByte & 15; - this.length = secondByte & 127; - if (this.opcode >= 8) { - if (this.length > 125) { - this.protocolError = true; - this.dropReason = "Illegal control frame longer than 125 bytes."; - return true; - } - if (!this.fin) { - this.protocolError = true; - this.dropReason = "Control frames must not be fragmented."; - return true; - } - } - if (this.length === 126) { - this.parseState = WAITING_FOR_16_BIT_LENGTH; - } else if (this.length === 127) { - this.parseState = WAITING_FOR_64_BIT_LENGTH; - } else { - this.parseState = WAITING_FOR_MASK_KEY; - } - } + var USERNAME_RE = new RegExp("@|(?:https?:\\/\\/)?(?:www\\.)?(?:telegram\\.(?:me|dog)|t\\.me)\\/(@|joinchat\\/)?", "i"); + var JPEG_HEADER = Buffer.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00", "hex"); + var JPEG_FOOTER = Buffer.from("ffd9", "hex"); + var TG_JOIN_RE = new RegExp("tg:\\/\\/(join)\\?invite=", "i"); + var VALID_USERNAME_RE = new RegExp("^([a-z]((?!__)[\\w\\d]){3,30}[a-z\\d]|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$", "i"); + function _raiseCastFail(entity, target) { + let toWrite = entity; + if (typeof entity === "object" && "className" in entity) { + toWrite = entity.className; } - if (this.parseState === WAITING_FOR_16_BIT_LENGTH) { - if (bufferList.length >= 2) { - bufferList.joinInto(this.frameHeader, 2, 0, 2); - bufferList.advance(2); - this.length = this.frameHeader.readUInt16BE(2); - this.parseState = WAITING_FOR_MASK_KEY; + throw new Error(`Cannot cast ${toWrite} to any kind of ${target}`); + } + function getInputPeer(entity, allowSelf = true, checkHash = true) { + if (entity.SUBCLASS_OF_ID === void 0) { + if (allowSelf && "inputEntity" in entity) { + return entity.inputEntity; + } else if ("entity" in entity) { + return getInputPeer(entity.entity); + } else { + _raiseCastFail(entity, "InputPeer"); } - } else if (this.parseState === WAITING_FOR_64_BIT_LENGTH) { - if (bufferList.length >= 8) { - bufferList.joinInto(this.frameHeader, 2, 0, 8); - bufferList.advance(8); - var lengthPair = [ - this.frameHeader.readUInt32BE(2), - this.frameHeader.readUInt32BE(2 + 4) - ]; - if (lengthPair[0] !== 0) { - this.protocolError = true; - this.dropReason = "Unsupported 64-bit length frame received"; - return true; - } - this.length = lengthPair[1]; - this.parseState = WAITING_FOR_MASK_KEY; + } + if (entity.SUBCLASS_OF_ID === 3374092470) { + return entity; + } + if (entity instanceof tl_1.Api.User) { + if (entity.self && allowSelf) { + return new tl_1.Api.InputPeerSelf(); + } else if (entity.accessHash !== void 0 && !entity.min || !checkHash) { + return new tl_1.Api.InputPeerUser({ + userId: entity.id, + accessHash: entity.accessHash || (0, big_integer_1.default)(0) + }); + } else { + throw new Error("User without accessHash or min cannot be input"); } } - if (this.parseState === WAITING_FOR_MASK_KEY) { - if (this.mask) { - if (bufferList.length >= 4) { - bufferList.joinInto(this.maskBytes, 0, 0, 4); - bufferList.advance(4); - this.parseState = WAITING_FOR_PAYLOAD; - } + if (entity instanceof tl_1.Api.Chat || entity instanceof tl_1.Api.ChatEmpty || entity instanceof tl_1.Api.ChatForbidden) { + return new tl_1.Api.InputPeerChat({ chatId: entity.id }); + } + if (entity instanceof tl_1.Api.Channel) { + if (entity.accessHash !== void 0 && !entity.min || !checkHash) { + return new tl_1.Api.InputPeerChannel({ + channelId: entity.id, + accessHash: entity.accessHash || (0, big_integer_1.default)(0) + }); } else { - this.parseState = WAITING_FOR_PAYLOAD; + throw new TypeError("Channel without accessHash or min info cannot be input"); } } - if (this.parseState === WAITING_FOR_PAYLOAD) { - if (this.length > this.maxReceivedFrameSize) { - this.frameTooLarge = true; - this.dropReason = "Frame size of " + this.length.toString(10) + " bytes exceeds maximum accepted frame size"; - return true; + if (entity instanceof tl_1.Api.ChannelForbidden) { + return new tl_1.Api.InputPeerChannel({ + channelId: entity.id, + accessHash: entity.accessHash + }); + } + if (entity instanceof tl_1.Api.InputUser) { + return new tl_1.Api.InputPeerUser({ + userId: entity.userId, + accessHash: entity.accessHash + }); + } + if (entity instanceof tl_1.Api.InputChannel) { + return new tl_1.Api.InputPeerChannel({ + channelId: entity.channelId, + accessHash: entity.accessHash + }); + } + if (entity instanceof tl_1.Api.UserEmpty) { + return new tl_1.Api.InputPeerEmpty(); + } + if (entity instanceof tl_1.Api.UserFull) { + return getInputPeer(entity.id); + } + if (entity instanceof tl_1.Api.ChatFull) { + return new tl_1.Api.InputPeerChat({ chatId: entity.id }); + } + if (entity instanceof tl_1.Api.PeerChat) { + return new tl_1.Api.InputPeerChat({ + chatId: entity.chatId + }); + } + _raiseCastFail(entity, "InputPeer"); + } + function _photoSizeByteCount(size) { + if (size instanceof tl_1.Api.PhotoSize) { + return size.size; + } else if (size instanceof tl_1.Api.PhotoStrippedSize) { + if (size.bytes.length < 3 || size.bytes[0] != 1) { + return size.bytes.length; } - if (this.length === 0) { - this.binaryPayload = bufferAllocUnsafe(0); - this.parseState = COMPLETE; - return true; + return size.bytes.length + 622; + } else if (size instanceof tl_1.Api.PhotoCachedSize) { + return size.bytes.length; + } else if (size instanceof tl_1.Api.PhotoSizeEmpty) { + return 0; + } else if (size instanceof tl_1.Api.PhotoSizeProgressive) { + return size.sizes[size.sizes.length - 1]; + } else { + return void 0; + } + } + function _getEntityPair(entityId, entities2, cache, getInputPeerFunction = getInputPeer) { + const entity = entities2.get(entityId); + let inputEntity; + try { + inputEntity = cache.get(entityId); + } catch (e) { + try { + inputEntity = getInputPeerFunction(inputEntity); + } catch (e2) { } - if (bufferList.length >= this.length) { - this.binaryPayload = bufferList.take(this.length); - bufferList.advance(this.length); - if (this.mask) { - bufferUtil.unmask(this.binaryPayload, this.maskBytes); - } - if (this.opcode === 8) { - if (this.length === 1) { - this.binaryPayload = bufferAllocUnsafe(0); - this.invalidCloseFrameLength = true; - } - if (this.length >= 2) { - this.closeStatus = this.binaryPayload.readUInt16BE(0); - this.binaryPayload = this.binaryPayload.slice(2); - } + } + return [entity, inputEntity]; + } + function getInnerText(text, entities2) { + const result = []; + entities2.forEach(function(value, key) { + const start = value.offset; + const end = value.offset + value.length; + result.push(text.slice(start, end)); + }); + return result; + } + function getInputChannel(entity) { + if (typeof entity === "string" || typeof entity == "number" || typeof entity == "bigint" || big_integer_1.default.isInstance(entity)) { + _raiseCastFail(entity, "InputChannel"); + } + if (entity.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(entity, "InputChannel"); + } + if (entity.SUBCLASS_OF_ID === 1089602301) { + return entity; + } + if (entity instanceof tl_1.Api.Channel || entity instanceof tl_1.Api.ChannelForbidden) { + return new tl_1.Api.InputChannel({ + channelId: entity.id, + accessHash: entity.accessHash || big_integer_1.default.zero + }); + } + if (entity instanceof tl_1.Api.InputPeerChannel) { + return new tl_1.Api.InputChannel({ + channelId: entity.channelId, + accessHash: entity.accessHash + }); + } + _raiseCastFail(entity, "InputChannel"); + } + function getInputUser(entity) { + if (typeof entity === "string" || typeof entity == "number" || typeof entity == "bigint" || big_integer_1.default.isInstance(entity)) { + _raiseCastFail(entity, "InputUser"); + } + if (entity.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(entity, "InputUser"); + } + if (entity.SUBCLASS_OF_ID === 3865689926) { + return entity; + } + if (entity instanceof tl_1.Api.User) { + if (entity.self) { + return new tl_1.Api.InputUserSelf(); + } else { + return new tl_1.Api.InputUser({ + userId: entity.id, + accessHash: entity.accessHash || big_integer_1.default.zero + }); + } + } + if (entity instanceof tl_1.Api.InputPeerSelf) { + return new tl_1.Api.InputUserSelf(); + } + if (entity instanceof tl_1.Api.UserEmpty || entity instanceof tl_1.Api.InputPeerEmpty) { + return new tl_1.Api.InputUserEmpty(); + } + if (entity instanceof tl_1.Api.UserFull) { + return getInputUser(entity); + } + if (entity instanceof tl_1.Api.InputPeerUser) { + return new tl_1.Api.InputUser({ + userId: entity.userId, + accessHash: entity.accessHash + }); + } + if (entity instanceof tl_1.Api.InputPeerUserFromMessage) { + return new tl_1.Api.InputUserFromMessage({ + userId: entity.userId, + peer: entity.peer, + msgId: entity.msgId + }); + } + _raiseCastFail(entity, "InputUser"); + } + function getInputMessage(message) { + if (typeof message === "number") { + return new tl_1.Api.InputMessageID({ id: message }); + } + if (message === void 0 || message.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(message, "InputMessage"); + } + if (message.SUBCLASS_OF_ID === 1421262021) { + return message; + } else if (message.SUBCLASS_OF_ID === 2030045667) { + return new tl_1.Api.InputMessageID({ id: message.id }); + } + _raiseCastFail(message, "InputMessage"); + } + function getInputChatPhoto(photo) { + if (photo === void 0 || photo.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(photo, "InputChatPhoto"); + } + if (photo.SUBCLASS_OF_ID === 3572182388) { + return photo; + } else if (photo.SUBCLASS_OF_ID === 3882180383) { + return new tl_1.Api.InputChatUploadedPhoto({ + file: photo + }); + } + photo = getInputPhoto(photo); + if (photo instanceof tl_1.Api.InputPhoto) { + return new tl_1.Api.InputChatPhoto({ + id: photo + }); + } else if (photo instanceof tl_1.Api.InputPhotoEmpty) { + return new tl_1.Api.InputChatPhotoEmpty(); + } + _raiseCastFail(photo, "InputChatPhoto"); + } + function strippedPhotoToJpg(stripped) { + if (stripped.length < 3 || stripped[0] !== 1) { + return stripped; + } + const header = Buffer.from(JPEG_HEADER); + header[164] = stripped[1]; + header[166] = stripped[2]; + return Buffer.concat([header, stripped.slice(3), JPEG_FOOTER]); + } + function getInputPhoto(photo) { + if (photo.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(photo, "InputPhoto"); + } + if (photo.SUBCLASS_OF_ID === 2221106144) { + return photo; + } + if (photo instanceof tl_1.Api.Message) { + photo = photo.media; + } + if (photo instanceof tl_1.Api.photos.Photo || photo instanceof tl_1.Api.MessageMediaPhoto) { + photo = photo.photo; + } + if (photo instanceof tl_1.Api.Photo) { + return new tl_1.Api.InputPhoto({ + id: photo.id, + accessHash: photo.accessHash, + fileReference: photo.fileReference + }); + } + if (photo instanceof tl_1.Api.PhotoEmpty) { + return new tl_1.Api.InputPhotoEmpty(); + } + if (photo instanceof tl_1.Api.messages.ChatFull) { + photo = photo.fullChat; + } + if (photo instanceof tl_1.Api.ChannelFull) { + return getInputPhoto(photo.chatPhoto); + } else { + if (photo instanceof tl_1.Api.UserFull) { + return getInputPhoto(photo.profilePhoto); + } else { + if (photo instanceof tl_1.Api.Channel || photo instanceof tl_1.Api.Chat || photo instanceof tl_1.Api.User) { + return getInputPhoto(photo.photo); } - this.parseState = COMPLETE; - return true; } } - return false; - }; - WebSocketFrame.prototype.throwAwayPayload = function(bufferList) { - if (bufferList.length >= this.length) { - bufferList.advance(this.length); - this.parseState = COMPLETE; - return true; + if (photo instanceof tl_1.Api.UserEmpty || photo instanceof tl_1.Api.ChatEmpty || photo instanceof tl_1.Api.ChatForbidden || photo instanceof tl_1.Api.ChannelForbidden) { + return new tl_1.Api.InputPhotoEmpty(); } - return false; - }; - WebSocketFrame.prototype.toBuffer = function(nullMask) { - var maskKey; - var headerLength = 2; - var data; - var outputPos; - var firstByte = 0; - var secondByte = 0; - if (this.fin) { - firstByte |= 128; + _raiseCastFail(photo, "InputPhoto"); + } + function getInputDocument(document2) { + if (document2.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(document2, "InputDocument"); } - if (this.rsv1) { - firstByte |= 64; + if (document2.SUBCLASS_OF_ID === 4081048424) { + return document2; } - if (this.rsv2) { - firstByte |= 32; + if (document2 instanceof tl_1.Api.Document) { + return new tl_1.Api.InputDocument({ + id: document2.id, + accessHash: document2.accessHash, + fileReference: document2.fileReference + }); } - if (this.rsv3) { - firstByte |= 16; + if (document2 instanceof tl_1.Api.DocumentEmpty) { + return new tl_1.Api.InputDocumentEmpty(); } - if (this.mask) { - secondByte |= 128; + if (document2 instanceof tl_1.Api.MessageMediaDocument) { + return getInputDocument(document2.document); } - firstByte |= this.opcode & 15; - if (this.opcode === 8) { - this.length = 2; - if (this.binaryPayload) { - this.length += this.binaryPayload.length; + if (document2 instanceof tl_1.Api.Message) { + return getInputDocument(document2.media); + } + _raiseCastFail(document2, "InputDocument"); + } + function isAudio(file) { + const ext = _getExtension(file); + if (!ext) { + const metadata = _getMetadata(file); + return (metadata.get("mimeType") || "").startsWith("audio/"); + } else { + file = "a" + ext; + return (mime_1.default.getType(file) || "").startsWith("audio/"); + } + } + function isImage(file) { + const ext = _getExtension(file).toLowerCase(); + return ext.endsWith(".png") || ext.endsWith(".jpg") || ext.endsWith(".jpeg"); + } + function getExtension(media) { + try { + getInputPhoto(media); + return ".jpg"; + } catch (e) { + } + if (media instanceof tl_1.Api.UserProfilePhoto || media instanceof tl_1.Api.ChatPhoto) { + return ".jpg"; + } + if (media instanceof tl_1.Api.MessageMediaDocument) { + media = media.document; + } + if (media instanceof tl_1.Api.Document || media instanceof tl_1.Api.WebDocument || media instanceof tl_1.Api.WebDocumentNoProxy) { + if (media.mimeType === "application/octet-stream") { + return ""; + } else { + return mime_1.default.getExtension(media.mimeType) || ""; } - data = bufferAllocUnsafe(this.length); - data.writeUInt16BE(this.closeStatus, 0); - if (this.length > 2) { - this.binaryPayload.copy(data, 2); + } + return ""; + } + function _getExtension(file) { + if (typeof file === "string") { + return "." + file.split(".").pop(); + } else if ("name" in file) { + return _getExtension(file.name); + } else { + return getExtension(file); + } + } + function _getMetadata(file) { + return /* @__PURE__ */ new Map(); + } + function isVideo(file) { + var _a; + const ext = _getExtension(file); + if (!ext) { + const metadata = _getMetadata(file); + if (metadata.has("mimeType")) { + return ((_a = metadata.get("mimeType")) === null || _a === void 0 ? void 0 : _a.startsWith("video/")) || false; + } else { + return false; } - } else if (this.binaryPayload) { - data = this.binaryPayload; - this.length = data.length; } else { - this.length = 0; + file = "a" + ext; + return (mime_1.default.getType(file) || "").startsWith("video/"); } - if (this.length <= 125) { - secondByte |= this.length & 127; - } else if (this.length > 125 && this.length <= 65535) { - secondByte |= 126; - headerLength += 2; - } else if (this.length > 65535) { - secondByte |= 127; - headerLength += 8; + } + function getAttributes(file, { attributes = null, mimeType = void 0, forceDocument = false, voiceNote = false, videoNote = false, supportsStreaming = false, thumb = null }) { + var _a, _b, _c, _d; + const name = typeof file == "string" ? file : "name" in file ? file.name || "unnamed" : "unnamed"; + if (mimeType === void 0) { + mimeType = mime_1.default.getType(name) || "application/octet-stream"; } - var output = bufferAllocUnsafe(this.length + headerLength + (this.mask ? 4 : 0)); - output[0] = firstByte; - output[1] = secondByte; - outputPos = 2; - if (this.length > 125 && this.length <= 65535) { - output.writeUInt16BE(this.length, outputPos); - outputPos += 2; - } else if (this.length > 65535) { - output.writeUInt32BE(0, outputPos); - output.writeUInt32BE(this.length, outputPos + 4); - outputPos += 8; + const attrObj = /* @__PURE__ */ new Map(); + attrObj.set(tl_1.Api.DocumentAttributeFilename, new tl_1.Api.DocumentAttributeFilename({ + fileName: name.split(/[\\/]/).pop() || "" + })); + if (isAudio(file)) { + const m = _getMetadata(file); + attrObj.set(tl_1.Api.DocumentAttributeAudio, new tl_1.Api.DocumentAttributeAudio({ + voice: voiceNote, + title: m.has("title") ? m.get("title") : void 0, + performer: m.has("author") ? m.get("author") : void 0, + duration: Number.parseInt((_a = m.get("duration")) !== null && _a !== void 0 ? _a : "0") + })); } - if (this.mask) { - maskKey = nullMask ? 0 : Math.random() * 4294967295 >>> 0; - this.maskBytes.writeUInt32BE(maskKey, 0); - this.maskBytes.copy(output, outputPos); - outputPos += 4; - if (data) { - bufferUtil.mask(data, this.maskBytes, output, outputPos, this.length); + if (!forceDocument && isVideo(file)) { + let doc; + if (thumb) { + const t_m = _getMetadata(thumb); + const width = Number.parseInt((t_m === null || t_m === void 0 ? void 0 : t_m.get("width")) || "1"); + const height = Number.parseInt((t_m === null || t_m === void 0 ? void 0 : t_m.get("height")) || "1"); + doc = new tl_1.Api.DocumentAttributeVideo({ + duration: 0, + h: height, + w: width, + roundMessage: videoNote, + supportsStreaming + }); + } else { + const m = _getMetadata(file); + doc = new tl_1.Api.DocumentAttributeVideo({ + roundMessage: videoNote, + w: Number.parseInt((_b = m.get("width")) !== null && _b !== void 0 ? _b : "1"), + h: Number.parseInt((_c = m.get("height")) !== null && _c !== void 0 ? _c : "1"), + duration: Number.parseInt((_d = m.get("duration")) !== null && _d !== void 0 ? _d : "0"), + supportsStreaming + }); } - } else if (data) { - data.copy(output, outputPos); + attrObj.set(tl_1.Api.DocumentAttributeVideo, doc); } - return output; - }; - WebSocketFrame.prototype.toString = function() { - return "Opcode: " + this.opcode + ", fin: " + this.fin + ", length: " + this.length + ", hasPayload: " + Boolean(this.binaryPayload) + ", masked: " + this.mask; - }; - module2.exports = WebSocketFrame; - } -}); - -// node_modules/websocket/vendor/FastBufferList.js -var require_FastBufferList = __commonJS({ - "node_modules/websocket/vendor/FastBufferList.js"(exports2, module2) { - init_define_import_meta_env(); - var Buffer2 = require("buffer").Buffer; - var EventEmitter = require("events").EventEmitter; - var bufferAllocUnsafe = require_utils4().bufferAllocUnsafe; - module2.exports = BufferList; - module2.exports.BufferList = BufferList; - function BufferList(opts) { - if (!(this instanceof BufferList)) return new BufferList(opts); - EventEmitter.call(this); - var self2 = this; - if (typeof opts == "undefined") opts = {}; - self2.encoding = opts.encoding; - var head = { next: null, buffer: null }; - var last = { next: null, buffer: null }; - var length = 0; - self2.__defineGetter__("length", function() { - return length; - }); - var offset = 0; - self2.write = function(buf) { - if (!head.buffer) { - head.buffer = buf; - last = head; + if (videoNote) { + if (attrObj.has(tl_1.Api.DocumentAttributeAudio)) { + attrObj.get(tl_1.Api.DocumentAttributeAudio).voice = true; } else { - last.next = { next: null, buffer: buf }; - last = last.next; + attrObj.set(tl_1.Api.DocumentAttributeAudio, new tl_1.Api.DocumentAttributeAudio({ + duration: 0, + voice: true + })); } - length += buf.length; - self2.emit("write", buf); - return true; - }; - self2.end = function(buf) { - if (Buffer2.isBuffer(buf)) self2.write(buf); - }; - self2.push = function() { - var args = [].concat.apply([], arguments); - args.forEach(self2.write); - return self2; - }; - self2.forEach = function(fn) { - if (!head.buffer) return bufferAllocUnsafe(0); - if (head.buffer.length - offset <= 0) return self2; - var firstBuf = head.buffer.slice(offset); - var b = { buffer: firstBuf, next: head.next }; - while (b && b.buffer) { - var r = fn(b.buffer); - if (r) break; - b = b.next; + } + if (attributes) { + for (const a of attributes) { + attrObj.set(a.constructor, a); } - return self2; + } + return { + attrs: Array.from(attrObj.values()), + mimeType }; - self2.join = function(start, end) { - if (!head.buffer) return bufferAllocUnsafe(0); - if (start == void 0) start = 0; - if (end == void 0) end = self2.length; - var big = bufferAllocUnsafe(end - start); - var ix = 0; - self2.forEach(function(buffer) { - if (start < ix + buffer.length && ix < end) { - buffer.copy( - big, - Math.max(0, ix - start), - Math.max(0, start - ix), - Math.min(buffer.length, end - ix) - ); + } + function getInputGeo(geo) { + if (geo === void 0 || geo.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(geo, "InputGeoPoint"); + } + if (geo.SUBCLASS_OF_ID === 70308389) { + return geo; + } + if (geo instanceof tl_1.Api.GeoPoint) { + return new tl_1.Api.InputGeoPoint({ lat: geo.lat, long: geo.long }); + } + if (geo instanceof tl_1.Api.GeoPointEmpty) { + return new tl_1.Api.InputGeoPointEmpty(); + } + if (geo instanceof tl_1.Api.MessageMediaGeo) { + return getInputGeo(geo.geo); + } + if (geo instanceof tl_1.Api.Message) { + return getInputGeo(geo.media); + } + _raiseCastFail(geo, "InputGeoPoint"); + } + function getInputMedia(media, { isPhoto = false, attributes = void 0, forceDocument = false, voiceNote = false, videoNote = false, supportsStreaming = false } = {}) { + if (media.SUBCLASS_OF_ID === void 0) { + _raiseCastFail(media, "InputMedia"); + } + if (media.SUBCLASS_OF_ID === 4210575092) { + return media; + } else { + if (media.SUBCLASS_OF_ID === 2221106144) { + return new tl_1.Api.InputMediaPhoto({ id: media }); + } else { + if (media.SUBCLASS_OF_ID === 4081048424) { + return new tl_1.Api.InputMediaDocument({ id: media }); } - ix += buffer.length; - if (ix > end) return true; - }); - return big; - }; - self2.joinInto = function(targetBuffer, targetStart, sourceStart, sourceEnd) { - if (!head.buffer) return new bufferAllocUnsafe(0); - if (sourceStart == void 0) sourceStart = 0; - if (sourceEnd == void 0) sourceEnd = self2.length; - var big = targetBuffer; - if (big.length - targetStart < sourceEnd - sourceStart) { - throw new Error("Insufficient space available in target Buffer."); } - var ix = 0; - self2.forEach(function(buffer) { - if (sourceStart < ix + buffer.length && ix < sourceEnd) { - buffer.copy( - big, - Math.max(targetStart, targetStart + ix - sourceStart), - Math.max(0, sourceStart - ix), - Math.min(buffer.length, sourceEnd - ix) - ); - } - ix += buffer.length; - if (ix > sourceEnd) return true; + } + if (media instanceof tl_1.Api.MessageMediaPhoto) { + return new tl_1.Api.InputMediaPhoto({ + id: getInputPhoto(media.photo), + ttlSeconds: media.ttlSeconds }); - return big; - }; - self2.advance = function(n) { - offset += n; - length -= n; - while (head.buffer && offset >= head.buffer.length) { - offset -= head.buffer.length; - head = head.next ? head.next : { buffer: null, next: null }; - } - if (head.buffer === null) last = { next: null, buffer: null }; - self2.emit("advance", n); - return self2; - }; - self2.take = function(n, encoding) { - if (n == void 0) n = self2.length; - else if (typeof n !== "number") { - encoding = n; - n = self2.length; - } - var b = head; - if (!encoding) encoding = self2.encoding; - if (encoding) { - var acc = ""; - self2.forEach(function(buffer) { - if (n <= 0) return true; - acc += buffer.toString( - encoding, - 0, - Math.min(n, buffer.length) - ); - n -= buffer.length; - }); - return acc; + } + if (media instanceof tl_1.Api.Photo || media instanceof tl_1.Api.photos.Photo || media instanceof tl_1.Api.PhotoEmpty) { + return new tl_1.Api.InputMediaPhoto({ id: getInputPhoto(media) }); + } + if (media instanceof tl_1.Api.MessageMediaDocument) { + return new tl_1.Api.InputMediaDocument({ + id: getInputDocument(media.document), + ttlSeconds: media.ttlSeconds + }); + } + if (media instanceof tl_1.Api.Document || media instanceof tl_1.Api.DocumentEmpty) { + return new tl_1.Api.InputMediaDocument({ id: getInputDocument(media) }); + } + if (media instanceof tl_1.Api.InputFile || media instanceof tl_1.Api.InputFileBig) { + if (isPhoto) { + return new tl_1.Api.InputMediaUploadedPhoto({ file: media }); } else { - return self2.join(0, n); + const { attrs, mimeType } = getAttributes(media, { + attributes, + forceDocument, + voiceNote, + videoNote, + supportsStreaming + }); + return new tl_1.Api.InputMediaUploadedDocument({ + file: media, + mimeType, + attributes: attrs, + forceFile: forceDocument + }); } - }; - self2.toString = function() { - return self2.take("binary"); - }; - } - require("util").inherits(BufferList, EventEmitter); - } -}); - -// node_modules/utf-8-validate/fallback.js -var require_fallback2 = __commonJS({ - "node_modules/utf-8-validate/fallback.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - function isValidUTF8(buf) { - const len = buf.length; - let i = 0; - while (i < len) { - if ((buf[i] & 128) === 0) { - i++; - } else if ((buf[i] & 224) === 192) { - if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) { - return false; - } - i += 2; - } else if ((buf[i] & 240) === 224) { - if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // overlong - buf[i] === 237 && (buf[i + 1] & 224) === 160) { - return false; + } + if (media instanceof tl_1.Api.MessageMediaGame) { + return new tl_1.Api.InputMediaGame({ + id: new tl_1.Api.InputGameID({ + id: media.game.id, + accessHash: media.game.accessHash + }) + }); + } + if (media instanceof tl_1.Api.MessageMediaContact) { + return new tl_1.Api.InputMediaContact({ + phoneNumber: media.phoneNumber, + firstName: media.firstName, + lastName: media.lastName, + vcard: "" + }); + } + if (media instanceof tl_1.Api.MessageMediaGeo) { + return new tl_1.Api.InputMediaGeoPoint({ geoPoint: getInputGeo(media.geo) }); + } + if (media instanceof tl_1.Api.MessageMediaVenue) { + return new tl_1.Api.InputMediaVenue({ + geoPoint: getInputGeo(media.geo), + title: media.title, + address: media.address, + provider: media.provider, + venueId: media.venueId, + venueType: "" + }); + } + if (media instanceof tl_1.Api.MessageMediaDice) { + return new tl_1.Api.InputMediaDice({ + emoticon: media.emoticon + }); + } + if (media instanceof tl_1.Api.MessageMediaEmpty || media instanceof tl_1.Api.MessageMediaUnsupported || media instanceof tl_1.Api.ChatPhotoEmpty || media instanceof tl_1.Api.UserProfilePhotoEmpty || media instanceof tl_1.Api.ChatPhoto || media instanceof tl_1.Api.UserProfilePhoto) { + return new tl_1.Api.InputMediaEmpty(); + } + if (media instanceof tl_1.Api.Message) { + return getInputMedia(media.media, { isPhoto }); + } + if (media instanceof tl_1.Api.MessageMediaPoll) { + let correctAnswers; + if (media.poll.quiz) { + if (!media.results.results) { + throw new Error("Cannot cast unanswered quiz to any kind of InputMedia."); } - i += 3; - } else if ((buf[i] & 248) === 240) { - if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // overlong - buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) { - return false; + correctAnswers = []; + for (const r of media.results.results) { + if (r.correct) { + correctAnswers.push(r.option); + } } - i += 4; } else { - return false; + correctAnswers = void 0; } + return new tl_1.Api.InputMediaPoll({ + poll: media.poll, + correctAnswers, + solution: media.results.solution, + solutionEntities: media.results.solutionEntities + }); } - return true; + if (media instanceof tl_1.Api.Poll) { + return new tl_1.Api.InputMediaPoll({ + poll: media + }); + } + _raiseCastFail(media, "InputMedia"); } - module2.exports = isValidUTF8; - } -}); - -// node_modules/utf-8-validate/index.js -var require_utf_8_validate = __commonJS({ - "node_modules/utf-8-validate/index.js"(exports2, module2) { - "use strict"; - init_define_import_meta_env(); - try { - module2.exports = require_node_gyp_build2()(__dirname); - } catch (e) { - module2.exports = require_fallback2(); + function getAppropriatedPartSize(fileSize) { + if (fileSize.lesser(104857600)) { + return 128; + } + if (fileSize.lesser(786432e3)) { + return 256; + } + return 512; } - } -}); - -// node_modules/websocket/lib/WebSocketConnection.js -var require_WebSocketConnection = __commonJS({ - "node_modules/websocket/lib/WebSocketConnection.js"(exports2, module2) { - init_define_import_meta_env(); - var util = require("util"); - var utils = require_utils4(); - var EventEmitter = require("events").EventEmitter; - var WebSocketFrame = require_WebSocketFrame(); - var BufferList = require_FastBufferList(); - var isValidUTF8 = require_utf_8_validate(); - var bufferAllocUnsafe = utils.bufferAllocUnsafe; - var bufferFromString = utils.bufferFromString; - var STATE_OPEN = "open"; - var STATE_PEER_REQUESTED_CLOSE = "peer_requested_close"; - var STATE_ENDING = "ending"; - var STATE_CLOSED = "closed"; - var setImmediateImpl = "setImmediate" in global ? global.setImmediate.bind(global) : process.nextTick.bind(process); - var idCounter = 0; - function WebSocketConnection(socket, extensions, protocol, maskOutgoingPackets, config) { - this._debug = utils.BufferingLogger("websocket:connection", ++idCounter); - this._debug("constructor"); - if (this._debug.enabled) { - instrumentSocketForDebugging(this, socket); + function getPeer(peer) { + if (!peer) { + _raiseCastFail(peer, "undefined"); } - EventEmitter.call(this); - this._pingListenerCount = 0; - this.on("newListener", function(ev) { - if (ev === "ping") { - this._pingListenerCount++; + if (typeof peer === "string") { + _raiseCastFail(peer, "peer"); + } + if (typeof peer == "number" || typeof peer == "bigint") { + peer = (0, Helpers_1.returnBigInt)(peer); + } + try { + if (big_integer_1.default.isInstance(peer)) { + const res = resolveId(peer); + if (res[1] === tl_1.Api.PeerChannel) { + return new tl_1.Api.PeerChannel({ channelId: res[0] }); + } else if (res[1] === tl_1.Api.PeerChat) { + return new tl_1.Api.PeerChat({ chatId: res[0] }); + } else { + return new tl_1.Api.PeerUser({ userId: res[0] }); + } } - }).on("removeListener", function(ev) { - if (ev === "ping") { - this._pingListenerCount--; + if (peer.SUBCLASS_OF_ID === void 0) { + throw new Error(); } - }); - this.config = config; - this.socket = socket; - this.protocol = protocol; - this.extensions = extensions; - this.remoteAddress = socket.remoteAddress; - this.closeReasonCode = -1; - this.closeDescription = null; - this.closeEventEmitted = false; - this.maskOutgoingPackets = maskOutgoingPackets; - this.maskBytes = bufferAllocUnsafe(4); - this.frameHeader = bufferAllocUnsafe(10); - this.bufferList = new BufferList(); - this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - this.fragmentationSize = 0; - this.frameQueue = []; - this.connected = true; - this.state = STATE_OPEN; - this.waitingForCloseResponse = false; - this.receivedEnd = false; - this.closeTimeout = this.config.closeTimeout; - this.assembleFragments = this.config.assembleFragments; - this.maxReceivedMessageSize = this.config.maxReceivedMessageSize; - this.outputBufferFull = false; - this.inputPaused = false; - this.receivedDataHandler = this.processReceivedData.bind(this); - this._closeTimerHandler = this.handleCloseTimer.bind(this); - this.socket.setNoDelay(this.config.disableNagleAlgorithm); - this.socket.setTimeout(0); - if (this.config.keepalive && !this.config.useNativeKeepalive) { - if (typeof this.config.keepaliveInterval !== "number") { - throw new Error("keepaliveInterval must be specified and numeric if keepalive is true."); + if (peer.SUBCLASS_OF_ID === 47470215) { + return peer; + } else if (peer instanceof tl_1.Api.contacts.ResolvedPeer || peer instanceof tl_1.Api.InputNotifyPeer || peer instanceof tl_1.Api.TopPeer || peer instanceof tl_1.Api.Dialog || peer instanceof tl_1.Api.DialogPeer) { + return peer.peer; + } else if (peer instanceof tl_1.Api.ChannelFull) { + return new tl_1.Api.PeerChannel({ channelId: peer.id }); } - this._keepaliveTimerHandler = this.handleKeepaliveTimer.bind(this); - this.setKeepaliveTimer(); - if (this.config.dropConnectionOnKeepaliveTimeout) { - if (typeof this.config.keepaliveGracePeriod !== "number") { - throw new Error("keepaliveGracePeriod must be specified and numeric if dropConnectionOnKeepaliveTimeout is true."); + if (peer.SUBCLASS_OF_ID === 2105307014 || peer.SUBCLASS_OF_ID === 3653762072) { + if ("userId" in peer) { + return new tl_1.Api.PeerUser({ userId: peer.userId }); } - this._gracePeriodTimerHandler = this.handleGracePeriodTimer.bind(this); } - } else if (this.config.keepalive && this.config.useNativeKeepalive) { - if (!("setKeepAlive" in this.socket)) { - throw new Error("Unable to use native keepalive: unsupported by this version of Node."); + peer = getInputPeer(peer, false, false); + if (peer instanceof tl_1.Api.InputPeerUser) { + return new tl_1.Api.PeerUser({ userId: peer.userId }); + } else if (peer instanceof tl_1.Api.InputPeerChat) { + return new tl_1.Api.PeerChat({ chatId: peer.chatId }); + } else if (peer instanceof tl_1.Api.InputPeerChannel) { + return new tl_1.Api.PeerChannel({ channelId: peer.channelId }); } - this.socket.setKeepAlive(true, this.config.keepaliveInterval); + } catch (e) { } - this.socket.removeAllListeners("error"); + _raiseCastFail(peer, "peer"); } - WebSocketConnection.CLOSE_REASON_NORMAL = 1e3; - WebSocketConnection.CLOSE_REASON_GOING_AWAY = 1001; - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR = 1002; - WebSocketConnection.CLOSE_REASON_UNPROCESSABLE_INPUT = 1003; - WebSocketConnection.CLOSE_REASON_RESERVED = 1004; - WebSocketConnection.CLOSE_REASON_NOT_PROVIDED = 1005; - WebSocketConnection.CLOSE_REASON_ABNORMAL = 1006; - WebSocketConnection.CLOSE_REASON_INVALID_DATA = 1007; - WebSocketConnection.CLOSE_REASON_POLICY_VIOLATION = 1008; - WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG = 1009; - WebSocketConnection.CLOSE_REASON_EXTENSION_REQUIRED = 1010; - WebSocketConnection.CLOSE_REASON_INTERNAL_SERVER_ERROR = 1011; - WebSocketConnection.CLOSE_REASON_TLS_HANDSHAKE_FAILED = 1015; - WebSocketConnection.CLOSE_DESCRIPTIONS = { - 1e3: "Normal connection closure", - 1001: "Remote peer is going away", - 1002: "Protocol error", - 1003: "Unprocessable input", - 1004: "Reserved", - 1005: "Reason not provided", - 1006: "Abnormal closure, no further detail available", - 1007: "Invalid data received", - 1008: "Policy violation", - 1009: "Message too big", - 1010: "Extension requested by client is required", - 1011: "Internal Server Error", - 1015: "TLS Handshake Failed" - }; - function validateCloseReason(code) { - if (code < 1e3) { - return false; - } - if (code >= 1e3 && code <= 2999) { - return [1e3, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015].indexOf(code) !== -1; + function sanitizeParseMode(mode) { + if (mode === "md" || mode === "markdown") { + return markdown_1.MarkdownParser; } - if (code >= 3e3 && code <= 3999) { - return true; + if (mode === "md2" || mode === "markdownv2") { + return markdownv2_1.MarkdownV2Parser; } - if (code >= 4e3 && code <= 4999) { - return true; + if (mode == "html") { + return html_1.HTMLParser; } - if (code >= 5e3) { - return false; + if (typeof mode == "object") { + if ("parse" in mode && "unparse" in mode) { + return mode; + } } + throw new Error(`Invalid parse mode type ${mode}`); } - util.inherits(WebSocketConnection, EventEmitter); - WebSocketConnection.prototype._addSocketEventListeners = function() { - this.socket.on("error", this.handleSocketError.bind(this)); - this.socket.on("end", this.handleSocketEnd.bind(this)); - this.socket.on("close", this.handleSocketClose.bind(this)); - this.socket.on("drain", this.handleSocketDrain.bind(this)); - this.socket.on("pause", this.handleSocketPause.bind(this)); - this.socket.on("resume", this.handleSocketResume.bind(this)); - this.socket.on("data", this.handleSocketData.bind(this)); - }; - WebSocketConnection.prototype.setKeepaliveTimer = function() { - this._debug("setKeepaliveTimer"); - if (!this.config.keepalive || this.config.useNativeKeepalive) { - return; - } - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - this._keepaliveTimeoutID = setTimeout(this._keepaliveTimerHandler, this.config.keepaliveInterval); - }; - WebSocketConnection.prototype.clearKeepaliveTimer = function() { - if (this._keepaliveTimeoutID) { - clearTimeout(this._keepaliveTimeoutID); - } - }; - WebSocketConnection.prototype.handleKeepaliveTimer = function() { - this._debug("handleKeepaliveTimer"); - this._keepaliveTimeoutID = null; - this.ping(); - if (this.config.dropConnectionOnKeepaliveTimeout) { - this.setGracePeriodTimer(); - } else { - this.setKeepaliveTimer(); - } - }; - WebSocketConnection.prototype.setGracePeriodTimer = function() { - this._debug("setGracePeriodTimer"); - this.clearGracePeriodTimer(); - this._gracePeriodTimeoutID = setTimeout(this._gracePeriodTimerHandler, this.config.keepaliveGracePeriod); - }; - WebSocketConnection.prototype.clearGracePeriodTimer = function() { - if (this._gracePeriodTimeoutID) { - clearTimeout(this._gracePeriodTimeoutID); + function getPeerId(peer, addMark = true) { + if (typeof peer == "string" && parseID(peer)) { + peer = (0, Helpers_1.returnBigInt)(peer); } - }; - WebSocketConnection.prototype.handleGracePeriodTimer = function() { - this._debug("handleGracePeriodTimer"); - this._gracePeriodTimeoutID = null; - this.drop(WebSocketConnection.CLOSE_REASON_ABNORMAL, "Peer not responding.", true); - }; - WebSocketConnection.prototype.handleSocketData = function(data) { - this._debug("handleSocketData"); - this.setKeepaliveTimer(); - this.bufferList.write(data); - this.processReceivedData(); - }; - WebSocketConnection.prototype.processReceivedData = function() { - this._debug("processReceivedData"); - if (!this.connected) { - return; + if (big_integer_1.default.isInstance(peer)) { + return addMark ? peer.toString() : resolveId(peer)[0].toString(); } - if (this.inputPaused) { - return; + if (peer instanceof tl_1.Api.InputPeerSelf) { + _raiseCastFail(peer, "int (you might want to use client.get_peer_id)"); } - var frame = this.currentFrame; - if (!frame.addData(this.bufferList)) { - this._debug("-- insufficient data for frame"); - return; + try { + peer = getPeer(peer); + } catch (e) { + _raiseCastFail(peer, "int"); } - var self2 = this; - if (frame.protocolError) { - this._debug("-- protocol error"); - process.nextTick(function() { - self2.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, frame.dropReason); - }); - return; - } else if (frame.frameTooLarge) { - this._debug("-- frame too large"); - process.nextTick(function() { - self2.drop(WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, frame.dropReason); - }); - return; + if (peer instanceof tl_1.Api.PeerUser) { + return peer.userId.toString(); + } else if (peer instanceof tl_1.Api.PeerChat) { + peer.chatId = resolveId((0, Helpers_1.returnBigInt)(peer.chatId))[0]; + return addMark ? peer.chatId.negate().toString() : peer.chatId.toString(); + } else if (typeof peer == "object" && "channelId" in peer) { + peer.channelId = resolveId((0, Helpers_1.returnBigInt)(peer.channelId))[0]; + if (!addMark) { + return peer.channelId.toString(); + } + return "-100" + peer.channelId.toString(); } - if (frame.rsv1 || frame.rsv2 || frame.rsv3) { - this._debug("-- illegal rsv flag"); - process.nextTick(function() { - self2.drop( - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - "Unsupported usage of rsv bits without negotiated extension." - ); - }); - return; + _raiseCastFail(peer, "int"); + } + function resolveId(markedId) { + if (markedId.greaterOrEquals(big_integer_1.default.zero)) { + return [markedId, tl_1.Api.PeerUser]; } - if (!this.assembleFragments) { - this._debug("-- emitting frame"); - process.nextTick(function() { - self2.emit("frame", frame); - }); + const m = markedId.toString().match(/-100([^0]\d*)/); + if (m) { + return [(0, big_integer_1.default)(m[1]), tl_1.Api.PeerChannel]; } - process.nextTick(function() { - self2.processFrame(frame); - }); - this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - if (this.bufferList.length > 0) { - setImmediateImpl(this.receivedDataHandler); + return [markedId.negate(), tl_1.Api.PeerChat]; + } + function getMessageId(message) { + if (!message) { + return void 0; + } else if (typeof message === "number") { + return message; + } else if (message.SUBCLASS_OF_ID === 2030045667 || "id" in message) { + return message.id; + } else { + throw new Error(`Invalid message type: ${message.constructor.name}`); } - }; - WebSocketConnection.prototype.handleSocketError = function(error) { - this._debug("handleSocketError: %j", error); - if (this.state === STATE_CLOSED) { - this._debug(" --- Socket 'error' after 'close'"); - return; + } + function parsePhone(phone) { + phone = phone.toString().replace(/[()\s-]/gm, ""); + if (phone.startsWith("+") && phone.split("+").length - 1 == 1) { + return !isNaN(Number(phone)) ? phone.replace("+", "") : void 0; } - this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; - this.closeDescription = "Socket Error: " + error.syscall + " " + error.code; - this.connected = false; - this.state = STATE_CLOSED; - this.fragmentationSize = 0; - if (utils.eventEmitterListenerCount(this, "error") > 0) { - this.emit("error", error); + } + function parseID(id) { + const isValid = /^(-?[0-9][0-9]*)$/.test(id); + return isValid ? (0, big_integer_1.default)(id) : void 0; + } + function resolveInviteLink(link) { + throw new Error("not implemented"); + } + function parseUsername(username) { + username = username.trim(); + const m = username.match(USERNAME_RE) || username.match(TG_JOIN_RE); + if (m) { + username = username.replace(m[0], ""); + if (m[1]) { + return { + username, + isInvite: true + }; + } else { + username = rtrim(username, "/"); + } } - this.socket.destroy(); - this._debug.printOutput(); - }; - WebSocketConnection.prototype.handleSocketEnd = function() { - this._debug("handleSocketEnd: received socket end. state = %s", this.state); - this.receivedEnd = true; - if (this.state === STATE_CLOSED) { - this._debug(" --- Socket 'end' after 'close'"); - return; + if (username.match(VALID_USERNAME_RE)) { + return { + username: username.toLowerCase(), + isInvite: false + }; + } else { + return { + username: void 0, + isInvite: false + }; } - if (this.state !== STATE_PEER_REQUESTED_CLOSE && this.state !== STATE_ENDING) { - this._debug(" --- UNEXPECTED socket end."); - this.socket.end(); + } + function rtrim(s, mask) { + while (~mask.indexOf(s[s.length - 1])) { + s = s.slice(0, -1); } - }; - WebSocketConnection.prototype.handleSocketClose = function(hadError) { - this._debug("handleSocketClose: received socket close"); - this.socketHadError = hadError; - this.connected = false; - this.state = STATE_CLOSED; - if (this.closeReasonCode === -1) { - this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; - this.closeDescription = "Connection dropped by remote peer."; + return s; + } + function getDisplayName(entity) { + if (entity instanceof tl_1.Api.User) { + if (entity.lastName && entity.firstName) { + return `${entity.firstName} ${entity.lastName}`; + } else if (entity.firstName) { + return entity.firstName; + } else if (entity.lastName) { + return entity.lastName; + } else { + return ""; + } + } else if (entity instanceof tl_1.Api.Chat || entity instanceof tl_1.Api.Channel) { + return entity.title; } - this.clearCloseTimer(); - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - if (!this.closeEventEmitted) { - this.closeEventEmitted = true; - this._debug("-- Emitting WebSocketConnection close event"); - this.emit("close", this.closeReasonCode, this.closeDescription); + return ""; + } + } +}); + +// node_modules/telegram/tl/custom/forward.js +var require_forward = __commonJS({ + "node_modules/telegram/tl/custom/forward.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Forward = void 0; + var chatGetter_1 = require_chatGetter(); + var senderGetter_1 = require_senderGetter(); + var Helpers_1 = require_Helpers(); + var Utils_1 = require_Utils(); + var inspect_1 = require_inspect(); + var Forward = class extends senderGetter_1.SenderGetter { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - }; - WebSocketConnection.prototype.handleSocketDrain = function() { - this._debug("handleSocketDrain: socket drain event"); - this.outputBufferFull = false; - this.emit("drain"); - }; - WebSocketConnection.prototype.handleSocketPause = function() { - this._debug("handleSocketPause: socket pause event"); - this.inputPaused = true; - this.emit("pause"); - }; - WebSocketConnection.prototype.handleSocketResume = function() { - this._debug("handleSocketResume: socket resume event"); - this.inputPaused = false; - this.emit("resume"); - this.processReceivedData(); - }; - WebSocketConnection.prototype.pause = function() { - this._debug("pause: pause requested"); - this.socket.pause(); - }; - WebSocketConnection.prototype.resume = function() { - this._debug("resume: resume requested"); - this.socket.resume(); - }; - WebSocketConnection.prototype.close = function(reasonCode, description) { - if (this.connected) { - this._debug("close: Initating clean WebSocket close sequence."); - if ("number" !== typeof reasonCode) { - reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; - } - if (!validateCloseReason(reasonCode)) { - throw new Error("Close code " + reasonCode + " is not valid."); - } - if ("string" !== typeof description) { - description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; + constructor(client2, original, entities2) { + super(); + this.originalFwd = original; + let senderId = void 0; + let sender = void 0; + let inputSender = void 0; + let peer = void 0; + let chat = void 0; + let inputChat = void 0; + if (original.fromId) { + const ty = (0, Helpers_1._entityType)(original.fromId); + if (ty === Helpers_1._EntityType.USER) { + senderId = (0, Utils_1.getPeerId)(original.fromId); + [sender, inputSender] = (0, Utils_1._getEntityPair)(senderId, entities2, client2._entityCache); + } else if (ty === Helpers_1._EntityType.CHANNEL || ty === Helpers_1._EntityType.CHAT) { + peer = original.fromId; + [chat, inputChat] = (0, Utils_1._getEntityPair)((0, Utils_1.getPeerId)(peer), entities2, client2._entityCache); + } } - this.closeReasonCode = reasonCode; - this.closeDescription = description; - this.setCloseTimer(); - this.sendCloseFrame(this.closeReasonCode, this.closeDescription); - this.state = STATE_ENDING; - this.connected = false; + chatGetter_1.ChatGetter.initChatClass(this, { + chatPeer: peer, + chat, + inputChat + }); + senderGetter_1.SenderGetter.initSenderClass(this, { + senderId: senderId ? (0, Helpers_1.returnBigInt)(senderId) : void 0, + sender, + inputSender + }); + this._client = client2; } }; - WebSocketConnection.prototype.drop = function(reasonCode, description, skipCloseFrame) { - this._debug("drop"); - if (typeof reasonCode !== "number") { - reasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; + exports2.Forward = Forward; + } +}); + +// node_modules/telegram/tl/custom/file.js +var require_file = __commonJS({ + "node_modules/telegram/tl/custom/file.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.File = void 0; + var api_1 = require_api(); + var Utils_1 = require_Utils(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var File2 = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - if (typeof description !== "string") { - description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; + constructor(media) { + this.media = media; } - this._debug( - "Forcefully dropping connection. skipCloseFrame: %s, code: %d, description: %s", - skipCloseFrame, - reasonCode, - description - ); - this.closeReasonCode = reasonCode; - this.closeDescription = description; - this.frameQueue = []; - this.fragmentationSize = 0; - if (!skipCloseFrame) { - this.sendCloseFrame(reasonCode, description); + get id() { + throw new Error("Unsupported"); } - this.connected = false; - this.state = STATE_CLOSED; - this.clearCloseTimer(); - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - if (!this.closeEventEmitted) { - this.closeEventEmitted = true; - this._debug("Emitting WebSocketConnection close event"); - this.emit("close", this.closeReasonCode, this.closeDescription); + get name() { + return this._fromAttr(api_1.Api.DocumentAttributeFilename, "fileName"); } - this._debug("Drop: destroying socket"); - this.socket.destroy(); - }; - WebSocketConnection.prototype.setCloseTimer = function() { - this._debug("setCloseTimer"); - this.clearCloseTimer(); - this._debug("Setting close timer"); - this.waitingForCloseResponse = true; - this.closeTimer = setTimeout(this._closeTimerHandler, this.closeTimeout); - }; - WebSocketConnection.prototype.clearCloseTimer = function() { - this._debug("clearCloseTimer"); - if (this.closeTimer) { - this._debug("Clearing close timer"); - clearTimeout(this.closeTimer); - this.waitingForCloseResponse = false; - this.closeTimer = null; + get mimeType() { + if (this.media instanceof api_1.Api.Photo) { + return "image/jpeg"; + } else if (this.media instanceof api_1.Api.Document) { + return this.media.mimeType; + } } - }; - WebSocketConnection.prototype.handleCloseTimer = function() { - this._debug("handleCloseTimer"); - this.closeTimer = null; - if (this.waitingForCloseResponse) { - this._debug("Close response not received from client. Forcing socket end."); - this.waitingForCloseResponse = false; - this.state = STATE_CLOSED; - this.socket.end(); + get width() { + return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "w"); } - }; - WebSocketConnection.prototype.processFrame = function(frame) { - this._debug("processFrame"); - this._debug(" -- frame: %s", frame); - if (this.frameQueue.length !== 0 && (frame.opcode > 0 && frame.opcode < 8)) { - this.drop( - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - "Illegal frame opcode 0x" + frame.opcode.toString(16) + " received in middle of fragmented message." - ); - return; + get height() { + return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "h"); } - switch (frame.opcode) { - case 2: - this._debug("-- Binary Frame"); - if (this.assembleFragments) { - if (frame.fin) { - this._debug("---- Emitting 'message' event"); - this.emit("message", { - type: "binary", - binaryData: frame.binaryPayload - }); - } else { - this.frameQueue.push(frame); - this.fragmentationSize = frame.length; - } - } - break; - case 1: - this._debug("-- Text Frame"); - if (this.assembleFragments) { - if (frame.fin) { - if (!isValidUTF8(frame.binaryPayload)) { - this.drop( - WebSocketConnection.CLOSE_REASON_INVALID_DATA, - "Invalid UTF-8 Data Received" - ); - return; - } - this._debug("---- Emitting 'message' event"); - this.emit("message", { - type: "utf8", - utf8Data: frame.binaryPayload.toString("utf8") - }); - } else { - this.frameQueue.push(frame); - this.fragmentationSize = frame.length; - } - } - break; - case 0: - this._debug("-- Continuation Frame"); - if (this.assembleFragments) { - if (this.frameQueue.length === 0) { - this.drop( - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - "Unexpected Continuation Frame" - ); - return; - } - this.fragmentationSize += frame.length; - if (this.fragmentationSize > this.maxReceivedMessageSize) { - this.drop( - WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, - "Maximum message size exceeded." - ); - return; - } - this.frameQueue.push(frame); - if (frame.fin) { - var bytesCopied = 0; - var binaryPayload = bufferAllocUnsafe(this.fragmentationSize); - var opcode = this.frameQueue[0].opcode; - this.frameQueue.forEach(function(currentFrame) { - currentFrame.binaryPayload.copy(binaryPayload, bytesCopied); - bytesCopied += currentFrame.binaryPayload.length; - }); - this.frameQueue = []; - this.fragmentationSize = 0; - switch (opcode) { - case 2: - this.emit("message", { - type: "binary", - binaryData: binaryPayload - }); - break; - case 1: - if (!isValidUTF8(binaryPayload)) { - this.drop( - WebSocketConnection.CLOSE_REASON_INVALID_DATA, - "Invalid UTF-8 Data Received" - ); - return; - } - this.emit("message", { - type: "utf8", - utf8Data: binaryPayload.toString("utf8") - }); - break; - default: - this.drop( - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - "Unexpected first opcode in fragmentation sequence: 0x" + opcode.toString(16) - ); - return; - } - } - } - break; - case 9: - this._debug("-- Ping Frame"); - if (this._pingListenerCount > 0) { - var cancelled = false; - var cancel = function() { - cancelled = true; - }; - this.emit("ping", cancel, frame.binaryPayload); - if (!cancelled) { - this.pong(frame.binaryPayload); - } - } else { - this.pong(frame.binaryPayload); - } - break; - case 10: - this._debug("-- Pong Frame"); - this.emit("pong", frame.binaryPayload); - break; - case 8: - this._debug("-- Close Frame"); - if (this.waitingForCloseResponse) { - this._debug("---- Got close response from peer. Completing closing handshake."); - this.clearCloseTimer(); - this.waitingForCloseResponse = false; - this.state = STATE_CLOSED; - this.socket.end(); - return; - } - this._debug("---- Closing handshake initiated by peer."); - this.state = STATE_PEER_REQUESTED_CLOSE; - var respondCloseReasonCode; - if (frame.invalidCloseFrameLength) { - this.closeReasonCode = 1005; - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; - } else if (frame.closeStatus === -1 || validateCloseReason(frame.closeStatus)) { - this.closeReasonCode = frame.closeStatus; - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; - } else { - this.closeReasonCode = frame.closeStatus; - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; - } - if (frame.binaryPayload.length > 1) { - if (!isValidUTF8(frame.binaryPayload)) { - this.drop( - WebSocketConnection.CLOSE_REASON_INVALID_DATA, - "Invalid UTF-8 Data Received" - ); - return; - } - this.closeDescription = frame.binaryPayload.toString("utf8"); - } else { - this.closeDescription = WebSocketConnection.CLOSE_DESCRIPTIONS[this.closeReasonCode]; - } - this._debug( - "------ Remote peer %s - code: %d - %s - close frame payload length: %d", - this.remoteAddress, - this.closeReasonCode, - this.closeDescription, - frame.length - ); - this._debug("------ responding to remote peer's close request."); - this.sendCloseFrame(respondCloseReasonCode, null); - this.connected = false; - break; - default: - this._debug("-- Unrecognized Opcode %d", frame.opcode); - this.drop( - WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - "Unrecognized Opcode: 0x" + frame.opcode.toString(16) - ); - break; + get duration() { + return this._fromAttr([api_1.Api.DocumentAttributeAudio, api_1.Api.DocumentAttributeVideo], "duration"); } - }; - WebSocketConnection.prototype.send = function(data, cb) { - this._debug("send"); - if (Buffer.isBuffer(data)) { - this.sendBytes(data, cb); - } else if (typeof data["toString"] === "function") { - this.sendUTF(data, cb); - } else { - throw new Error("Data provided must either be a Node Buffer or implement toString()"); + get title() { + return this._fromAttr(api_1.Api.DocumentAttributeAudio, "title"); } - }; - WebSocketConnection.prototype.sendUTF = function(data, cb) { - data = bufferFromString(data.toString(), "utf8"); - this._debug("sendUTF: %d bytes", data.length); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 1; - frame.binaryPayload = data; - this.fragmentAndSend(frame, cb); - }; - WebSocketConnection.prototype.sendBytes = function(data, cb) { - this._debug("sendBytes"); - if (!Buffer.isBuffer(data)) { - throw new Error("You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()"); + get performer() { + return this._fromAttr(api_1.Api.DocumentAttributeAudio, "performer"); } - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 2; - frame.binaryPayload = data; - this.fragmentAndSend(frame, cb); - }; - WebSocketConnection.prototype.ping = function(data) { - this._debug("ping"); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 9; - frame.fin = true; - if (data) { - if (!Buffer.isBuffer(data)) { - data = bufferFromString(data.toString(), "utf8"); + get emoji() { + return this._fromAttr(api_1.Api.DocumentAttributeSticker, "alt"); + } + get stickerSet() { + return this._fromAttr(api_1.Api.DocumentAttributeSticker, "stickerset"); + } + get size() { + if (this.media instanceof api_1.Api.Photo) { + return (0, Utils_1._photoSizeByteCount)(this.media.sizes[this.media.sizes.length - 1]); + } else if (this.media instanceof api_1.Api.Document) { + return this.media.size; } - if (data.length > 125) { - this._debug("WebSocket: Data for ping is longer than 125 bytes. Truncating."); - data = data.slice(0, 124); + } + _fromAttr(cls, field) { + if (this.media instanceof api_1.Api.Document) { + for (const attr of this.media.attributes) { + if (attr instanceof cls) { + return attr[field]; + } + } } - frame.binaryPayload = data; } - this.sendFrame(frame); }; - WebSocketConnection.prototype.pong = function(binaryPayload) { - this._debug("pong"); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 10; - if (Buffer.isBuffer(binaryPayload) && binaryPayload.length > 125) { - this._debug("WebSocket: Data for pong is longer than 125 bytes. Truncating."); - binaryPayload = binaryPayload.slice(0, 124); + exports2.File = File2; + } +}); + +// node_modules/telegram/extensions/Logger.js +var require_Logger = __commonJS({ + "node_modules/telegram/extensions/Logger.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Logger = exports2.LogLevel = void 0; + var platform_1 = require_platform(); + var LogLevel; + (function(LogLevel2) { + LogLevel2["NONE"] = "none"; + LogLevel2["ERROR"] = "error"; + LogLevel2["WARN"] = "warn"; + LogLevel2["INFO"] = "info"; + LogLevel2["DEBUG"] = "debug"; + })(LogLevel || (exports2.LogLevel = LogLevel = {})); + var Logger = class { + constructor(level) { + this.levels = ["error", "warn", "info", "debug"]; + this._logLevel = level || LogLevel.INFO; + this.isBrowser = !platform_1.isNode; + if (!this.isBrowser) { + this.colors = { + start: "\x1B[2m", + warn: "\x1B[35m", + info: "\x1B[33m", + debug: "\x1B[36m", + error: "\x1B[31m", + end: "\x1B[0m" + }; + } else { + this.colors = { + start: "%c", + warn: "color : #ff00ff", + info: "color : #ffff00", + debug: "color : #00ffff", + error: "color : #ff0000", + end: "" + }; + } + this.messageFormat = "[%t] [%l] - [%m]"; + this.tzOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 6e4; } - frame.binaryPayload = binaryPayload; - frame.fin = true; - this.sendFrame(frame); - }; - WebSocketConnection.prototype.fragmentAndSend = function(frame, cb) { - this._debug("fragmentAndSend"); - if (frame.opcode > 7) { - throw new Error("You cannot fragment control frames."); + /** + * + * @param level {string} + * @returns {boolean} + */ + canSend(level) { + return this._logLevel ? this.levels.indexOf(this._logLevel) >= this.levels.indexOf(level) : false; } - var threshold = this.config.fragmentationThreshold; - var length = frame.binaryPayload.length; - if (!this.config.fragmentOutgoingMessages || frame.binaryPayload && length <= threshold) { - frame.fin = true; - this.sendFrame(frame, cb); - return; + /** + * @param message {string} + */ + warn(message) { + this._log(LogLevel.WARN, message, this.colors.warn); } - var numFragments = Math.ceil(length / threshold); - var sentFragments = 0; - var sentCallback = function fragmentSentCallback(err) { - if (err) { - if (typeof cb === "function") { - cb(err); - cb = null; - } + /** + * @param message {string} + */ + info(message) { + this._log(LogLevel.INFO, message, this.colors.info); + } + /** + * @param message {string} + */ + debug(message) { + this._log(LogLevel.DEBUG, message, this.colors.debug); + } + /** + * @param message {string} + */ + error(message) { + this._log(LogLevel.ERROR, message, this.colors.error); + } + format(message, level) { + return this.messageFormat.replace("%t", this.getDateTime()).replace("%l", level.toUpperCase()).replace("%m", message); + } + get logLevel() { + return this._logLevel; + } + setLevel(level) { + this._logLevel = level; + } + static setLevel(level) { + console.log("Logger.setLevel is deprecated, it will has no effect. Please, use client.setLogLevel instead."); + } + /** + * @param level {string} + * @param message {string} + * @param color {string} + */ + _log(level, message, color) { + if (this.canSend(level)) { + this.log(level, message, color); + } else { return; } - ++sentFragments; - if (sentFragments === numFragments && typeof cb === "function") { - cb(); + } + /** + * Override this function for custom Logger. <br /> + * + * @remarks use `this.isBrowser` to check and handle for different environment. + * @param level {string} + * @param message {string} + * @param color {string} + */ + log(level, message, color) { + if (!this.isBrowser) { + console.log(color + this.format(message, level) + this.colors.end); + } else { + console.log(this.colors.start + this.format(message, level), color); } - }; - for (var i = 1; i <= numFragments; i++) { - var currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - currentFrame.opcode = i === 1 ? frame.opcode : 0; - currentFrame.fin = i === numFragments; - var currentLength = i === numFragments ? length - threshold * (i - 1) : threshold; - var sliceStart = threshold * (i - 1); - currentFrame.binaryPayload = frame.binaryPayload.slice(sliceStart, sliceStart + currentLength); - this.sendFrame(currentFrame, sentCallback); } - }; - WebSocketConnection.prototype.sendCloseFrame = function(reasonCode, description, cb) { - if (typeof reasonCode !== "number") { - reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; + getDateTime() { + return new Date(Date.now() - this.tzOffset).toISOString().slice(0, -1); } - this._debug("sendCloseFrame state: %s, reasonCode: %d, description: %s", this.state, reasonCode, description); - if (this.state !== STATE_OPEN && this.state !== STATE_PEER_REQUESTED_CLOSE) { - return; + }; + exports2.Logger = Logger; + } +}); + +// node_modules/telegram/extensions/Deferred.js +var require_Deferred = __commonJS({ + "node_modules/telegram/extensions/Deferred.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + var Deferred = class _Deferred { + constructor() { + this.promise = new Promise((resolve, reject) => { + this.reject = reject; + this.resolve = resolve; + }); } - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.fin = true; - frame.opcode = 8; - frame.closeStatus = reasonCode; - if (typeof description === "string") { - frame.binaryPayload = bufferFromString(description, "utf8"); + static resolved(value) { + const deferred = new _Deferred(); + deferred.resolve(value); + return deferred; } - this.sendFrame(frame, cb); - this.socket.end(); }; - WebSocketConnection.prototype.sendFrame = function(frame, cb) { - this._debug("sendFrame"); - frame.mask = this.maskOutgoingPackets; - var flushed = this.socket.write(frame.toBuffer(), cb); - this.outputBufferFull = !flushed; - return flushed; + exports2.default = Deferred; + } +}); + +// node_modules/telegram/network/RequestState.js +var require_RequestState = __commonJS({ + "node_modules/telegram/network/RequestState.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - module2.exports = WebSocketConnection; - function instrumentSocketForDebugging(connection, socket) { - if (!connection._debug.enabled) { - return; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RequestState = void 0; + var Deferred_1 = __importDefault2(require_Deferred()); + var RequestState = class { + constructor(request) { + this.containerId = void 0; + this.msgId = void 0; + this.request = request; + this.data = request.getBytes(); + this.after = void 0; + this.result = void 0; + this.finished = new Deferred_1.default(); + this.resetPromise(); } - var originalSocketEmit = socket.emit; - socket.emit = function(event) { - connection._debug("||| Socket Event '%s'", event); - originalSocketEmit.apply(this, arguments); - }; - for (var key2 in socket) { - if ("function" !== typeof socket[key2]) { - continue; - } - if (["emit"].indexOf(key2) !== -1) { - continue; + isReady() { + if (!this.after) { + return true; } - (function(key3) { - var original = socket[key3]; - if (key3 === "on") { - socket[key3] = function proxyMethod__EventEmitter__On() { - connection._debug("||| Socket method called: %s (%s)", key3, arguments[0]); - return original.apply(this, arguments); - }; - return; - } - socket[key3] = function proxyMethod() { - connection._debug("||| Socket method called: %s", key3); - return original.apply(this, arguments); - }; - })(key2); + return this.after.finished.promise; } - } + resetPromise() { + var _a; + (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this); + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); + } + }; + exports2.RequestState = RequestState; } }); -// node_modules/websocket/lib/WebSocketRequest.js -var require_WebSocketRequest = __commonJS({ - "node_modules/websocket/lib/WebSocketRequest.js"(exports2, module2) { +// node_modules/telegram/client/users.js +var require_users = __commonJS({ + "node_modules/telegram/client/users.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var crypto4 = require("crypto"); - var util = require("util"); - var url = require("url"); - var EventEmitter = require("events").EventEmitter; - var WebSocketConnection = require_WebSocketConnection(); - var headerValueSplitRegExp = /,\s*/; - var headerParamSplitRegExp = /;\s*/; - var headerSanitizeRegExp = /[\r\n]/g; - var xForwardedForSeparatorRegExp = /,\s*/; - var separators = [ - "(", - ")", - "<", - ">", - "@", - ",", - ";", - ":", - "\\", - '"', - "/", - "[", - "]", - "?", - "=", - "{", - "}", - " ", - String.fromCharCode(9) - ]; - var controlChars = [ - String.fromCharCode(127) - /* DEL */ - ]; - for (i = 0; i < 31; i++) { - controlChars.push(String.fromCharCode(i)); - } - var i; - var cookieNameValidateRegEx = /([\x00-\x20\x22\x28\x29\x2c\x2f\x3a-\x3f\x40\x5b-\x5e\x7b\x7d\x7f])/; - var cookieValueValidateRegEx = /[^\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]/; - var cookieValueDQuoteValidateRegEx = /^"[^"]*"$/; - var controlCharsAndSemicolonRegEx = /[\x00-\x20\x3b]/g; - var cookieSeparatorRegEx = /[;,] */; - var httpStatusDescriptions = { - 100: "Continue", - 101: "Switching Protocols", - 200: "OK", - 201: "Created", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 300: "Multiple Choices", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 406: "Not Acceptable", - 407: "Proxy Authorization Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Long", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 426: "Upgrade Required", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported" + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - function WebSocketRequest(socket, httpRequest, serverConfig) { - EventEmitter.call(this); - this.socket = socket; - this.httpRequest = httpRequest; - this.resource = httpRequest.url; - this.remoteAddress = socket.remoteAddress; - this.remoteAddresses = [this.remoteAddress]; - this.serverConfig = serverConfig; - this._socketIsClosing = false; - this._socketCloseHandler = this._handleSocketCloseBeforeAccept.bind(this); - this.socket.on("end", this._socketCloseHandler); - this.socket.on("close", this._socketCloseHandler); - this._resolved = false; - } - util.inherits(WebSocketRequest, EventEmitter); - WebSocketRequest.prototype.readHandshake = function() { - var self2 = this; - var request = this.httpRequest; - this.resourceURL = url.parse(this.resource, true); - this.host = request.headers["host"]; - if (!this.host) { - throw new Error("Client must provide a Host header."); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.invoke = invoke; + exports2.getMe = getMe; + exports2.isBot = isBot; + exports2.isUserAuthorized = isUserAuthorized; + exports2.getEntity = getEntity; + exports2.getInputEntity = getInputEntity; + exports2._getEntityFromString = _getEntityFromString; + exports2.getPeerId = getPeerId; + exports2._getPeer = _getPeer; + exports2._getInputDialog = _getInputDialog; + exports2._getInputNotify = _getInputNotify; + exports2._selfId = _selfId; + var tl_1 = require_tl(); + var Utils_1 = require_Utils(); + var Helpers_1 = require_Helpers(); + var __1 = require_telegram(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var Logger_1 = require_Logger(); + var RequestState_1 = require_RequestState(); + async function invoke(client2, request, dcId, otherSender) { + if (request.classType !== "request") { + throw new Error("You can only invoke MTProtoRequests"); } - this.key = request.headers["sec-websocket-key"]; - if (!this.key) { - throw new Error("Client must provide a value for Sec-WebSocket-Key."); + let sender = client2._sender; + if (dcId) { + sender = await client2.getSender(dcId); } - this.webSocketVersion = parseInt(request.headers["sec-websocket-version"], 10); - if (!this.webSocketVersion || isNaN(this.webSocketVersion)) { - throw new Error("Client must provide a value for Sec-WebSocket-Version."); + if (otherSender != void 0) { + sender = otherSender; } - switch (this.webSocketVersion) { - case 8: - case 13: - break; - default: - var e = new Error("Unsupported websocket client version: " + this.webSocketVersion + "Only versions 8 and 13 are supported."); - e.httpCode = 426; - e.headers = { - "Sec-WebSocket-Version": "13" - }; - throw e; + if (sender == void 0) { + throw new Error("Cannot send requests while disconnected. You need to call .connect()"); } - if (this.webSocketVersion === 13) { - this.origin = request.headers["origin"]; - } else if (this.webSocketVersion === 8) { - this.origin = request.headers["sec-websocket-origin"]; + if (sender.userDisconnected) { + throw new Error("Cannot send requests while disconnected. Please reconnect."); } - var protocolString = request.headers["sec-websocket-protocol"]; - this.protocolFullCaseMap = {}; - this.requestedProtocols = []; - if (protocolString) { - var requestedProtocolsFullCase = protocolString.split(headerValueSplitRegExp); - requestedProtocolsFullCase.forEach(function(protocol) { - var lcProtocol = protocol.toLocaleLowerCase(); - self2.requestedProtocols.push(lcProtocol); - self2.protocolFullCaseMap[lcProtocol] = protocol; - }); + await client2._connectedDeferred.promise; + await request.resolve(client2, __1.utils); + client2._lastRequest = (/* @__PURE__ */ new Date()).getTime(); + const state2 = new RequestState_1.RequestState(request); + let attempt = 0; + for (attempt = 0; attempt < client2._requestRetries; attempt++) { + sender.addStateToQueue(state2); + try { + const result = await state2.promise; + state2.finished.resolve(); + client2.session.processEntities(result); + client2._entityCache.add(result); + return result; + } catch (e) { + if (e instanceof __1.errors.ServerError || e.errorMessage === "RPC_CALL_FAIL" || e.errorMessage === "RPC_MCGET_FAIL") { + client2._log.warn(`Telegram is having internal issues ${e.constructor.name}`); + await (0, Helpers_1.sleep)(2e3); + } else if (e instanceof __1.errors.FloodWaitError || e instanceof __1.errors.FloodTestPhoneWaitError) { + if (e.seconds <= client2.floodSleepThreshold) { + client2._log.info(`Sleeping for ${e.seconds}s on flood wait (Caused by ${request.className})`); + await (0, Helpers_1.sleep)(e.seconds * 1e3); + } else { + state2.finished.resolve(); + throw e; + } + } else if (e instanceof __1.errors.PhoneMigrateError || e instanceof __1.errors.NetworkMigrateError || e instanceof __1.errors.UserMigrateError) { + client2._log.info(`Phone migrated to ${e.newDc}`); + const shouldRaise = e instanceof __1.errors.PhoneMigrateError || e instanceof __1.errors.NetworkMigrateError; + if (shouldRaise && await client2.isUserAuthorized()) { + state2.finished.resolve(); + throw e; + } + await client2._switchDC(e.newDc); + sender = dcId === void 0 ? client2._sender : await client2.getSender(dcId); + } else if (e instanceof __1.errors.MsgWaitError) { + await state2.isReady(); + state2.after = void 0; + } else if (e.message === "CONNECTION_NOT_INITED") { + await client2.disconnect(); + await (0, Helpers_1.sleep)(2e3); + await client2.connect(); + } else { + state2.finished.resolve(); + throw e; + } + } + state2.resetPromise(); } - if (!this.serverConfig.ignoreXForwardedFor && request.headers["x-forwarded-for"]) { - var immediatePeerIP = this.remoteAddress; - this.remoteAddresses = request.headers["x-forwarded-for"].split(xForwardedForSeparatorRegExp); - this.remoteAddresses.push(immediatePeerIP); - this.remoteAddress = this.remoteAddresses[0]; + throw new Error(`Request was unsuccessful ${attempt} time(s)`); + } + async function getMe(client2, inputPeer) { + if (inputPeer && client2._selfInputPeer) { + return client2._selfInputPeer; } - if (this.serverConfig.parseExtensions) { - var extensionsString = request.headers["sec-websocket-extensions"]; - this.requestedExtensions = this.parseExtensions(extensionsString); - } else { - this.requestedExtensions = []; + const me = (await client2.invoke(new tl_1.Api.users.GetUsers({ id: [new tl_1.Api.InputUserSelf()] })))[0]; + client2._bot = me.bot; + if (!client2._selfInputPeer) { + client2._selfInputPeer = __1.utils.getInputPeer(me, false); } - if (this.serverConfig.parseCookies) { - var cookieString = request.headers["cookie"]; - this.cookies = this.parseCookies(cookieString); - } else { - this.cookies = []; + return inputPeer ? client2._selfInputPeer : me; + } + async function isBot(client2) { + if (client2._bot === void 0) { + const me = await client2.getMe(); + if (me) { + return !(me instanceof tl_1.Api.InputPeerUser) ? me.bot : void 0; + } } - }; - WebSocketRequest.prototype.parseExtensions = function(extensionsString) { - if (!extensionsString || extensionsString.length === 0) { - return []; + return client2._bot; + } + async function isUserAuthorized(client2) { + try { + await client2.invoke(new tl_1.Api.updates.GetState()); + return true; + } catch (e) { + return false; } - var extensions = extensionsString.toLocaleLowerCase().split(headerValueSplitRegExp); - extensions.forEach(function(extension, index2, array) { - var params = extension.split(headerParamSplitRegExp); - var extensionName = params[0]; - var extensionParams = params.slice(1); - extensionParams.forEach(function(rawParam, index3, array2) { - var arr = rawParam.split("="); - var obj2 = { - name: arr[0], - value: arr[1] - }; - array2.splice(index3, 1, obj2); - }); - var obj = { - name: extensionName, - params: extensionParams - }; - array.splice(index2, 1, obj); - }); - return extensions; - }; - WebSocketRequest.prototype.parseCookies = function(str) { - if (!str || typeof str !== "string") { - return []; + } + async function getEntity(client2, entity) { + const single = !(0, Helpers_1.isArrayLike)(entity); + let entityArray = []; + if ((0, Helpers_1.isArrayLike)(entity)) { + entityArray = entity; + } else { + entityArray.push(entity); } - var cookies = []; - var pairs = str.split(cookieSeparatorRegEx); - pairs.forEach(function(pair) { - var eq_idx = pair.indexOf("="); - if (eq_idx === -1) { - cookies.push({ - name: pair, - value: null - }); - return; + const inputs = []; + for (const x of entityArray) { + if (typeof x === "string") { + const valid = (0, Utils_1.parseID)(x); + if (valid) { + inputs.push(await client2.getInputEntity(valid)); + } else { + inputs.push(x); + } + } else { + inputs.push(await client2.getInputEntity(x)); } - var key2 = pair.substr(0, eq_idx).trim(); - var val = pair.substr(++eq_idx, pair.length).trim(); - if ('"' === val[0]) { - val = val.slice(1, -1); + } + const lists = /* @__PURE__ */ new Map([ + [Helpers_1._EntityType.USER, []], + [Helpers_1._EntityType.CHAT, []], + [Helpers_1._EntityType.CHANNEL, []] + ]); + for (const x of inputs) { + try { + lists.get((0, Helpers_1._entityType)(x)).push(x); + } catch (e) { } - cookies.push({ - name: key2, - value: decodeURIComponent(val) - }); - }); - return cookies; - }; - WebSocketRequest.prototype.accept = function(acceptedProtocol, allowedOrigin, cookies) { - this._verifyResolution(); - var protocolFullCase; - if (acceptedProtocol) { - protocolFullCase = this.protocolFullCaseMap[acceptedProtocol.toLocaleLowerCase()]; - if (typeof protocolFullCase === "undefined") { - protocolFullCase = acceptedProtocol; + } + let users = lists.get(Helpers_1._EntityType.USER); + let chats = lists.get(Helpers_1._EntityType.CHAT); + let channels = lists.get(Helpers_1._EntityType.CHANNEL); + if (users.length) { + users = await client2.invoke(new tl_1.Api.users.GetUsers({ + id: users + })); + } + if (chats.length) { + const chatIds = chats.map((x) => x.chatId); + chats = (await client2.invoke(new tl_1.Api.messages.GetChats({ id: chatIds }))).chats; + } + if (channels.length) { + channels = (await client2.invoke(new tl_1.Api.channels.GetChannels({ id: channels }))).chats; + } + const idEntity = /* @__PURE__ */ new Map(); + for (const user of users) { + idEntity.set((0, Utils_1.getPeerId)(user), user); + } + for (const channel of channels) { + idEntity.set((0, Utils_1.getPeerId)(channel), channel); + } + for (const chat of chats) { + idEntity.set((0, Utils_1.getPeerId)(chat), chat); + } + const result = []; + for (const x of inputs) { + if (typeof x === "string") { + result.push(await _getEntityFromString(client2, x)); + } else if (!(x instanceof tl_1.Api.InputPeerSelf)) { + result.push(idEntity.get((0, Utils_1.getPeerId)(x))); + } else { + for (const [key, u] of idEntity.entries()) { + if (u instanceof tl_1.Api.User && u.self) { + result.push(u); + break; + } + } } - } else { - protocolFullCase = acceptedProtocol; } - this.protocolFullCaseMap = null; - var sha1 = crypto4.createHash("sha1"); - sha1.update(this.key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - var acceptKey = sha1.digest("base64"); - var response = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: " + acceptKey + "\r\n"; - if (protocolFullCase) { - for (var i2 = 0; i2 < protocolFullCase.length; i2++) { - var charCode = protocolFullCase.charCodeAt(i2); - var character = protocolFullCase.charAt(i2); - if (charCode < 33 || charCode > 126 || separators.indexOf(character) !== -1) { - this.reject(500); - throw new Error('Illegal character "' + String.fromCharCode(character) + '" in subprotocol.'); + return single ? result[0] : result; + } + async function getInputEntity(client2, peer) { + try { + return __1.utils.getInputPeer(peer); + } catch (e) { + } + try { + if (typeof peer == "string") { + const valid = (0, Utils_1.parseID)(peer); + if (valid) { + const res = client2._entityCache.get(peer); + if (res) { + return res; + } } } - if (this.requestedProtocols.indexOf(acceptedProtocol) === -1) { - this.reject(500); - throw new Error("Specified protocol was not requested by the client."); + if (typeof peer === "number" || typeof peer === "bigint" || big_integer_1.default.isInstance(peer)) { + const res = client2._entityCache.get(peer.toString()); + if (res) { + return res; + } + } + if (typeof peer == "object" && !big_integer_1.default.isInstance(peer) && peer.SUBCLASS_OF_ID === 47470215) { + const res = client2._entityCache.get(__1.utils.getPeerId(peer)); + if (res) { + return res; + } + } + } catch (e) { + } + if (typeof peer == "string") { + if (["me", "this", "self"].includes(peer)) { + return new tl_1.Api.InputPeerSelf(); } - protocolFullCase = protocolFullCase.replace(headerSanitizeRegExp, ""); - response += "Sec-WebSocket-Protocol: " + protocolFullCase + "\r\n"; } - this.requestedProtocols = null; - if (allowedOrigin) { - allowedOrigin = allowedOrigin.replace(headerSanitizeRegExp, ""); - if (this.webSocketVersion === 13) { - response += "Origin: " + allowedOrigin + "\r\n"; - } else if (this.webSocketVersion === 8) { - response += "Sec-WebSocket-Origin: " + allowedOrigin + "\r\n"; + try { + if (peer != void 0) { + return client2.session.getInputEntity(peer); } + } catch (e) { } - if (cookies) { - if (!Array.isArray(cookies)) { - this.reject(500); - throw new Error('Value supplied for "cookies" argument must be an array.'); + if (typeof peer === "string") { + return __1.utils.getInputPeer(await _getEntityFromString(client2, peer)); + } + if (typeof peer === "number") { + peer = (0, Helpers_1.returnBigInt)(peer); + } + peer = __1.utils.getPeer(peer); + if (peer instanceof tl_1.Api.PeerUser) { + const users = await client2.invoke(new tl_1.Api.users.GetUsers({ + id: [ + new tl_1.Api.InputUser({ + userId: peer.userId, + accessHash: big_integer_1.default.zero + }) + ] + })); + if (users.length && !(users[0] instanceof tl_1.Api.UserEmpty)) { + return __1.utils.getInputPeer(users[0]); } - var seenCookies = {}; - cookies.forEach(function(cookie) { - if (!cookie.name || !cookie.value) { - this.reject(500); - throw new Error('Each cookie to set must at least provide a "name" and "value"'); - } - cookie.name = cookie.name.replace(controlCharsAndSemicolonRegEx, ""); - cookie.value = cookie.value.replace(controlCharsAndSemicolonRegEx, ""); - if (seenCookies[cookie.name]) { - this.reject(500); - throw new Error("You may not specify the same cookie name twice."); - } - seenCookies[cookie.name] = true; - var invalidChar = cookie.name.match(cookieNameValidateRegEx); - if (invalidChar) { - this.reject(500); - throw new Error("Illegal character " + invalidChar[0] + " in cookie name"); - } - if (cookie.value.match(cookieValueDQuoteValidateRegEx)) { - invalidChar = cookie.value.slice(1, -1).match(cookieValueValidateRegEx); - } else { - invalidChar = cookie.value.match(cookieValueValidateRegEx); - } - if (invalidChar) { - this.reject(500); - throw new Error("Illegal character " + invalidChar[0] + " in cookie value"); + } else if (peer instanceof tl_1.Api.PeerChat) { + return new tl_1.Api.InputPeerChat({ + chatId: peer.chatId + }); + } else if (peer instanceof tl_1.Api.PeerChannel) { + try { + const channels = await client2.invoke(new tl_1.Api.channels.GetChannels({ + id: [ + new tl_1.Api.InputChannel({ + channelId: peer.channelId, + accessHash: big_integer_1.default.zero + }) + ] + })); + return __1.utils.getInputPeer(channels.chats[0]); + } catch (e) { + if (client2._errorHandler) { + await client2._errorHandler(e); } - var cookieParts = [cookie.name + "=" + cookie.value]; - if (cookie.path) { - invalidChar = cookie.path.match(controlCharsAndSemicolonRegEx); - if (invalidChar) { - this.reject(500); - throw new Error("Illegal character " + invalidChar[0] + " in cookie path"); - } - cookieParts.push("Path=" + cookie.path); + if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); } - if (cookie.domain) { - if (typeof cookie.domain !== "string") { - this.reject(500); - throw new Error("Domain must be specified and must be a string."); - } - invalidChar = cookie.domain.match(controlCharsAndSemicolonRegEx); - if (invalidChar) { - this.reject(500); - throw new Error("Illegal character " + invalidChar[0] + " in cookie domain"); + } + } + throw new Error(`Could not find the input entity for ${JSON.stringify(peer)}. + Please read https://docs.telethon.dev/en/stable/concepts/entities.html to find out more details.`); + } + async function _getEntityFromString(client2, string) { + const phone = __1.utils.parsePhone(string); + if (phone) { + try { + const result = await client2.invoke(new tl_1.Api.contacts.GetContacts({ + hash: big_integer_1.default.zero + })); + if (!(result instanceof tl_1.Api.contacts.ContactsNotModified)) { + for (const user of result.users) { + if (user instanceof tl_1.Api.User && user.phone === phone) { + return user; + } } - cookieParts.push("Domain=" + cookie.domain.toLowerCase()); } - if (cookie.expires) { - if (!(cookie.expires instanceof Date)) { - this.reject(500); - throw new Error('Value supplied for cookie "expires" must be a vaild date object'); - } - cookieParts.push("Expires=" + cookie.expires.toGMTString()); + } catch (e) { + if (e.errorMessage === "BOT_METHOD_INVALID") { + throw new Error("Cannot get entity by phone number as a bot (try using integer IDs, not strings)"); } - if (cookie.maxage) { - var maxage = cookie.maxage; - if (typeof maxage === "string") { - maxage = parseInt(maxage, 10); - } - if (isNaN(maxage) || maxage <= 0) { - this.reject(500); - throw new Error('Value supplied for cookie "maxage" must be a non-zero number'); - } - maxage = Math.round(maxage); - cookieParts.push("Max-Age=" + maxage.toString(10)); + throw e; + } + } + const id = __1.utils.parseID(string); + if (id != void 0) { + return getInputEntity(client2, id); + } else if (["me", "this"].includes(string.toLowerCase())) { + return client2.getMe(); + } else { + const { username, isInvite } = __1.utils.parseUsername(string); + if (isInvite) { + const invite = await client2.invoke(new tl_1.Api.messages.CheckChatInvite({ + hash: username + })); + if (invite instanceof tl_1.Api.ChatInvite) { + throw new Error("Cannot get entity from a channel (or group) that you are not part of. Join the group and retry"); + } else if (invite instanceof tl_1.Api.ChatInviteAlready) { + return invite.chat; } - if (cookie.secure) { - if (typeof cookie.secure !== "boolean") { - this.reject(500); - throw new Error('Value supplied for cookie "secure" must be of type boolean'); + } else if (username) { + try { + const result = await client2.invoke(new tl_1.Api.contacts.ResolveUsername({ username })); + const pid = __1.utils.getPeerId(result.peer, false); + if (result.peer instanceof tl_1.Api.PeerUser) { + for (const x of result.users) { + if ((0, Helpers_1.returnBigInt)(x.id).equals((0, Helpers_1.returnBigInt)(pid))) { + return x; + } + } + } else { + for (const x of result.chats) { + if ((0, Helpers_1.returnBigInt)(x.id).equals((0, Helpers_1.returnBigInt)(pid))) { + return x; + } + } } - cookieParts.push("Secure"); - } - if (cookie.httponly) { - if (typeof cookie.httponly !== "boolean") { - this.reject(500); - throw new Error('Value supplied for cookie "httponly" must be of type boolean'); + } catch (e) { + if (e.errorMessage === "USERNAME_NOT_OCCUPIED") { + throw new Error(`No user has "${username}" as username`); } - cookieParts.push("HttpOnly"); + throw e; } - response += "Set-Cookie: " + cookieParts.join(";") + "\r\n"; - }.bind(this)); + } } - this._resolved = true; - this.emit("requestResolved", this); - response += "\r\n"; - var connection = new WebSocketConnection(this.socket, [], acceptedProtocol, false, this.serverConfig); - connection.webSocketVersion = this.webSocketVersion; - connection.remoteAddress = this.remoteAddress; - connection.remoteAddresses = this.remoteAddresses; - var self2 = this; - if (this._socketIsClosing) { - cleanupFailedConnection(connection); - } else { - this.socket.write(response, "ascii", function(error) { - if (error) { - cleanupFailedConnection(connection); - return; - } - self2._removeSocketCloseListeners(); - connection._addSocketEventListeners(); - }); + throw new Error(`Cannot find any entity corresponding to "${string}"`); + } + async function getPeerId(client2, peer, addMark = true) { + if (typeof peer == "string") { + const valid = (0, Utils_1.parseID)(peer); + if (valid) { + return __1.utils.getPeerId(peer, addMark); + } else { + peer = await client2.getInputEntity(peer); + } } - this.emit("requestAccepted", connection); - return connection; - }; - WebSocketRequest.prototype.reject = function(status, reason, extraHeaders) { - this._verifyResolution(); - this._resolved = true; - this.emit("requestResolved", this); - if (typeof status !== "number") { - status = 403; + if (typeof peer == "number" || typeof peer == "bigint" || big_integer_1.default.isInstance(peer)) { + return __1.utils.getPeerId(peer, addMark); } - var response = "HTTP/1.1 " + status + " " + httpStatusDescriptions[status] + "\r\nConnection: close\r\n"; - if (reason) { - reason = reason.replace(headerSanitizeRegExp, ""); - response += "X-WebSocket-Reject-Reason: " + reason + "\r\n"; + if (peer.SUBCLASS_OF_ID == 47470215 || peer.SUBCLASS_OF_ID == 3374092470) { + peer = await client2.getInputEntity(peer); } - if (extraHeaders) { - for (var key2 in extraHeaders) { - var sanitizedValue = extraHeaders[key2].toString().replace(headerSanitizeRegExp, ""); - var sanitizedKey = key2.replace(headerSanitizeRegExp, ""); - response += sanitizedKey + ": " + sanitizedValue + "\r\n"; + if (peer instanceof tl_1.Api.InputPeerSelf) { + peer = await client2.getMe(true); + } + return __1.utils.getPeerId(peer, addMark); + } + async function _getPeer(client2, peer) { + if (!peer) { + return void 0; + } + const [i, cls] = __1.utils.resolveId((0, Helpers_1.returnBigInt)(await client2.getPeerId(peer))); + return new cls({ + userId: i, + channelId: i, + chatId: i + }); + } + async function _getInputDialog(client2, dialog) { + try { + if (dialog.SUBCLASS_OF_ID == 2719782805) { + dialog.peer = await client2.getInputEntity(dialog.peer); + return dialog; + } else if (dialog.SUBCLASS_OF_ID == 3374092470) { + return new tl_1.Api.InputDialogPeer({ + peer: dialog + }); } + } catch (e) { } - response += "\r\n"; - this.socket.end(response, "ascii"); - this.emit("requestRejected", this); - }; - WebSocketRequest.prototype._handleSocketCloseBeforeAccept = function() { - this._socketIsClosing = true; - this._removeSocketCloseListeners(); - }; - WebSocketRequest.prototype._removeSocketCloseListeners = function() { - this.socket.removeListener("end", this._socketCloseHandler); - this.socket.removeListener("close", this._socketCloseHandler); - }; - WebSocketRequest.prototype._verifyResolution = function() { - if (this._resolved) { - throw new Error("WebSocketRequest may only be accepted or rejected one time."); + return new tl_1.Api.InputDialogPeer({ + peer: dialog + }); + } + async function _getInputNotify(client2, notify) { + try { + if (notify.SUBCLASS_OF_ID == 1486362133) { + if (notify instanceof tl_1.Api.InputNotifyPeer) { + notify.peer = await client2.getInputEntity(notify.peer); + } + return notify; + } + } catch (e) { } - }; - function cleanupFailedConnection(connection) { - process.nextTick(function() { - connection.drop(1006, "TCP connection lost before handshake completed.", true); + return new tl_1.Api.InputNotifyPeer({ + peer: await client2.getInputEntity(notify) }); } - module2.exports = WebSocketRequest; + function _selfId(client2) { + return client2._selfInputPeer ? client2._selfInputPeer.userId : void 0; + } } }); -// node_modules/websocket/lib/WebSocketServer.js -var require_WebSocketServer = __commonJS({ - "node_modules/websocket/lib/WebSocketServer.js"(exports2, module2) { +// node_modules/telegram/tl/custom/button.js +var require_button = __commonJS({ + "node_modules/telegram/tl/custom/button.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var extend = require_utils4().extend; - var utils = require_utils4(); - var util = require("util"); - var debug = require_src2()("websocket:server"); - var EventEmitter = require("events").EventEmitter; - var WebSocketRequest = require_WebSocketRequest(); - var WebSocketServer = function WebSocketServer2(config) { - EventEmitter.call(this); - this._handlers = { - upgrade: this.handleUpgrade.bind(this), - requestAccepted: this.handleRequestAccepted.bind(this), - requestResolved: this.handleRequestResolved.bind(this) - }; - this.connections = []; - this.pendingRequests = []; - if (config) { - this.mount(config); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Button = void 0; + var api_1 = require_api(); + var __1 = require_telegram(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var Button = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - }; - util.inherits(WebSocketServer, EventEmitter); - WebSocketServer.prototype.mount = function(config) { - this.config = { - // The http server instance to attach to. Required. - httpServer: null, - // 64KiB max frame size. - maxReceivedFrameSize: 65536, - // 1MiB max message size, only applicable if - // assembleFragments is true - maxReceivedMessageSize: 1048576, - // Outgoing messages larger than fragmentationThreshold will be - // split into multiple fragments. - fragmentOutgoingMessages: true, - // Outgoing frames are fragmented if they exceed this threshold. - // Default is 16KiB - fragmentationThreshold: 16384, - // If true, the server will automatically send a ping to all - // clients every 'keepaliveInterval' milliseconds. The timer is - // reset on any received data from the client. - keepalive: true, - // The interval to send keepalive pings to connected clients if the - // connection is idle. Any received data will reset the counter. - keepaliveInterval: 2e4, - // If true, the server will consider any connection that has not - // received any data within the amount of time specified by - // 'keepaliveGracePeriod' after a keepalive ping has been sent to - // be dead, and will drop the connection. - // Ignored if keepalive is false. - dropConnectionOnKeepaliveTimeout: true, - // The amount of time to wait after sending a keepalive ping before - // closing the connection if the connected peer does not respond. - // Ignored if keepalive is false. - keepaliveGracePeriod: 1e4, - // Whether to use native TCP keep-alive instead of WebSockets ping - // and pong packets. Native TCP keep-alive sends smaller packets - // on the wire and so uses bandwidth more efficiently. This may - // be more important when talking to mobile devices. - // If this value is set to true, then these values will be ignored: - // keepaliveGracePeriod - // dropConnectionOnKeepaliveTimeout - useNativeKeepalive: false, - // If true, fragmented messages will be automatically assembled - // and the full message will be emitted via a 'message' event. - // If false, each frame will be emitted via a 'frame' event and - // the application will be responsible for aggregating multiple - // fragmented frames. Single-frame messages will emit a 'message' - // event in addition to the 'frame' event. - // Most users will want to leave this set to 'true' - assembleFragments: true, - // If this is true, websocket connections will be accepted - // regardless of the path and protocol specified by the client. - // The protocol accepted will be the first that was requested - // by the client. Clients from any origin will be accepted. - // This should only be used in the simplest of cases. You should - // probably leave this set to 'false' and inspect the request - // object to make sure it's acceptable before accepting it. - autoAcceptConnections: false, - // Whether or not the X-Forwarded-For header should be respected. - // It's important to set this to 'true' when accepting connections - // from untrusted clients, as a malicious client could spoof its - // IP address by simply setting this header. It's meant to be added - // by a trusted proxy or other intermediary within your own - // infrastructure. - // See: http://en.wikipedia.org/wiki/X-Forwarded-For - ignoreXForwardedFor: false, - // If this is true, 'cookie' headers are parsed and exposed as WebSocketRequest.cookies - parseCookies: true, - // If this is true, 'sec-websocket-extensions' headers are parsed and exposed as WebSocketRequest.requestedExtensions - parseExtensions: true, - // The Nagle Algorithm makes more efficient use of network resources - // by introducing a small delay before sending small packets so that - // multiple messages can be batched together before going onto the - // wire. This however comes at the cost of latency, so the default - // is to disable it. If you don't need low latency and are streaming - // lots of small messages, you can change this to 'false' - disableNagleAlgorithm: true, - // The number of milliseconds to wait after sending a close frame - // for an acknowledgement to come back before giving up and just - // closing the socket. - closeTimeout: 5e3 - }; - extend(this.config, config); - if (this.config.httpServer) { - if (!Array.isArray(this.config.httpServer)) { - this.config.httpServer = [this.config.httpServer]; + constructor(button, resize, singleUse, selective) { + this.button = button; + this.resize = resize; + this.singleUse = singleUse; + this.selective = selective; + } + static _isInline(button) { + return button instanceof api_1.Api.KeyboardButtonCallback || button instanceof api_1.Api.KeyboardButtonSwitchInline || button instanceof api_1.Api.KeyboardButtonUrl || button instanceof api_1.Api.KeyboardButtonUrlAuth || button instanceof api_1.Api.InputKeyboardButtonUrlAuth; + } + static inline(text, data) { + if (!data) { + data = Buffer.from(text, "utf-8"); } - var upgradeHandler = this._handlers.upgrade; - this.config.httpServer.forEach(function(httpServer) { - httpServer.on("upgrade", upgradeHandler); + if (data.length > 64) { + throw new Error("Too many bytes for the data"); + } + return new api_1.Api.KeyboardButtonCallback({ + text, + data }); - } else { - throw new Error("You must specify an httpServer on which to mount the WebSocket server."); } - }; - WebSocketServer.prototype.unmount = function() { - var upgradeHandler = this._handlers.upgrade; - this.config.httpServer.forEach(function(httpServer) { - httpServer.removeListener("upgrade", upgradeHandler); - }); - }; - WebSocketServer.prototype.closeAllConnections = function() { - this.connections.forEach(function(connection) { - connection.close(); - }); - this.pendingRequests.forEach(function(request) { - process.nextTick(function() { - request.reject(503); + static switchInline(text, query = "", samePeer = false) { + return new api_1.Api.KeyboardButtonSwitchInline({ + text, + query, + samePeer }); - }); - }; - WebSocketServer.prototype.broadcast = function(data) { - if (Buffer.isBuffer(data)) { - this.broadcastBytes(data); - } else if (typeof data.toString === "function") { - this.broadcastUTF(data); } - }; - WebSocketServer.prototype.broadcastUTF = function(utfData) { - this.connections.forEach(function(connection) { - connection.sendUTF(utfData); - }); - }; - WebSocketServer.prototype.broadcastBytes = function(binaryData) { - this.connections.forEach(function(connection) { - connection.sendBytes(binaryData); - }); - }; - WebSocketServer.prototype.shutDown = function() { - this.unmount(); - this.closeAllConnections(); - }; - WebSocketServer.prototype.handleUpgrade = function(request, socket) { - var self2 = this; - var wsRequest = new WebSocketRequest(socket, request, this.config); - try { - wsRequest.readHandshake(); - } catch (e) { - wsRequest.reject( - e.httpCode ? e.httpCode : 400, - e.message, - e.headers - ); - debug("Invalid handshake: %s", e.message); - this.emit("upgradeError", e); - return; + static url(text, url) { + return new api_1.Api.KeyboardButtonUrl({ + text, + url: url || text + }); + } + static auth(text, url, bot, writeAccess, fwdText) { + return new api_1.Api.InputKeyboardButtonUrlAuth({ + text, + url: url || text, + bot: __1.utils.getInputUser(bot || new api_1.Api.InputUserSelf()), + requestWriteAccess: writeAccess, + fwdText + }); + } + static text(text, resize, singleUse, selective) { + return new this(new api_1.Api.KeyboardButton({ text }), resize, singleUse, selective); + } + static requestLocation(text, resize, singleUse, selective) { + return new this(new api_1.Api.KeyboardButtonRequestGeoLocation({ text }), resize, singleUse, selective); } - this.pendingRequests.push(wsRequest); - wsRequest.once("requestAccepted", this._handlers.requestAccepted); - wsRequest.once("requestResolved", this._handlers.requestResolved); - socket.once("close", function() { - self2._handlers.requestResolved(wsRequest); - }); - if (!this.config.autoAcceptConnections && utils.eventEmitterListenerCount(this, "request") > 0) { - this.emit("request", wsRequest); - } else if (this.config.autoAcceptConnections) { - wsRequest.accept(wsRequest.requestedProtocols[0], wsRequest.origin); - } else { - wsRequest.reject(404, "No handler is configured to accept the connection."); + static requestPhone(text, resize, singleUse, selective) { + return new this(new api_1.Api.KeyboardButtonRequestPhone({ text }), resize, singleUse, selective); } - }; - WebSocketServer.prototype.handleRequestAccepted = function(connection) { - var self2 = this; - connection.once("close", function(closeReason, description) { - self2.handleConnectionClose(connection, closeReason, description); - }); - this.connections.push(connection); - this.emit("connect", connection); - }; - WebSocketServer.prototype.handleConnectionClose = function(connection, closeReason, description) { - var index2 = this.connections.indexOf(connection); - if (index2 !== -1) { - this.connections.splice(index2, 1); + static requestPoll(text, resize, singleUse, selective) { + return new this(new api_1.Api.KeyboardButtonRequestPoll({ text }), resize, singleUse, selective); } - this.emit("close", connection, closeReason, description); - }; - WebSocketServer.prototype.handleRequestResolved = function(request) { - var index2 = this.pendingRequests.indexOf(request); - if (index2 !== -1) { - this.pendingRequests.splice(index2, 1); + static clear() { + return new api_1.Api.ReplyKeyboardHide({}); + } + static forceReply() { + return new api_1.Api.ReplyKeyboardForceReply({}); } }; - module2.exports = WebSocketServer; + exports2.Button = Button; } }); -// node_modules/websocket/lib/WebSocketClient.js -var require_WebSocketClient = __commonJS({ - "node_modules/websocket/lib/WebSocketClient.js"(exports2, module2) { +// node_modules/telegram/Password.js +var require_Password = __commonJS({ + "node_modules/telegram/Password.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var utils = require_utils4(); - var extend = utils.extend; - var util = require("util"); - var EventEmitter = require("events").EventEmitter; - var http = require("http"); - var https = require("https"); - var url = require("url"); - var crypto4 = require("crypto"); - var WebSocketConnection = require_WebSocketConnection(); - var bufferAllocUnsafe = utils.bufferAllocUnsafe; - var protocolSeparators = [ - "(", - ")", - "<", - ">", - "@", - ",", - ";", - ":", - "\\", - '"', - "/", - "[", - "]", - "?", - "=", - "{", - "}", - " ", - String.fromCharCode(9) - ]; - var excludedTlsOptions = ["hostname", "port", "method", "path", "headers"]; - function WebSocketClient(config) { - EventEmitter.call(this); - this.config = { - // 1MiB max frame size. - maxReceivedFrameSize: 1048576, - // 8MiB max message size, only applicable if - // assembleFragments is true - maxReceivedMessageSize: 8388608, - // Outgoing messages larger than fragmentationThreshold will be - // split into multiple fragments. - fragmentOutgoingMessages: true, - // Outgoing frames are fragmented if they exceed this threshold. - // Default is 16KiB - fragmentationThreshold: 16384, - // Which version of the protocol to use for this session. This - // option will be removed once the protocol is finalized by the IETF - // It is only available to ease the transition through the - // intermediate draft protocol versions. - // At present, it only affects the name of the Origin header. - webSocketVersion: 13, - // If true, fragmented messages will be automatically assembled - // and the full message will be emitted via a 'message' event. - // If false, each frame will be emitted via a 'frame' event and - // the application will be responsible for aggregating multiple - // fragmented frames. Single-frame messages will emit a 'message' - // event in addition to the 'frame' event. - // Most users will want to leave this set to 'true' - assembleFragments: true, - // The Nagle Algorithm makes more efficient use of network resources - // by introducing a small delay before sending small packets so that - // multiple messages can be batched together before going onto the - // wire. This however comes at the cost of latency, so the default - // is to disable it. If you don't need low latency and are streaming - // lots of small messages, you can change this to 'false' - disableNagleAlgorithm: true, - // The number of milliseconds to wait after sending a close frame - // for an acknowledgement to come back before giving up and just - // closing the socket. - closeTimeout: 5e3, - // Options to pass to https.connect if connecting via TLS - tlsOptions: {} - }; - if (config) { - var tlsOptions; - if (config.tlsOptions) { - tlsOptions = config.tlsOptions; - delete config.tlsOptions; - } else { - tlsOptions = {}; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computeCheck = computeCheck; + exports2.computeDigest = computeDigest; + var tl_1 = require_tl(); + var Helpers_1 = require_Helpers(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var CryptoFile_1 = __importDefault2(require_CryptoFile()); + var SIZE_FOR_HASH = 256; + function checkPrimeAndGood(primeBytes, g) { + const goodPrime = Buffer.from([ + 199, + 28, + 174, + 185, + 198, + 177, + 201, + 4, + 142, + 108, + 82, + 47, + 112, + 241, + 63, + 115, + 152, + 13, + 64, + 35, + 142, + 62, + 33, + 193, + 73, + 52, + 208, + 55, + 86, + 61, + 147, + 15, + 72, + 25, + 138, + 10, + 167, + 193, + 64, + 88, + 34, + 148, + 147, + 210, + 37, + 48, + 244, + 219, + 250, + 51, + 111, + 110, + 10, + 201, + 37, + 19, + 149, + 67, + 174, + 212, + 76, + 206, + 124, + 55, + 32, + 253, + 81, + 246, + 148, + 88, + 112, + 90, + 198, + 140, + 212, + 254, + 107, + 107, + 19, + 171, + 220, + 151, + 70, + 81, + 41, + 105, + 50, + 132, + 84, + 241, + 143, + 175, + 140, + 89, + 95, + 100, + 36, + 119, + 254, + 150, + 187, + 42, + 148, + 29, + 91, + 205, + 29, + 74, + 200, + 204, + 73, + 136, + 7, + 8, + 250, + 155, + 55, + 142, + 60, + 79, + 58, + 144, + 96, + 190, + 230, + 124, + 249, + 164, + 164, + 166, + 149, + 129, + 16, + 81, + 144, + 126, + 22, + 39, + 83, + 181, + 107, + 15, + 107, + 65, + 13, + 186, + 116, + 216, + 168, + 75, + 42, + 20, + 179, + 20, + 78, + 14, + 241, + 40, + 71, + 84, + 253, + 23, + 237, + 149, + 13, + 89, + 101, + 180, + 185, + 221, + 70, + 88, + 45, + 177, + 23, + 141, + 22, + 156, + 107, + 196, + 101, + 176, + 214, + 255, + 156, + 163, + 146, + 143, + 239, + 91, + 154, + 228, + 228, + 24, + 252, + 21, + 232, + 62, + 190, + 160, + 248, + 127, + 169, + 255, + 94, + 237, + 112, + 5, + 13, + 237, + 40, + 73, + 244, + 123, + 249, + 89, + 217, + 86, + 133, + 12, + 233, + 41, + 133, + 31, + 13, + 129, + 21, + 246, + 53, + 177, + 5, + 238, + 46, + 78, + 21, + 208, + 75, + 36, + 84, + 191, + 111, + 79, + 173, + 240, + 52, + 177, + 4, + 3, + 17, + 156, + 216, + 227, + 185, + 47, + 204, + 91 + ]); + if (goodPrime.equals(primeBytes)) { + if ([3, 4, 5, 7].includes(g)) { + return; } - extend(this.config, config); - extend(this.config.tlsOptions, tlsOptions); } - this._req = null; - switch (this.config.webSocketVersion) { - case 8: - case 13: - break; - default: - throw new Error("Requested webSocketVersion is not supported. Allowed values are 8 and 13."); + throw new Error("Changing passwords unsupported"); + } + function isGoodLarge(number, p) { + return number.greater((0, big_integer_1.default)(0)) && p.subtract(number).greater((0, big_integer_1.default)(0)); + } + function numBytesForHash(number) { + return Buffer.concat([Buffer.alloc(SIZE_FOR_HASH - number.length), number]); + } + function bigNumForHash(g) { + return (0, Helpers_1.readBufferFromBigInt)(g, SIZE_FOR_HASH, false); + } + function isGoodModExpFirst(modexp, prime) { + const diff = prime.subtract(modexp); + const minDiffBitsCount = 2048 - 64; + const maxModExpSize = 256; + return !(diff.lesser((0, big_integer_1.default)(0)) || diff.bitLength().toJSNumber() < minDiffBitsCount || modexp.bitLength().toJSNumber() < minDiffBitsCount || Math.floor((modexp.bitLength().toJSNumber() + 7) / 8) > maxModExpSize); + } + function xor(a, b) { + const length = Math.min(a.length, b.length); + for (let i = 0; i < length; i++) { + a[i] = a[i] ^ b[i]; } + return a; } - util.inherits(WebSocketClient, EventEmitter); - WebSocketClient.prototype.connect = function(requestUrl, protocols, origin, headers, extraRequestOptions) { - var self2 = this; - if (typeof protocols === "string") { - if (protocols.length > 0) { - protocols = [protocols]; - } else { - protocols = []; - } + function pbkdf2sha512(password, salt, iterations) { + return CryptoFile_1.default.pbkdf2Sync(password, salt, iterations, 64, "sha512"); + } + async function computeHash(algo, password) { + const hash1 = await (0, Helpers_1.sha256)(Buffer.concat([algo.salt1, Buffer.from(password, "utf-8"), algo.salt1])); + const hash2 = await (0, Helpers_1.sha256)(Buffer.concat([algo.salt2, hash1, algo.salt2])); + const hash3 = await pbkdf2sha512(hash2, algo.salt1, 1e5); + return (0, Helpers_1.sha256)(Buffer.concat([algo.salt2, hash3, algo.salt2])); + } + async function computeDigest(algo, password) { + try { + checkPrimeAndGood(algo.p, algo.g); + } catch (e) { + throw new Error("bad p/g in password"); } - if (!(protocols instanceof Array)) { - protocols = []; + const value = (0, Helpers_1.modExp)((0, big_integer_1.default)(algo.g), (0, Helpers_1.readBigIntFromBuffer)(await computeHash(algo, password), false), (0, Helpers_1.readBigIntFromBuffer)(algo.p, false)); + return bigNumForHash(value); + } + async function computeCheck(request, password) { + const algo = request.currentAlgo; + if (!(algo instanceof tl_1.Api.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) { + throw new Error(`Unsupported password algorithm ${algo === null || algo === void 0 ? void 0 : algo.className}`); } - this.protocols = protocols; - this.origin = origin; - if (typeof requestUrl === "string") { - this.url = url.parse(requestUrl); - } else { - this.url = requestUrl; + const srp_B = request.srp_B; + const srpId = request.srpId; + if (!srp_B || !srpId) { + throw new Error(`Undefined srp_b ${request}`); } - if (!this.url.protocol) { - throw new Error("You must specify a full WebSocket URL, including protocol."); + const pwHash = await computeHash(algo, password); + const p = (0, Helpers_1.readBigIntFromBuffer)(algo.p, false); + const g = algo.g; + const B = (0, Helpers_1.readBigIntFromBuffer)(srp_B, false); + try { + checkPrimeAndGood(algo.p, g); + } catch (e) { + throw new Error("bad /g in password"); } - if (!this.url.host) { - throw new Error("You must specify a full WebSocket URL, including hostname. Relative URLs are not supported."); + if (!isGoodLarge(B, p)) { + throw new Error("bad b in check"); } - this.secure = this.url.protocol === "wss:"; - this.protocols.forEach(function(protocol) { - for (var i2 = 0; i2 < protocol.length; i2++) { - var charCode = protocol.charCodeAt(i2); - var character = protocol.charAt(i2); - if (charCode < 33 || charCode > 126 || protocolSeparators.indexOf(character) !== -1) { - throw new Error('Protocol list contains invalid character "' + String.fromCharCode(charCode) + '"'); + const x = (0, Helpers_1.readBigIntFromBuffer)(pwHash, false); + const pForHash = numBytesForHash(algo.p); + const gForHash = bigNumForHash((0, big_integer_1.default)(g)); + const bForHash = numBytesForHash(srp_B); + const gX = (0, Helpers_1.modExp)((0, big_integer_1.default)(g), x, p); + const k = (0, Helpers_1.readBigIntFromBuffer)(await (0, Helpers_1.sha256)(Buffer.concat([pForHash, gForHash])), false); + const kgX = (0, Helpers_1.bigIntMod)(k.multiply(gX), p); + const generateAndCheckRandom = async () => { + const randomSize = 256; + while (true) { + const random = (0, Helpers_1.generateRandomBytes)(randomSize); + const a2 = (0, Helpers_1.readBigIntFromBuffer)(random, false); + const A = (0, Helpers_1.modExp)((0, big_integer_1.default)(g), a2, p); + if (isGoodModExpFirst(A, p)) { + const aForHash2 = bigNumForHash(A); + const u2 = (0, Helpers_1.readBigIntFromBuffer)(await (0, Helpers_1.sha256)(Buffer.concat([aForHash2, bForHash])), false); + if (u2.greater((0, big_integer_1.default)(0))) { + return { + a: a2, + aForHash: aForHash2, + u: u2 + }; + } } } - }); - var defaultPorts = { - "ws:": "80", - "wss:": "443" }; - if (!this.url.port) { - this.url.port = defaultPorts[this.url.protocol]; - } - var nonce = bufferAllocUnsafe(16); - for (var i = 0; i < 16; i++) { - nonce[i] = Math.round(Math.random() * 255); + const { a, aForHash, u } = await generateAndCheckRandom(); + const gB = (0, Helpers_1.bigIntMod)(B.subtract(kgX), p); + if (!isGoodModExpFirst(gB, p)) { + throw new Error("bad gB"); } - this.base64nonce = nonce.toString("base64"); - var hostHeaderValue = this.url.hostname; - if (this.url.protocol === "ws:" && this.url.port !== "80" || this.url.protocol === "wss:" && this.url.port !== "443") { - hostHeaderValue += ":" + this.url.port; + const ux = u.multiply(x); + const aUx = a.add(ux); + const S = (0, Helpers_1.modExp)(gB, aUx, p); + const [K, pSha, gSha, salt1Sha, salt2Sha] = await Promise.all([ + (0, Helpers_1.sha256)(bigNumForHash(S)), + (0, Helpers_1.sha256)(pForHash), + (0, Helpers_1.sha256)(gForHash), + (0, Helpers_1.sha256)(algo.salt1), + (0, Helpers_1.sha256)(algo.salt2) + ]); + const M1 = await (0, Helpers_1.sha256)(Buffer.concat([ + xor(pSha, gSha), + salt1Sha, + salt2Sha, + aForHash, + bForHash, + K + ])); + return new tl_1.Api.InputCheckPasswordSRP({ + srpId, + A: Buffer.from(aForHash), + M1 + }); + } + } +}); + +// node_modules/telegram/tl/custom/messageButton.js +var require_messageButton = __commonJS({ + "node_modules/telegram/tl/custom/messageButton.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MessageButton = void 0; + var api_1 = require_api(); + var button_1 = require_button(); + var Helpers_1 = require_Helpers(); + var Password_1 = require_Password(); + var inspect_1 = require_inspect(); + var MessageButton = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - var reqHeaders = {}; - if (this.secure && this.config.tlsOptions.hasOwnProperty("headers")) { - extend(reqHeaders, this.config.tlsOptions.headers); + constructor(client2, original, chat, bot, msgId) { + this.button = original; + this._bot = bot; + this._chat = chat; + this._msgId = msgId; + this._client = client2; } - if (headers) { - extend(reqHeaders, headers); + get client() { + return this._client; } - extend(reqHeaders, { - "Upgrade": "websocket", - "Connection": "Upgrade", - "Sec-WebSocket-Version": this.config.webSocketVersion.toString(10), - "Sec-WebSocket-Key": this.base64nonce, - "Host": reqHeaders.Host || hostHeaderValue - }); - if (this.protocols.length > 0) { - reqHeaders["Sec-WebSocket-Protocol"] = this.protocols.join(", "); + get text() { + return !(this.button instanceof button_1.Button) ? this.button.text : ""; } - if (this.origin) { - if (this.config.webSocketVersion === 13) { - reqHeaders["Origin"] = this.origin; - } else if (this.config.webSocketVersion === 8) { - reqHeaders["Sec-WebSocket-Origin"] = this.origin; + get data() { + if (this.button instanceof api_1.Api.KeyboardButtonCallback) { + return this.button.data; } } - var pathAndQuery; - if (this.url.pathname) { - pathAndQuery = this.url.path; - } else if (this.url.path) { - pathAndQuery = "/" + this.url.path; - } else { - pathAndQuery = "/"; - } - function handleRequestError(error) { - self2._req = null; - self2.emit("connectFailed", error); - } - var requestOptions = { - agent: false - }; - if (extraRequestOptions) { - extend(requestOptions, extraRequestOptions); + get inlineQuery() { + if (this.button instanceof api_1.Api.KeyboardButtonSwitchInline) { + return this.button.query; + } } - extend(requestOptions, { - hostname: this.url.hostname, - port: this.url.port, - method: "GET", - path: pathAndQuery, - headers: reqHeaders - }); - if (this.secure) { - var tlsOptions = this.config.tlsOptions; - for (var key2 in tlsOptions) { - if (tlsOptions.hasOwnProperty(key2) && excludedTlsOptions.indexOf(key2) === -1) { - requestOptions[key2] = tlsOptions[key2]; - } + get url() { + if (this.button instanceof api_1.Api.KeyboardButtonUrl) { + return this.button.url; } } - var req = this._req = (this.secure ? https : http).request(requestOptions); - req.on("upgrade", function handleRequestUpgrade(response, socket, head) { - self2._req = null; - req.removeListener("error", handleRequestError); - self2.socket = socket; - self2.response = response; - self2.firstDataChunk = head; - self2.validateHandshake(); - }); - req.on("error", handleRequestError); - req.on("response", function(response) { - self2._req = null; - if (utils.eventEmitterListenerCount(self2, "httpResponse") > 0) { - self2.emit("httpResponse", response, self2); - if (response.socket) { - response.socket.end(); + /** + * Emulates the behaviour of clicking this button. + + If it's a normal `KeyboardButton` with text, a message will be + sent, and the sent `Message <Message>` returned. + + If it's an inline `KeyboardButtonCallback` with text and data, + it will be "clicked" and the `BotCallbackAnswer` returned. + + If it's an inline `KeyboardButtonSwitchInline` button, the + `StartBot` will be invoked and the resulting updates + returned. + + If it's a `KeyboardButtonUrl`, the URL of the button will + be returned. + + If it's a `KeyboardButtonRequestPhone`, you must indicate that you + want to ``sharePhone=True`` in order to share it. Sharing it is not a + default because it is a privacy concern and could happen accidentally. + + You may also use ``sharePhone=phone`` to share a specific number, in + which case either `str` or `InputMediaContact` should be used. + + If it's a `KeyboardButtonRequestGeoLocation`, you must pass a + tuple in ``shareGeo=[longitude, latitude]``. Note that Telegram seems + to have some heuristics to determine impossible locations, so changing + this value a lot quickly may not work as expected. You may also pass a + `InputGeoPoint` if you find the order confusing. + */ + async click({ sharePhone = false, shareGeo = [0, 0], password }) { + if (this.button instanceof api_1.Api.KeyboardButton) { + return this._client.sendMessage(this._chat, { + message: this.button.text, + parseMode: void 0 + }); + } else if (this.button instanceof api_1.Api.KeyboardButtonCallback) { + let encryptedPassword; + if (password != void 0) { + const pwd = await this.client.invoke(new api_1.Api.account.GetPassword()); + encryptedPassword = await (0, Password_1.computeCheck)(pwd, password); } - } else { - var headerDumpParts = []; - for (var headerName in response.headers) { - headerDumpParts.push(headerName + ": " + response.headers[headerName]); + const request = new api_1.Api.messages.GetBotCallbackAnswer({ + peer: this._chat, + msgId: this._msgId, + data: this.button.data, + password: encryptedPassword + }); + try { + return await this._client.invoke(request); + } catch (e) { + if (e.errorMessage == "BOT_RESPONSE_TIMEOUT") { + return null; + } + throw e; } - self2.failHandshake( - "Server responded with a non-101 status: " + response.statusCode + " " + response.statusMessage + "\nResponse Headers Follow:\n" + headerDumpParts.join("\n") + "\n" - ); - } - }); - req.end(); - }; - WebSocketClient.prototype.validateHandshake = function() { - var headers = this.response.headers; - if (this.protocols.length > 0) { - this.protocol = headers["sec-websocket-protocol"]; - if (this.protocol) { - if (this.protocols.indexOf(this.protocol) === -1) { - this.failHandshake("Server did not respond with a requested protocol."); - return; + } else if (this.button instanceof api_1.Api.KeyboardButtonSwitchInline) { + return this._client.invoke(new api_1.Api.messages.StartBot({ + bot: this._bot, + peer: this._chat, + startParam: this.button.query + })); + } else if (this.button instanceof api_1.Api.KeyboardButtonUrl) { + return this.button.url; + } else if (this.button instanceof api_1.Api.KeyboardButtonGame) { + const request = new api_1.Api.messages.GetBotCallbackAnswer({ + peer: this._chat, + msgId: this._msgId, + game: true + }); + try { + return await this._client.invoke(request); + } catch (e) { + if (e.errorMessage == "BOT_RESPONSE_TIMEOUT") { + return null; + } + throw e; } - } else { - this.failHandshake("Expected a Sec-WebSocket-Protocol header."); - return; + } else if (this.button instanceof api_1.Api.KeyboardButtonRequestPhone) { + if (!sharePhone) { + throw new Error("cannot click on phone buttons unless sharePhone=true"); + } + if (sharePhone == true || typeof sharePhone == "string") { + const me = await this._client.getMe(); + sharePhone = new api_1.Api.InputMediaContact({ + phoneNumber: (sharePhone == true ? me.phone : sharePhone) || "", + firstName: me.firstName || "", + lastName: me.lastName || "", + vcard: "" + }); + } + throw new Error("Not supported for now"); + } else if (this.button instanceof api_1.Api.InputWebFileGeoPointLocation) { + if (!shareGeo) { + throw new Error("cannot click on geo buttons unless shareGeo=[longitude, latitude]"); + } + throw new Error("Not supported for now"); } } - if (!(headers["connection"] && headers["connection"].toLocaleLowerCase() === "upgrade")) { - this.failHandshake("Expected a Connection: Upgrade header from the server"); - return; - } - if (!(headers["upgrade"] && headers["upgrade"].toLocaleLowerCase() === "websocket")) { - this.failHandshake("Expected an Upgrade: websocket header from the server"); - return; - } - var sha1 = crypto4.createHash("sha1"); - sha1.update(this.base64nonce + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - var expectedKey = sha1.digest("base64"); - if (!headers["sec-websocket-accept"]) { - this.failHandshake("Expected Sec-WebSocket-Accept header from server"); - return; - } - if (headers["sec-websocket-accept"] !== expectedKey) { - this.failHandshake("Sec-WebSocket-Accept header from server didn't match expected value of " + expectedKey); - return; - } - this.succeedHandshake(); - }; - WebSocketClient.prototype.failHandshake = function(errorDescription) { - if (this.socket && this.socket.writable) { - this.socket.end(); - } - this.emit("connectFailed", new Error(errorDescription)); - }; - WebSocketClient.prototype.succeedHandshake = function() { - var connection = new WebSocketConnection(this.socket, [], this.protocol, true, this.config); - connection.webSocketVersion = this.config.webSocketVersion; - connection._addSocketEventListeners(); - this.emit("connect", connection); - if (this.firstDataChunk.length > 0) { - connection.handleSocketData(this.firstDataChunk); - } - this.firstDataChunk = null; - }; - WebSocketClient.prototype.abort = function() { - if (this._req) { - this._req.abort(); - } }; - module2.exports = WebSocketClient; + exports2.MessageButton = MessageButton; } }); -// node_modules/websocket/lib/WebSocketRouterRequest.js -var require_WebSocketRouterRequest = __commonJS({ - "node_modules/websocket/lib/WebSocketRouterRequest.js"(exports2, module2) { +// node_modules/telegram/tl/custom/message.js +var require_message = __commonJS({ + "node_modules/telegram/tl/custom/message.js"(exports2) { + "use strict"; init_define_import_meta_env(); - var util = require("util"); - var EventEmitter = require("events").EventEmitter; - function WebSocketRouterRequest(webSocketRequest, resolvedProtocol) { - EventEmitter.call(this); - this.webSocketRequest = webSocketRequest; - if (resolvedProtocol === "____no_protocol____") { - this.protocol = null; - } else { - this.protocol = resolvedProtocol; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - this.origin = webSocketRequest.origin; - this.resource = webSocketRequest.resource; - this.resourceURL = webSocketRequest.resourceURL; - this.httpRequest = webSocketRequest.httpRequest; - this.remoteAddress = webSocketRequest.remoteAddress; - this.webSocketVersion = webSocketRequest.webSocketVersion; - this.requestedExtensions = webSocketRequest.requestedExtensions; - this.cookies = webSocketRequest.cookies; - } - util.inherits(WebSocketRouterRequest, EventEmitter); - WebSocketRouterRequest.prototype.accept = function(origin, cookies) { - var connection = this.webSocketRequest.accept(this.protocol, origin, cookies); - this.emit("requestAccepted", connection); - return connection; - }; - WebSocketRouterRequest.prototype.reject = function(status, reason, extraHeaders) { - this.webSocketRequest.reject(status, reason, extraHeaders); - this.emit("requestRejected", this); + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; }; - module2.exports = WebSocketRouterRequest; - } -}); - -// node_modules/websocket/lib/WebSocketRouter.js -var require_WebSocketRouter = __commonJS({ - "node_modules/websocket/lib/WebSocketRouter.js"(exports2, module2) { - init_define_import_meta_env(); - var extend = require_utils4().extend; - var util = require("util"); - var EventEmitter = require("events").EventEmitter; - var WebSocketRouterRequest = require_WebSocketRouterRequest(); - function WebSocketRouter(config) { - EventEmitter.call(this); - this.config = { - // The WebSocketServer instance to attach to. - server: null - }; - if (config) { - extend(this.config, config); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CustomMessage = void 0; + var senderGetter_1 = require_senderGetter(); + var api_1 = require_api(); + var chatGetter_1 = require_chatGetter(); + var utils = __importStar2(require_Utils()); + var forward_1 = require_forward(); + var file_1 = require_file(); + var Helpers_1 = require_Helpers(); + var users_1 = require_users(); + var Logger_1 = require_Logger(); + var messageButton_1 = require_messageButton(); + var inspect_1 = require_inspect(); + var CustomMessage = class extends senderGetter_1.SenderGetter { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + init({ id, peerId = void 0, date = void 0, out = void 0, mentioned = void 0, mediaUnread = void 0, silent = void 0, post = void 0, fromId = void 0, replyTo = void 0, message = void 0, fwdFrom = void 0, viaBotId = void 0, media = void 0, replyMarkup = void 0, entities: entities2 = void 0, views = void 0, editDate = void 0, postAuthor = void 0, groupedId = void 0, fromScheduled = void 0, legacy = void 0, editHide = void 0, pinned = void 0, restrictionReason = void 0, forwards = void 0, replies = void 0, action = void 0, reactions = void 0, noforwards = void 0, ttlPeriod = void 0, _entities = /* @__PURE__ */ new Map() }) { + if (!id) + throw new Error("id is a required attribute for Message"); + let senderId = void 0; + if (fromId) { + senderId = utils.getPeerId(fromId); + } else if (peerId) { + if (post || !out && peerId instanceof api_1.Api.PeerUser) { + senderId = utils.getPeerId(peerId); + } + } + this._entities = _entities; + this.out = out; + this.mentioned = mentioned; + this.mediaUnread = mediaUnread; + this.silent = silent; + this.post = post; + this.post = post; + this.fromScheduled = fromScheduled; + this.legacy = legacy; + this.editHide = editHide; + this.ttlPeriod = ttlPeriod; + this.id = id; + this.fromId = fromId; + this.peerId = peerId; + this.fwdFrom = fwdFrom; + this.viaBotId = viaBotId; + this.replyTo = replyTo; + this.date = date; + this.message = message; + this.media = media instanceof api_1.Api.MessageMediaEmpty ? media : void 0; + this.replyMarkup = replyMarkup; + this.entities = entities2; + this.views = views; + this.forwards = forwards; + this.replies = replies; + this.editDate = editDate; + this.pinned = pinned; + this.postAuthor = postAuthor; + this.groupedId = groupedId; + this.restrictionReason = restrictionReason; + this.action = action; + this.noforwards = noforwards; + this.reactions = reactions; + this._client = void 0; + this._text = void 0; + this._file = void 0; + this._replyMessage = void 0; + this._buttons = void 0; + this._buttonsFlat = void 0; + this._buttonsCount = 0; + this._viaBot = void 0; + this._viaInputBot = void 0; + this._actionEntities = void 0; + chatGetter_1.ChatGetter.initChatClass(this, { chatPeer: peerId, broadcast: post }); + senderGetter_1.SenderGetter.initSenderClass(this, { + senderId: senderId ? (0, Helpers_1.returnBigInt)(senderId) : void 0 + }); + this._forward = void 0; + } + constructor(args) { + super(); + this.init(args); + } + _finishInit(client2, entities2, inputChat) { + this._client = client2; + const cache = client2._entityCache; + if (this.senderId) { + [this._sender, this._inputSender] = utils._getEntityPair(this.senderId.toString(), entities2, cache); + } + if (this.chatId) { + [this._chat, this._inputChat] = utils._getEntityPair(this.chatId.toString(), entities2, cache); + } + if (inputChat) { + this._inputChat = inputChat; + } + if (this.viaBotId) { + [this._viaBot, this._viaInputBot] = utils._getEntityPair(this.viaBotId.toString(), entities2, cache); + } + if (this.fwdFrom) { + this._forward = new forward_1.Forward(this._client, this.fwdFrom, entities2); + } + if (this.action) { + if (this.action instanceof api_1.Api.MessageActionChatAddUser || this.action instanceof api_1.Api.MessageActionChatCreate) { + this._actionEntities = this.action.users.map((i) => entities2.get(i.toString())); + } else if (this.action instanceof api_1.Api.MessageActionChatDeleteUser) { + this._actionEntities = [ + entities2.get(this.action.userId.toString()) + ]; + } else if (this.action instanceof api_1.Api.MessageActionChatJoinedByLink) { + this._actionEntities = [ + entities2.get(utils.getPeerId(new api_1.Api.PeerChannel({ + channelId: this.action.inviterId + }))) + ]; + } else if (this.action instanceof api_1.Api.MessageActionChannelMigrateFrom) { + this._actionEntities = [ + entities2.get(utils.getPeerId(new api_1.Api.PeerChat({ chatId: this.action.chatId }))) + ]; + } + } + } + get client() { + return this._client; + } + get text() { + if (this._text === void 0 && this._client) { + if (!this._client.parseMode) { + this._text = this.message; + } else { + this._text = this._client.parseMode.unparse(this.message || "", this.entities || []); + } + } + return this._text || ""; } - this.handlers = []; - this._requestHandler = this.handleRequest.bind(this); - if (this.config.server) { - this.attachServer(this.config.server); + set text(value) { + this._text = value; + if (this._client && this._client.parseMode) { + [this.message, this.entities] = this._client.parseMode.parse(value); + } else { + this.message = value; + this.entities = []; + } } - } - util.inherits(WebSocketRouter, EventEmitter); - WebSocketRouter.prototype.attachServer = function(server) { - if (server) { - this.server = server; - this.server.on("request", this._requestHandler); - } else { - throw new Error("You must specify a WebSocketServer instance to attach to."); + get rawText() { + return this.message || ""; } - }; - WebSocketRouter.prototype.detachServer = function() { - if (this.server) { - this.server.removeListener("request", this._requestHandler); - this.server = null; - } else { - throw new Error("Cannot detach from server: not attached."); + /** + * @param {string} value + */ + set rawText(value) { + this.message = value; + this.entities = []; + this._text = ""; } - }; - WebSocketRouter.prototype.mount = function(path2, protocol, callback) { - if (!path2) { - throw new Error("You must specify a path for this handler."); + get isReply() { + return !!this.replyTo; } - if (!protocol) { - protocol = "____no_protocol____"; + get forward() { + return this._forward; } - if (!callback) { - throw new Error("You must specify a callback for this handler."); + async _refetchSender() { + await this._reloadMessage(); } - path2 = this.pathToRegExp(path2); - if (!(path2 instanceof RegExp)) { - throw new Error("Path must be specified as either a string or a RegExp."); + /** + * Re-fetches this message to reload the sender and chat entities, + * along with their input versions. + * @private + */ + async _reloadMessage() { + if (!this._client) + return; + let msg = void 0; + try { + const chat = this.isChannel ? await this.getInputChat() : void 0; + let temp = await this._client.getMessages(chat, { ids: this.id }); + if (temp) { + msg = temp[0]; + } + } catch (e) { + this._client._log.error("Got error while trying to finish init message with id " + this.id); + if (this._client._errorHandler) { + await this._client._errorHandler(e); + } + if (this._client._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); + } + } + if (msg == void 0) + return; + this._sender = msg._sender; + this._inputSender = msg._inputSender; + this._chat = msg._chat; + this._inputChat = msg._inputChat; + this._viaBot = msg._viaBot; + this._viaInputBot = msg._viaInputBot; + this._forward = msg._forward; + this._actionEntities = msg._actionEntities; } - var pathString = path2.toString(); - protocol = protocol.toLocaleLowerCase(); - if (this.findHandlerIndex(pathString, protocol) !== -1) { - throw new Error("You may only mount one handler per path/protocol combination."); + /** + * Returns a list of lists of `MessageButton <MessageButton>`, if any. + * Otherwise, it returns `undefined`. + */ + get buttons() { + if (!this._buttons && this.replyMarkup) { + if (!this.inputChat) { + return; + } + try { + const bot = this._neededMarkupBot(); + this._setButtons(this.inputChat, bot); + } catch (e) { + return; + } + } + return this._buttons; } - this.handlers.push({ - "path": path2, - "pathString": pathString, - "protocol": protocol, - "callback": callback - }); - }; - WebSocketRouter.prototype.unmount = function(path2, protocol) { - var index2 = this.findHandlerIndex(this.pathToRegExp(path2).toString(), protocol); - if (index2 !== -1) { - this.handlers.splice(index2, 1); - } else { - throw new Error("Unable to find a route matching the specified path and protocol."); + /** + * Returns `buttons` when that property fails (this is rarely needed). + */ + async getButtons() { + if (!this.buttons && this.replyMarkup) { + const chat = await this.getInputChat(); + if (!chat) + return; + let bot; + try { + bot = this._neededMarkupBot(); + } catch (e) { + await this._reloadMessage(); + bot = this._neededMarkupBot(); + } + this._setButtons(chat, bot); + } + return this._buttons; } - }; - WebSocketRouter.prototype.findHandlerIndex = function(pathString, protocol) { - protocol = protocol.toLocaleLowerCase(); - for (var i = 0, len = this.handlers.length; i < len; i++) { - var handler4 = this.handlers[i]; - if (handler4.pathString === pathString && handler4.protocol === protocol) { - return i; + get buttonCount() { + if (!this._buttonsCount) { + if (this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup) { + this._buttonsCount = this.replyMarkup.rows.map((r) => r.buttons.length).reduce(function(a, b) { + return a + b; + }, 0); + } else { + this._buttonsCount = 0; + } } + return this._buttonsCount; } - return -1; - }; - WebSocketRouter.prototype.pathToRegExp = function(path2) { - if (typeof path2 === "string") { - if (path2 === "*") { - path2 = /^.*$/; - } else { - path2 = path2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - path2 = new RegExp("^" + path2 + "$"); + get file() { + if (!this._file) { + const media = this.photo || this.document; + if (media) { + this._file = new file_1.File(media); + } } + return this._file; } - return path2; - }; - WebSocketRouter.prototype.handleRequest = function(request) { - var requestedProtocols = request.requestedProtocols; - if (requestedProtocols.length === 0) { - requestedProtocols = ["____no_protocol____"]; + get photo() { + if (this.media instanceof api_1.Api.MessageMediaPhoto) { + if (this.media.photo instanceof api_1.Api.Photo) + return this.media.photo; + } else if (this.action instanceof api_1.Api.MessageActionChatEditPhoto) { + return this.action.photo; + } else { + return this.webPreview && this.webPreview.photo instanceof api_1.Api.Photo ? this.webPreview.photo : void 0; + } + return void 0; } - for (var i = 0; i < requestedProtocols.length; i++) { - var requestedProtocol = requestedProtocols[i].toLocaleLowerCase(); - for (var j = 0, len = this.handlers.length; j < len; j++) { - var handler4 = this.handlers[j]; - if (handler4.path.test(request.resourceURL.pathname)) { - if (requestedProtocol === handler4.protocol || handler4.protocol === "*") { - var routerRequest = new WebSocketRouterRequest(request, requestedProtocol); - handler4.callback(routerRequest); - return; - } - } + get document() { + if (this.media instanceof api_1.Api.MessageMediaDocument) { + if (this.media.document instanceof api_1.Api.Document) + return this.media.document; + } else { + const web = this.webPreview; + return web && web.document instanceof api_1.Api.Document ? web.document : void 0; } + return void 0; } - request.reject(404, "No handler is available for the given request."); - }; - module2.exports = WebSocketRouter; - } -}); - -// node_modules/is-typedarray/index.js -var require_is_typedarray = __commonJS({ - "node_modules/is-typedarray/index.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = isTypedArray; - isTypedArray.strict = isStrictTypedArray; - isTypedArray.loose = isLooseTypedArray; - var toString2 = Object.prototype.toString; - var names = { - "[object Int8Array]": true, - "[object Int16Array]": true, - "[object Int32Array]": true, - "[object Uint8Array]": true, - "[object Uint8ClampedArray]": true, - "[object Uint16Array]": true, - "[object Uint32Array]": true, - "[object Float32Array]": true, - "[object Float64Array]": true - }; - function isTypedArray(arr) { - return isStrictTypedArray(arr) || isLooseTypedArray(arr); - } - function isStrictTypedArray(arr) { - return arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array; - } - function isLooseTypedArray(arr) { - return names[toString2.call(arr)]; - } - } -}); - -// node_modules/typedarray-to-buffer/index.js -var require_typedarray_to_buffer = __commonJS({ - "node_modules/typedarray-to-buffer/index.js"(exports2, module2) { - init_define_import_meta_env(); - var isTypedArray = require_is_typedarray().strict; - module2.exports = function typedarrayToBuffer(arr) { - if (isTypedArray(arr)) { - var buf = Buffer.from(arr.buffer); - if (arr.byteLength !== arr.buffer.byteLength) { - buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength); + get webPreview() { + if (this.media instanceof api_1.Api.MessageMediaWebPage) { + if (this.media.webpage instanceof api_1.Api.WebPage) + return this.media.webpage; } - return buf; - } else { - return Buffer.from(arr); } - }; - } -}); - -// node_modules/yaeti/lib/EventTarget.js -var require_EventTarget = __commonJS({ - "node_modules/yaeti/lib/EventTarget.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = _EventTarget; - function _EventTarget() { - if (typeof this.addEventListener === "function") { - return; + get audio() { + return this._documentByAttribute(api_1.Api.DocumentAttributeAudio, (attr) => !attr.voice); } - this._listeners = {}; - this.addEventListener = _addEventListener; - this.removeEventListener = _removeEventListener; - this.dispatchEvent = _dispatchEvent; - } - Object.defineProperties(_EventTarget.prototype, { - listeners: { - get: function() { - return this._listeners; + get voice() { + return this._documentByAttribute(api_1.Api.DocumentAttributeAudio, (attr) => !!attr.voice); + } + get video() { + return this._documentByAttribute(api_1.Api.DocumentAttributeVideo); + } + get videoNote() { + return this._documentByAttribute(api_1.Api.DocumentAttributeVideo, (attr) => !!attr.roundMessage); + } + get gif() { + return this._documentByAttribute(api_1.Api.DocumentAttributeAnimated); + } + get sticker() { + return this._documentByAttribute(api_1.Api.DocumentAttributeSticker); + } + get contact() { + if (this.media instanceof api_1.Api.MessageMediaContact) { + return this.media; } } - }); - function _addEventListener(type, newListener) { - var listenersType, i, listener; - if (!type || !newListener) { - return; + get game() { + if (this.media instanceof api_1.Api.MessageMediaGame) { + return this.media.game; + } } - listenersType = this._listeners[type]; - if (listenersType === void 0) { - this._listeners[type] = listenersType = []; + get geo() { + if (this.media instanceof api_1.Api.MessageMediaGeo || this.media instanceof api_1.Api.MessageMediaGeoLive || this.media instanceof api_1.Api.MessageMediaVenue) { + return this.media.geo; + } } - for (i = 0; !!(listener = listenersType[i]); i++) { - if (listener === newListener) { - return; + get invoice() { + if (this.media instanceof api_1.Api.MessageMediaInvoice) { + return this.media; } } - listenersType.push(newListener); - } - function _removeEventListener(type, oldListener) { - var listenersType, i, listener; - if (!type || !oldListener) { - return; + get poll() { + if (this.media instanceof api_1.Api.MessageMediaPoll) { + return this.media; + } } - listenersType = this._listeners[type]; - if (listenersType === void 0) { - return; + get venue() { + if (this.media instanceof api_1.Api.MessageMediaVenue) { + return this.media; + } } - for (i = 0; !!(listener = listenersType[i]); i++) { - if (listener === oldListener) { - listenersType.splice(i, 1); - break; + get dice() { + if (this.media instanceof api_1.Api.MessageMediaDice) { + return this.media; } } - if (listenersType.length === 0) { - delete this._listeners[type]; + get actionEntities() { + return this._actionEntities; } - } - function _dispatchEvent(event) { - var type, listenersType, dummyListener, stopImmediatePropagation = false, i, listener; - if (!event || typeof event.type !== "string") { - throw new Error("`event` must have a valid `type` property"); + get viaBot() { + return this._viaBot; } - if (event._yaeti) { - event.target = this; - event.cancelable = true; + get viaInputBot() { + return this._viaInputBot; } - try { - event.stopImmediatePropagation = function() { - stopImmediatePropagation = true; - }; - } catch (error) { + get replyToMsgId() { + var _a; + return (_a = this.replyTo) === null || _a === void 0 ? void 0 : _a.replyToMsgId; } - type = event.type; - listenersType = this._listeners[type] || []; - dummyListener = this["on" + type]; - if (typeof dummyListener === "function") { - dummyListener.call(this, event); + get toId() { + if (this._client && !this.out && this.isPrivate) { + return new api_1.Api.PeerUser({ + userId: (0, users_1._selfId)(this._client) + }); + } + return this.peerId; } - for (i = 0; !!(listener = listenersType[i]); i++) { - if (stopImmediatePropagation) { - break; + getEntitiesText(cls) { + let ent = this.entities; + if (!ent || ent.length == 0) + return; + if (cls) { + ent = ent.filter((v) => v instanceof cls); } - listener.call(this, event); + const texts = utils.getInnerText(this.message || "", ent); + const zip = (rows) => rows[0].map((_, c) => rows.map((row) => row[c])); + return zip([ent, texts]); } - return !event.defaultPrevented; - } - } -}); - -// node_modules/yaeti/lib/Event.js -var require_Event = __commonJS({ - "node_modules/yaeti/lib/Event.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = _Event; - function _Event(type) { - this.type = type; - this.isTrusted = false; - this._yaeti = true; - } - } -}); - -// node_modules/yaeti/index.js -var require_yaeti = __commonJS({ - "node_modules/yaeti/index.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = { - EventTarget: require_EventTarget(), - Event: require_Event() - }; - } -}); - -// node_modules/websocket/lib/W3CWebSocket.js -var require_W3CWebSocket = __commonJS({ - "node_modules/websocket/lib/W3CWebSocket.js"(exports2, module2) { - init_define_import_meta_env(); - var WebSocketClient = require_WebSocketClient(); - var toBuffer = require_typedarray_to_buffer(); - var yaeti = require_yaeti(); - var CONNECTING = 0; - var OPEN = 1; - var CLOSING = 2; - var CLOSED = 3; - module2.exports = W3CWebSocket; - function W3CWebSocket(url, protocols, origin, headers, requestOptions, clientConfig) { - yaeti.EventTarget.call(this); - clientConfig = clientConfig || {}; - clientConfig.assembleFragments = true; - var self2 = this; - this._url = url; - this._readyState = CONNECTING; - this._protocol = void 0; - this._extensions = ""; - this._bufferedAmount = 0; - this._binaryType = "arraybuffer"; - this._connection = void 0; - this._client = new WebSocketClient(clientConfig); - this._client.on("connect", function(connection) { - onConnect.call(self2, connection); - }); - this._client.on("connectFailed", function() { - onConnectFailed.call(self2); - }); - this._client.connect(url, protocols, origin, headers, requestOptions); - } - Object.defineProperties(W3CWebSocket.prototype, { - url: { get: function() { - return this._url; - } }, - readyState: { get: function() { - return this._readyState; - } }, - protocol: { get: function() { - return this._protocol; - } }, - extensions: { get: function() { - return this._extensions; - } }, - bufferedAmount: { get: function() { - return this._bufferedAmount; - } } - }); - Object.defineProperties(W3CWebSocket.prototype, { - binaryType: { - get: function() { - return this._binaryType; - }, - set: function(type) { - if (type !== "arraybuffer") { - throw new SyntaxError('just "arraybuffer" type allowed for "binaryType" attribute'); + async getReplyMessage() { + if (!this._replyMessage && this._client) { + if (!this.replyTo) + return void 0; + this._replyMessage = (await this._client.getMessages(this.isChannel ? await this.getInputChat() : void 0, { + ids: new api_1.Api.InputMessageReplyTo({ id: this.id }) + }))[0]; + if (!this._replyMessage) { + this._replyMessage = (await this._client.getMessages(this.isChannel ? this._inputChat : void 0, { + ids: this.replyToMsgId + }))[0]; } - this._binaryType = type; + } + return this._replyMessage; + } + async respond(params) { + if (this._client) { + return this._client.sendMessage(await this.getInputChat(), params); + } + } + async reply(params) { + if (this._client) { + params.replyTo = this.id; + return this._client.sendMessage(await this.getInputChat(), params); + } + } + async forwardTo(entity) { + if (this._client) { + entity = await this._client.getInputEntity(entity); + const params = { + messages: [this.id], + fromPeer: await this.getInputChat() + }; + return this._client.forwardMessages(entity, params); } } - }); - [["CONNECTING", CONNECTING], ["OPEN", OPEN], ["CLOSING", CLOSING], ["CLOSED", CLOSED]].forEach(function(property) { - Object.defineProperty(W3CWebSocket.prototype, property[0], { - get: function() { - return property[1]; + async edit(params) { + const param = params; + if (this.fwdFrom || !this._client) + return void 0; + if (param.linkPreview == void 0) { + param.linkPreview = !!this.webPreview; } - }); - }); - [["CONNECTING", CONNECTING], ["OPEN", OPEN], ["CLOSING", CLOSING], ["CLOSED", CLOSED]].forEach(function(property) { - Object.defineProperty(W3CWebSocket, property[0], { - get: function() { - return property[1]; + if (param.buttons == void 0) { + param.buttons = this.replyMarkup; } - }); - }); - W3CWebSocket.prototype.send = function(data) { - if (this._readyState !== OPEN) { - throw new Error("cannot call send() while not connected"); + param.message = this.id; + return this._client.editMessage(await this.getInputChat(), param); } - if (typeof data === "string" || data instanceof String) { - this._connection.sendUTF(data); - } else { - if (data instanceof Buffer) { - this._connection.sendBytes(data); - } else if (data.byteLength || data.byteLength === 0) { - data = toBuffer(data); - this._connection.sendBytes(data); - } else { - throw new Error("unknown binary data:", data); + async delete({ revoke } = { revoke: false }) { + if (this._client) { + return this._client.deleteMessages(await this.getInputChat(), [this.id], { + revoke + }); } } - }; - W3CWebSocket.prototype.close = function(code, reason) { - switch (this._readyState) { - case CONNECTING: - onConnectFailed.call(this); - this._client.on("connect", function(connection) { - if (code) { - connection.close(code, reason); - } else { - connection.close(); - } - }); - break; - case OPEN: - this._readyState = CLOSING; - if (code) { - this._connection.close(code, reason); - } else { - this._connection.close(); + async pin(params) { + if (this._client) { + const entity = await this.getInputChat(); + if (entity === void 0) { + throw Error("Failed to pin message due to cannot get input chat."); } - break; - case CLOSING: - case CLOSED: - break; - } - }; - function createCloseEvent(code, reason) { - var event = new yaeti.Event("close"); - event.code = code; - event.reason = reason; - event.wasClean = typeof code === "undefined" || code === 1e3; - return event; - } - function createMessageEvent(data) { - var event = new yaeti.Event("message"); - event.data = data; - return event; - } - function onConnect(connection) { - var self2 = this; - this._readyState = OPEN; - this._connection = connection; - this._protocol = connection.protocol; - this._extensions = connection.extensions; - this._connection.on("close", function(code, reason) { - onClose.call(self2, code, reason); - }); - this._connection.on("message", function(msg) { - onMessage.call(self2, msg); - }); - this.dispatchEvent(new yaeti.Event("open")); - } - function onConnectFailed() { - destroy.call(this); - this._readyState = CLOSED; - try { - this.dispatchEvent(new yaeti.Event("error")); - } finally { - this.dispatchEvent(createCloseEvent(1006, "connection failed")); + return this._client.pinMessage(entity, this.id, params); + } } - } - function onClose(code, reason) { - destroy.call(this); - this._readyState = CLOSED; - this.dispatchEvent(createCloseEvent(code, reason || "")); - } - function onMessage(message) { - if (message.utf8Data) { - this.dispatchEvent(createMessageEvent(message.utf8Data)); - } else if (message.binaryData) { - if (this.binaryType === "arraybuffer") { - var buffer = message.binaryData; - var arraybuffer = new ArrayBuffer(buffer.length); - var view = new Uint8Array(arraybuffer); - for (var i = 0, len = buffer.length; i < len; ++i) { - view[i] = buffer[i]; + async unpin(params) { + if (this._client) { + const entity = await this.getInputChat(); + if (entity === void 0) { + throw Error("Failed to unpin message due to cannot get input chat."); } - this.dispatchEvent(createMessageEvent(arraybuffer)); + return this._client.unpinMessage(entity, this.id, params); } } - } - function destroy() { - this._client.removeAllListeners(); - if (this._connection) { - this._connection.removeAllListeners(); + async downloadMedia(params) { + if (this._client) + return this._client.downloadMedia(this, params || {}); } - } - } -}); - -// node_modules/websocket/lib/Deprecation.js -var require_Deprecation = __commonJS({ - "node_modules/websocket/lib/Deprecation.js"(exports2, module2) { - init_define_import_meta_env(); - var Deprecation = { - disableWarnings: false, - deprecationWarningMap: {}, - warn: function(deprecationName) { - if (!this.disableWarnings && this.deprecationWarningMap[deprecationName]) { - console.warn("DEPRECATION WARNING: " + this.deprecationWarningMap[deprecationName]); - this.deprecationWarningMap[deprecationName] = false; + async markAsRead() { + if (this._client) { + const entity = await this.getInputChat(); + if (entity === void 0) { + throw Error(`Failed to mark message id ${this.id} as read due to cannot get input chat.`); + } + return this._client.markAsRead(entity, this.id); } } - }; - module2.exports = Deprecation; - } -}); - -// node_modules/websocket/package.json -var require_package = __commonJS({ - "node_modules/websocket/package.json"(exports2, module2) { - module2.exports = { - name: "websocket", - description: "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.", - keywords: [ - "websocket", - "websockets", - "socket", - "networking", - "comet", - "push", - "RFC-6455", - "realtime", - "server", - "client" - ], - author: "Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)", - contributors: [ - "I\xF1aki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)" - ], - version: "1.0.35", - repository: { - type: "git", - url: "https://github.com/theturtle32/WebSocket-Node.git" - }, - homepage: "https://github.com/theturtle32/WebSocket-Node", - engines: { - node: ">=4.0.0" - }, - dependencies: { - bufferutil: "^4.0.1", - debug: "^2.2.0", - "es5-ext": "^0.10.63", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - yaeti: "^0.0.6" - }, - devDependencies: { - "buffer-equal": "^1.0.0", - gulp: "^4.0.2", - "gulp-jshint": "^2.0.4", - "jshint-stylish": "^2.2.1", - jshint: "^2.0.0", - tape: "^4.9.1" - }, - config: { - verbose: false - }, - scripts: { - test: "tape test/unit/*.js", - gulp: "gulp" - }, - main: "index", - directories: { - lib: "./lib" - }, - browser: "lib/browser.js", - license: "Apache-2.0" - }; - } -}); - -// node_modules/websocket/lib/version.js -var require_version = __commonJS({ - "node_modules/websocket/lib/version.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = require_package().version; - } -}); - -// node_modules/websocket/lib/websocket.js -var require_websocket = __commonJS({ - "node_modules/websocket/lib/websocket.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = { - "server": require_WebSocketServer(), - "client": require_WebSocketClient(), - "router": require_WebSocketRouter(), - "frame": require_WebSocketFrame(), - "request": require_WebSocketRequest(), - "connection": require_WebSocketConnection(), - "w3cwebsocket": require_W3CWebSocket(), - "deprecation": require_Deprecation(), - "version": require_version() - }; - } -}); - -// node_modules/websocket/index.js -var require_websocket2 = __commonJS({ - "node_modules/websocket/index.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = require_websocket(); - } -}); - -// node_modules/tslib/tslib.es6.mjs -var tslib_es6_exports = {}; -__export(tslib_es6_exports, { - __addDisposableResource: () => __addDisposableResource, - __assign: () => __assign, - __asyncDelegator: () => __asyncDelegator, - __asyncGenerator: () => __asyncGenerator, - __asyncValues: () => __asyncValues, - __await: () => __await, - __awaiter: () => __awaiter, - __classPrivateFieldGet: () => __classPrivateFieldGet, - __classPrivateFieldIn: () => __classPrivateFieldIn, - __classPrivateFieldSet: () => __classPrivateFieldSet, - __createBinding: () => __createBinding, - __decorate: () => __decorate, - __disposeResources: () => __disposeResources, - __esDecorate: () => __esDecorate, - __exportStar: () => __exportStar, - __extends: () => __extends, - __generator: () => __generator, - __importDefault: () => __importDefault, - __importStar: () => __importStar, - __makeTemplateObject: () => __makeTemplateObject, - __metadata: () => __metadata, - __param: () => __param, - __propKey: () => __propKey, - __read: () => __read, - __rest: () => __rest, - __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension, - __runInitializers: () => __runInitializers, - __setFunctionName: () => __setFunctionName, - __spread: () => __spread, - __spreadArray: () => __spreadArray, - __spreadArrays: () => __spreadArrays, - __values: () => __values2, - default: () => tslib_es6_default -}); -function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} -function __decorate(decorators, target, key2, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key2, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key2, r) : d(target, key2)) || r; - return c > 3 && r && Object.defineProperty(target, key2, r), r; -} -function __param(paramIndex, decorator) { - return function(target, key2) { - decorator(target, key2, paramIndex); - }; -} -function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { - if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); - return f; - } - var kind = contextIn.kind, key2 = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context2 = {}; - for (var p in contextIn) context2[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context2.access[p] = contextIn.access[p]; - context2.addInitializer = function(f) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f || null)); - }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key2], context2); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key2] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -} -function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -} -function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -} -function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -} -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; - } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; + async click({ i, j, text, filter: filter2, data, sharePhone, shareGeo, password }) { + if (!this.client) { + return; + } + if (data) { + const chat = await this.getInputChat(); + if (!chat) { + return; + } + const button2 = new api_1.Api.KeyboardButtonCallback({ + text: "", + data + }); + return await new messageButton_1.MessageButton(this.client, button2, chat, void 0, this.id).click({ + sharePhone, + shareGeo, + password + }); + } + if (this.poll) { + let findPoll = function(answers) { + if (i != void 0) { + if (Array.isArray(i)) { + const corrects = []; + for (let x = 0; x < i.length; x++) { + corrects.push(answers[x].option); + } + return corrects; + } + return [answers[i].option]; + } + if (text != void 0) { + if (typeof text == "function") { + for (const answer of answers) { + if (text(answer.text)) { + return [answer.option]; + } + } + } else { + for (const answer of answers) { + if (answer.text.text == text) { + return [answer.option]; + } + } + } + return; + } + if (filter2 != void 0) { + for (const answer of answers) { + if (filter2(answer)) { + return [answer.option]; + } + } + return; + } + }; + const options = findPoll(this.poll.poll.answers) || []; + return await this.client.invoke(new api_1.Api.messages.SendVote({ + peer: this.inputChat, + msgId: this.id, + options + })); + } + if (!await this.getButtons()) { + return; + } + function findButton(self2) { + if (!self2._buttonsFlat || !self2._buttons) { + return; + } + if (Array.isArray(i)) { + i = i[0]; + } + if (text != void 0) { + if (typeof text == "function") { + for (const button2 of self2._buttonsFlat) { + if (text(button2.text)) { + return button2; + } + } + } else { + for (const button2 of self2._buttonsFlat) { + if (button2.text == text) { + return button2; + } + } + } + return; } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; + if (filter2 != void 0) { + for (const button2 of self2._buttonsFlat) { + if (filter2(button2)) { + return button2; + } + } + return; } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; + if (i == void 0) { + i = 0; } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; + if (j == void 0) { + return self2._buttonsFlat[i]; + } else { + return self2._buttons[i][j]; } - if (t[2]) _.ops.pop(); - _.trys.pop(); - continue; + } + const button = findButton(this); + if (button) { + return await button.click({ + sharePhone, + shareGeo, + password + }); + } } - op = body.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; + /** + * Helper methods to set the buttons given the input sender and chat. + */ + _setButtons(chat, bot) { + if (this.client && (this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup)) { + this._buttons = []; + this._buttonsFlat = []; + for (const row of this.replyMarkup.rows) { + const tmp = []; + for (const button of row.buttons) { + const btn = new messageButton_1.MessageButton(this.client, button, chat, bot, this.id); + tmp.push(btn); + this._buttonsFlat.push(btn); + } + this._buttons.push(tmp); + } + } + } + /** + *Returns the input peer of the bot that's needed for the reply markup. + + This is necessary for `KeyboardButtonSwitchInline` since we need + to know what bot we want to start. Raises ``Error`` if the bot + cannot be found but is needed. Returns `None` if it's not needed. + */ + _neededMarkupBot() { + if (!this.client || this.replyMarkup == void 0) { + return; + } + if (!(this.replyMarkup instanceof api_1.Api.ReplyInlineMarkup || this.replyMarkup instanceof api_1.Api.ReplyKeyboardMarkup)) { + return; + } + for (const row of this.replyMarkup.rows) { + for (const button of row.buttons) { + if (button instanceof api_1.Api.KeyboardButtonSwitchInline) { + if (button.samePeer || !this.viaBotId) { + const bot = this._inputSender; + if (!bot) + throw new Error("No input sender"); + return bot; + } else { + const ent = this.client._entityCache.get(this.viaBotId); + if (!ent) + throw new Error("No input sender"); + return ent; + } + } + } + } + } + // TODO fix this + _documentByAttribute(kind, condition) { + const doc = this.document; + if (doc) { + for (const attr of doc.attributes) { + if (attr instanceof kind) { + if (condition == void 0 || typeof condition == "function" && condition(attr)) { + return doc; + } + return void 0; + } + } + } + } + }; + exports2.CustomMessage = CustomMessage; } -} -function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} -function __values2(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function() { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } catch (error) { - e = { error }; - } finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally { - if (e) throw e.error; +}); + +// node_modules/telegram/tl/patched/index.js +var require_patched = __commonJS({ + "node_modules/telegram/tl/patched/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.patchAll = patchAll; + var api_1 = require_api(); + var message_1 = require_message(); + function getGetter(obj, prop) { + while (obj) { + let getter = Object.getOwnPropertyDescriptor(obj, prop); + if (getter && getter.get) { + return getter.get; + } + obj = Object.getPrototypeOf(obj); + } } - } - return ar; -} -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; + function getSetter(obj, prop) { + while (obj) { + let getter = Object.getOwnPropertyDescriptor(obj, prop); + if (getter && getter.set) { + return getter.set; + } + obj = Object.getPrototypeOf(obj); + } } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function awaitReturn(f) { - return function(v) { - return Promise.resolve(v).then(f, reject); + var getInstanceMethods = (obj) => { + let keys = { + methods: /* @__PURE__ */ new Set(), + setters: /* @__PURE__ */ new Set(), + getters: /* @__PURE__ */ new Set() + }; + let topObject = obj; + const mapAllMethods = (property) => { + const getter = getGetter(topObject, property); + const setter = getSetter(topObject, property); + if (getter) { + keys["getters"].add(property); + } else if (setter) { + keys["setters"].add(property); + } else { + if (!(property == "constructor")) { + keys["methods"].add(property); + } + } + }; + do { + Object.getOwnPropertyNames(obj).map(mapAllMethods); + obj = Object.getPrototypeOf(obj); + } while ( + // not the the Object prototype methods (hasOwnProperty, etc...) + obj && Object.getPrototypeOf(obj) + ); + return keys; }; - } - function verb(n, f) { - if (g[n]) { - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); + function patchClass(clazz) { + const { getters, setters, methods } = getInstanceMethods(message_1.CustomMessage.prototype); + for (const getter of getters) { + Object.defineProperty(clazz.prototype, getter, { + get: getGetter(message_1.CustomMessage.prototype, getter) }); - }; - if (f) i[n] = f(i[n]); + } + for (const setter of setters) { + Object.defineProperty(clazz.prototype, setter, { + set: getSetter(message_1.CustomMessage.prototype, setter) + }); + } + for (const method of methods) { + clazz.prototype[method] = message_1.CustomMessage.prototype[method]; + } } - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); + function patchAll() { + patchClass(api_1.Api.Message); + patchClass(api_1.Api.MessageService); + patchClass(api_1.Api.MessageEmpty); } } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); - } -} -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function(e) { - throw e; - }), verb("return"), i[Symbol.iterator] = function() { - return this; - }, i; - function verb(n, f) { - i[n] = o[n] ? function(v) { - return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; - } : f; +}); + +// node_modules/telegram/tl/index.js +var require_tl = __commonJS({ + "node_modules/telegram/tl/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.serializeDate = exports2.serializeBytes = exports2.Api = void 0; + var api_1 = require_api(); + Object.defineProperty(exports2, "Api", { enumerable: true, get: function() { + return api_1.Api; + } }); + var patched_1 = require_patched(); + (0, patched_1.patchAll)(); + var generationHelpers_1 = require_generationHelpers(); + Object.defineProperty(exports2, "serializeBytes", { enumerable: true, get: function() { + return generationHelpers_1.serializeBytes; + } }); + Object.defineProperty(exports2, "serializeDate", { enumerable: true, get: function() { + return generationHelpers_1.serializeDate; + } }); } -} -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); +}); + +// node_modules/telegram/extensions/BinaryWriter.js +var require_BinaryWriter = __commonJS({ + "node_modules/telegram/extensions/BinaryWriter.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BinaryWriter = void 0; + var BinaryWriter = class { + constructor(stream) { + this._buffers = [stream]; + } + write(buffer) { + this._buffers.push(buffer); + } + getValue() { + return Buffer.concat(this._buffers); + } }; + exports2.BinaryWriter = BinaryWriter; } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } -} -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } else { - cooked.raw = raw; - } - return cooked; -} -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; -} -function __importDefault(mod) { - return mod && mod.__esModule ? mod : { default: mod }; -} -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -function __classPrivateFieldIn(state, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -function __addDisposableResource(env2, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; +}); + +// node_modules/ts-custom-error/dist/custom-error.js +var require_custom_error = __commonJS({ + "node_modules/ts-custom-error/dist/custom-error.js"(exports2) { + init_define_import_meta_env(); + function fixProto(target, prototype) { + var setPrototypeOf = Object.setPrototypeOf; + setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype; } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; + function fixStack(target, fn) { + if (fn === void 0) { + fn = target.constructor; + } + var captureStackTrace = Error.captureStackTrace; + captureStackTrace && captureStackTrace(target, fn); } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { - try { - inner.call(this); - } catch (e) { - return Promise.reject(e); + var __extends2 = /* @__PURE__ */ (function() { + var _extendStatics = function extendStatics2(d, b) { + _extendStatics = Object.setPrototypeOf || { + __proto__: [] + } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) { + if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + } + }; + return _extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + _extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var CustomError = (function(_super) { + __extends2(CustomError2, _super); + function CustomError2(message, options) { + var _newTarget = this.constructor; + var _this = _super.call(this, message, options) || this; + Object.defineProperty(_this, "name", { + value: _newTarget.name, + enumerable: false, + configurable: true + }); + fixProto(_this, _newTarget.prototype); + fixStack(_this); + return _this; + } + return CustomError2; + })(Error); + var __spreadArray2 = function(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + function customErrorFactory(fn, parent) { + if (parent === void 0) { + parent = Error; + } + function CustomError2() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (!(this instanceof CustomError2)) return new (CustomError2.bind.apply(CustomError2, __spreadArray2([void 0], args, false)))(); + parent.apply(this, args); + Object.defineProperty(this, "name", { + value: fn.name || parent.name, + enumerable: false, + configurable: true + }); + fn.apply(this, args); + fixStack(this, CustomError2); + } + return Object.defineProperties(CustomError2, { + prototype: { + value: Object.create(parent.prototype, { + constructor: { + value: CustomError2, + writable: true, + configurable: true + } + }) + } + }); + } + exports2.CustomError = CustomError; + exports2.customErrorFactory = customErrorFactory; + } +}); + +// node_modules/telegram/errors/RPCBaseErrors.js +var require_RPCBaseErrors = __commonJS({ + "node_modules/telegram/errors/RPCBaseErrors.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TimedOutError = exports2.ServerError = exports2.FloodError = exports2.AuthKeyError = exports2.NotFoundError = exports2.ForbiddenError = exports2.UnauthorizedError = exports2.BadRequestError = exports2.InvalidDCError = exports2.RPCError = void 0; + var ts_custom_error_1 = require_custom_error(); + var RPCError = class _RPCError extends ts_custom_error_1.CustomError { + constructor(message, request, code) { + super("{0}: {1}{2}".replace("{0}", (code === null || code === void 0 ? void 0 : code.toString()) || "").replace("{1}", message || "").replace("{2}", _RPCError._fmtRequest(request))); + this.code = code; + this.errorMessage = message; + } + static _fmtRequest(request) { + if (request) { + return ` (caused by ${request.className})`; + } else { + return ""; + } + } + }; + exports2.RPCError = RPCError; + var InvalidDCError = class extends RPCError { + constructor(message, request, code) { + super(message, request, code); + this.code = code || 303; + this.errorMessage = message || "ERROR_SEE_OTHER"; + } + }; + exports2.InvalidDCError = InvalidDCError; + var BadRequestError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 400; + this.errorMessage = "BAD_REQUEST"; } }; - env2.stack.push({ value, dispose, async }); - } else if (async) { - env2.stack.push({ async: true }); - } - return value; -} -function __disposeResources(env2) { - function fail(e) { - env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e; - env2.hasError = true; - } - var r, s = 0; - function next() { - while (r = env2.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { - fail(e); - return next(); - }); - } else s |= 1; - } catch (e) { - fail(e); + exports2.BadRequestError = BadRequestError; + var UnauthorizedError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 401; + this.errorMessage = "UNAUTHORIZED"; } - } - if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve(); - if (env2.hasError) throw env2.error; - } - return next(); -} -function __rewriteRelativeImportExtension(path2, preserveJsx) { - if (typeof path2 === "string" && /^\.\.?\//.test(path2)) { - return path2.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js"; - }); - } - return path2; -} -var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default; -var init_tslib_es6 = __esm({ - "node_modules/tslib/tslib.es6.mjs"() { - init_define_import_meta_env(); - extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - }; - return extendStatics(d, b); }; - __assign = function() { - __assign = Object.assign || function __assign2(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); + exports2.UnauthorizedError = UnauthorizedError; + var ForbiddenError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 403; + this.errorMessage = "FORBIDDEN"; + } }; - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + exports2.ForbiddenError = ForbiddenError; + var NotFoundError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 404; + this.errorMessage = "NOT_FOUND"; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }); - __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; }; - ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); + exports2.NotFoundError = NotFoundError; + var AuthKeyError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 406; + this.errorMessage = "AUTH_KEY"; + } }; - _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + exports2.AuthKeyError = AuthKeyError; + var FloodError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 420; + this.errorMessage = "FLOOD"; + } }; - tslib_es6_default = { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __createBinding, - __exportStar, - __values: __values2, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources, - __rewriteRelativeImportExtension + exports2.FloodError = FloodError; + var ServerError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 500; + this.errorMessage = "INTERNAL"; + } + }; + exports2.ServerError = ServerError; + var TimedOutError = class extends RPCError { + constructor() { + super(...arguments); + this.code = 503; + this.errorMessage = "Timeout"; + } }; + exports2.TimedOutError = TimedOutError; } }); -// node_modules/async-mutex/lib/errors.js -var require_errors2 = __commonJS({ - "node_modules/async-mutex/lib/errors.js"(exports2) { +// node_modules/telegram/errors/RPCErrorList.js +var require_RPCErrorList = __commonJS({ + "node_modules/telegram/errors/RPCErrorList.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.E_CANCELED = exports2.E_ALREADY_LOCKED = exports2.E_TIMEOUT = void 0; - exports2.E_TIMEOUT = new Error("timeout while waiting for mutex to become available"); - exports2.E_ALREADY_LOCKED = new Error("mutex already locked"); - exports2.E_CANCELED = new Error("request for lock canceled"); + exports2.rpcErrorRe = exports2.MsgWaitError = exports2.EmailUnconfirmedError = exports2.NetworkMigrateError = exports2.FileMigrateError = exports2.FloodTestPhoneWaitError = exports2.FloodWaitError = exports2.SlowModeWaitError = exports2.PhoneMigrateError = exports2.UserMigrateError = void 0; + var RPCBaseErrors_1 = require_RPCBaseErrors(); + var UserMigrateError = class extends RPCBaseErrors_1.InvalidDCError { + constructor(args) { + const newDc = Number(args.capture || 0); + super(`The user whose identity is being used to execute queries is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `The user whose identity is being used to execute queries is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.newDc = newDc; + } + }; + exports2.UserMigrateError = UserMigrateError; + var PhoneMigrateError = class extends RPCBaseErrors_1.InvalidDCError { + constructor(args) { + const newDc = Number(args.capture || 0); + super(`The phone number a user is trying to use for authorization is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `The phone number a user is trying to use for authorization is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.newDc = newDc; + } + }; + exports2.PhoneMigrateError = PhoneMigrateError; + var SlowModeWaitError = class extends RPCBaseErrors_1.FloodError { + constructor(args) { + const seconds = Number(args.capture || 0); + super(`A wait of ${seconds} seconds is required before sending another message in this chat` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `A wait of ${seconds} seconds is required before sending another message in this chat` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.seconds = seconds; + } + }; + exports2.SlowModeWaitError = SlowModeWaitError; + var FloodWaitError = class extends RPCBaseErrors_1.FloodError { + constructor(args) { + const seconds = Number(args.capture || 0); + super(`A wait of ${seconds} seconds is required` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `A wait of ${seconds} seconds is required` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.seconds = seconds; + } + }; + exports2.FloodWaitError = FloodWaitError; + var FloodTestPhoneWaitError = class extends RPCBaseErrors_1.FloodError { + constructor(args) { + const seconds = Number(args.capture || 0); + super(`A wait of ${seconds} seconds is required in the test servers` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `A wait of ${seconds} seconds is required in the test servers` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.seconds = seconds; + } + }; + exports2.FloodTestPhoneWaitError = FloodTestPhoneWaitError; + var FileMigrateError = class extends RPCBaseErrors_1.InvalidDCError { + constructor(args) { + const newDc = Number(args.capture || 0); + super(`The file to be accessed is currently stored in DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `The file to be accessed is currently stored in DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.newDc = newDc; + } + }; + exports2.FileMigrateError = FileMigrateError; + var NetworkMigrateError = class extends RPCBaseErrors_1.InvalidDCError { + constructor(args) { + const newDc = Number(args.capture || 0); + super(`The source IP address is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request), args.request); + this.message = `The source IP address is associated with DC ${newDc}` + RPCBaseErrors_1.RPCError._fmtRequest(args.request); + this.newDc = newDc; + } + }; + exports2.NetworkMigrateError = NetworkMigrateError; + var EmailUnconfirmedError = class extends RPCBaseErrors_1.BadRequestError { + constructor(args) { + const codeLength = Number(args.capture || 0); + super(`Email unconfirmed, the length of the code must be ${codeLength}${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`, args.request, 400); + this.message = `Email unconfirmed, the length of the code must be ${codeLength}${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`; + this.codeLength = codeLength; + } + }; + exports2.EmailUnconfirmedError = EmailUnconfirmedError; + var MsgWaitError = class extends RPCBaseErrors_1.FloodError { + constructor(args) { + super(`Message failed to be sent.${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`, args.request); + this.message = `Message failed to be sent.${RPCBaseErrors_1.RPCError._fmtRequest(args.request)}`; + } + }; + exports2.MsgWaitError = MsgWaitError; + exports2.rpcErrorRe = /* @__PURE__ */ new Map([ + [/FILE_MIGRATE_(\d+)/, FileMigrateError], + [/FLOOD_TEST_PHONE_WAIT_(\d+)/, FloodTestPhoneWaitError], + [/FLOOD_WAIT_(\d+)/, FloodWaitError], + [/FLOOD_PREMIUM_WAIT_(\d+)/, FloodWaitError], + [/MSG_WAIT_(.*)/, MsgWaitError], + [/PHONE_MIGRATE_(\d+)/, PhoneMigrateError], + [/SLOWMODE_WAIT_(\d+)/, SlowModeWaitError], + [/USER_MIGRATE_(\d+)/, UserMigrateError], + [/NETWORK_MIGRATE_(\d+)/, NetworkMigrateError], + [/EMAIL_UNCONFIRMED_(\d+)/, EmailUnconfirmedError] + ]); } }); -// node_modules/async-mutex/lib/Semaphore.js -var require_Semaphore = __commonJS({ - "node_modules/async-mutex/lib/Semaphore.js"(exports2) { +// node_modules/telegram/errors/Common.js +var require_Common = __commonJS({ + "node_modules/telegram/errors/Common.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var errors_1 = require_errors2(); - var Semaphore = ( - /** @class */ - (function() { - function Semaphore2(_maxConcurrency, _cancelError) { - if (_cancelError === void 0) { - _cancelError = errors_1.E_CANCELED; - } - this._maxConcurrency = _maxConcurrency; - this._cancelError = _cancelError; - this._queue = []; - this._waiters = []; - if (_maxConcurrency <= 0) { - throw new Error("semaphore must be initialized to a positive value"); - } - this._value = _maxConcurrency; + exports2.BadMessageError = exports2.CdnFileTamperedError = exports2.SecurityError = exports2.InvalidBufferError = exports2.InvalidChecksumError = exports2.TypeNotFoundError = exports2.ReadCancelledError = void 0; + var ReadCancelledError = class extends Error { + constructor() { + super("The read operation was cancelled."); + } + }; + exports2.ReadCancelledError = ReadCancelledError; + var TypeNotFoundError = class extends Error { + constructor(invalidConstructorId, remaining) { + super(`Could not find a matching Constructor ID for the TLObject that was supposed to be + read with ID ${invalidConstructorId}. Most likely, a TLObject was trying to be read when + it should not be read. Remaining bytes: ${remaining.length}`); + if (typeof alert !== "undefined") { + alert(`Missing MTProto Entity: Please, make sure to add TL definition for ID ${invalidConstructorId}`); } - Semaphore2.prototype.acquire = function() { - var _this = this; - var locked = this.isLocked(); - var ticketPromise = new Promise(function(resolve, reject) { - return _this._queue.push({ resolve, reject }); - }); - if (!locked) - this._dispatch(); - return ticketPromise; - }; - Semaphore2.prototype.runExclusive = function(callback) { - return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { - var _a3, value, release; - return (0, tslib_1.__generator)(this, function(_b) { - switch (_b.label) { - case 0: - return [4, this.acquire()]; - case 1: - _a3 = _b.sent(), value = _a3[0], release = _a3[1]; - _b.label = 2; - case 2: - _b.trys.push([2, , 4, 5]); - return [4, callback(value)]; - case 3: - return [2, _b.sent()]; - case 4: - release(); - return [ - 7 - /*endfinally*/ - ]; - case 5: - return [ - 2 - /*return*/ - ]; - } - }); - }); - }; - Semaphore2.prototype.waitForUnlock = function() { - return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { - var waitPromise; - var _this = this; - return (0, tslib_1.__generator)(this, function(_a3) { - if (!this.isLocked()) { - return [2, Promise.resolve()]; - } - waitPromise = new Promise(function(resolve) { - return _this._waiters.push({ resolve }); - }); - return [2, waitPromise]; - }); - }); - }; - Semaphore2.prototype.isLocked = function() { - return this._value <= 0; - }; - Semaphore2.prototype.release = function() { - if (this._maxConcurrency > 1) { - throw new Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead"); - } - if (this._currentReleaser) { - var releaser = this._currentReleaser; - this._currentReleaser = void 0; - releaser(); - } - }; - Semaphore2.prototype.cancel = function() { - var _this = this; - this._queue.forEach(function(ticket) { - return ticket.reject(_this._cancelError); - }); - this._queue = []; - }; - Semaphore2.prototype._dispatch = function() { - var _this = this; - var nextTicket = this._queue.shift(); - if (!nextTicket) - return; - var released = false; - this._currentReleaser = function() { - if (released) - return; - released = true; - _this._value++; - _this._resolveWaiters(); - _this._dispatch(); - }; - nextTicket.resolve([this._value--, this._currentReleaser]); - }; - Semaphore2.prototype._resolveWaiters = function() { - this._waiters.forEach(function(waiter) { - return waiter.resolve(); - }); - this._waiters = []; - }; - return Semaphore2; - })() - ); - exports2.default = Semaphore; - } -}); - -// node_modules/async-mutex/lib/Mutex.js -var require_Mutex = __commonJS({ - "node_modules/async-mutex/lib/Mutex.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var Semaphore_1 = require_Semaphore(); - var Mutex = ( - /** @class */ - (function() { - function Mutex2(cancelError) { - this._semaphore = new Semaphore_1.default(1, cancelError); + this.invalidConstructorId = invalidConstructorId; + this.remaining = remaining; + } + }; + exports2.TypeNotFoundError = TypeNotFoundError; + var InvalidChecksumError = class extends Error { + constructor(checksum, validChecksum) { + super(`Invalid checksum (${checksum} when ${validChecksum} was expected). This packet should be skipped.`); + this.checksum = checksum; + this.validChecksum = validChecksum; + } + }; + exports2.InvalidChecksumError = InvalidChecksumError; + var InvalidBufferError = class extends Error { + constructor(payload) { + let code = void 0; + if (payload.length === 4) { + code = -payload.readInt32LE(0); + super(`Invalid response buffer (HTTP code ${code})`); + } else { + super(`Invalid response buffer (too short ${payload})`); } - Mutex2.prototype.acquire = function() { - return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { - var _a3, releaser; - return (0, tslib_1.__generator)(this, function(_b) { - switch (_b.label) { - case 0: - return [4, this._semaphore.acquire()]; - case 1: - _a3 = _b.sent(), releaser = _a3[1]; - return [2, releaser]; - } - }); - }); - }; - Mutex2.prototype.runExclusive = function(callback) { - return this._semaphore.runExclusive(function() { - return callback(); - }); - }; - Mutex2.prototype.isLocked = function() { - return this._semaphore.isLocked(); - }; - Mutex2.prototype.waitForUnlock = function() { - return this._semaphore.waitForUnlock(); - }; - Mutex2.prototype.release = function() { - this._semaphore.release(); - }; - Mutex2.prototype.cancel = function() { - return this._semaphore.cancel(); - }; - return Mutex2; - })() - ); - exports2.default = Mutex; + this.code = code; + this.payload = payload; + } + }; + exports2.InvalidBufferError = InvalidBufferError; + var SecurityError = class extends Error { + constructor(...args) { + if (!args.length) { + args = ["A security check failed."]; + } + super(...args); + } + }; + exports2.SecurityError = SecurityError; + var CdnFileTamperedError = class extends SecurityError { + constructor() { + super("The CDN file has been altered and its download cancelled."); + } + }; + exports2.CdnFileTamperedError = CdnFileTamperedError; + var BadMessageError = class _BadMessageError extends Error { + constructor(request, code) { + let errorMessage = _BadMessageError.ErrorMessages[code] || `Unknown error code (this should not happen): ${code}.`; + errorMessage += ` Caused by ${request.className}`; + super(errorMessage); + this.errorMessage = errorMessage; + this.code = code; + } + }; + exports2.BadMessageError = BadMessageError; + BadMessageError.ErrorMessages = { + 16: "msg_id too low (most likely, client time is wrong it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the \u201Ccorrect\u201D msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted).", + 17: "msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id).", + 18: "Incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4).", + 19: "Container msg_id is the same as msg_id of a previously received message (this must never happen).", + 20: "Message too old, and it cannot be verified whether the server has received a message with this msg_id or not.", + 32: "msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno).", + 33: "msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno).", + 34: "An even msg_seqno expected (irrelevant message), but odd received.", + 35: "Odd msg_seqno expected (relevant message), but even received.", + 48: "Incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it).", + 64: "Invalid container." + }; } }); -// node_modules/async-mutex/lib/withTimeout.js -var require_withTimeout = __commonJS({ - "node_modules/async-mutex/lib/withTimeout.js"(exports2) { +// node_modules/telegram/errors/index.js +var require_errors = __commonJS({ + "node_modules/telegram/errors/index.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.withTimeout = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var errors_1 = require_errors2(); - function withTimeout(sync, timeout, timeoutError) { - var _this = this; - if (timeoutError === void 0) { - timeoutError = errors_1.E_TIMEOUT; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - return { - acquire: function() { - return new Promise(function(resolve, reject) { - return (0, tslib_1.__awaiter)(_this, void 0, void 0, function() { - var isTimeout, handle2, ticket, release, e_1; - return (0, tslib_1.__generator)(this, function(_a3) { - switch (_a3.label) { - case 0: - isTimeout = false; - handle2 = setTimeout(function() { - isTimeout = true; - reject(timeoutError); - }, timeout); - _a3.label = 1; - case 1: - _a3.trys.push([1, 3, , 4]); - return [4, sync.acquire()]; - case 2: - ticket = _a3.sent(); - if (isTimeout) { - release = Array.isArray(ticket) ? ticket[1] : ticket; - release(); - } else { - clearTimeout(handle2); - resolve(ticket); - } - return [3, 4]; - case 3: - e_1 = _a3.sent(); - if (!isTimeout) { - clearTimeout(handle2); - reject(e_1); - } - return [3, 4]; - case 4: - return [ - 2 - /*return*/ - ]; - } - }); - }); - }); - }, - runExclusive: function(callback) { - return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { - var release, ticket; - return (0, tslib_1.__generator)(this, function(_a3) { - switch (_a3.label) { - case 0: - release = function() { - return void 0; - }; - _a3.label = 1; - case 1: - _a3.trys.push([1, , 7, 8]); - return [4, this.acquire()]; - case 2: - ticket = _a3.sent(); - if (!Array.isArray(ticket)) return [3, 4]; - release = ticket[1]; - return [4, callback(ticket[0])]; - case 3: - return [2, _a3.sent()]; - case 4: - release = ticket; - return [4, callback()]; - case 5: - return [2, _a3.sent()]; - case 6: - return [3, 8]; - case 7: - release(); - return [ - 7 - /*endfinally*/ - ]; - case 8: - return [ - 2 - /*return*/ - ]; - } - }); - }); - }, - /** @deprecated Deprecated in 0.3.0, will be removed in 0.4.0. Use runExclusive instead. */ - release: function() { - sync.release(); - }, - cancel: function() { - return sync.cancel(); - }, - waitForUnlock: function() { - return sync.waitForUnlock(); - }, - isLocked: function() { - return sync.isLocked(); + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RPCMessageToError = RPCMessageToError; + var RPCBaseErrors_1 = require_RPCBaseErrors(); + var RPCErrorList_1 = require_RPCErrorList(); + function RPCMessageToError(rpcError, request) { + for (const [msgRegex, Cls] of RPCErrorList_1.rpcErrorRe) { + const m = rpcError.errorMessage.match(msgRegex); + if (m) { + const capture = m.length === 2 ? parseInt(m[1]) : null; + return new Cls({ request, capture }); } - }; + } + return new RPCBaseErrors_1.RPCError(rpcError.errorMessage, request, rpcError.errorCode); } - exports2.withTimeout = withTimeout; + __exportStar2(require_Common(), exports2); + __exportStar2(require_RPCBaseErrors(), exports2); + __exportStar2(require_RPCErrorList(), exports2); } }); -// node_modules/async-mutex/lib/tryAcquire.js -var require_tryAcquire = __commonJS({ - "node_modules/async-mutex/lib/tryAcquire.js"(exports2) { +// node_modules/telegram/tl/core/TLMessage.js +var require_TLMessage = __commonJS({ + "node_modules/telegram/tl/core/TLMessage.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.tryAcquire = void 0; - var errors_1 = require_errors2(); - var withTimeout_1 = require_withTimeout(); - function tryAcquire(sync, alreadyAcquiredError) { - if (alreadyAcquiredError === void 0) { - alreadyAcquiredError = errors_1.E_ALREADY_LOCKED; + exports2.TLMessage = void 0; + var TLMessage = class { + constructor(msgId, seqNo, obj) { + this.msgId = msgId; + this.seqNo = seqNo; + this.obj = obj; + this.classType = "constructor"; } - return (0, withTimeout_1.withTimeout)(sync, 0, alreadyAcquiredError); - } - exports2.tryAcquire = tryAcquire; + }; + exports2.TLMessage = TLMessage; + TLMessage.SIZE_OVERHEAD = 12; + TLMessage.classType = "constructor"; } }); -// node_modules/async-mutex/lib/index.js -var require_lib12 = __commonJS({ - "node_modules/async-mutex/lib/index.js"(exports2) { +// node_modules/telegram/tl/core/RPCResult.js +var require_RPCResult = __commonJS({ + "node_modules/telegram/tl/core/RPCResult.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.tryAcquire = exports2.withTimeout = exports2.Semaphore = exports2.Mutex = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var Mutex_1 = require_Mutex(); - Object.defineProperty(exports2, "Mutex", { enumerable: true, get: function() { - return Mutex_1.default; - } }); - var Semaphore_1 = require_Semaphore(); - Object.defineProperty(exports2, "Semaphore", { enumerable: true, get: function() { - return Semaphore_1.default; - } }); - var withTimeout_1 = require_withTimeout(); - Object.defineProperty(exports2, "withTimeout", { enumerable: true, get: function() { - return withTimeout_1.withTimeout; - } }); - var tryAcquire_1 = require_tryAcquire(); - Object.defineProperty(exports2, "tryAcquire", { enumerable: true, get: function() { - return tryAcquire_1.tryAcquire; - } }); - (0, tslib_1.__exportStar)(require_errors2(), exports2); + exports2.RPCResult = void 0; + var api_1 = require_api(); + var _1 = require_core(); + var RPCResult = class _RPCResult { + constructor(reqMsgId, body, error) { + this.CONSTRUCTOR_ID = 4082920705; + this.reqMsgId = reqMsgId; + this.body = body; + this.error = error; + this.classType = "constructor"; + } + static async fromReader(reader) { + const msgId = reader.readLong(); + const innerCode = reader.readInt(false); + if (innerCode === api_1.Api.RpcError.CONSTRUCTOR_ID) { + return new _RPCResult(msgId, void 0, api_1.Api.RpcError.fromReader(reader)); + } + if (innerCode === _1.GZIPPacked.CONSTRUCTOR_ID) { + return new _RPCResult(msgId, (await _1.GZIPPacked.fromReader(reader)).data); + } + reader.seek(-4); + return new _RPCResult(msgId, reader.read(), void 0); + } + }; + exports2.RPCResult = RPCResult; + RPCResult.CONSTRUCTOR_ID = 4082920705; + RPCResult.classType = "constructor"; } }); -// node_modules/telegram/extensions/PromisedWebSockets.js -var require_PromisedWebSockets = __commonJS({ - "node_modules/telegram/extensions/PromisedWebSockets.js"(exports2) { +// node_modules/telegram/tl/core/MessageContainer.js +var require_MessageContainer = __commonJS({ + "node_modules/telegram/tl/core/MessageContainer.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PromisedWebSockets = void 0; - var websocket_1 = require_websocket2(); - var async_mutex_1 = require_lib12(); - var platform_1 = require_platform(); - var mutex = new async_mutex_1.Mutex(); - var closeError = new Error("WebSocket was closed"); - var PromisedWebSockets = class { - constructor() { - this.client = void 0; - this.stream = Buffer.alloc(0); - this.closed = true; + exports2.MessageContainer = void 0; + var TLMessage_1 = require_TLMessage(); + var MessageContainer = class _MessageContainer { + constructor(messages) { + this.CONSTRUCTOR_ID = 1945237724; + this.messages = messages; + this.classType = "constructor"; } - async readExactly(number) { - let readData = Buffer.alloc(0); - while (true) { - const thisTime = await this.read(number); - readData = Buffer.concat([readData, thisTime]); - number = number - thisTime.length; - if (!number) { - return readData; - } + static async fromReader(reader) { + const messages = []; + const length = reader.readInt(); + for (let x = 0; x < length; x++) { + const msgId = reader.readLong(); + const seqNo = reader.readInt(); + const length2 = reader.readInt(); + const before = reader.tellPosition(); + const obj = reader.tgReadObject(); + reader.setPosition(before + length2); + const tlMessage = new TLMessage_1.TLMessage(msgId, seqNo, obj); + messages.push(tlMessage); } + return new _MessageContainer(messages); } - async read(number) { - if (this.closed) { - throw closeError; - } - await this.canRead; - if (this.closed) { - throw closeError; - } - const toReturn = this.stream.slice(0, number); - this.stream = this.stream.slice(number); - if (this.stream.length === 0) { - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - } - return toReturn; + }; + exports2.MessageContainer = MessageContainer; + MessageContainer.CONSTRUCTOR_ID = 1945237724; + MessageContainer.classType = "constructor"; + MessageContainer.MAXIMUM_SIZE = 1044456 - 8; + MessageContainer.MAXIMUM_LENGTH = 100; + } +}); + +// node_modules/pako/lib/zlib/trees.js +var require_trees = __commonJS({ + "node_modules/pako/lib/zlib/trees.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var Z_FIXED = 4; + var Z_BINARY = 0; + var Z_TEXT = 1; + var Z_UNKNOWN = 2; + function zero(buf) { + let len = buf.length; + while (--len >= 0) { + buf[len] = 0; } - async readAll() { - if (this.closed || !await this.canRead) { - throw closeError; - } - const toReturn = this.stream; - this.stream = Buffer.alloc(0); - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - return toReturn; + } + var STORED_BLOCK = 0; + var STATIC_TREES = 1; + var DYN_TREES = 2; + var MIN_MATCH = 3; + var MAX_MATCH = 258; + var LENGTH_CODES = 29; + var LITERALS = 256; + var L_CODES = LITERALS + 1 + LENGTH_CODES; + var D_CODES = 30; + var BL_CODES = 19; + var HEAP_SIZE = 2 * L_CODES + 1; + var MAX_BITS = 15; + var Buf_size = 16; + var MAX_BL_BITS = 7; + var END_BLOCK = 256; + var REP_3_6 = 16; + var REPZ_3_10 = 17; + var REPZ_11_138 = 18; + var extra_lbits = ( + /* extra bits for each length code */ + new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) + ); + var extra_dbits = ( + /* extra bits for each distance code */ + new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) + ); + var extra_blbits = ( + /* extra bits for each bit length code */ + new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) + ); + var bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); + var DIST_CODE_LEN = 512; + var static_ltree = new Array((L_CODES + 2) * 2); + zero(static_ltree); + var static_dtree = new Array(D_CODES * 2); + zero(static_dtree); + var _dist_code = new Array(DIST_CODE_LEN); + zero(_dist_code); + var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); + zero(_length_code); + var base_length = new Array(LENGTH_CODES); + zero(base_length); + var base_dist = new Array(D_CODES); + zero(base_dist); + function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + this.static_tree = static_tree; + this.extra_bits = extra_bits; + this.extra_base = extra_base; + this.elems = elems; + this.max_length = max_length; + this.has_stree = static_tree && static_tree.length; + } + var static_l_desc; + var static_d_desc; + var static_bl_desc; + function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; + this.max_code = 0; + this.stat_desc = stat_desc; + } + var d_code = (dist) => { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; + }; + var put_short = (s, w) => { + s.pending_buf[s.pending++] = w & 255; + s.pending_buf[s.pending++] = w >>> 8 & 255; + }; + var send_bits = (s, value, length) => { + if (s.bi_valid > Buf_size - length) { + s.bi_buf |= value << s.bi_valid & 65535; + put_short(s, s.bi_buf); + s.bi_buf = value >> Buf_size - s.bi_valid; + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= value << s.bi_valid & 65535; + s.bi_valid += length; } - getWebSocketLink(ip, port, testServers) { - if (port === 443) { - return `wss://${ip}:${port}/apiws${testServers ? "_test" : ""}`; - } else { - return `ws://${ip}:${port}/apiws${testServers ? "_test" : ""}`; - } + }; + var send_code = (s, c, tree) => { + send_bits( + s, + tree[c * 2], + tree[c * 2 + 1] + /*.Len*/ + ); + }; + var bi_reverse = (code, len) => { + let res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; + }; + var bi_flush = (s) => { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 255; + s.bi_buf >>= 8; + s.bi_valid -= 8; } - async connect(port, ip, testServers = false) { - this.stream = Buffer.alloc(0); - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - this.closed = false; - this.website = this.getWebSocketLink(ip, port, testServers); - this.client = new websocket_1.w3cwebsocket(this.website, "binary"); - return new Promise((resolve, reject) => { - if (this.client) { - this.client.onopen = () => { - this.receive(); - resolve(this); - }; - this.client.onerror = (error) => { - reject(error); - }; - this.client.onclose = () => { - if (this.resolveRead) { - this.resolveRead(false); - } - this.closed = true; - }; - if (platform_1.isBrowser) { - window.addEventListener("offline", async () => { - await this.close(); - if (this.resolveRead) { - this.resolveRead(false); - } - }); - } - } - }); + }; + var gen_bitlen = (s, desc) => { + const tree = desc.dyn_tree; + const max_code = desc.max_code; + const stree = desc.stat_desc.static_tree; + const has_stree = desc.stat_desc.has_stree; + const extra = desc.stat_desc.extra_bits; + const base = desc.stat_desc.extra_base; + const max_length = desc.stat_desc.max_length; + let h; + let n, m; + let bits; + let xbits; + let f; + let overflow = 0; + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; } - write(data) { - if (this.closed) { - throw closeError; - } - if (this.client) { - this.client.send(data); + tree[s.heap[s.heap_max] * 2 + 1] = 0; + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; + if (bits > max_length) { + bits = max_length; + overflow++; } - } - async close() { - if (this.client) { - await this.client.close(); + tree[n * 2 + 1] = bits; + if (n > max_code) { + continue; } - this.closed = true; - } - async receive() { - if (this.client) { - this.client.onmessage = async (message) => { - const release = await mutex.acquire(); - try { - let data; - data = Buffer.from(await new Response(message.data).arrayBuffer()); - this.stream = Buffer.concat([this.stream, data]); - if (this.resolveRead) { - this.resolveRead(true); - } - } finally { - release(); - } - }; + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1] + xbits); } } - toString() { - return "PromisedWebSocket"; + if (overflow === 0) { + return; } - }; - exports2.PromisedWebSockets = PromisedWebSockets; - } -}); - -// node_modules/telegram/extensions/net.js -var require_net = __commonJS({ - "node_modules/telegram/extensions/net.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { + bits--; + } + s.bl_count[bits]--; + s.bl_count[bits + 1] += 2; + s.bl_count[max_length]--; + overflow -= 2; + } while (overflow > 0); + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { + continue; + } + if (tree[m * 2 + 1] !== bits) { + s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2]; + tree[m * 2 + 1] = bits; + } + n--; + } } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - __exportStar2(require("net"), exports2); - } -}); - -// node_modules/smart-buffer/build/utils.js -var require_utils5 = __commonJS({ - "node_modules/smart-buffer/build/utils.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - var buffer_1 = require("buffer"); - var ERRORS2 = { - INVALID_ENCODING: "Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.", - INVALID_SMARTBUFFER_SIZE: "Invalid size provided. Size must be a valid integer greater than zero.", - INVALID_SMARTBUFFER_BUFFER: "Invalid Buffer provided in SmartBufferOptions.", - INVALID_SMARTBUFFER_OBJECT: "Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.", - INVALID_OFFSET: "An invalid offset value was provided.", - INVALID_OFFSET_NON_NUMBER: "An invalid offset value was provided. A numeric value is required.", - INVALID_LENGTH: "An invalid length value was provided.", - INVALID_LENGTH_NON_NUMBER: "An invalid length value was provived. A numeric value is required.", - INVALID_TARGET_OFFSET: "Target offset is beyond the bounds of the internal SmartBuffer data.", - INVALID_TARGET_LENGTH: "Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.", - INVALID_READ_BEYOND_BOUNDS: "Attempted to read beyond the bounds of the managed data.", - INVALID_WRITE_BEYOND_BOUNDS: "Attempted to write beyond the bounds of the managed data." }; - exports2.ERRORS = ERRORS2; - function checkEncoding(encoding) { - if (!buffer_1.Buffer.isEncoding(encoding)) { - throw new Error(ERRORS2.INVALID_ENCODING); + var gen_codes = (tree, max_code, bl_count) => { + const next_code = new Array(MAX_BITS + 1); + let code = 0; + let bits; + let n; + for (bits = 1; bits <= MAX_BITS; bits++) { + code = code + bl_count[bits - 1] << 1; + next_code[bits] = code; } - } - exports2.checkEncoding = checkEncoding; - function isFiniteInteger(value) { - return typeof value === "number" && isFinite(value) && isInteger(value); - } - exports2.isFiniteInteger = isFiniteInteger; - function checkOffsetOrLengthValue(value, offset) { - if (typeof value === "number") { - if (!isFiniteInteger(value) || value < 0) { - throw new Error(offset ? ERRORS2.INVALID_OFFSET : ERRORS2.INVALID_LENGTH); + for (n = 0; n <= max_code; n++) { + let len = tree[n * 2 + 1]; + if (len === 0) { + continue; } - } else { - throw new Error(offset ? ERRORS2.INVALID_OFFSET_NON_NUMBER : ERRORS2.INVALID_LENGTH_NON_NUMBER); - } - } - function checkLengthValue(length) { - checkOffsetOrLengthValue(length, false); - } - exports2.checkLengthValue = checkLengthValue; - function checkOffsetValue(offset) { - checkOffsetOrLengthValue(offset, true); - } - exports2.checkOffsetValue = checkOffsetValue; - function checkTargetOffset(offset, buff) { - if (offset < 0 || offset > buff.length) { - throw new Error(ERRORS2.INVALID_TARGET_OFFSET); - } - } - exports2.checkTargetOffset = checkTargetOffset; - function isInteger(value) { - return typeof value === "number" && isFinite(value) && Math.floor(value) === value; - } - function bigIntAndBufferInt64Check(bufferMethod) { - if (typeof BigInt === "undefined") { - throw new Error("Platform does not support JS BigInt type."); - } - if (typeof buffer_1.Buffer.prototype[bufferMethod] === "undefined") { - throw new Error(`Platform does not support Buffer.prototype.${bufferMethod}.`); + tree[n * 2] = bi_reverse(next_code[len]++, len); } - } - exports2.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check; - } -}); - -// node_modules/smart-buffer/build/smartbuffer.js -var require_smartbuffer = __commonJS({ - "node_modules/smart-buffer/build/smartbuffer.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - var utils_1 = require_utils5(); - var DEFAULT_SMARTBUFFER_SIZE = 4096; - var DEFAULT_SMARTBUFFER_ENCODING = "utf8"; - var SmartBuffer = class _SmartBuffer { - /** - * Creates a new SmartBuffer instance. - * - * @param options { SmartBufferOptions } The SmartBufferOptions to apply to this instance. - */ - constructor(options) { - this.length = 0; - this._encoding = DEFAULT_SMARTBUFFER_ENCODING; - this._writeOffset = 0; - this._readOffset = 0; - if (_SmartBuffer.isSmartBufferOptions(options)) { - if (options.encoding) { - utils_1.checkEncoding(options.encoding); - this._encoding = options.encoding; - } - if (options.size) { - if (utils_1.isFiniteInteger(options.size) && options.size > 0) { - this._buff = Buffer.allocUnsafe(options.size); - } else { - throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_SIZE); - } - } else if (options.buff) { - if (Buffer.isBuffer(options.buff)) { - this._buff = options.buff; - this.length = options.buff.length; - } else { - throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_BUFFER); - } - } else { - this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); - } - } else { - if (typeof options !== "undefined") { - throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_OBJECT); - } - this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + }; + var tr_static_init = () => { + let n; + let bits; + let length; + let code; + let dist; + const bl_count = new Array(MAX_BITS + 1); + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < 1 << extra_lbits[code]; n++) { + _length_code[length++] = code; } } - /** - * Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding. - * - * @param size { Number } The size of the internal Buffer. - * @param encoding { String } The BufferEncoding to use for strings. - * - * @return { SmartBuffer } - */ - static fromSize(size, encoding) { - return new this({ - size, - encoding - }); + _length_code[length - 1] = code; + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < 1 << extra_dbits[code]; n++) { + _dist_code[dist++] = code; + } } - /** - * Creates a new SmartBuffer instance with the provided Buffer and optional encoding. - * - * @param buffer { Buffer } The Buffer to use as the internal Buffer value. - * @param encoding { String } The BufferEncoding to use for strings. - * - * @return { SmartBuffer } - */ - static fromBuffer(buff, encoding) { - return new this({ - buff, - encoding - }); + dist >>= 7; + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { + _dist_code[256 + dist++] = code; + } } - /** - * Creates a new SmartBuffer instance with the provided SmartBufferOptions options. - * - * @param options { SmartBufferOptions } The options to use when creating the SmartBuffer instance. - */ - static fromOptions(options) { - return new this(options); + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; } - /** - * Type checking function that determines if an object is a SmartBufferOptions object. - */ - static isSmartBufferOptions(options) { - const castOptions = options; - return castOptions && (castOptions.encoding !== void 0 || castOptions.size !== void 0 || castOptions.buff !== void 0); + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; } - // Signed integers - /** - * Reads an Int8 value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readInt8(offset) { - return this._readNumberValue(Buffer.prototype.readInt8, 1, offset); + while (n <= 255) { + static_ltree[n * 2 + 1] = 9; + n++; + bl_count[9]++; } - /** - * Reads an Int16BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readInt16BE(offset) { - return this._readNumberValue(Buffer.prototype.readInt16BE, 2, offset); + while (n <= 279) { + static_ltree[n * 2 + 1] = 7; + n++; + bl_count[7]++; } - /** - * Reads an Int16LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readInt16LE(offset) { - return this._readNumberValue(Buffer.prototype.readInt16LE, 2, offset); + while (n <= 287) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; } - /** - * Reads an Int32BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readInt32BE(offset) { - return this._readNumberValue(Buffer.prototype.readInt32BE, 4, offset); + gen_codes(static_ltree, L_CODES + 1, bl_count); + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1] = 5; + static_dtree[n * 2] = bi_reverse(n, 5); } - /** - * Reads an Int32LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readInt32LE(offset) { - return this._readNumberValue(Buffer.prototype.readInt32LE, 4, offset); + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + }; + var init_block = (s) => { + let n; + for (n = 0; n < L_CODES; n++) { + s.dyn_ltree[n * 2] = 0; } - /** - * Reads a BigInt64BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { BigInt } - */ - readBigInt64BE(offset) { - utils_1.bigIntAndBufferInt64Check("readBigInt64BE"); - return this._readNumberValue(Buffer.prototype.readBigInt64BE, 8, offset); + for (n = 0; n < D_CODES; n++) { + s.dyn_dtree[n * 2] = 0; } - /** - * Reads a BigInt64LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { BigInt } - */ - readBigInt64LE(offset) { - utils_1.bigIntAndBufferInt64Check("readBigInt64LE"); - return this._readNumberValue(Buffer.prototype.readBigInt64LE, 8, offset); + for (n = 0; n < BL_CODES; n++) { + s.bl_tree[n * 2] = 0; } - /** - * Writes an Int8 value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeInt8(value, offset) { - this._writeNumberValue(Buffer.prototype.writeInt8, 1, value, offset); - return this; + s.dyn_ltree[END_BLOCK * 2] = 1; + s.opt_len = s.static_len = 0; + s.sym_next = s.matches = 0; + }; + var bi_windup = (s) => { + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + s.pending_buf[s.pending++] = s.bi_buf; } - /** - * Inserts an Int8 value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertInt8(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + s.bi_buf = 0; + s.bi_valid = 0; + }; + var smaller = (tree, n, m, depth) => { + const _n2 = n * 2; + const _m2 = m * 2; + return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m]; + }; + var pqdownheap = (s, tree, k) => { + const v = s.heap[k]; + let j = k << 1; + while (j <= s.heap_len) { + if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + if (smaller(tree, v, s.heap[j], s.depth)) { + break; + } + s.heap[k] = s.heap[j]; + k = j; + j <<= 1; } - /** - * Writes an Int16BE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeInt16BE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + s.heap[k] = v; + }; + var compress_block = (s, ltree, dtree) => { + let dist; + let lc; + let sx = 0; + let code; + let extra; + if (s.sym_next !== 0) { + do { + dist = s.pending_buf[s.sym_buf + sx++] & 255; + dist += (s.pending_buf[s.sym_buf + sx++] & 255) << 8; + lc = s.pending_buf[s.sym_buf + sx++]; + if (dist === 0) { + send_code(s, lc, ltree); + } else { + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); + } + dist--; + code = d_code(dist); + send_code(s, code, dtree); + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); + } + } + } while (sx < s.sym_next); } - /** - * Inserts an Int16BE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertInt16BE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + send_code(s, END_BLOCK, ltree); + }; + var build_tree = (s, desc) => { + const tree = desc.dyn_tree; + const stree = desc.stat_desc.static_tree; + const has_stree = desc.stat_desc.has_stree; + const elems = desc.stat_desc.elems; + let n, m; + let max_code = -1; + let node; + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + for (n = 0; n < elems; n++) { + if (tree[n * 2] !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + } else { + tree[n * 2 + 1] = 0; + } } - /** - * Writes an Int16LE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeInt16LE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; + tree[node * 2] = 1; + s.depth[node] = 0; + s.opt_len--; + if (has_stree) { + s.static_len -= stree[node * 2 + 1]; + } } - /** - * Inserts an Int16LE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertInt16LE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + desc.max_code = max_code; + for (n = s.heap_len >> 1; n >= 1; n--) { + pqdownheap(s, tree, n); } - /** - * Writes an Int32BE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeInt32BE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + node = elems; + do { + n = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[ + 1 + /*SMALLEST*/ + ] = s.heap[s.heap_len--]; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + m = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[--s.heap_max] = n; + s.heap[--s.heap_max] = m; + tree[node * 2] = tree[n * 2] + tree[m * 2]; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1] = tree[m * 2 + 1] = node; + s.heap[ + 1 + /*SMALLEST*/ + ] = node++; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + } while (s.heap_len >= 2); + s.heap[--s.heap_max] = s.heap[ + 1 + /*SMALLEST*/ + ]; + gen_bitlen(s, desc); + gen_codes(tree, max_code, s.bl_count); + }; + var scan_tree = (s, tree, max_code) => { + let n; + let prevlen = -1; + let curlen; + let nextlen = tree[0 * 2 + 1]; + let count = 0; + let max_count = 7; + let min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; } - /** - * Inserts an Int32BE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertInt32BE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + tree[(max_code + 1) * 2 + 1] = 65535; + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + s.bl_tree[curlen * 2] += count; + } else if (curlen !== 0) { + if (curlen !== prevlen) { + s.bl_tree[curlen * 2]++; + } + s.bl_tree[REP_3_6 * 2]++; + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]++; + } else { + s.bl_tree[REPZ_11_138 * 2]++; + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } } - /** - * Writes an Int32LE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeInt32LE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + }; + var send_tree = (s, tree, max_code) => { + let n; + let prevlen = -1; + let curlen; + let nextlen = tree[0 * 2 + 1]; + let count = 0; + let max_count = 7; + let min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; } - /** - * Inserts an Int32LE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertInt32LE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + do { + send_code(s, curlen, s.bl_tree); + } while (--count !== 0); + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } } - /** - * Writes a BigInt64BE value to the current write position (or at optional offset). - * - * @param value { BigInt } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeBigInt64BE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigInt64BE"); - return this._writeNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + }; + var build_bl_tree = (s) => { + let max_blindex; + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + build_tree(s, s.bl_desc); + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { + break; + } } - /** - * Inserts a BigInt64BE value at the given offset value. - * - * @param value { BigInt } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertBigInt64BE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigInt64BE"); - return this._insertNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + return max_blindex; + }; + var send_all_trees = (s, lcodes, dcodes, blcodes) => { + let rank; + send_bits(s, lcodes - 257, 5); + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); + for (rank = 0; rank < blcodes; rank++) { + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3); } - /** - * Writes a BigInt64LE value to the current write position (or at optional offset). - * - * @param value { BigInt } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeBigInt64LE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigInt64LE"); - return this._writeNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + send_tree(s, s.dyn_ltree, lcodes - 1); + send_tree(s, s.dyn_dtree, dcodes - 1); + }; + var detect_data_type = (s) => { + let block_mask = 4093624447; + let n; + for (n = 0; n <= 31; n++, block_mask >>>= 1) { + if (block_mask & 1 && s.dyn_ltree[n * 2] !== 0) { + return Z_BINARY; + } } - /** - * Inserts a Int64LE value at the given offset value. - * - * @param value { BigInt } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertBigInt64LE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigInt64LE"); - return this._insertNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { + return Z_TEXT; } - // Unsigned Integers - /** - * Reads an UInt8 value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readUInt8(offset) { - return this._readNumberValue(Buffer.prototype.readUInt8, 1, offset); + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2] !== 0) { + return Z_TEXT; + } } - /** - * Reads an UInt16BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readUInt16BE(offset) { - return this._readNumberValue(Buffer.prototype.readUInt16BE, 2, offset); + return Z_BINARY; + }; + var static_init_done = false; + var _tr_init = (s) => { + if (!static_init_done) { + tr_static_init(); + static_init_done = true; } - /** - * Reads an UInt16LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readUInt16LE(offset) { - return this._readNumberValue(Buffer.prototype.readUInt16LE, 2, offset); + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + s.bi_buf = 0; + s.bi_valid = 0; + init_block(s); + }; + var _tr_stored_block = (s, buf, stored_len, last) => { + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); + bi_windup(s); + put_short(s, stored_len); + put_short(s, ~stored_len); + if (stored_len) { + s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending); } - /** - * Reads an UInt32BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readUInt32BE(offset) { - return this._readNumberValue(Buffer.prototype.readUInt32BE, 4, offset); + s.pending += stored_len; + }; + var _tr_align = (s) => { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); + }; + var _tr_flush_block = (s, buf, stored_len, last) => { + let opt_lenb, static_lenb; + let max_blindex = 0; + if (s.level > 0) { + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + build_tree(s, s.l_desc); + build_tree(s, s.d_desc); + max_blindex = build_bl_tree(s); + opt_lenb = s.opt_len + 3 + 7 >>> 3; + static_lenb = s.static_len + 3 + 7 >>> 3; + if (static_lenb <= opt_lenb) { + opt_lenb = static_lenb; + } + } else { + opt_lenb = static_lenb = stored_len + 5; } - /** - * Reads an UInt32LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readUInt32LE(offset) { - return this._readNumberValue(Buffer.prototype.readUInt32LE, 4, offset); + if (stored_len + 4 <= opt_lenb && buf !== -1) { + _tr_stored_block(s, buf, stored_len, last); + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); } - /** - * Reads a BigUInt64BE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { BigInt } - */ - readBigUInt64BE(offset) { - utils_1.bigIntAndBufferInt64Check("readBigUInt64BE"); - return this._readNumberValue(Buffer.prototype.readBigUInt64BE, 8, offset); + init_block(s); + if (last) { + bi_windup(s); } - /** - * Reads a BigUInt64LE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { BigInt } - */ - readBigUInt64LE(offset) { - utils_1.bigIntAndBufferInt64Check("readBigUInt64LE"); - return this._readNumberValue(Buffer.prototype.readBigUInt64LE, 8, offset); + }; + var _tr_tally = (s, dist, lc) => { + s.pending_buf[s.sym_buf + s.sym_next++] = dist; + s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8; + s.pending_buf[s.sym_buf + s.sym_next++] = lc; + if (dist === 0) { + s.dyn_ltree[lc * 2]++; + } else { + s.matches++; + dist--; + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++; + s.dyn_dtree[d_code(dist) * 2]++; } - /** - * Writes an UInt8 value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeUInt8(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + return s.sym_next === s.sym_end; + }; + module2.exports._tr_init = _tr_init; + module2.exports._tr_stored_block = _tr_stored_block; + module2.exports._tr_flush_block = _tr_flush_block; + module2.exports._tr_tally = _tr_tally; + module2.exports._tr_align = _tr_align; + } +}); + +// node_modules/pako/lib/zlib/adler32.js +var require_adler32 = __commonJS({ + "node_modules/pako/lib/zlib/adler32.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var adler32 = (adler, buf, len, pos) => { + let s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; + while (len !== 0) { + n = len > 2e3 ? 2e3 : len; + len -= n; + do { + s1 = s1 + buf[pos++] | 0; + s2 = s2 + s1 | 0; + } while (--n); + s1 %= 65521; + s2 %= 65521; } - /** - * Inserts an UInt8 value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertUInt8(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + return s1 | s2 << 16 | 0; + }; + module2.exports = adler32; + } +}); + +// node_modules/pako/lib/zlib/crc32.js +var require_crc32 = __commonJS({ + "node_modules/pako/lib/zlib/crc32.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var makeTable = () => { + let c, table = []; + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; + } + table[n] = c; } - /** - * Writes an UInt16BE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeUInt16BE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + return table; + }; + var crcTable = new Uint32Array(makeTable()); + var crc32 = (crc, buf, len, pos) => { + const t = crcTable; + const end = pos + len; + crc ^= -1; + for (let i = pos; i < end; i++) { + crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; } - /** - * Inserts an UInt16BE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertUInt16BE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + return crc ^ -1; + }; + module2.exports = crc32; + } +}); + +// node_modules/pako/lib/zlib/messages.js +var require_messages = __commonJS({ + "node_modules/pako/lib/zlib/messages.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + module2.exports = { + 2: "need dictionary", + /* Z_NEED_DICT 2 */ + 1: "stream end", + /* Z_STREAM_END 1 */ + 0: "", + /* Z_OK 0 */ + "-1": "file error", + /* Z_ERRNO (-1) */ + "-2": "stream error", + /* Z_STREAM_ERROR (-2) */ + "-3": "data error", + /* Z_DATA_ERROR (-3) */ + "-4": "insufficient memory", + /* Z_MEM_ERROR (-4) */ + "-5": "buffer error", + /* Z_BUF_ERROR (-5) */ + "-6": "incompatible version" + /* Z_VERSION_ERROR (-6) */ + }; + } +}); + +// node_modules/pako/lib/zlib/constants.js +var require_constants2 = __commonJS({ + "node_modules/pako/lib/zlib/constants.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + module2.exports = { + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type + }; + } +}); + +// node_modules/pako/lib/zlib/deflate.js +var require_deflate = __commonJS({ + "node_modules/pako/lib/zlib/deflate.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require_trees(); + var adler32 = require_adler32(); + var crc32 = require_crc32(); + var msg = require_messages(); + var { + Z_NO_FLUSH, + Z_PARTIAL_FLUSH, + Z_FULL_FLUSH, + Z_FINISH, + Z_BLOCK, + Z_OK, + Z_STREAM_END, + Z_STREAM_ERROR, + Z_DATA_ERROR, + Z_BUF_ERROR, + Z_DEFAULT_COMPRESSION, + Z_FILTERED, + Z_HUFFMAN_ONLY, + Z_RLE, + Z_FIXED, + Z_DEFAULT_STRATEGY, + Z_UNKNOWN, + Z_DEFLATED + } = require_constants2(); + var MAX_MEM_LEVEL = 9; + var MAX_WBITS = 15; + var DEF_MEM_LEVEL = 8; + var LENGTH_CODES = 29; + var LITERALS = 256; + var L_CODES = LITERALS + 1 + LENGTH_CODES; + var D_CODES = 30; + var BL_CODES = 19; + var HEAP_SIZE = 2 * L_CODES + 1; + var MAX_BITS = 15; + var MIN_MATCH = 3; + var MAX_MATCH = 258; + var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; + var PRESET_DICT = 32; + var INIT_STATE = 42; + var GZIP_STATE = 57; + var EXTRA_STATE = 69; + var NAME_STATE = 73; + var COMMENT_STATE = 91; + var HCRC_STATE = 103; + var BUSY_STATE = 113; + var FINISH_STATE = 666; + var BS_NEED_MORE = 1; + var BS_BLOCK_DONE = 2; + var BS_FINISH_STARTED = 3; + var BS_FINISH_DONE = 4; + var OS_CODE = 3; + var err = (strm, errorCode) => { + strm.msg = msg[errorCode]; + return errorCode; + }; + var rank = (f) => { + return f * 2 - (f > 4 ? 9 : 0); + }; + var zero = (buf) => { + let len = buf.length; + while (--len >= 0) { + buf[len] = 0; } - /** - * Writes an UInt16LE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeUInt16LE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + }; + var slide_hash = (s) => { + let n, m; + let p; + let wsize = s.w_size; + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = m >= wsize ? m - wsize : 0; + } while (--n); + n = wsize; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = m >= wsize ? m - wsize : 0; + } while (--n); + }; + var HASH = (s, prev, data) => (prev << s.hash_shift ^ data) & s.hash_mask; + var INSERT_STRING = (s, str) => { + let h; + if (s.legacy_hash) { + h = s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); + } else { + const w = s.window; + const value = w[str] | w[str + 1] << 8 | w[str + 2] << 16 | w[str + 3] << 24; + h = s.ins_h = Math.imul(value, 66521) + 66521 >>> 16 & s.hash_mask; } - /** - * Inserts an UInt16LE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertUInt16LE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + const hash_head = s.prev[str & s.w_mask] = s.head[h]; + s.head[h] = str; + return hash_head; + }; + var flush_pending = (strm) => { + const s = strm.state; + let len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; } - /** - * Writes an UInt32BE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeUInt32BE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + if (len === 0) { + return; } - /** - * Inserts an UInt32BE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertUInt32BE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; } - /** - * Writes an UInt32LE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeUInt32LE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + }; + var flush_block_only = (s, last) => { + _tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); + }; + var put_byte = (s, b) => { + s.pending_buf[s.pending++] = b; + }; + var putShortMSB = (s, b) => { + s.pending_buf[s.pending++] = b >>> 8 & 255; + s.pending_buf[s.pending++] = b & 255; + }; + var read_buf = (strm, buf, start, size) => { + let len = strm.avail_in; + if (len > size) { + len = size; } - /** - * Inserts an UInt32LE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertUInt32LE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + if (len === 0) { + return 0; } - /** - * Writes a BigUInt64BE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeBigUInt64BE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigUInt64BE"); - return this._writeNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + strm.avail_in -= len; + buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); } - /** - * Inserts a BigUInt64BE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertBigUInt64BE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigUInt64BE"); - return this._insertNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + strm.next_in += len; + strm.total_in += len; + return len; + }; + var longest_match = (s, cur_match) => { + let chain_length = s.max_chain_length; + let scan = s.strstart; + let match; + let len; + let best_len = s.prev_length; + let nice_match = s.nice_match; + const limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; + const _win = s.window; + const wmask = s.w_mask; + const prev = s.prev; + const strend = s.strstart + MAX_MATCH; + let scan_end1 = _win[scan + best_len - 1]; + let scan_end = _win[scan + best_len]; + if (s.prev_length >= s.good_match) { + chain_length >>= 2; } - /** - * Writes a BigUInt64LE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeBigUInt64LE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigUInt64LE"); - return this._writeNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + if (nice_match > s.lookahead) { + nice_match = s.lookahead; } - /** - * Inserts a BigUInt64LE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertBigUInt64LE(value, offset) { - utils_1.bigIntAndBufferInt64Check("writeBigUInt64LE"); - return this._insertNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + do { + match = cur_match; + if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { + continue; + } + scan += 2; + match++; + do { + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + if (best_len <= s.lookahead) { + return best_len; } - // Floating Point - /** - * Reads an FloatBE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readFloatBE(offset) { - return this._readNumberValue(Buffer.prototype.readFloatBE, 4, offset); + return s.lookahead; + }; + var fill_window = (s) => { + const _w_size = s.w_size; + let n, more, str; + do { + more = s.window_size - s.lookahead - s.strstart; + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + s.block_start -= _w_size; + if (s.insert > s.strstart) { + s.insert = s.strstart; + } + slide_hash(s); + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + if (!s.legacy_hash) { + if (s.lookahead + s.insert > MIN_MATCH) { + str = s.strstart - s.insert; + while (s.insert) { + INSERT_STRING(s, str); + str++; + s.insert--; + if (s.lookahead + s.insert <= MIN_MATCH) { + break; + } + } + } + } else if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + s.ins_h = HASH(s, s.ins_h, s.window[str + 1]); + while (s.insert) { + INSERT_STRING(s, str); + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + }; + var deflate_stored = (s, flush) => { + let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5; + let len, left, have, last = 0; + let used = s.strm.avail_in; + do { + len = 65535; + have = s.bi_valid + 42 >> 3; + if (s.strm.avail_out < have) { + break; + } + have = s.strm.avail_out - have; + left = s.strstart - s.block_start; + if (len > left + s.strm.avail_in) { + len = left + s.strm.avail_in; + } + if (len > have) { + len = have; + } + if (len < min_block && (len === 0 && flush !== Z_FINISH || flush === Z_NO_FLUSH || len !== left + s.strm.avail_in)) { + break; + } + last = flush === Z_FINISH && len === left + s.strm.avail_in ? 1 : 0; + _tr_stored_block(s, 0, 0, last); + s.pending_buf[s.pending - 4] = len; + s.pending_buf[s.pending - 3] = len >> 8; + s.pending_buf[s.pending - 2] = ~len; + s.pending_buf[s.pending - 1] = ~len >> 8; + flush_pending(s.strm); + if (left) { + if (left > len) { + left = len; + } + s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out); + s.strm.next_out += left; + s.strm.avail_out -= left; + s.strm.total_out += left; + s.block_start += left; + len -= left; + } + if (len) { + read_buf(s.strm, s.strm.output, s.strm.next_out, len); + s.strm.next_out += len; + s.strm.avail_out -= len; + s.strm.total_out += len; + } + } while (last === 0); + used -= s.strm.avail_in; + if (used) { + if (used >= s.w_size) { + s.matches = 2; + s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0); + s.strstart = s.w_size; + s.insert = s.strstart; + } else { + if (s.window_size - s.strstart <= used) { + s.strstart -= s.w_size; + s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); + if (s.matches < 2) { + s.matches++; + } + if (s.insert > s.strstart) { + s.insert = s.strstart; + } + } + s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart); + s.strstart += used; + s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used; + } + s.block_start = s.strstart; } - /** - * Reads an FloatLE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readFloatLE(offset) { - return this._readNumberValue(Buffer.prototype.readFloatLE, 4, offset); + if (s.high_water < s.strstart) { + s.high_water = s.strstart; } - /** - * Writes a FloatBE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeFloatBE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + if (last) { + return BS_FINISH_DONE; } - /** - * Inserts a FloatBE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertFloatBE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + if (flush !== Z_NO_FLUSH && flush !== Z_FINISH && s.strm.avail_in === 0 && s.strstart === s.block_start) { + return BS_BLOCK_DONE; } - /** - * Writes a FloatLE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeFloatLE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + have = s.window_size - s.strstart; + if (s.strm.avail_in > have && s.block_start >= s.w_size) { + s.block_start -= s.w_size; + s.strstart -= s.w_size; + s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); + if (s.matches < 2) { + s.matches++; + } + have += s.w_size; + if (s.insert > s.strstart) { + s.insert = s.strstart; + } } - /** - * Inserts a FloatLE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertFloatLE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + if (have > s.strm.avail_in) { + have = s.strm.avail_in; } - // Double Floating Point - /** - * Reads an DoublEBE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readDoubleBE(offset) { - return this._readNumberValue(Buffer.prototype.readDoubleBE, 8, offset); + if (have) { + read_buf(s.strm, s.window, s.strstart, have); + s.strstart += have; + s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have; } - /** - * Reads an DoubleLE value from the current read position or an optionally provided offset. - * - * @param offset { Number } The offset to read data from (optional) - * @return { Number } - */ - readDoubleLE(offset) { - return this._readNumberValue(Buffer.prototype.readDoubleLE, 8, offset); + if (s.high_water < s.strstart) { + s.high_water = s.strstart; } - /** - * Writes a DoubleBE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeDoubleBE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + have = s.bi_valid + 42 >> 3; + have = s.pending_buf_size - have > 65535 ? 65535 : s.pending_buf_size - have; + min_block = have > s.w_size ? s.w_size : have; + left = s.strstart - s.block_start; + if (left >= min_block || (left || flush === Z_FINISH) && flush !== Z_NO_FLUSH && s.strm.avail_in === 0 && left <= have) { + len = left > have ? have : left; + last = flush === Z_FINISH && s.strm.avail_in === 0 && len === left ? 1 : 0; + _tr_stored_block(s, s.block_start, len, last); + s.block_start += len; + flush_pending(s.strm); } - /** - * Inserts a DoubleBE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertDoubleBE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + return last ? BS_FINISH_STARTED : BS_NEED_MORE; + }; + var deflate_fast = (s, flush) => { + let hash_head; + let bflush; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + hash_head = INSERT_STRING(s, s.strstart); + } + if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + } + if (s.match_length >= MIN_MATCH) { + bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { + s.match_length--; + do { + s.strstart++; + hash_head = INSERT_STRING(s, s.strstart); + } while (--s.match_length !== 0); + s.strstart++; + } else { + s.strstart += s.match_length; + s.match_length = 0; + if (s.legacy_hash) { + s.ins_h = s.window[s.strstart]; + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]); + } + } + } else { + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } } - /** - * Writes a DoubleLE value to the current write position (or at optional offset). - * - * @param value { Number } The value to write. - * @param offset { Number } The offset to write the value at. - * - * @return this - */ - writeDoubleLE(value, offset) { - return this._writeNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; } - /** - * Inserts a DoubleLE value at the given offset value. - * - * @param value { Number } The value to insert. - * @param offset { Number } The offset to insert the value at. - * - * @return this - */ - insertDoubleLE(value, offset) { - return this._insertNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } } - // Strings - /** - * Reads a String from the current read position. - * - * @param arg1 { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for - * the string (Defaults to instance level encoding). - * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). - * - * @return { String } - */ - readString(arg1, encoding) { - let lengthVal; - if (typeof arg1 === "number") { - utils_1.checkLengthValue(arg1); - lengthVal = Math.min(arg1, this.length - this._readOffset); - } else { - encoding = arg1; - lengthVal = this.length - this._readOffset; + return BS_BLOCK_DONE; + }; + var deflate_slow = (s, flush) => { + let hash_head; + let bflush; + let max_insert; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } } - if (typeof encoding !== "undefined") { - utils_1.checkEncoding(encoding); + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + hash_head = INSERT_STRING(s, s.strstart); + } + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { + s.match_length = MIN_MATCH - 1; + } + } + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + hash_head = INSERT_STRING(s, s.strstart); + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } else if (s.match_available) { + bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); + if (bflush) { + flush_block_only(s, false); + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + s.match_available = 1; + s.strstart++; + s.lookahead--; } - const value = this._buff.slice(this._readOffset, this._readOffset + lengthVal).toString(encoding || this._encoding); - this._readOffset += lengthVal; - return value; } - /** - * Inserts a String - * - * @param value { String } The String value to insert. - * @param offset { Number } The offset to insert the string at. - * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). - * - * @return this - */ - insertString(value, offset, encoding) { - utils_1.checkOffsetValue(offset); - return this._handleString(value, true, offset, encoding); + if (s.match_available) { + bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); + s.match_available = 0; } - /** - * Writes a String - * - * @param value { String } The String value to write. - * @param arg2 { Number | String } The offset to write the string at, or the BufferEncoding to use. - * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). - * - * @return this - */ - writeString(value, arg2, encoding) { - return this._handleString(value, false, arg2, encoding); + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; } - /** - * Reads a null-terminated String from the current read position. - * - * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). - * - * @return { String } - */ - readStringNT(encoding) { - if (typeof encoding !== "undefined") { - utils_1.checkEncoding(encoding); + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; } - let nullPos = this.length; - for (let i = this._readOffset; i < this.length; i++) { - if (this._buff[i] === 0) { - nullPos = i; + } + return BS_BLOCK_DONE; + }; + var deflate_rle = (s, flush) => { + let bflush; + let prev; + let scan, strend; + const _win = s.window; + for (; ; ) { + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } } - const value = this._buff.slice(this._readOffset, nullPos); - this._readOffset = nullPos + 1; - return value.toString(encoding || this._encoding); + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + } + if (s.match_length >= MIN_MATCH) { + bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } } - /** - * Inserts a null-terminated String. - * - * @param value { String } The String value to write. - * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. - * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). - * - * @return this - */ - insertStringNT(value, offset, encoding) { - utils_1.checkOffsetValue(offset); - this.insertString(value, offset, encoding); - this.insertUInt8(0, offset + value.length); - return this; + s.insert = 0; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; } - /** - * Writes a null-terminated String. - * - * @param value { String } The String value to write. - * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. - * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). - * - * @return this - */ - writeStringNT(value, arg2, encoding) { - this.writeString(value, arg2, encoding); - this.writeUInt8(0, typeof arg2 === "number" ? arg2 + value.length : this.writeOffset); - return this; + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } } - // Buffers - /** - * Reads a Buffer from the internal read position. - * - * @param length { Number } The length of data to read as a Buffer. - * - * @return { Buffer } - */ - readBuffer(length) { - if (typeof length !== "undefined") { - utils_1.checkLengthValue(length); + return BS_BLOCK_DONE; + }; + var deflate_huff = (s, flush) => { + let bflush; + for (; ; ) { + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; + } + } + s.match_length = 0; + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } } - const lengthVal = typeof length === "number" ? length : this.length; - const endPoint = Math.min(this.length, this._readOffset + lengthVal); - const value = this._buff.slice(this._readOffset, endPoint); - this._readOffset = endPoint; - return value; } - /** - * Writes a Buffer to the current write position. - * - * @param value { Buffer } The Buffer to write. - * @param offset { Number } The offset to write the Buffer to. - * - * @return this - */ - insertBuffer(value, offset) { - utils_1.checkOffsetValue(offset); - return this._handleBuffer(value, true, offset); + s.insert = 0; + if (flush === Z_FINISH) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; + }; + function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; + } + var configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), + /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), + /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), + /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), + /* 3 */ + new Config(4, 4, 16, 16, deflate_slow), + /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), + /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), + /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), + /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), + /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) + /* 9 max compression */ + ]; + var lm_init = (s) => { + s.window_size = 2 * s.w_size; + zero(s.head); + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; + }; + function DeflateState() { + this.strm = null; + this.status = 0; + this.pending_buf = null; + this.pending_buf_size = 0; + this.pending_out = 0; + this.pending = 0; + this.wrap = 0; + this.gzhead = null; + this.gzindex = 0; + this.method = Z_DEFLATED; + this.last_flush = -1; + this.w_size = 0; + this.w_bits = 0; + this.w_mask = 0; + this.window = null; + this.window_size = 0; + this.prev = null; + this.head = null; + this.ins_h = 0; + this.legacy_hash = 0; + this.hash_size = 0; + this.hash_bits = 0; + this.hash_mask = 0; + this.hash_shift = 0; + this.block_start = 0; + this.match_length = 0; + this.prev_match = 0; + this.match_available = 0; + this.strstart = 0; + this.match_start = 0; + this.lookahead = 0; + this.prev_length = 0; + this.max_chain_length = 0; + this.max_lazy_match = 0; + this.level = 0; + this.strategy = 0; + this.good_match = 0; + this.nice_match = 0; + this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2); + this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2); + this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + this.l_desc = null; + this.d_desc = null; + this.bl_desc = null; + this.bl_count = new Uint16Array(MAX_BITS + 1); + this.heap = new Uint16Array(2 * L_CODES + 1); + zero(this.heap); + this.heap_len = 0; + this.heap_max = 0; + this.depth = new Uint16Array(2 * L_CODES + 1); + zero(this.depth); + this.sym_buf = 0; + this.lit_bufsize = 0; + this.sym_next = 0; + this.sym_end = 0; + this.opt_len = 0; + this.static_len = 0; + this.matches = 0; + this.insert = 0; + this.bi_buf = 0; + this.bi_valid = 0; + } + var deflateStateCheck = (strm) => { + if (!strm) { + return 1; } - /** - * Writes a Buffer to the current write position. - * - * @param value { Buffer } The Buffer to write. - * @param offset { Number } The offset to write the Buffer to. - * - * @return this - */ - writeBuffer(value, offset) { - return this._handleBuffer(value, false, offset); + const s = strm.state; + if (!s || s.strm !== strm || s.status !== INIT_STATE && //#ifdef GZIP + s.status !== GZIP_STATE && //#endif + s.status !== EXTRA_STATE && s.status !== NAME_STATE && s.status !== COMMENT_STATE && s.status !== HCRC_STATE && s.status !== BUSY_STATE && s.status !== FINISH_STATE) { + return 1; } - /** - * Reads a null-terminated Buffer from the current read poisiton. - * - * @return { Buffer } - */ - readBufferNT() { - let nullPos = this.length; - for (let i = this._readOffset; i < this.length; i++) { - if (this._buff[i] === 0) { - nullPos = i; - break; - } - } - const value = this._buff.slice(this._readOffset, nullPos); - this._readOffset = nullPos + 1; - return value; + return 0; + }; + var deflateResetKeep = (strm) => { + if (deflateStateCheck(strm)) { + return err(strm, Z_STREAM_ERROR); } - /** - * Inserts a null-terminated Buffer. - * - * @param value { Buffer } The Buffer to write. - * @param offset { Number } The offset to write the Buffer to. - * - * @return this - */ - insertBufferNT(value, offset) { - utils_1.checkOffsetValue(offset); - this.insertBuffer(value, offset); - this.insertUInt8(0, offset + value.length); - return this; + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + const s = strm.state; + s.pending = 0; + s.pending_out = 0; + if (s.wrap < 0) { + s.wrap = -s.wrap; } - /** - * Writes a null-terminated Buffer. - * - * @param value { Buffer } The Buffer to write. - * @param offset { Number } The offset to write the Buffer to. - * - * @return this - */ - writeBufferNT(value, offset) { - if (typeof offset !== "undefined") { - utils_1.checkOffsetValue(offset); - } - this.writeBuffer(value, offset); - this.writeUInt8(0, typeof offset === "number" ? offset + value.length : this._writeOffset); - return this; + s.status = //#ifdef GZIP + s.wrap === 2 ? GZIP_STATE : ( + //#endif + s.wrap ? INIT_STATE : BUSY_STATE + ); + strm.adler = s.wrap === 2 ? 0 : 1; + s.last_flush = -2; + _tr_init(s); + return Z_OK; + }; + var deflateReset = (strm) => { + const ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); } - /** - * Clears the SmartBuffer instance to its original empty state. - */ - clear() { - this._writeOffset = 0; - this._readOffset = 0; - this.length = 0; - return this; + return ret; + }; + var deflateSetHeader = (strm, head) => { + if (deflateStateCheck(strm) || strm.state.wrap !== 2) { + return Z_STREAM_ERROR; } - /** - * Gets the remaining data left to be read from the SmartBuffer instance. - * - * @return { Number } - */ - remaining() { - return this.length - this._readOffset; + strm.state.gzhead = head; + return Z_OK; + }; + var deflateInit2 = (strm, level, method, windowBits, memLevel, strategy, legacyHash) => { + if (!strm) { + return Z_STREAM_ERROR; } - /** - * Gets the current read offset value of the SmartBuffer instance. - * - * @return { Number } - */ - get readOffset() { - return this._readOffset; + let wrap = 1; + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; } - /** - * Sets the read offset value of the SmartBuffer instance. - * - * @param offset { Number } - The offset value to set. - */ - set readOffset(offset) { - utils_1.checkOffsetValue(offset); - utils_1.checkTargetOffset(offset, this); - this._readOffset = offset; + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else if (windowBits > 15) { + wrap = 2; + windowBits -= 16; } - /** - * Gets the current write offset value of the SmartBuffer instance. - * - * @return { Number } - */ - get writeOffset() { - return this._writeOffset; + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED || windowBits === 8 && wrap !== 1) { + return err(strm, Z_STREAM_ERROR); } - /** - * Sets the write offset value of the SmartBuffer instance. - * - * @param offset { Number } - The offset value to set. - */ - set writeOffset(offset) { - utils_1.checkOffsetValue(offset); - utils_1.checkTargetOffset(offset, this); - this._writeOffset = offset; + if (windowBits === 8) { + windowBits = 9; } - /** - * Gets the currently set string encoding of the SmartBuffer instance. - * - * @return { BufferEncoding } The string Buffer encoding currently set. - */ - get encoding() { - return this._encoding; + const s = new DeflateState(); + strm.state = s; + s.strm = strm; + s.status = INIT_STATE; + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + s.legacy_hash = legacyHash ? 1 : 0; + s.hash_bits = memLevel + 7; + if (!s.legacy_hash && s.hash_bits < 15) { + s.hash_bits = 15; } - /** - * Sets the string encoding of the SmartBuffer instance. - * - * @param encoding { BufferEncoding } The string Buffer encoding to set. - */ - set encoding(encoding) { - utils_1.checkEncoding(encoding); - this._encoding = encoding; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + s.window = new Uint8Array(s.w_size * 2); + s.head = new Uint16Array(s.hash_size); + s.prev = new Uint16Array(s.w_size); + s.lit_bufsize = 1 << memLevel + 6; + s.pending_buf_size = s.lit_bufsize * 4; + s.pending_buf = new Uint8Array(s.pending_buf_size); + s.sym_buf = s.lit_bufsize; + s.sym_end = (s.lit_bufsize - 1) * 3; + s.level = level; + s.strategy = strategy; + s.method = method; + return deflateReset(strm); + }; + var deflateInit = (strm, level) => { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); + }; + var deflate = (strm, flush) => { + if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; } - /** - * Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer) - * - * @return { Buffer } The Buffer value. - */ - get internalBuffer() { - return this._buff; + const s = strm.state; + if (!strm.output || strm.avail_in !== 0 && !strm.input || s.status === FINISH_STATE && flush !== Z_FINISH) { + return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR); } - /** - * Gets the value of the internal managed Buffer (Includes managed data only) - * - * @param { Buffer } - */ - toBuffer() { - return this._buff.slice(0, this.length); + const old_flush = s.last_flush; + s.last_flush = flush; + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK; + } + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); } - /** - * Gets the String value of the internal managed Buffer - * - * @param encoding { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding). - */ - toString(encoding) { - const encodingVal = typeof encoding === "string" ? encoding : this._encoding; - utils_1.checkEncoding(encodingVal); - return this._buff.toString(encodingVal, 0, this.length); + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); } - /** - * Destroys the SmartBuffer instance. - */ - destroy() { - this.clear(); - return this; + if (s.status === INIT_STATE && s.wrap === 0) { + s.status = BUSY_STATE; } - /** - * Handles inserting and writing strings. - * - * @param value { String } The String value to insert. - * @param isInsert { Boolean } True if inserting a string, false if writing. - * @param arg2 { Number | String } The offset to insert the string at, or the BufferEncoding to use. - * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). - */ - _handleString(value, isInsert, arg3, encoding) { - let offsetVal = this._writeOffset; - let encodingVal = this._encoding; - if (typeof arg3 === "number") { - offsetVal = arg3; - } else if (typeof arg3 === "string") { - utils_1.checkEncoding(arg3); - encodingVal = arg3; + if (s.status === INIT_STATE) { + let header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8; + let level_flags = -1; + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; } - if (typeof encoding === "string") { - utils_1.checkEncoding(encoding); - encodingVal = encoding; + header |= level_flags << 6; + if (s.strstart !== 0) { + header |= PRESET_DICT; } - const byteLength = Buffer.byteLength(value, encodingVal); - if (isInsert) { - this.ensureInsertable(byteLength, offsetVal); - } else { - this._ensureWriteable(byteLength, offsetVal); + header += 31 - header % 31; + putShortMSB(s, header); + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); } - this._buff.write(value, offsetVal, byteLength, encodingVal); - if (isInsert) { - this._writeOffset += byteLength; - } else { - if (typeof arg3 === "number") { - this._writeOffset = Math.max(this._writeOffset, offsetVal + byteLength); - } else { - this._writeOffset += byteLength; - } + strm.adler = 1; + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; } - return this; } - /** - * Handles writing or insert of a Buffer. - * - * @param value { Buffer } The Buffer to write. - * @param offset { Number } The offset to write the Buffer to. - */ - _handleBuffer(value, isInsert, offset) { - const offsetVal = typeof offset === "number" ? offset : this._writeOffset; - if (isInsert) { - this.ensureInsertable(value.length, offsetVal); - } else { - this._ensureWriteable(value.length, offsetVal); - } - value.copy(this._buff, offsetVal); - if (isInsert) { - this._writeOffset += value.length; + if (s.status === GZIP_STATE) { + strm.adler = 0; + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; + } } else { - if (typeof offset === "number") { - this._writeOffset = Math.max(this._writeOffset, offsetVal + value.length); - } else { - this._writeOffset += value.length; + put_byte( + s, + (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 255); + put_byte(s, s.gzhead.time >> 8 & 255); + put_byte(s, s.gzhead.time >> 16 & 255); + put_byte(s, s.gzhead.time >> 24 & 255); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, s.gzhead.os & 255); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 255); + put_byte(s, s.gzhead.extra.length >> 8 & 255); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); } + s.gzindex = 0; + s.status = EXTRA_STATE; } - return this; } - /** - * Ensures that the internal Buffer is large enough to read data. - * - * @param length { Number } The length of the data that needs to be read. - * @param offset { Number } The offset of the data that needs to be read. - */ - ensureReadable(length, offset) { - let offsetVal = this._readOffset; - if (typeof offset !== "undefined") { - utils_1.checkOffsetValue(offset); - offsetVal = offset; - } - if (offsetVal < 0 || offsetVal + length > this.length) { - throw new Error(utils_1.ERRORS.INVALID_READ_BEYOND_BOUNDS); + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra) { + let beg = s.pending; + let left = (s.gzhead.extra.length & 65535) - s.gzindex; + while (s.pending + left > s.pending_buf_size) { + let copy = s.pending_buf_size - s.pending; + s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending); + s.pending = s.pending_buf_size; + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex += copy; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; + } + beg = 0; + left -= copy; + } + let gzhead_extra = new Uint8Array(s.gzhead.extra); + s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending); + s.pending += left; + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex = 0; } + s.status = NAME_STATE; } - /** - * Ensures that the internal Buffer is large enough to insert data. - * - * @param dataLength { Number } The length of the data that needs to be written. - * @param offset { Number } The offset of the data to be written. - */ - ensureInsertable(dataLength, offset) { - utils_1.checkOffsetValue(offset); - this._ensureCapacity(this.length + dataLength); - if (offset < this.length) { - this._buff.copy(this._buff, offset + dataLength, offset, this._buff.length); - } - if (offset + dataLength > this.length) { - this.length = offset + dataLength; - } else { - this.length += dataLength; + if (s.status === NAME_STATE) { + if (s.gzhead.name) { + let beg = s.pending; + let val; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; + } + beg = 0; + } + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex = 0; } + s.status = COMMENT_STATE; } - /** - * Ensures that the internal Buffer is large enough to write data. - * - * @param dataLength { Number } The length of the data that needs to be written. - * @param offset { Number } The offset of the data to be written (defaults to writeOffset). - */ - _ensureWriteable(dataLength, offset) { - const offsetVal = typeof offset === "number" ? offset : this._writeOffset; - this._ensureCapacity(offsetVal + dataLength); - if (offsetVal + dataLength > this.length) { - this.length = offsetVal + dataLength; + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment) { + let beg = s.pending; + let val; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; + } + beg = 0; + } + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } } + s.status = HCRC_STATE; } - /** - * Ensures that the internal Buffer is large enough to write at least the given amount of data. - * - * @param minLength { Number } The minimum length of the data needs to be written. - */ - _ensureCapacity(minLength) { - const oldLength = this._buff.length; - if (minLength > oldLength) { - let data = this._buff; - let newLength = oldLength * 3 / 2 + 1; - if (newLength < minLength) { - newLength = minLength; + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; + } } - this._buff = Buffer.allocUnsafe(newLength); - data.copy(this._buff, 0, 0, oldLength); + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + strm.adler = 0; } - } - /** - * Reads a numeric number value using the provided function. - * - * @typeparam T { number | bigint } The type of the value to be read - * - * @param func { Function(offset: number) => number } The function to read data on the internal Buffer with. - * @param byteSize { Number } The number of bytes read. - * @param offset { Number } The offset to read from (optional). When this is not provided, the managed readOffset is used instead. - * - * @returns { T } the number value - */ - _readNumberValue(func, byteSize, offset) { - this.ensureReadable(byteSize, offset); - const value = func.call(this._buff, typeof offset === "number" ? offset : this._readOffset); - if (typeof offset === "undefined") { - this._readOffset += byteSize; + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK; } - return value; - } - /** - * Inserts a numeric number value based on the given offset and value. - * - * @typeparam T { number | bigint } The type of the value to be written - * - * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. - * @param byteSize { Number } The number of bytes written. - * @param value { T } The number value to write. - * @param offset { Number } the offset to write the number at (REQUIRED). - * - * @returns SmartBuffer this buffer - */ - _insertNumberValue(func, byteSize, value, offset) { - utils_1.checkOffsetValue(offset); - this.ensureInsertable(byteSize, offset); - func.call(this._buff, value, offset); - this._writeOffset += byteSize; - return this; } - /** - * Writes a numeric number value based on the given offset and value. - * - * @typeparam T { number | bigint } The type of the value to be written - * - * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. - * @param byteSize { Number } The number of bytes written. - * @param value { T } The number value to write. - * @param offset { Number } the offset to write the number at (REQUIRED). - * - * @returns SmartBuffer this buffer - */ - _writeNumberValue(func, byteSize, value, offset) { - if (typeof offset === "number") { - if (offset < 0) { - throw new Error(utils_1.ERRORS.INVALID_WRITE_BEYOND_BOUNDS); + if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) { + let bstate = s.level === 0 ? deflate_stored(s, flush) : s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush); + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; } - utils_1.checkOffsetValue(offset); + return Z_OK; } - const offsetVal = typeof offset === "number" ? offset : this._writeOffset; - this._ensureWriteable(byteSize, offsetVal); - func.call(this._buff, value, offsetVal); - if (typeof offset === "number") { - this._writeOffset = Math.max(this._writeOffset, offsetVal + byteSize); - } else { - this._writeOffset += byteSize; + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush !== Z_BLOCK) { + _tr_stored_block(s, 0, 0, false); + if (flush === Z_FULL_FLUSH) { + zero(s.head); + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK; + } } - return this; - } - }; - exports2.SmartBuffer = SmartBuffer; - } -}); - -// node_modules/socks/build/common/constants.js -var require_constants2 = __commonJS({ - "node_modules/socks/build/common/constants.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SOCKS5_NO_ACCEPTABLE_AUTH = exports2.SOCKS5_CUSTOM_AUTH_END = exports2.SOCKS5_CUSTOM_AUTH_START = exports2.SOCKS_INCOMING_PACKET_SIZES = exports2.SocksClientState = exports2.Socks5Response = exports2.Socks5HostType = exports2.Socks5Auth = exports2.Socks4Response = exports2.SocksCommand = exports2.ERRORS = exports2.DEFAULT_TIMEOUT = void 0; - var DEFAULT_TIMEOUT = 3e4; - exports2.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; - var ERRORS2 = { - InvalidSocksCommand: "An invalid SOCKS command was provided. Valid options are connect, bind, and associate.", - InvalidSocksCommandForOperation: "An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.", - InvalidSocksCommandChain: "An invalid SOCKS command was provided. Chaining currently only supports the connect command.", - InvalidSocksClientOptionsDestination: "An invalid destination host was provided.", - InvalidSocksClientOptionsExistingSocket: "An invalid existing socket was provided. This should be an instance of stream.Duplex.", - InvalidSocksClientOptionsProxy: "Invalid SOCKS proxy details were provided.", - InvalidSocksClientOptionsTimeout: "An invalid timeout value was provided. Please enter a value above 0 (in ms).", - InvalidSocksClientOptionsProxiesLength: "At least two socks proxies must be provided for chaining.", - InvalidSocksClientOptionsCustomAuthRange: "Custom auth must be a value between 0x80 and 0xFE.", - InvalidSocksClientOptionsCustomAuthOptions: "When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.", - NegotiationError: "Negotiation error", - SocketClosed: "Socket closed", - ProxyConnectionTimedOut: "Proxy connection timed out", - InternalError: "SocksClient internal error (this should not happen)", - InvalidSocks4HandshakeResponse: "Received invalid Socks4 handshake response", - Socks4ProxyRejectedConnection: "Socks4 Proxy rejected connection", - InvalidSocks4IncomingConnectionResponse: "Socks4 invalid incoming connection response", - Socks4ProxyRejectedIncomingBoundConnection: "Socks4 Proxy rejected incoming bound connection", - InvalidSocks5InitialHandshakeResponse: "Received invalid Socks5 initial handshake response", - InvalidSocks5IntiailHandshakeSocksVersion: "Received invalid Socks5 initial handshake (invalid socks version)", - InvalidSocks5InitialHandshakeNoAcceptedAuthType: "Received invalid Socks5 initial handshake (no accepted authentication type)", - InvalidSocks5InitialHandshakeUnknownAuthType: "Received invalid Socks5 initial handshake (unknown authentication type)", - Socks5AuthenticationFailed: "Socks5 Authentication failed", - InvalidSocks5FinalHandshake: "Received invalid Socks5 final handshake response", - InvalidSocks5FinalHandshakeRejected: "Socks5 proxy rejected connection", - InvalidSocks5IncomingConnectionResponse: "Received invalid Socks5 incoming connection response", - Socks5ProxyRejectedIncomingBoundConnection: "Socks5 Proxy rejected incoming bound connection" - }; - exports2.ERRORS = ERRORS2; - var SOCKS_INCOMING_PACKET_SIZES = { - Socks5InitialHandshakeResponse: 2, - Socks5UserPassAuthenticationResponse: 2, - // Command response + incoming connection (bind) - Socks5ResponseHeader: 5, - // We need at least 5 to read the hostname length, then we wait for the address+port information. - Socks5ResponseIPv4: 10, - // 4 header + 4 ip + 2 port - Socks5ResponseIPv6: 22, - // 4 header + 16 ip + 2 port - Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, - // 4 header + 1 host length + host + 2 port - // Command response + incoming connection (bind) - Socks4Response: 8 - // 2 header + 2 port + 4 ip - }; - exports2.SOCKS_INCOMING_PACKET_SIZES = SOCKS_INCOMING_PACKET_SIZES; - var SocksCommand; - (function(SocksCommand2) { - SocksCommand2[SocksCommand2["connect"] = 1] = "connect"; - SocksCommand2[SocksCommand2["bind"] = 2] = "bind"; - SocksCommand2[SocksCommand2["associate"] = 3] = "associate"; - })(SocksCommand || (exports2.SocksCommand = SocksCommand = {})); - var Socks4Response; - (function(Socks4Response2) { - Socks4Response2[Socks4Response2["Granted"] = 90] = "Granted"; - Socks4Response2[Socks4Response2["Failed"] = 91] = "Failed"; - Socks4Response2[Socks4Response2["Rejected"] = 92] = "Rejected"; - Socks4Response2[Socks4Response2["RejectedIdent"] = 93] = "RejectedIdent"; - })(Socks4Response || (exports2.Socks4Response = Socks4Response = {})); - var Socks5Auth; - (function(Socks5Auth2) { - Socks5Auth2[Socks5Auth2["NoAuth"] = 0] = "NoAuth"; - Socks5Auth2[Socks5Auth2["GSSApi"] = 1] = "GSSApi"; - Socks5Auth2[Socks5Auth2["UserPass"] = 2] = "UserPass"; - })(Socks5Auth || (exports2.Socks5Auth = Socks5Auth = {})); - var SOCKS5_CUSTOM_AUTH_START = 128; - exports2.SOCKS5_CUSTOM_AUTH_START = SOCKS5_CUSTOM_AUTH_START; - var SOCKS5_CUSTOM_AUTH_END = 254; - exports2.SOCKS5_CUSTOM_AUTH_END = SOCKS5_CUSTOM_AUTH_END; - var SOCKS5_NO_ACCEPTABLE_AUTH = 255; - exports2.SOCKS5_NO_ACCEPTABLE_AUTH = SOCKS5_NO_ACCEPTABLE_AUTH; - var Socks5Response; - (function(Socks5Response2) { - Socks5Response2[Socks5Response2["Granted"] = 0] = "Granted"; - Socks5Response2[Socks5Response2["Failure"] = 1] = "Failure"; - Socks5Response2[Socks5Response2["NotAllowed"] = 2] = "NotAllowed"; - Socks5Response2[Socks5Response2["NetworkUnreachable"] = 3] = "NetworkUnreachable"; - Socks5Response2[Socks5Response2["HostUnreachable"] = 4] = "HostUnreachable"; - Socks5Response2[Socks5Response2["ConnectionRefused"] = 5] = "ConnectionRefused"; - Socks5Response2[Socks5Response2["TTLExpired"] = 6] = "TTLExpired"; - Socks5Response2[Socks5Response2["CommandNotSupported"] = 7] = "CommandNotSupported"; - Socks5Response2[Socks5Response2["AddressNotSupported"] = 8] = "AddressNotSupported"; - })(Socks5Response || (exports2.Socks5Response = Socks5Response = {})); - var Socks5HostType; - (function(Socks5HostType2) { - Socks5HostType2[Socks5HostType2["IPv4"] = 1] = "IPv4"; - Socks5HostType2[Socks5HostType2["Hostname"] = 3] = "Hostname"; - Socks5HostType2[Socks5HostType2["IPv6"] = 4] = "IPv6"; - })(Socks5HostType || (exports2.Socks5HostType = Socks5HostType = {})); - var SocksClientState; - (function(SocksClientState2) { - SocksClientState2[SocksClientState2["Created"] = 0] = "Created"; - SocksClientState2[SocksClientState2["Connecting"] = 1] = "Connecting"; - SocksClientState2[SocksClientState2["Connected"] = 2] = "Connected"; - SocksClientState2[SocksClientState2["SentInitialHandshake"] = 3] = "SentInitialHandshake"; - SocksClientState2[SocksClientState2["ReceivedInitialHandshakeResponse"] = 4] = "ReceivedInitialHandshakeResponse"; - SocksClientState2[SocksClientState2["SentAuthentication"] = 5] = "SentAuthentication"; - SocksClientState2[SocksClientState2["ReceivedAuthenticationResponse"] = 6] = "ReceivedAuthenticationResponse"; - SocksClientState2[SocksClientState2["SentFinalHandshake"] = 7] = "SentFinalHandshake"; - SocksClientState2[SocksClientState2["ReceivedFinalResponse"] = 8] = "ReceivedFinalResponse"; - SocksClientState2[SocksClientState2["BoundWaitingForConnection"] = 9] = "BoundWaitingForConnection"; - SocksClientState2[SocksClientState2["Established"] = 10] = "Established"; - SocksClientState2[SocksClientState2["Disconnected"] = 11] = "Disconnected"; - SocksClientState2[SocksClientState2["Error"] = 99] = "Error"; - })(SocksClientState || (exports2.SocksClientState = SocksClientState = {})); - } -}); - -// node_modules/socks/build/common/util.js -var require_util = __commonJS({ - "node_modules/socks/build/common/util.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SocksClientError = void 0; - exports2.shuffleArray = shuffleArray; - var SocksClientError = class extends Error { - constructor(message, options) { - super(message); - this.options = options; - } - }; - exports2.SocksClientError = SocksClientError; - function shuffleArray(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [array[i], array[j]] = [array[j], array[i]]; - } - } - } -}); - -// node_modules/ip-address/dist/address-error.js -var require_address_error = __commonJS({ - "node_modules/ip-address/dist/address-error.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AddressError = void 0; - var AddressError = class extends Error { - constructor(message, parseMessage) { - super(message); - this.name = "AddressError"; - this.parseMessage = parseMessage; - } - }; - exports2.AddressError = AddressError; - } -}); - -// node_modules/ip-address/dist/common.js -var require_common2 = __commonJS({ - "node_modules/ip-address/dist/common.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isInSubnet = isInSubnet; - exports2.isHostInSubnet = isHostInSubnet; - exports2.isGloballyReachable = isGloballyReachable; - exports2.offsetBigInt = offsetBigInt; - exports2.isCorrect = isCorrect; - exports2.prefixLengthFromMask = prefixLengthFromMask; - exports2.assertByteArray = assertByteArray; - exports2.numberToPaddedHex = numberToPaddedHex; - exports2.stringToPaddedHex = stringToPaddedHex; - exports2.testBit = testBit; - var address_error_1 = require_address_error(); - function isInSubnet(address) { - if (this.subnetMask < address.subnetMask) { - return false; - } - return isHostInSubnet.call(this, address); - } - function isHostInSubnet(address) { - if (this.binaryZeroPad().length !== address.binaryZeroPad().length) { - return false; } - return this.mask(address.subnetMask) === address.mask(); - } - function isGloballyReachable(entries2) { - let best = null; - for (let i = 0; i < entries2.length; i++) { - const entry = entries2[i]; - if (entry.reachable !== null && isHostInSubnet.call(this, entry.subnet) && (best === null || entry.subnet.subnetMask > best.subnet.subnetMask)) { - best = entry; - } + if (flush !== Z_FINISH) { + return Z_OK; } - return best === null ? true : best.reachable; - } - function offsetBigInt(value, n, bits, family) { - if (typeof n === "number" && !Number.isSafeInteger(n)) { - throw new address_error_1.AddressError(`${family} offset must be an integer`); + if (s.wrap <= 0) { + return Z_STREAM_END; } - if (typeof n !== "number" && typeof n !== "bigint") { - throw new address_error_1.AddressError(`${family} offset must be an integer`); + if (s.wrap === 2) { + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + put_byte(s, strm.adler >> 16 & 255); + put_byte(s, strm.adler >> 24 & 255); + put_byte(s, strm.total_in & 255); + put_byte(s, strm.total_in >> 8 & 255); + put_byte(s, strm.total_in >> 16 & 255); + put_byte(s, strm.total_in >> 24 & 255); + } else { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); } - const result = value + BigInt(n); - if (result < BigInt(0) || result > (BigInt(1) << BigInt(bits)) - BigInt(1)) { - throw new address_error_1.AddressError(`${family} offset leaves the address space`); + flush_pending(strm); + if (s.wrap > 0) { + s.wrap = -s.wrap; } - return result; - } - function isCorrect(defaultBits) { - return function isCorrectForm() { - if (this.addressMinusSuffix !== this.correctForm()) { - return false; - } - if (this.subnetMask === defaultBits && !this.parsedSubnet) { - return true; - } - return this.parsedSubnet === String(this.subnetMask); - }; - } - function prefixLengthFromMask(value, totalBits) { - const binary = value.toString(2).padStart(totalBits, "0"); - if (binary.length > totalBits) { - throw new address_error_1.AddressError("Invalid subnet mask."); + return s.pending !== 0 ? Z_OK : Z_STREAM_END; + }; + var deflateEnd = (strm) => { + if (deflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - const firstZero = binary.indexOf("0"); - if (firstZero === -1) { - return totalBits; + const status = strm.state.status; + strm.state = null; + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; + }; + var deflateSetDictionary = (strm, dictionary) => { + let dictLength = dictionary.length; + if (deflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - if (binary.slice(firstZero).includes("1")) { - throw new address_error_1.AddressError("Invalid subnet mask."); + const s = strm.state; + const wrap = s.wrap; + if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { + return Z_STREAM_ERROR; } - return firstZero; - } - function assertByteArray(bytes, byteCount, family, minimum) { - if (bytes.length !== byteCount) { - throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`); + if (wrap === 1) { + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); } - for (let i = 0; i < bytes.length; i++) { - if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) { - throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`); + s.wrap = 0; + if (dictLength >= s.w_size) { + if (wrap === 0) { + zero(s.head); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; } + let tmpDict = new Uint8Array(s.w_size); + tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0); + dictionary = tmpDict; + dictLength = s.w_size; } - } - function numberToPaddedHex(number) { - return number.toString(16).padStart(2, "0"); - } - function stringToPaddedHex(numberString) { - return numberToPaddedHex(parseInt(numberString, 10)); - } - function testBit(binaryValue, position) { - const { length } = binaryValue; - if (position >= length) { - return false; + const avail = strm.avail_in; + const next = strm.next_in; + const input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + let str = s.strstart; + let n = s.lookahead - (MIN_MATCH - 1); + do { + INSERT_STRING(s, str); + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); } - const positionInString = length - position - 1; - return binaryValue.substring(positionInString, positionInString + 1) === "1"; - } - } -}); - -// node_modules/ip-address/dist/v4/constants.js -var require_constants3 = __commonJS({ - "node_modules/ip-address/dist/v4/constants.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SPECIAL_PURPOSE = exports2.RE_SUBNET_STRING = exports2.RE_ADDRESS = exports2.GROUPS = exports2.BITS = void 0; - exports2.BITS = 32; - exports2.GROUPS = 4; - exports2.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g; - exports2.RE_SUBNET_STRING = /\/\d{1,2}$/; - exports2.SPECIAL_PURPOSE = [ - ["0.0.0.0/8", "This network", false], - ["0.0.0.0/32", "This host on this network", false], - ["10.0.0.0/8", "Private-Use", false], - ["100.64.0.0/10", "Shared Address Space", false], - ["127.0.0.0/8", "Loopback", false], - ["169.254.0.0/16", "Link Local", false], - ["172.16.0.0/12", "Private-Use", false], - ["192.0.0.0/24", "IETF Protocol Assignments", false], - ["192.0.0.0/29", "IPv4 Service Continuity Prefix", false], - ["192.0.0.8/32", "IPv4 dummy address", false], - ["192.0.0.9/32", "Port Control Protocol Anycast", true], - ["192.0.0.10/32", "Traversal Using Relays around NAT Anycast", true], - ["192.0.0.170/32", "NAT64/DNS64 Discovery", false], - ["192.0.0.171/32", "NAT64/DNS64 Discovery", false], - ["192.0.2.0/24", "Documentation (TEST-NET-1)", false], - ["192.31.196.0/24", "AS112-v4", true], - ["192.52.193.0/24", "AMT", true], - ["192.88.99.0/24", "Deprecated (6to4 Relay Anycast)", null], - ["192.88.99.2/32", "6a44-relay anycast address", false], - ["192.168.0.0/16", "Private-Use", false], - ["192.175.48.0/24", "Direct Delegation AS112 Service", true], - ["198.18.0.0/15", "Benchmarking", false], - ["198.51.100.0/24", "Documentation (TEST-NET-2)", false], - ["203.0.113.0/24", "Documentation (TEST-NET-3)", false], - ["240.0.0.0/4", "Reserved", false], - ["255.255.255.255/32", "Limited Broadcast", false] - ]; + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; + }; + module2.exports.deflateInit = deflateInit; + module2.exports.deflateInit2 = deflateInit2; + module2.exports.deflateReset = deflateReset; + module2.exports.deflateResetKeep = deflateResetKeep; + module2.exports.deflateSetHeader = deflateSetHeader; + module2.exports.deflate = deflate; + module2.exports.deflateEnd = deflateEnd; + module2.exports.deflateSetDictionary = deflateSetDictionary; + module2.exports.deflateInfo = "pako deflate (from Nodeca project)"; } }); - -// node_modules/ip-address/dist/ipv4.js -var require_ipv4 = __commonJS({ - "node_modules/ip-address/dist/ipv4.js"(exports2) { + +// node_modules/pako/lib/utils/common.js +var require_common = __commonJS({ + "node_modules/pako/lib/utils/common.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; + var _has = (obj, key) => { + return Object.prototype.hasOwnProperty.call(obj, key); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Address4 = void 0; - var common = __importStar2(require_common2()); - var constants = __importStar2(require_constants3()); - var address_error_1 = require_address_error(); - var isCorrect4 = common.isCorrect(constants.BITS); - var Address4 = class _Address4 { - constructor(address) { - this.addressMinusSuffix = ""; - this.groups = constants.GROUPS; - this.parsedAddress = []; - this.parsedSubnet = ""; - this.subnet = "/32"; - this.subnetMask = 32; - this.v4 = true; - this.isCorrect = isCorrect4; - this.isInSubnet = common.isInSubnet; - this.isHostInSubnet = common.isHostInSubnet; - this.address = address; - const subnet = constants.RE_SUBNET_STRING.exec(address); - if (subnet) { - this.parsedSubnet = subnet[0].replace("/", ""); - this.subnetMask = parseInt(this.parsedSubnet, 10); - this.subnet = `/${this.subnetMask}`; - if (this.subnetMask < 0 || this.subnetMask > constants.BITS) { - throw new address_error_1.AddressError("Invalid subnet mask."); - } - address = address.replace(constants.RE_SUBNET_STRING, ""); - } - const longest = constants.GROUPS * 4 - 1; - if (address.length > longest) { - throw new address_error_1.AddressError(`IPv4 addresses are at most ${longest} characters.`); - } - this.addressMinusSuffix = address; - this.parsedAddress = this.parse(address); - } - /** - * Returns true if the given string is a valid IPv4 address (with optional - * CIDR subnet), false otherwise. Host bits in the subnet portion are - * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address - * validation compare `correctForm()` to `startAddress().correctForm()`, - * or use `networkForm()`. - */ - static isValid(address) { - try { - new _Address4(address); - return true; - } catch { - return false; + module2.exports.assign = function(obj) { + const sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + const source = sources.shift(); + if (!source) { + continue; } - } - /** - * Parses an IPv4 address string into its four octet groups and stores the - * result on `this.parsedAddress`. Called automatically by the constructor; - * you typically don't need to call it directly. Throws `AddressError` if - * the input is not a valid IPv4 address. - */ - parse(address) { - const groups = address.split("."); - if (groups.some((group) => /^0\d/.test(group))) { - throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes."); + if (typeof source !== "object") { + throw new TypeError(source + "must be non-object"); } - if (!address.match(constants.RE_ADDRESS)) { - throw new address_error_1.AddressError("Invalid IPv4 address."); + for (const p in source) { + if (_has(source, p)) { + obj[p] = source[p]; + } } - return groups; } - /** - * Returns the address in correct form: octets joined with `.` and any - * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the - * canonical dotted-decimal representation. - */ - correctForm() { - return this.parsedAddress.map((part) => parseInt(part, 10)).join("."); + return obj; + }; + module2.exports.flattenChunks = (chunks) => { + let len = 0; + for (let i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; } - /** - * Construct an `Address4` from an address and a dotted-decimal subnet - * mask given as separate strings (e.g. as returned by Node's - * `os.networkInterfaces()`). Throws `AddressError` if the mask is - * non-contiguous (e.g. `255.0.255.0`). - * @example - * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0'); - * address.subnetMask; // 24 - */ - static fromAddressAndMask(address, mask) { - const bits = common.prefixLengthFromMask(new _Address4(mask).bigInt(), constants.BITS); - return new _Address4(`${address}/${bits}`); + const result = new Uint8Array(len); + for (let i = 0, pos = 0, l = chunks.length; i < l; i++) { + let chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; } - /** - * Construct an `Address4` from an address and a Cisco-style wildcard mask - * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard - * mask is the bitwise inverse of the subnet mask. Throws `AddressError` - * if the mask is non-contiguous (e.g. `0.255.0.255`). - * @example - * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255'); - * address.subnetMask; // 24 - */ - static fromAddressAndWildcardMask(address, wildcardMask) { - const wildcard = new _Address4(wildcardMask).bigInt(); - const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1); - const mask = wildcard ^ allOnes; - const bits = common.prefixLengthFromMask(mask, constants.BITS); - return new _Address4(`${address}/${bits}`); + return result; + }; + } +}); + +// node_modules/pako/lib/utils/strings.js +var require_strings = __commonJS({ + "node_modules/pako/lib/utils/strings.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var STR_APPLY_UIA_OK = true; + try { + String.fromCharCode.apply(null, new Uint8Array(1)); + } catch (__) { + STR_APPLY_UIA_OK = false; + } + var _utf8len = new Uint8Array(256); + for (let q = 0; q < 256; q++) { + _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; + } + _utf8len[254] = _utf8len[255] = 1; + module2.exports.string2buf = (str) => { + if (typeof TextEncoder === "function" && TextEncoder.prototype.encode) { + return new TextEncoder().encode(str); } - /** - * Construct an `Address4` from a wildcard pattern with trailing `*` - * octets. The number of trailing wildcards determines the prefix - * length: each `*` represents 8 bits. - * - * Only trailing whole-octet wildcards are supported. Partial-octet - * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g. - * `192.*.0.1`) throw `AddressError`. - * @example - * Address4.fromWildcard('192.168.0.*').subnet; // '/24' - * Address4.fromWildcard('192.168.*.*').subnet; // '/16' - * Address4.fromWildcard('*.*.*.*').subnet; // '/0' - */ - static fromWildcard(input) { - const groups = input.split("."); - if (groups.length !== constants.GROUPS) { - throw new address_error_1.AddressError("Wildcard pattern must have 4 octets"); - } - let firstWildcard = -1; - for (let i = 0; i < groups.length; i++) { - if (groups[i] === "*") { - if (firstWildcard === -1) { - firstWildcard = i; - } - } else if (firstWildcard !== -1) { - throw new address_error_1.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)"); + let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; } } - const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard; - const replaced = groups.map((g) => g === "*" ? "0" : g); - const subnetBits = constants.BITS - trailing * 8; - return new _Address4(`${replaced.join(".")}/${subnetBits}`); + buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; } - /** - * Converts a hex string to an IPv4 address object. Accepts 8 hex digits - * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`). - * Throws `AddressError` for any other length or for non-hex characters. - * @param {string} hex - a hex string to convert - * @returns {Address4} - */ - static fromHex(hex) { - const stripped = hex.replace(/:/g, ""); - if (!/^[0-9a-fA-F]{8}$/.test(stripped)) { - throw new address_error_1.AddressError("IPv4 hex must be exactly 8 hex digits"); - } - const groups = []; - for (let i = 0; i < 8; i += 2) { - groups.push(parseInt(stripped.slice(i, i + 2), 16)); + buf = new Uint8Array(buf_len); + for (i = 0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; + } } - return new _Address4(groups.join(".")); - } - /** - * Converts an integer into a IPv4 address object. The integer must be a - * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise - * `AddressError` is thrown. - * @param {integer} integer - a number to convert - * @returns {Address4} - */ - static fromInteger(integer) { - if (!Number.isInteger(integer) || integer < 0 || integer > 4294967295) { - throw new address_error_1.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1"); + if (c < 128) { + buf[i++] = c; + } else if (c < 2048) { + buf[i++] = 192 | c >>> 6; + buf[i++] = 128 | c & 63; + } else if (c < 65536) { + buf[i++] = 224 | c >>> 12; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; + } else { + buf[i++] = 240 | c >>> 18; + buf[i++] = 128 | c >>> 12 & 63; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; } - return _Address4.fromHex(integer.toString(16).padStart(8, "0")); } - /** - * Return an address from in-addr.arpa form: the four octets reversed, with - * or without the `.in-addr.arpa` suffix and root dot, in any case. Throws - * `AddressError` unless the reversed labels form a valid IPv4 address, so - * `fromArpa(x.reverseForm())` round-trips {@link reverseForm}. - * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address - * @returns {Adress4} - * @example - * var address = Address4.fromArpa('42.2.0.192.in-addr.arpa.') - * address.correctForm(); // '192.0.2.42' - */ - static fromArpa(arpaFormAddress) { - const longest = constants.GROUPS * 4 - 1 + "/32".length + ".in-addr.arpa.".length; - if (arpaFormAddress.length > longest) { - throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`); + return buf; + }; + var buf2binstring = (buf, len) => { + if (len < 65534) { + if (buf.subarray && STR_APPLY_UIA_OK) { + return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len)); } - const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, ""); - const address = leader.split(".").reverse().join("."); - return new _Address4(address); } - /** - * Converts an IPv4 address object to a hex string - * @returns {String} - */ - toHex() { - return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(":"); + let result = ""; + for (let i = 0; i < len; i++) { + result += String.fromCharCode(buf[i]); } - /** - * Converts an IPv4 address object to an array of bytes. - * - * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`. - * @returns {Array} - */ - toArray() { - return this.parsedAddress.map((part) => parseInt(part, 10)); + return result; + }; + module2.exports.buf2string = (buf, max) => { + const len = max || buf.length; + if (typeof TextDecoder === "function" && TextDecoder.prototype.decode) { + return new TextDecoder().decode(buf.subarray(0, max)); } - /** - * Converts an IPv4 address object to an IPv6 address group - * @returns {String} - */ - toGroup6() { - const output = []; - let i; - for (i = 0; i < constants.GROUPS; i += 2) { - output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`); + let i, out; + const utf16buf = new Array(len * 2); + for (out = 0, i = 0; i < len; ) { + let c = buf[i++]; + if (c < 128) { + utf16buf[out++] = c; + continue; + } + let c_len = _utf8len[c]; + if (c_len > 4) { + utf16buf[out++] = 65533; + i += c_len - 1; + continue; + } + c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; + while (c_len > 1 && i < len) { + c = c << 6 | buf[i++] & 63; + c_len--; + } + if (c_len > 1) { + utf16buf[out++] = 65533; + continue; + } + if (c < 65536) { + utf16buf[out++] = c; + } else { + c -= 65536; + utf16buf[out++] = 55296 | c >> 10 & 1023; + utf16buf[out++] = 56320 | c & 1023; } - return output.join(":"); } - /** - * Returns the address as a `bigint` - * @returns {bigint} - */ - bigInt() { - return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join("")}`); + return buf2binstring(utf16buf, out); + }; + module2.exports.utf8border = (buf, max) => { + max = max || buf.length; + if (max > buf.length) { + max = buf.length; } - /** - * Helper function getting start address. - * @returns {bigint} - */ - _startAddress() { - return BigInt(`0b${this.mask() + "0".repeat(constants.BITS - this.subnetMask)}`); + let pos = max - 1; + while (pos >= 0 && (buf[pos] & 192) === 128) { + pos--; } - /** - * The first address in the range given by this address' subnet. - * Often referred to as the Network Address. - * @returns {Address4} - */ - startAddress() { - return _Address4.fromBigInt(this._startAddress()); + if (pos < 0) { + return max; } - /** - * The first host address in the range given by this address's subnet ie - * the first address after the Network Address - * @returns {Address4} - */ - startAddressExclusive() { - const adjust = BigInt("1"); - return _Address4.fromBigInt(this._startAddress() + adjust); + if (pos === 0) { + return max; } - /** - * Returns the address `n` addresses after this one (or before, when `n` is - * negative), keeping this address's subnet mask. Throws `AddressError` when - * the result would fall outside the IPv4 address space or `n` is not an - * integer. - * @param {number | bigint} n - * @returns {Address4} - * @example - * new Address4('10.0.0.0/24').offset(1).correctForm(); // '10.0.0.1' - */ - offset(n) { - return _Address4.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants.BITS, "IPv4")).withSubnetMask(this.subnetMask); + return pos + _utf8len[buf[pos]] > max ? pos : max; + }; + } +}); + +// node_modules/pako/lib/zlib/zstream.js +var require_zstream = __commonJS({ + "node_modules/pako/lib/zlib/zstream.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + function ZStream() { + this.input = null; + this.next_in = 0; + this.avail_in = 0; + this.total_in = 0; + this.output = null; + this.next_out = 0; + this.avail_out = 0; + this.total_out = 0; + this.msg = ""; + this.state = null; + this.data_type = 2; + this.adler = 0; + } + module2.exports = ZStream; + } +}); + +// node_modules/pako/lib/deflate.js +var require_deflate2 = __commonJS({ + "node_modules/pako/lib/deflate.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var zlib_deflate = require_deflate(); + var utils = require_common(); + var strings = require_strings(); + var msg = require_messages(); + var ZStream = require_zstream(); + var toString = Object.prototype.toString; + var { + Z_NO_FLUSH, + Z_SYNC_FLUSH, + Z_FULL_FLUSH, + Z_FINISH, + Z_OK, + Z_STREAM_END, + Z_DEFAULT_COMPRESSION, + Z_DEFAULT_STRATEGY, + Z_DEFLATED + } = require_constants2(); + var defaultOptions2 = { + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY, + legacyHash: true + }; + function Deflate(options) { + this.options = utils.assign({}, defaultOptions2, options || {}); + let opt = this.options; + if (opt.raw && opt.windowBits > 0) { + opt.windowBits = -opt.windowBits; + } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { + opt.windowBits += 16; } - /** - * Returns the network that follows this address's network: the address after - * {@link endAddress}, with the same subnet mask. Throws `AddressError` when - * this network is the last one in the address space. - * @returns {Address4} - * @example - * new Address4('10.0.0.0/24').nextNetwork().networkForm(); // '10.0.1.0/24' - */ - nextNetwork() { - return _Address4.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants.BITS, "IPv4")).withSubnetMask(this.subnetMask); + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new ZStream(); + this.strm.avail_out = 0; + let status = zlib_deflate.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy, + opt.legacyHash + ); + if (status !== Z_OK) { + throw new Error(msg[status]); } - withSubnetMask(subnetMask) { - return new _Address4(`${this.correctForm()}/${subnetMask}`); + if (opt.header) { + zlib_deflate.deflateSetHeader(this.strm, opt.header); } - /** - * Helper function getting end address. - * @returns {bigint} - */ - _endAddress() { - return BigInt(`0b${this.mask() + "1".repeat(constants.BITS - this.subnetMask)}`); + if (opt.dictionary) { + let dict; + if (typeof opt.dictionary === "string") { + dict = strings.string2buf(opt.dictionary); + } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + dict = new Uint8Array(opt.dictionary); + } else { + dict = opt.dictionary; + } + status = zlib_deflate.deflateSetDictionary(this.strm, dict); + if (status !== Z_OK) { + throw new Error(msg[status]); + } + this._dict_set = true; } - /** - * The last address in the range given by this address' subnet - * Often referred to as the Broadcast - * @returns {Address4} - */ - endAddress() { - return _Address4.fromBigInt(this._endAddress()); + } + Deflate.prototype.push = function(data, flush_mode) { + const strm = this.strm; + const chunkSize = this.options.chunkSize; + let status, _flush_mode; + if (this.ended) { + return false; } - /** - * The last host address in the range given by this address's subnet ie - * the last address prior to the Broadcast Address - * @returns {Address4} - */ - endAddressExclusive() { - const adjust = BigInt("1"); - return _Address4.fromBigInt(this._endAddress() - adjust); + if (flush_mode === ~~flush_mode) _flush_mode = flush_mode; + else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; + if (typeof data === "string") { + strm.input = strings.string2buf(data); + } else if (toString.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; } - /** - * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for - * a `/20`. Returns an `Address4`; call `.correctForm()` for the string. - * @returns {Address4} - */ - subnetMaskAddress() { - return _Address4.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(constants.BITS - this.subnetMask)}`)); + strm.next_in = 0; + strm.avail_in = strm.input.length; + for (; ; ) { + if (strm.avail_out === 0) { + strm.output = new Uint8Array(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) { + this.onData(strm.output.subarray(0, strm.next_out)); + strm.avail_out = 0; + continue; + } + status = zlib_deflate.deflate(strm, _flush_mode); + if (status === Z_STREAM_END) { + if (strm.next_out > 0) { + this.onData(strm.output.subarray(0, strm.next_out)); + } + status = zlib_deflate.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK; + } + if (strm.avail_out === 0) { + this.onData(strm.output); + continue; + } + if (_flush_mode > 0 && strm.next_out > 0) { + this.onData(strm.output.subarray(0, strm.next_out)); + strm.avail_out = 0; + continue; + } + if (strm.avail_in === 0) break; } - /** - * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is - * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`; - * call `.correctForm()` for the string. - * @returns {Address4} - */ - wildcardMask() { - return _Address4.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(constants.BITS - this.subnetMask)}`)); + return true; + }; + Deflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + Deflate.prototype.onEnd = function(status) { + if (status === Z_OK) { + this.result = utils.flattenChunks(this.chunks); } - /** - * The network address in CIDR string form, e.g. `192.168.1.0/24` for - * `192.168.1.5/24`. For an address with no explicit subnet the prefix is - * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`. - * @returns {string} - */ - networkForm() { - return `${this.startAddress().correctForm()}/${this.subnetMask}`; + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + function deflate(input, options) { + const deflator = new Deflate(options); + deflator.push(input, true); + if (deflator.err) { + throw deflator.msg || msg[deflator.err]; } - /** - * Converts a BigInt to a v4 address object. The value must be in the - * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. - * @param {bigint} bigInt - a BigInt to convert - * @returns {Address4} - */ - static fromBigInt(bigInt) { - if (bigInt < BigInt(0) || bigInt > BigInt(4294967295)) { - throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1"); - } - return _Address4.fromHex(bigInt.toString(16).padStart(8, "0")); + return deflator.result; + } + function deflateRaw(input, options) { + options = options || {}; + options.raw = true; + return deflate(input, options); + } + function gzip2(input, options) { + options = options || {}; + options.gzip = true; + return deflate(input, options); + } + module2.exports.Deflate = Deflate; + module2.exports.deflate = deflate; + module2.exports.deflateRaw = deflateRaw; + module2.exports.gzip = gzip2; + module2.exports.constants = require_constants2(); + } +}); + +// node_modules/pako/lib/zlib/inffast.js +var require_inffast = __commonJS({ + "node_modules/pako/lib/zlib/inffast.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var BAD = 16209; + var TYPE = 16191; + module2.exports = function inflate_fast(strm, start) { + let _in; + let last; + let _out; + let beg; + let end; + let dmax; + let wsize; + let whave; + let wnext; + let s_window; + let hold; + let bits; + let lcode; + let dcode; + let lmask; + let dmask; + let here; + let op; + let len; + let dist; + let from; + let from_source; + let input, output; + const state2 = strm.state; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); + dmax = state2.dmax; + wsize = state2.wsize; + whave = state2.whave; + wnext = state2.wnext; + s_window = state2.window; + hold = state2.hold; + bits = state2.bits; + lcode = state2.lencode; + dcode = state2.distcode; + lmask = (1 << state2.lenbits) - 1; + dmask = (1 << state2.distbits) - 1; + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op === 0) { + output[_out++] = here & 65535; + } else if (op & 16) { + len = here & 65535; + op &= 15; + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & (1 << op) - 1; + hold >>>= op; + bits -= op; + } + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op & 16) { + dist = here & 65535; + op &= 15; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & (1 << op) - 1; + if (dist > dmax) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break top; + } + hold >>>= op; + bits -= op; + op = _out - beg; + if (dist > op) { + op = dist - op; + if (op > whave) { + if (state2.sane) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break top; + } + } + from = 0; + from_source = s_window; + if (wnext === 0) { + from += wsize - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } else if (wnext < op) { + from += wsize + wnext - op; + op -= wnext; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + } else { + from += wnext - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } else { + from = _out - dist; + do { + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } else if ((op & 64) === 0) { + here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dodist; + } else { + strm.msg = "invalid distance code"; + state2.mode = BAD; + break top; + } + break; + } + } else if ((op & 64) === 0) { + here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dolen; + } else if (op & 32) { + state2.mode = TYPE; + break top; + } else { + strm.msg = "invalid literal/length code"; + state2.mode = BAD; + break top; + } + break; + } + } while (_in < last && _out < end); + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); + strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); + state2.hold = hold; + state2.bits = bits; + return; + }; + } +}); + +// node_modules/pako/lib/zlib/inftrees.js +var require_inftrees = __commonJS({ + "node_modules/pako/lib/zlib/inftrees.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var MAXBITS = 15; + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; + var CODES = 0; + var LENS = 1; + var DISTS = 2; + var lbase = new Uint16Array([ + /* Length codes 257..285 base */ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 13, + 15, + 17, + 19, + 23, + 27, + 31, + 35, + 43, + 51, + 59, + 67, + 83, + 99, + 115, + 131, + 163, + 195, + 227, + 258, + 0, + 0 + ]); + var lext = new Uint8Array([ + /* Length codes 257..285 extra */ + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 17, + 17, + 17, + 17, + 18, + 18, + 18, + 18, + 19, + 19, + 19, + 19, + 20, + 20, + 20, + 20, + 21, + 21, + 21, + 21, + 16, + 199, + 75 + ]); + var dbase = new Uint16Array([ + /* Distance codes 0..29 base */ + 1, + 2, + 3, + 4, + 5, + 7, + 9, + 13, + 17, + 25, + 33, + 49, + 65, + 97, + 129, + 193, + 257, + 385, + 513, + 769, + 1025, + 1537, + 2049, + 3073, + 4097, + 6145, + 8193, + 12289, + 16385, + 24577, + 0, + 0 + ]); + var dext = new Uint8Array([ + /* Distance codes 0..29 extra */ + 16, + 16, + 16, + 16, + 17, + 17, + 18, + 18, + 19, + 19, + 20, + 20, + 21, + 21, + 22, + 22, + 23, + 23, + 24, + 24, + 25, + 25, + 26, + 26, + 27, + 27, + 28, + 28, + 29, + 29, + 64, + 64 + ]); + var inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) => { + const bits = opts.bits; + let len = 0; + let sym = 0; + let min = 0, max = 0; + let root = 0; + let curr = 0; + let drop = 0; + let left = 0; + let used = 0; + let huff = 0; + let incr; + let fill; + let low; + let mask; + let next; + let base = null; + let match; + const count = new Uint16Array(MAXBITS + 1); + const offs = new Uint16Array(MAXBITS + 1); + let extra = null; + let here_bits, here_op, here_val; + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; } - /** - * Convert a byte array to an Address4 object. Throws `AddressError` unless - * given exactly 4 integers from 0 to 255. Signed bytes are rejected, so - * this differs from `Address6.fromByteArray`, which folds them; the two - * contracts converge on this stricter form in the next major version. - * - * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`. - * @param {Array<number>} bytes - an array of 4 bytes (0-255) - * @returns {Address4} - */ - static fromByteArray(bytes) { - common.assertByteArray(bytes, 4, "IPv4", 0); - return this.fromUnsignedByteArray(bytes); + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; } - /** - * Convert an unsigned byte array to an Address4 object. Throws - * `AddressError` unless given exactly 4 bytes, and rejects values outside - * 0 to 255 when parsing the resulting address. - * - * To convert from a Node.js `Buffer`, spread it: - * `Address4.fromUnsignedByteArray([...buf])`. - * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255) - * @returns {Address4} - */ - static fromUnsignedByteArray(bytes) { - if (bytes.length !== 4) { - throw new address_error_1.AddressError("IPv4 addresses require exactly 4 bytes"); + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { + break; } - const address = bytes.join("."); - return new _Address4(address); } - /** - * Returns the first n bits of the address, defaulting to the - * subnet mask - * @returns {String} - */ - mask(mask) { - if (mask === void 0) { - mask = this.subnetMask; - } - return this.getBitsBase2(0, mask); + if (root > max) { + root = max; } - /** - * Returns the bits in the given range as a base-2 string - * @returns {string} - */ - getBitsBase2(start, end) { - return this.binaryZeroPad().slice(start, end); + if (max === 0) { + table[table_index++] = 1 << 24 | 64 << 16 | 0; + table[table_index++] = 1 << 24 | 64 << 16 | 0; + opts.bits = 1; + return 0; } - /** - * Return the reversed in-addr.arpa form of the address, e.g. - * `42.2.0.192.in-addr.arpa.` for `192.0.2.42`. - * @param {Object} options - * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix - * @returns {String} - */ - reverseForm(options) { - if (!options) { - options = {}; - } - const reversed = this.correctForm().split(".").reverse().join("."); - if (options.omitSuffix) { - return reversed; + for (min = 1; min < max; min++) { + if (count[min] !== 0) { + break; } - return `${reversed}.in-addr.arpa.`; - } - /** - * Returns true if the given address is a multicast address - * @returns {boolean} - */ - isMulticast() { - return this.isHostInSubnet(MULTICAST_V4); - } - /** - * Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`). - * @returns {boolean} - */ - isPrivate() { - return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet)); - } - /** - * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)). - * @returns {boolean} - */ - isLoopback() { - return this.isHostInSubnet(LOOPBACK_V4); - } - /** - * Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)). - * @returns {boolean} - */ - isLinkLocal() { - return this.isHostInSubnet(LINK_LOCAL_V4); } - /** - * Returns true if the address is the unspecified address `0.0.0.0`. - * @returns {boolean} - */ - isUnspecified() { - return this.isHostInSubnet(UNSPECIFIED_V4); + if (root < min) { + root = min; } - /** - * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)). - * @returns {boolean} - */ - isBroadcast() { - return this.isHostInSubnet(BROADCAST_V4); + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } } - /** - * Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)). - * @returns {boolean} - */ - isCGNAT() { - return this.isHostInSubnet(CGNAT_V4); + if (left > 0 && (type === CODES || max !== 1)) { + return -1; } - /** - * Returns true if the address is in one of the documentation ranges - * `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)). - * @returns {boolean} - */ - isDocumentation() { - return DOCUMENTATION_V4.some((subnet) => this.isHostInSubnet(subnet)); + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; } - /** - * Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)). - * @returns {boolean} - */ - isBenchmarking() { - return this.isHostInSubnet(BENCHMARKING_V4); + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } } - /** - * Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)), - * which includes the limited broadcast address. - * @returns {boolean} - */ - isReserved() { - return this.isHostInSubnet(RESERVED_V4); + if (type === CODES) { + base = extra = work; + match = 20; + } else if (type === LENS) { + base = lbase; + extra = lext; + match = 257; + } else { + base = dbase; + extra = dext; + match = 0; } - /** - * Returns true if the address is globally reachable: not multicast, and not - * in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/) - * marks as not globally reachable. That covers everything the individual - * classifiers name (private, loopback, link-local, CGNAT, unspecified, - * broadcast, documentation, benchmarking, reserved) and the blocks they do - * not, such as `0.0.0.0/8` and the IETF protocol assignments in - * `192.0.0.0/24`. This is the single predicate to use where a request must - * not reach an internal or special-purpose destination; see SECURITY.md. - * @returns {boolean} - */ - isGlobal() { - return !this.isMulticast() && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V4); + huff = 0; + sym = 0; + len = min; + next = table_index; + curr = root; + drop = 0; + low = -1; + used = 1 << root; + mask = used - 1; + if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { + return 1; } - /** - * Returns a zero-padded base-2 string representation of the address - * @returns {string} - */ - binaryZeroPad() { - if (this._binaryZeroPad === void 0) { - this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, "0"); + for (; ; ) { + here_bits = len - drop; + if (work[sym] + 1 < match) { + here_op = 0; + here_val = work[sym]; + } else if (work[sym] >= match) { + here_op = extra[work[sym] - match]; + here_val = base[work[sym] - match]; + } else { + here_op = 32 + 64; + here_val = 0; + } + incr = 1 << len - drop; + fill = 1 << curr; + min = fill; + do { + fill -= incr; + table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; + } while (fill !== 0); + incr = 1 << len - 1; + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + sym++; + if (--count[len] === 0) { + if (len === max) { + break; + } + len = lens[lens_index + work[sym]]; + } + if (len > root && (huff & mask) !== low) { + if (drop === 0) { + drop = root; + } + next += min; + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { + break; + } + curr++; + left <<= 1; + } + used += 1 << curr; + if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { + return 1; + } + low = huff & mask; + table[low] = root << 24 | curr << 16 | next - table_index | 0; } - return this._binaryZeroPad; } - /** - * Groups an IPv4 address for inclusion at the end of an IPv6 address. - * - * Returns an HTML fragment: each half of the address is wrapped in a - * `<span>` carrying the group classes an address-inspector UI hovers on. - * The address content is HTML-escaped; anything you concatenate around it - * is your responsibility. - * @returns {String} - */ - groupForV6() { - const segments = this.parsedAddress; - return this.correctForm().replace(constants.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments.slice(0, 2).join(".")}</span>.<span class="hover-group group-v4 group-7">${segments.slice(2, 4).join(".")}</span>`); + if (huff !== 0) { + table[next + huff] = len - drop << 24 | 64 << 16 | 0; } + opts.bits = root; + return 0; }; - exports2.Address4 = Address4; - var MULTICAST_V4 = new Address4("224.0.0.0/4"); - var PRIVATE_V4 = [ - new Address4("10.0.0.0/8"), - new Address4("172.16.0.0/12"), - new Address4("192.168.0.0/16") - ]; - var LOOPBACK_V4 = new Address4("127.0.0.0/8"); - var LINK_LOCAL_V4 = new Address4("169.254.0.0/16"); - var UNSPECIFIED_V4 = new Address4("0.0.0.0/32"); - var BROADCAST_V4 = new Address4("255.255.255.255/32"); - var CGNAT_V4 = new Address4("100.64.0.0/10"); - var DOCUMENTATION_V4 = [ - new Address4("192.0.2.0/24"), - new Address4("198.51.100.0/24"), - new Address4("203.0.113.0/24") - ]; - var BENCHMARKING_V4 = new Address4("198.18.0.0/15"); - var RESERVED_V4 = new Address4("240.0.0.0/4"); - var SPECIAL_PURPOSE_V4 = constants.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({ - subnet: new Address4(cidr), - reachable - })); + module2.exports = inflate_table; } }); -// node_modules/ip-address/dist/v6/constants.js -var require_constants4 = __commonJS({ - "node_modules/ip-address/dist/v6/constants.js"(exports2) { +// node_modules/pako/lib/zlib/inflate.js +var require_inflate = __commonJS({ + "node_modules/pako/lib/zlib/inflate.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SPECIAL_PURPOSE = exports2.RE_URL_WITH_PORT = exports2.RE_URL = exports2.RE_ZONE_STRING = exports2.RE_SUBNET_STRING = exports2.RE_BAD_ADDRESS = exports2.RE_BAD_CHARACTERS = exports2.TYPES = exports2.SCOPES = exports2.GROUPS = exports2.BITS = void 0; - exports2.BITS = 128; - exports2.GROUPS = 8; - exports2.SCOPES = { - 0: "Reserved", - 1: "Interface local", - 2: "Link local", - 4: "Admin local", - 5: "Site local", - 8: "Organization local", - 14: "Global", - 15: "Reserved" - }; - exports2.TYPES = { - "ff01::1/128": "Multicast (All nodes on this interface)", - "ff01::2/128": "Multicast (All routers on this interface)", - "ff02::1/128": "Multicast (All nodes on this link)", - "ff02::2/128": "Multicast (All routers on this link)", - "ff05::2/128": "Multicast (All routers in this site)", - "ff02::5/128": "Multicast (OSPFv3 AllSPF routers)", - "ff02::6/128": "Multicast (OSPFv3 AllDR routers)", - "ff02::9/128": "Multicast (RIP routers)", - "ff02::a/128": "Multicast (EIGRP routers)", - "ff02::d/128": "Multicast (PIM routers)", - "ff02::16/128": "Multicast (MLDv2 reports)", - "ff01::fb/128": "Multicast (mDNSv6)", - "ff02::fb/128": "Multicast (mDNSv6)", - "ff05::fb/128": "Multicast (mDNSv6)", - "ff02::1:2/128": "Multicast (All DHCP servers and relay agents on this link)", - "ff05::1:2/128": "Multicast (All DHCP servers and relay agents in this site)", - "ff02::1:3/128": "Multicast (All DHCP servers on this link)", - "ff05::1:3/128": "Multicast (All DHCP servers in this site)", - "::/128": "Unspecified", - "::1/128": "Loopback", - "::ffff:0:0/96": "IPv4-mapped", - "ff00::/8": "Multicast", - "fe80::/10": "Link-local unicast", - "fc00::/7": "Unique local", - "2001::/32": "Teredo", - "2001:2::/48": "Benchmarking", - "2002::/16": "6to4", - "2001:db8::/32": "Documentation", - "3fff::/20": "Documentation", - "100::/64": "Discard-only", - "fec0::/10": "Site-local unicast (deprecated)", - "::/96": "IPv4-compatible (deprecated)", - "64:ff9b::/96": "NAT64 (well-known)", - "64:ff9b:1::/48": "NAT64 (local-use)" + var adler32 = require_adler32(); + var crc32 = require_crc32(); + var inflate_fast = require_inffast(); + var inflate_table = require_inftrees(); + var CODES = 0; + var LENS = 1; + var DISTS = 2; + var { + Z_FINISH, + Z_BLOCK, + Z_TREES, + Z_OK, + Z_STREAM_END, + Z_NEED_DICT, + Z_STREAM_ERROR, + Z_DATA_ERROR, + Z_MEM_ERROR, + Z_BUF_ERROR, + Z_DEFLATED + } = require_constants2(); + var HEAD = 16180; + var FLAGS = 16181; + var TIME = 16182; + var OS = 16183; + var EXLEN = 16184; + var EXTRA = 16185; + var NAME = 16186; + var COMMENT = 16187; + var HCRC = 16188; + var DICTID = 16189; + var DICT = 16190; + var TYPE = 16191; + var TYPEDO = 16192; + var STORED = 16193; + var COPY_ = 16194; + var COPY = 16195; + var TABLE = 16196; + var LENLENS = 16197; + var CODELENS = 16198; + var LEN_ = 16199; + var LEN = 16200; + var LENEXT = 16201; + var DIST = 16202; + var DISTEXT = 16203; + var MATCH = 16204; + var LIT = 16205; + var CHECK = 16206; + var LENGTH = 16207; + var DONE = 16208; + var BAD = 16209; + var MEM = 16210; + var SYNC = 16211; + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; + var MAX_WBITS = 15; + var DEF_WBITS = MAX_WBITS; + var zswap32 = (q) => { + return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); }; - exports2.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi; - exports2.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi; - exports2.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/; - exports2.RE_ZONE_STRING = /%.*$/; - exports2.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i; - exports2.RE_URL_WITH_PORT = /^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i; - exports2.SPECIAL_PURPOSE = [ - ["::1/128", "Loopback Address", false], - ["::/128", "Unspecified Address", false], - ["::ffff:0:0/96", "IPv4-mapped Address", false], - ["64:ff9b::/96", "IPv4-IPv6 Translat.", true], - ["64:ff9b:1::/48", "IPv4-IPv6 Translat.", false], - ["100::/64", "Discard-Only Address Block", false], - ["100:0:0:1::/64", "Dummy IPv6 Prefix", false], - ["2001::/23", "IETF Protocol Assignments", false], - ["2001::/32", "TEREDO", false], - ["2001:1::1/128", "Port Control Protocol Anycast", true], - ["2001:1::2/128", "Traversal Using Relays around NAT Anycast", true], - ["2001:1::3/128", "DNS-SD Service Registration Protocol Anycast", true], - ["2001:2::/48", "Benchmarking", false], - ["2001:3::/32", "AMT", true], - ["2001:4:112::/48", "AS112-v6", true], - ["2001:10::/28", "Deprecated (previously ORCHID)", null], - ["2001:20::/28", "ORCHIDv2", true], - ["2001:30::/28", "Drone Remote ID Protocol Entity Tags (DETs) Prefix", true], - ["2001:db8::/32", "Documentation", false], - ["2002::/16", "6to4", false], - ["2620:4f:8000::/48", "Direct Delegation AS112 Service", true], - ["3fff::/20", "Documentation", false], - ["5f00::/16", "Segment Routing (SRv6) SIDs", false], - ["fc00::/7", "Unique-Local", false], - ["fe80::/10", "Link-Local Unicast", false] - ]; - } -}); - -// node_modules/ip-address/dist/v6/helpers.js -var require_helpers2 = __commonJS({ - "node_modules/ip-address/dist/v6/helpers.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.escapeHtml = escapeHtml; - exports2.spanAllZeroes = spanAllZeroes; - exports2.spanAll = spanAll; - exports2.spanLeadingZeroes = spanLeadingZeroes; - exports2.simpleGroup = simpleGroup; - function escapeHtml(s) { - return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); - } - function spanAllZeroes(s) { - return escapeHtml(s).replace(/(0+)/g, '<span class="zero">$1</span>'); - } - function spanAll(s, offset = 0) { - const letters = s.split(""); - return letters.map((n, i) => `<span class="digit value-${escapeHtml(n)} position-${i + offset}">${spanAllZeroes(n)}</span>`).join(""); - } - function spanLeadingZeroesSimple(group) { - return escapeHtml(group).replace(/^(0+)/, '<span class="zero">$1</span>'); - } - function spanLeadingZeroes(address) { - const groups = address.split(":"); - return groups.map((g) => spanLeadingZeroesSimple(g)).join(":"); - } - function simpleGroup(addressString, offset = 0) { - const groups = addressString.split(":"); - return groups.map((g, i) => { - if (/group-v4/.test(g)) { - return g; - } - return `<span class="hover-group group-${i + offset}">${spanLeadingZeroesSimple(g)}</span>`; - }); + function InflateState() { + this.strm = null; + this.mode = 0; + this.last = false; + this.wrap = 0; + this.havedict = false; + this.flags = 0; + this.dmax = 0; + this.check = 0; + this.total = 0; + this.head = null; + this.wbits = 0; + this.wsize = 0; + this.whave = 0; + this.wnext = 0; + this.window = null; + this.hold = 0; + this.bits = 0; + this.length = 0; + this.offset = 0; + this.extra = 0; + this.lencode = null; + this.distcode = null; + this.lenbits = 0; + this.distbits = 0; + this.ncode = 0; + this.nlen = 0; + this.ndist = 0; + this.have = 0; + this.next = null; + this.lens = new Uint16Array(320); + this.work = new Uint16Array(288); + this.lendyn = null; + this.distdyn = null; + this.sane = 0; + this.back = 0; + this.was = 0; } - } -}); - -// node_modules/ip-address/dist/v6/regular-expressions.js -var require_regular_expressions = __commonJS({ - "node_modules/ip-address/dist/v6/regular-expressions.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + var inflateStateCheck = (strm) => { + if (!strm) { + return 1; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + const state2 = strm.state; + if (!state2 || state2.strm !== strm || state2.mode < HEAD || state2.mode > SYNC) { + return 1; } - __setModuleDefault2(result, mod); - return result; + return 0; }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ADDRESS_BOUNDARY = void 0; - exports2.groupPossibilities = groupPossibilities; - exports2.padGroup = padGroup; - exports2.simpleRegularExpression = simpleRegularExpression; - exports2.possibleElisions = possibleElisions; - var v6 = __importStar2(require_constants4()); - function groupPossibilities(possibilities) { - return `(${possibilities.join("|")})`; - } - function padGroup(group) { - if (group.length < 4) { - return `0{0,${4 - group.length}}${group}`; - } - return group; - } - exports2.ADDRESS_BOUNDARY = "[^A-Fa-f0-9:]"; - function simpleRegularExpression(groups) { - const zeroIndexes = []; - groups.forEach((group, i) => { - const groupInteger = parseInt(group, 16); - if (groupInteger === 0) { - zeroIndexes.push(i); - } - }); - const possibilities = zeroIndexes.map((zeroIndex) => groups.map((group, i) => { - if (i === zeroIndex) { - const elision = i === 0 || i === v6.GROUPS - 1 ? ":" : ""; - return groupPossibilities([padGroup(group), elision]); - } - return padGroup(group); - }).join(":")); - possibilities.push(groups.map(padGroup).join(":")); - return groupPossibilities(possibilities); - } - function possibleElisions(elidedGroups, moreLeft, moreRight) { - const left = moreLeft ? "" : ":"; - const right = moreRight ? "" : ":"; - const possibilities = []; - if (!moreLeft && !moreRight) { - possibilities.push("::"); + var inflateResetKeep = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - if (moreLeft && moreRight) { - possibilities.push(""); + const state2 = strm.state; + strm.total_in = strm.total_out = state2.total = 0; + strm.msg = ""; + if (state2.wrap) { + strm.adler = state2.wrap & 1; + } + state2.mode = HEAD; + state2.last = 0; + state2.havedict = 0; + state2.flags = -1; + state2.dmax = 32768; + state2.head = null; + state2.hold = 0; + state2.bits = 0; + state2.lencode = state2.lendyn = new Int32Array(ENOUGH_LENS); + state2.distcode = state2.distdyn = new Int32Array(ENOUGH_DISTS); + state2.sane = 1; + state2.back = -1; + return Z_OK; + }; + var inflateReset = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - if (moreRight && !moreLeft || !moreRight && moreLeft) { - possibilities.push(":"); + const state2 = strm.state; + state2.wsize = 0; + state2.whave = 0; + state2.wnext = 0; + return inflateResetKeep(strm); + }; + var inflateReset2 = (strm, windowBits) => { + let wrap; + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - possibilities.push(`${left}(:0{1,4}){1,${elidedGroups - 1}}`); - possibilities.push(`(0{1,4}:){1,${elidedGroups - 1}}${right}`); - possibilities.push(`(0{1,4}:){${elidedGroups - 1}}0{1,4}`); - for (let groups = 1; groups < elidedGroups - 1; groups++) { - for (let position = 1; position < elidedGroups - groups; position++) { - possibilities.push(`(0{1,4}:){${position}}:(0{1,4}:){${elidedGroups - position - groups - 1}}0{1,4}`); + const state2 = strm.state; + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else { + wrap = (windowBits >> 4) + 5; + if (windowBits < 48) { + windowBits &= 15; } } - return groupPossibilities(possibilities); - } - } -}); - -// node_modules/ip-address/dist/ipv6.js -var require_ipv6 = __commonJS({ - "node_modules/ip-address/dist/ipv6.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + if (state2.window !== null && state2.wbits !== windowBits) { + state2.window = null; } - __setModuleDefault2(result, mod); - return result; + state2.wrap = wrap; + state2.wbits = windowBits; + return inflateReset(strm); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Address6 = void 0; - var common = __importStar2(require_common2()); - var constants4 = __importStar2(require_constants3()); - var constants6 = __importStar2(require_constants4()); - var helpers = __importStar2(require_helpers2()); - var ipv4_1 = require_ipv4(); - var regular_expressions_1 = require_regular_expressions(); - var address_error_1 = require_address_error(); - var common_1 = require_common2(); - var isCorrect6 = common.isCorrect(constants6.BITS); - function assert(condition) { - if (!condition) { - throw new Error("Assertion failed."); - } - } - function addCommas(number) { - const r = /(\d+)(\d{3})/; - while (r.test(number)) { - number = number.replace(r, "$1,$2"); + var inflateInit2 = (strm, windowBits) => { + if (!strm) { + return Z_STREAM_ERROR; } - return number; - } - function spanLeadingZeroes4(n) { - n = n.replace(/^(0{1,})([1-9]+)$/, '<span class="parse-error">$1</span>$2'); - n = n.replace(/^(0{1,})(0)$/, '<span class="parse-error">$1</span>$2'); - return n; - } - function compact(address, slice) { - const s1 = []; - const s2 = []; - let i; - for (i = 0; i < address.length; i++) { - if (i < slice[0]) { - s1.push(address[i]); - } else if (i > slice[1]) { - s2.push(address[i]); - } + const state2 = new InflateState(); + strm.state = state2; + state2.strm = strm; + state2.window = null; + state2.mode = HEAD; + const ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null; } - return s1.concat(["compact"]).concat(s2); - } - function paddedHex(octet) { - return parseInt(octet, 16).toString(16).padStart(4, "0"); - } - function unsignByte(b) { - return b & 255; - } - var Address6 = class _Address6 { - constructor(address, optionalGroups) { - this.addressMinusSuffix = ""; - this.parsedSubnet = ""; - this.subnet = "/128"; - this.subnetMask = 128; - this.v4 = false; - this.zone = ""; - this.isInSubnet = common.isInSubnet; - this.isHostInSubnet = common.isHostInSubnet; - this.isCorrect = isCorrect6; - if (optionalGroups === void 0) { - this.groups = constants6.GROUPS; - } else { - this.groups = optionalGroups; - } - this.address = address; - const subnet = constants6.RE_SUBNET_STRING.exec(address); - if (subnet) { - this.parsedSubnet = subnet[0].replace("/", ""); - this.subnetMask = parseInt(this.parsedSubnet, 10); - this.subnet = `/${this.subnetMask}`; - if (Number.isNaN(this.subnetMask) || this.subnetMask < 0 || this.subnetMask > constants6.BITS) { - throw new address_error_1.AddressError("Invalid subnet mask."); - } - address = address.replace(constants6.RE_SUBNET_STRING, ""); + return ret; + }; + var inflateInit = (strm) => { + return inflateInit2(strm, DEF_WBITS); + }; + var virgin = true; + var lenfix; + var distfix; + var fixedtables = (state2) => { + if (virgin) { + lenfix = new Int32Array(512); + distfix = new Int32Array(32); + let sym = 0; + while (sym < 144) { + state2.lens[sym++] = 8; } - if (/\//.test(address)) { - throw new address_error_1.AddressError("Invalid subnet mask."); + while (sym < 256) { + state2.lens[sym++] = 9; } - const zoneStart = address.indexOf("%"); - if (zoneStart !== -1 && /^.*$/.test(address.slice(zoneStart))) { - this.zone = address.slice(zoneStart); - address = address.slice(0, zoneStart); + while (sym < 280) { + state2.lens[sym++] = 7; } - const longest = this.groups * 5 + 5; - if (address.length > longest) { - throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`); + while (sym < 288) { + state2.lens[sym++] = 8; } - this.addressMinusSuffix = address; - this.parsedAddress = this.parse(this.addressMinusSuffix); - } - /** - * Returns true if the given string is a valid IPv6 address (with optional - * CIDR subnet and zone identifier), false otherwise. Host bits in the - * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict - * network-address validation compare `correctForm()` to - * `startAddress().correctForm()`, or use `networkForm()`. - */ - static isValid(address) { - try { - new _Address6(address); - return true; - } catch { - return false; + inflate_table(LENS, state2.lens, 0, 288, lenfix, 0, state2.work, { bits: 9 }); + sym = 0; + while (sym < 32) { + state2.lens[sym++] = 5; } + inflate_table(DISTS, state2.lens, 0, 32, distfix, 0, state2.work, { bits: 5 }); + virgin = false; } - /** - * Convert a BigInt to a v6 address object. The value must be in the - * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown. - * @param {bigint} bigInt - a BigInt to convert - * @returns {Address6} - * @example - * var bigInt = BigInt('1000000000000'); - * var address = Address6.fromBigInt(bigInt); - * address.correctForm(); // '::e8:d4a5:1000' - */ - static fromBigInt(bigInt) { - if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) { - throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1"); - } - const hex = bigInt.toString(16).padStart(32, "0"); - const groups = []; - for (let i = 0; i < constants6.GROUPS; i++) { - groups.push(hex.slice(i * 4, (i + 1) * 4)); + state2.lencode = lenfix; + state2.lenbits = 9; + state2.distcode = distfix; + state2.distbits = 5; + }; + var updatewindow = (strm, src, end, copy) => { + let dist; + const state2 = strm.state; + if (state2.window === null) { + state2.window = new Uint8Array(1 << state2.wbits); + } + if (state2.wsize === 0) { + state2.wsize = 1 << state2.wbits; + state2.wnext = 0; + state2.whave = 0; + } + if (copy >= state2.wsize) { + state2.window.set(src.subarray(end - state2.wsize, end), 0); + state2.wnext = 0; + state2.whave = state2.wsize; + } else { + dist = state2.wsize - state2.wnext; + if (dist > copy) { + dist = copy; } - return new _Address6(groups.join(":")); - } - /** - * Parse a URL (with optional bracketed host and port) into an address and - * port. Returns either `{ address, port }` on success or - * `{ error, address: null, port: null }` if the URL could not be parsed. - * Ports are returned as numbers (or `null` if absent or out of range). - * @example - * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/'); - * addressAndPort.address.correctForm(); // 'ffff::' - * addressAndPort.port; // 8080 - */ - static fromURL(url) { - var _a3; - let host; - let port = null; - let result; - let error; - const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, ""); - if (stripped.indexOf("[") !== -1 && stripped.indexOf("]:") !== -1) { - error = "failed to parse address with port"; - result = constants6.RE_URL_WITH_PORT.exec(stripped); - if (result === null) { - return { error, address: null, port: null }; - } - host = result[1]; - port = result[2]; + state2.window.set(src.subarray(end - copy, end - copy + dist), state2.wnext); + copy -= dist; + if (copy) { + state2.window.set(src.subarray(end - copy, end), 0); + state2.wnext = copy; + state2.whave = state2.wsize; } else { - error = "failed to parse address from URL"; - result = constants6.RE_URL.exec(stripped); - if (result === null) { - return { error, address: null, port: null }; + state2.wnext += dist; + if (state2.wnext === state2.wsize) { + state2.wnext = 0; } - host = (_a3 = result[1]) !== null && _a3 !== void 0 ? _a3 : result[2]; - } - if (port) { - port = parseInt(port, 10); - if (port < 0 || port > 65535) { - port = null; + if (state2.whave < state2.wsize) { + state2.whave += dist; } - } else { - port = null; - } - let address; - try { - address = new _Address6(host); - } catch { - return { error, address: null, port: null }; } - return { address, port }; } - /** - * Construct an `Address6` from an address and a hex subnet mask given as - * separate strings (e.g. as returned by Node's `os.networkInterfaces()`). - * Throws `AddressError` if the mask is non-contiguous (e.g. - * `ffff::ffff`). - * @example - * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::'); - * address.subnetMask; // 64 - */ - static fromAddressAndMask(address, mask) { - const bits = common.prefixLengthFromMask(new _Address6(mask).bigInt(), constants6.BITS); - return new _Address6(`${address}/${bits}`); + return 0; + }; + var inflate = (strm, flush) => { + let state2; + let input, output; + let next; + let put; + let have, left; + let hold; + let bits; + let _in, _out; + let copy; + let from; + let from_source; + let here = 0; + let here_bits, here_op, here_val; + let last_bits, last_op, last_val; + let len; + let ret; + const hbuf = new Uint8Array(4); + let opts; + let n; + const order = ( + /* permutation of code lengths */ + new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]) + ); + if (inflateStateCheck(strm) || !strm.output || !strm.input && strm.avail_in !== 0) { + return Z_STREAM_ERROR; } - /** - * Construct an `Address6` from an address and a Cisco-style wildcard mask - * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`). - * The wildcard mask is the bitwise inverse of the subnet mask. Throws - * `AddressError` if the mask is non-contiguous. - * @example - * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff'); - * address.subnetMask; // 64 - */ - static fromAddressAndWildcardMask(address, wildcardMask) { - const wildcard = new _Address6(wildcardMask).bigInt(); - const allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1); - const mask = wildcard ^ allOnes; - const bits = common.prefixLengthFromMask(mask, constants6.BITS); - return new _Address6(`${address}/${bits}`); + state2 = strm.state; + if (state2.mode === TYPE) { + state2.mode = TYPEDO; } - /** - * Construct an `Address6` from a wildcard pattern with trailing `*` - * groups. The number of trailing wildcards determines the prefix - * length: each `*` represents 16 bits. `::` is expanded to zero groups - * (not wildcards) before evaluating trailing wildcards. - * - * Only trailing whole-group wildcards are supported. Partial-group - * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g. - * `*::1`) throw `AddressError`. - * @example - * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32' - * Address6.fromWildcard('2001:db8::*').subnet; // '/112' - * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0' - */ - static fromWildcard(input) { - if (input.includes("%") || input.includes("/")) { - throw new address_error_1.AddressError("Wildcard pattern must not include a zone or CIDR suffix"); - } - const halves = input.split("::"); - if (halves.length > 2) { - throw new address_error_1.AddressError("Wildcard pattern cannot contain more than one '::'"); - } - let groups; - if (halves.length === 2) { - const left = halves[0] === "" ? [] : halves[0].split(":"); - const right = halves[1] === "" ? [] : halves[1].split(":"); - const remaining = constants6.GROUPS - left.length - right.length; - if (remaining < 1) { - throw new address_error_1.AddressError("Wildcard pattern with '::' has too many groups"); - } - groups = [...left, ...new Array(remaining).fill("0"), ...right]; - } else { - groups = input.split(":"); - } - if (groups.length !== constants6.GROUPS) { - throw new address_error_1.AddressError("Wildcard pattern must have 8 groups"); - } - let firstWildcard = -1; - for (let i = 0; i < groups.length; i++) { - if (groups[i] === "*") { - if (firstWildcard === -1) { - firstWildcard = i; - } - } else if (firstWildcard !== -1) { - throw new address_error_1.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)"); + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state2.hold; + bits = state2.bits; + _in = have; + _out = left; + ret = Z_OK; + inf_leave: + for (; ; ) { + switch (state2.mode) { + case HEAD: + if (state2.wrap === 0) { + state2.mode = TYPEDO; + break; + } + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state2.wrap & 2 && hold === 35615) { + if (state2.wbits === 0) { + state2.wbits = 15; + } + state2.check = 0; + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + hold = 0; + bits = 0; + state2.mode = FLAGS; + break; + } + if (state2.head) { + state2.head.done = false; + } + if (!(state2.wrap & 1) || /* check if zlib header allowed */ + (((hold & 255) << 8) + (hold >> 8)) % 31) { + strm.msg = "incorrect header check"; + state2.mode = BAD; + break; + } + if ((hold & 15) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state2.mode = BAD; + break; + } + hold >>>= 4; + bits -= 4; + len = (hold & 15) + 8; + if (state2.wbits === 0) { + state2.wbits = len; + } + if (len > 15 || len > state2.wbits) { + strm.msg = "invalid window size"; + state2.mode = BAD; + break; + } + state2.dmax = 1 << state2.wbits; + state2.flags = 0; + strm.adler = state2.check = 1; + state2.mode = hold & 512 ? DICTID : TYPE; + hold = 0; + bits = 0; + break; + case FLAGS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.flags = hold; + if ((state2.flags & 255) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state2.mode = BAD; + break; + } + if (state2.flags & 57344) { + strm.msg = "unknown header flags set"; + state2.mode = BAD; + break; + } + if (state2.head) { + state2.head.text = hold >> 8 & 1; + } + if (state2.flags & 512 && state2.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state2.mode = TIME; + /* falls through */ + case TIME: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state2.head) { + state2.head.time = hold; + } + if (state2.flags & 512 && state2.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + hbuf[2] = hold >>> 16 & 255; + hbuf[3] = hold >>> 24 & 255; + state2.check = crc32(state2.check, hbuf, 4, 0); + } + hold = 0; + bits = 0; + state2.mode = OS; + /* falls through */ + case OS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state2.head) { + state2.head.xflags = hold & 255; + state2.head.os = hold >> 8; + } + if (state2.flags & 512 && state2.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state2.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state2.flags & 1024) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.length = hold; + if (state2.head) { + state2.head.extra_len = hold; + } + if (state2.flags & 512 && state2.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state2.check = crc32(state2.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + } else if (state2.head) { + state2.head.extra = null; + } + state2.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state2.flags & 1024) { + copy = state2.length; + if (copy > have) { + copy = have; + } + if (copy) { + if (state2.head) { + len = state2.head.extra_len - state2.length; + if (!state2.head.extra) { + state2.head.extra = new Uint8Array(state2.head.extra_len); + } + state2.head.extra.set( + input.subarray( + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + next + copy + ), + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + } + if (state2.flags & 512 && state2.wrap & 4) { + state2.check = crc32(state2.check, input, copy, next); + } + have -= copy; + next += copy; + state2.length -= copy; + } + if (state2.length) { + break inf_leave; + } + } + state2.length = 0; + state2.mode = NAME; + /* falls through */ + case NAME: + if (state2.flags & 2048) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next + copy++]; + if (state2.head && len && state2.length < 65536) { + state2.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + if (state2.flags & 512 && state2.wrap & 4) { + state2.check = crc32(state2.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { + break inf_leave; + } + } else if (state2.head) { + state2.head.name = null; + } + state2.length = 0; + state2.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state2.flags & 4096) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next + copy++]; + if (state2.head && len && state2.length < 65536) { + state2.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state2.flags & 512 && state2.wrap & 4) { + state2.check = crc32(state2.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { + break inf_leave; + } + } else if (state2.head) { + state2.head.comment = null; + } + state2.mode = HCRC; + /* falls through */ + case HCRC: + if (state2.flags & 512) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state2.wrap & 4 && hold !== (state2.check & 65535)) { + strm.msg = "header crc mismatch"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + if (state2.head) { + state2.head.hcrc = state2.flags >> 9 & 1; + state2.head.done = true; + } + strm.adler = state2.check = 0; + state2.mode = TYPE; + break; + case DICTID: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + strm.adler = state2.check = zswap32(hold); + hold = 0; + bits = 0; + state2.mode = DICT; + /* falls through */ + case DICT: + if (state2.havedict === 0) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + return Z_NEED_DICT; + } + strm.adler = state2.check = 1; + state2.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case TYPEDO: + if (state2.last) { + hold >>>= bits & 7; + bits -= bits & 7; + state2.mode = CHECK; + break; + } + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.last = hold & 1; + hold >>>= 1; + bits -= 1; + switch (hold & 3) { + case 0: + state2.mode = STORED; + break; + case 1: + fixedtables(state2); + state2.mode = LEN_; + if (flush === Z_TREES) { + hold >>>= 2; + bits -= 2; + break inf_leave; + } + break; + case 2: + state2.mode = TABLE; + break; + case 3: + strm.msg = "invalid block type"; + state2.mode = BAD; + } + hold >>>= 2; + bits -= 2; + break; + case STORED: + hold >>>= bits & 7; + bits -= bits & 7; + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { + strm.msg = "invalid stored block lengths"; + state2.mode = BAD; + break; + } + state2.length = hold & 65535; + hold = 0; + bits = 0; + state2.mode = COPY_; + if (flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case COPY_: + state2.mode = COPY; + /* falls through */ + case COPY: + copy = state2.length; + if (copy) { + if (copy > have) { + copy = have; + } + if (copy > left) { + copy = left; + } + if (copy === 0) { + break inf_leave; + } + output.set(input.subarray(next, next + copy), put); + have -= copy; + next += copy; + left -= copy; + put += copy; + state2.length -= copy; + break; + } + state2.mode = TYPE; + break; + case TABLE: + while (bits < 14) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.nlen = (hold & 31) + 257; + hold >>>= 5; + bits -= 5; + state2.ndist = (hold & 31) + 1; + hold >>>= 5; + bits -= 5; + state2.ncode = (hold & 15) + 4; + hold >>>= 4; + bits -= 4; + if (state2.nlen > 286 || state2.ndist > 30) { + strm.msg = "too many length or distance symbols"; + state2.mode = BAD; + break; + } + state2.have = 0; + state2.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state2.have < state2.ncode) { + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.lens[order[state2.have++]] = hold & 7; + hold >>>= 3; + bits -= 3; + } + while (state2.have < 19) { + state2.lens[order[state2.have++]] = 0; + } + state2.lencode = state2.lendyn; + state2.lenbits = 7; + opts = { bits: state2.lenbits }; + ret = inflate_table(CODES, state2.lens, 0, 19, state2.lencode, 0, state2.work, opts); + state2.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid code lengths set"; + state2.mode = BAD; + break; + } + state2.have = 0; + state2.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state2.have < state2.nlen + state2.ndist) { + for (; ; ) { + here = state2.lencode[hold & (1 << state2.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (here_val < 16) { + hold >>>= here_bits; + bits -= here_bits; + state2.lens[state2.have++] = here_val; + } else { + if (here_val === 16) { + n = here_bits + 2; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + if (state2.have === 0) { + strm.msg = "invalid bit length repeat"; + state2.mode = BAD; + break; + } + len = state2.lens[state2.have - 1]; + copy = 3 + (hold & 3); + hold >>>= 2; + bits -= 2; + } else if (here_val === 17) { + n = here_bits + 3; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 3 + (hold & 7); + hold >>>= 3; + bits -= 3; + } else { + n = here_bits + 7; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 11 + (hold & 127); + hold >>>= 7; + bits -= 7; + } + if (state2.have + copy > state2.nlen + state2.ndist) { + strm.msg = "invalid bit length repeat"; + state2.mode = BAD; + break; + } + while (copy--) { + state2.lens[state2.have++] = len; + } + } + } + if (state2.mode === BAD) { + break; + } + if (state2.lens[256] === 0) { + strm.msg = "invalid code -- missing end-of-block"; + state2.mode = BAD; + break; + } + state2.lenbits = 9; + opts = { bits: state2.lenbits }; + ret = inflate_table(LENS, state2.lens, 0, state2.nlen, state2.lencode, 0, state2.work, opts); + state2.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid literal/lengths set"; + state2.mode = BAD; + break; + } + state2.distbits = 6; + state2.distcode = state2.distdyn; + opts = { bits: state2.distbits }; + ret = inflate_table(DISTS, state2.lens, state2.nlen, state2.ndist, state2.distcode, 0, state2.work, opts); + state2.distbits = opts.bits; + if (ret) { + strm.msg = "invalid distances set"; + state2.mode = BAD; + break; + } + state2.mode = LEN_; + if (flush === Z_TREES) { + break inf_leave; + } + /* falls through */ + case LEN_: + state2.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + inflate_fast(strm, _out); + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state2.hold; + bits = state2.bits; + if (state2.mode === TYPE) { + state2.back = -1; + } + break; + } + state2.back = 0; + for (; ; ) { + here = state2.lencode[hold & (1 << state2.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (here_op && (here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state2.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state2.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state2.back += here_bits; + state2.length = here_val; + if (here_op === 0) { + state2.mode = LIT; + break; + } + if (here_op & 32) { + state2.back = -1; + state2.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = "invalid literal/length code"; + state2.mode = BAD; + break; + } + state2.extra = here_op & 15; + state2.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state2.extra) { + n = state2.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.length += hold & (1 << state2.extra) - 1; + hold >>>= state2.extra; + bits -= state2.extra; + state2.back += state2.extra; + } + state2.was = state2.length; + state2.mode = DIST; + /* falls through */ + case DIST: + for (; ; ) { + here = state2.distcode[hold & (1 << state2.distbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if ((here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state2.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state2.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state2.back += here_bits; + if (here_op & 64) { + strm.msg = "invalid distance code"; + state2.mode = BAD; + break; + } + state2.offset = here_val; + state2.extra = here_op & 15; + state2.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state2.extra) { + n = state2.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state2.offset += hold & (1 << state2.extra) - 1; + hold >>>= state2.extra; + bits -= state2.extra; + state2.back += state2.extra; + } + if (state2.offset > state2.dmax) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break; + } + state2.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { + break inf_leave; + } + copy = _out - left; + if (state2.offset > copy) { + copy = state2.offset - copy; + if (copy > state2.whave) { + if (state2.sane) { + strm.msg = "invalid distance too far back"; + state2.mode = BAD; + break; + } + } + if (copy > state2.wnext) { + copy -= state2.wnext; + from = state2.wsize - copy; + } else { + from = state2.wnext - copy; + } + if (copy > state2.length) { + copy = state2.length; + } + from_source = state2.window; + } else { + from_source = output; + from = put - state2.offset; + copy = state2.length; + } + if (copy > left) { + copy = left; + } + left -= copy; + state2.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state2.length === 0) { + state2.mode = LEN; + } + break; + case LIT: + if (left === 0) { + break inf_leave; + } + output[put++] = state2.length; + left--; + state2.mode = LEN; + break; + case CHECK: + if (state2.wrap) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold |= input[next++] << bits; + bits += 8; + } + _out -= left; + strm.total_out += _out; + state2.total += _out; + if (state2.wrap & 4 && _out) { + strm.adler = state2.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/ + state2.flags ? crc32(state2.check, output, _out, put - _out) : adler32(state2.check, output, _out, put - _out); + } + _out = left; + if (state2.wrap & 4 && (state2.flags ? hold : zswap32(hold)) !== state2.check) { + strm.msg = "incorrect data check"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state2.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state2.wrap && state2.flags) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state2.wrap & 4 && hold !== (state2.total & 4294967295)) { + strm.msg = "incorrect length check"; + state2.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state2.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; } } - const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard; - const replaced = groups.map((g) => g === "*" ? "0" : g); - const subnetBits = constants6.BITS - trailing * 16; - return new _Address6(`${replaced.join(":")}/${subnetBits}`); - } - /** - * Create an IPv6-mapped address given an IPv4 address - * @param {string} address - An IPv4 address string - * @returns {Address6} - * @example - * var address = Address6.fromAddress4('192.168.0.1'); - * address.correctForm(); // '::ffff:c0a8:1' - * address.to4in6(); // '::ffff:192.168.0.1' - */ - static fromAddress4(address) { - const address4 = new ipv4_1.Address4(address); - const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask); - return new _Address6(`::ffff:${address4.correctForm()}/${mask6}`); - } - /** - * Return an address from ip6.arpa form. A full 32-nibble name gives a /128 - * address; a shorter name, as used for a delegated reverse zone, gives the - * network it covers, with a subnet mask of four bits per nibble, so - * `fromArpa(x.reverseForm())` round-trips {@link reverseForm} for any prefix. - * @param {string} arpaFormAddress - an 'ip6.arpa' form address - * @returns {Adress6} - * @example - * var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.) - * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe' - * Address6.fromArpa('8.b.d.0.1.0.0.2.ip6.arpa.').networkForm(); // '2001:db8::/32' - */ - static fromArpa(arpaFormAddress) { - const nibbles = arpaFormAddress.replace(/(\.ip6\.arpa)?\.?$/i, ""); - if (!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(nibbles)) { - throw new address_error_1.AddressError("Invalid 'ip6.arpa' form."); - } - const reversed = nibbles.split(".").reverse(); - const subnetMask = reversed.length * 4; - const hex = reversed.join("").padEnd(32, "0"); - const groups = []; - for (let i = 0; i < constants6.GROUPS; i++) { - groups.push(hex.slice(i * 4, (i + 1) * 4)); - } - return new _Address6(`${groups.join(":")}/${subnetMask}`); - } - /** - * Return the Microsoft UNC transcription of the address - * @returns {String} the Microsoft UNC transcription of the address - */ - microsoftTranscription() { - return `${this.correctForm().replace(/:/g, "-")}.ipv6-literal.net`; - } - /** - * Return the first n bits of the address, defaulting to the subnet mask - * @param {number} [mask=subnet] - the number of bits to mask - * @returns {String} the first n bits of the address as a string - */ - mask(mask = this.subnetMask) { - return this.getBitsBase2(0, mask); - } - /** - * Return the number of possible subnets of a given size in the address - * @param {number} [subnetSize=128] - the subnet size - * @returns {String} - */ - // TODO: probably useful to have a numeric version of this too - possibleSubnets(subnetSize = 128) { - const availableBits = constants6.BITS - this.subnetMask; - const subnetBits = Math.abs(subnetSize - constants6.BITS); - const subnetPowers = availableBits - subnetBits; - if (subnetPowers < 0) { - return "0"; + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state2.hold = hold; + state2.bits = bits; + if (state2.wsize || _out !== strm.avail_out && state2.mode < BAD && (state2.mode < CHECK || flush !== Z_FINISH)) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state2.mode = MEM; + return Z_MEM_ERROR; } - return addCommas((BigInt("2") ** BigInt(subnetPowers)).toString(10)); - } - /** - * Helper function getting start address. - * @returns {bigint} - */ - _startAddress() { - return BigInt(`0b${this.mask() + "0".repeat(constants6.BITS - this.subnetMask)}`); - } - /** - * The first address in the range given by this address' subnet - * Often referred to as the Network Address. - * @returns {Address6} - */ - startAddress() { - return _Address6.fromBigInt(this._startAddress()); - } - /** - * The first host address in the range given by this address's subnet ie - * the first address after the Network Address - * @returns {Address6} - */ - startAddressExclusive() { - const adjust = BigInt("1"); - return _Address6.fromBigInt(this._startAddress() + adjust); - } - /** - * Helper function getting end address. - * @returns {bigint} - */ - _endAddress() { - return BigInt(`0b${this.mask() + "1".repeat(constants6.BITS - this.subnetMask)}`); - } - /** - * The last address in the range given by this address's subnet. IPv6 has - * no broadcast address, so this is an ordinary assignable address (in a - * 64-bit-interface-identifier subnet it falls inside the reserved - * subnet-anycast block of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526)). - * @returns {Address6} - */ - endAddress() { - return _Address6.fromBigInt(this._endAddress()); - } - /** - * The address one before {@link endAddress}. This is the IPv6 counterpart - * of the IPv4 method that skips the broadcast address; IPv6 has no broadcast, - * so it drops exactly one address and does not model the 128 reserved - * subnet-anycast identifiers of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526). - * @returns {Address6} - */ - endAddressExclusive() { - const adjust = BigInt("1"); - return _Address6.fromBigInt(this._endAddress() - adjust); } - /** - * Returns the address `n` addresses after this one (or before, when `n` is - * negative), keeping this address's subnet mask. Throws `AddressError` when - * the result would fall outside the IPv6 address space or `n` is not an - * integer. - * @param {number | bigint} n - * @returns {Address6} - * @example - * new Address6('2001:db8::/64').offset(1).correctForm(); // '2001:db8::1' - */ - offset(n) { - return _Address6.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants6.BITS, "IPv6")).withSubnetMask(this.subnetMask); - } - /** - * Returns the network that follows this address's network: the address after - * {@link endAddress}, with the same subnet mask. Throws `AddressError` when - * this network is the last one in the address space. - * @returns {Address6} - * @example - * new Address6('2001:db8::/64').nextNetwork().networkForm(); // '2001:db8:0:1::/64' - */ - nextNetwork() { - return _Address6.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants6.BITS, "IPv6")).withSubnetMask(this.subnetMask); - } - withSubnetMask(subnetMask) { - return new _Address6(`${this.correctForm()}/${subnetMask}`); - } - /** - * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a - * `/64`. Returns an `Address6`; call `.correctForm()` for the string. - * @returns {Address6} - */ - subnetMaskAddress() { - return _Address6.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(constants6.BITS - this.subnetMask)}`)); - } - /** - * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a - * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns - * an `Address6`; call `.correctForm()` for the string. - * @returns {Address6} - */ - wildcardMask() { - return _Address6.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(constants6.BITS - this.subnetMask)}`)); - } - /** - * The network address in CIDR string form, e.g. `2001:db8::/32` for - * `2001:db8::1/32`. For an address with no explicit subnet the prefix - * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns - * `2001:db8::1/128`. - * @returns {string} - */ - networkForm() { - return `${this.startAddress().correctForm()}/${this.subnetMask}`; + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state2.total += _out; + if (state2.wrap & 4 && _out) { + strm.adler = state2.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/ + state2.flags ? crc32(state2.check, output, _out, strm.next_out - _out) : adler32(state2.check, output, _out, strm.next_out - _out); } - /** - * Return the scope of the address. The 4-bit scope field - * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7)) - * is only defined for multicast addresses; for unicast addresses the scope - * is derived from the address type per - * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6). - * @returns {String} - */ - getScope() { - const type = this.getType(); - if (type === "Multicast" || type.startsWith("Multicast ")) { - const scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)]; - return scope || "Unknown"; - } - if (type === "Link-local unicast" || type === "Loopback") { - return "Link local"; - } - if (type === "Unspecified") { - return "Unknown"; - } - return "Global"; + strm.data_type = state2.bits + (state2.last ? 64 : 0) + (state2.mode === TYPE ? 128 : 0) + (state2.mode === LEN_ || state2.mode === COPY_ ? 256 : 0); + if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; } - /** - * Return the type of the address - * @returns {String} - */ - getType() { - for (let i = 0; i < TYPE_SUBNETS.length; i++) { - const entry = TYPE_SUBNETS[i]; - if (this.isHostInSubnet(entry[0])) { - return entry[1]; - } - } - return "Global unicast"; + return ret; + }; + var inflateEnd = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - /** - * Return the bits in the given range as a BigInt - * @returns {bigint} - */ - getBits(start, end) { - return BigInt(`0b${this.getBitsBase2(start, end)}`); + let state2 = strm.state; + if (state2.window) { + state2.window = null; } - /** - * Return the bits in the given range as a base-2 string - * @returns {String} - */ - getBitsBase2(start, end) { - return this.binaryZeroPad().slice(start, end); + strm.state = null; + return Z_OK; + }; + var inflateGetHeader = (strm, head) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - /** - * Return the bits in the given range as a base-16 string - * @returns {String} - */ - getBitsBase16(start, end) { - const length = end - start; - if (length % 4 !== 0) { - throw new Error("Length of bits to retrieve must be divisible by four"); - } - return this.getBits(start, end).toString(16).padStart(length / 4, "0"); + const state2 = strm.state; + if ((state2.wrap & 2) === 0) { + return Z_STREAM_ERROR; } - /** - * Return the bits that are set past the subnet mask length - * @returns {String} - */ - getBitsPastSubnet() { - return this.getBitsBase2(this.subnetMask, constants6.BITS); + state2.head = head; + head.done = false; + return Z_OK; + }; + var inflateSetDictionary = (strm, dictionary) => { + const dictLength = dictionary.length; + let state2; + let dictid; + let ret; + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR; } - /** - * Return the reversed ip6.arpa form of the address - * @param {Object} options - * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix - * @returns {String} - */ - reverseForm(options) { - if (!options) { - options = {}; - } - const characters = Math.floor(this.subnetMask / 4); - const reversed = this.canonicalForm().replace(/:/g, "").split("").slice(0, characters).reverse().join("."); - if (characters > 0) { - if (options.omitSuffix) { - return reversed; - } - return `${reversed}.ip6.arpa.`; - } - if (options.omitSuffix) { - return ""; - } - return "ip6.arpa."; + state2 = strm.state; + if (state2.wrap !== 0 && state2.mode !== DICT) { + return Z_STREAM_ERROR; } - /** - * Returns the address in correct form, per - * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros - * stripped, the longest run of zero groups collapsed to `::`, and hex digits - * lowercased (e.g. `2001:db8::1`). This is the recommended form for display. - */ - correctForm() { - let i; - let groups = []; - let zeroCounter = 0; - const zeroes = []; - for (i = 0; i < this.parsedAddress.length; i++) { - const value = parseInt(this.parsedAddress[i], 16); - if (value === 0) { - zeroCounter++; - } - if (value !== 0 && zeroCounter > 0) { - if (zeroCounter > 1) { - zeroes.push([i - zeroCounter, i - 1]); - } - zeroCounter = 0; - } - } - if (zeroCounter > 1) { - zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]); - } - const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1); - if (zeroes.length > 0) { - const index2 = zeroLengths.indexOf(Math.max(...zeroLengths)); - groups = compact(this.parsedAddress, zeroes[index2]); - } else { - groups = this.parsedAddress; - } - for (i = 0; i < groups.length; i++) { - if (groups[i] !== "compact") { - groups[i] = parseInt(groups[i], 16).toString(16); - } + if (state2.mode === DICT) { + dictid = 1; + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state2.check) { + return Z_DATA_ERROR; } - let correct = groups.join(":"); - correct = correct.replace(/^compact$/, "::"); - correct = correct.replace(/(^compact)|(compact$)/, ":"); - correct = correct.replace(/compact/, ""); - return correct; } - /** - * Return a zero-padded base-2 string representation of the address - * @returns {String} - * @example - * var address = new Address6('2001:4860:4001:803::1011'); - * address.binaryZeroPad(); - * // '0010000000000001010010000110000001000000000000010000100000000011 - * // 0000000000000000000000000000000000000000000000000001000000010001' - */ - binaryZeroPad() { - if (this._binaryZeroPad === void 0) { - this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, "0"); - } - return this._binaryZeroPad; + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state2.mode = MEM; + return Z_MEM_ERROR; } - /** - * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the - * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and - * returning the address with the v4 portion converted to two v6 groups. - * Used internally by `parse()`. - */ - // TODO: Improve the semantics of this helper function - parse4in6(address) { - if (address.indexOf(".") === -1) { - return address; - } - const groups = address.split(":"); - const lastGroup = groups.slice(-1)[0]; - const v4Octets = lastGroup.split("."); - if (v4Octets.length === constants4.GROUPS && v4Octets.every((octet) => /^\d{1,3}$/.test(octet))) { - if (v4Octets.some((octet) => /^0\d/.test(octet))) { - const highlighted = v4Octets.map(spanLeadingZeroes4).join("."); - const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(":"); - const separator = groups.length > 1 ? ":" : ""; - throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`); - } - } - const address4 = lastGroup.match(constants4.RE_ADDRESS); - if (address4) { - this.parsedAddress4 = address4[0]; - const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : ""; - this.address4 = new ipv4_1.Address4(`${this.parsedAddress4}${v4Suffix}`); - this.v4 = true; - groups[groups.length - 1] = this.address4.toGroup6(); - address = groups.join(":"); + state2.havedict = 1; + return Z_OK; + }; + module2.exports.inflateReset = inflateReset; + module2.exports.inflateReset2 = inflateReset2; + module2.exports.inflateResetKeep = inflateResetKeep; + module2.exports.inflateInit = inflateInit; + module2.exports.inflateInit2 = inflateInit2; + module2.exports.inflate = inflate; + module2.exports.inflateEnd = inflateEnd; + module2.exports.inflateGetHeader = inflateGetHeader; + module2.exports.inflateSetDictionary = inflateSetDictionary; + module2.exports.inflateInfo = "pako inflate (from Nodeca project)"; + } +}); + +// node_modules/pako/lib/zlib/gzheader.js +var require_gzheader = __commonJS({ + "node_modules/pako/lib/zlib/gzheader.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + function GZheader() { + this.text = 0; + this.time = 0; + this.xflags = 0; + this.os = 0; + this.extra = null; + this.extra_len = 0; + this.name = ""; + this.comment = ""; + this.hcrc = 0; + this.done = false; + } + module2.exports = GZheader; + } +}); + +// node_modules/pako/lib/inflate.js +var require_inflate2 = __commonJS({ + "node_modules/pako/lib/inflate.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var zlib_inflate = require_inflate(); + var utils = require_common(); + var strings = require_strings(); + var msg = require_messages(); + var ZStream = require_zstream(); + var GZheader = require_gzheader(); + var toString = Object.prototype.toString; + var { + Z_NO_FLUSH, + Z_FINISH, + Z_OK, + Z_STREAM_END, + Z_NEED_DICT, + Z_STREAM_ERROR, + Z_DATA_ERROR, + Z_MEM_ERROR, + Z_BUF_ERROR + } = require_constants2(); + var defaultOptions2 = { + chunkSize: 1024 * 64, + windowBits: 15, + to: "" + }; + function Inflate(options) { + this.options = utils.assign({}, defaultOptions2, options || {}); + const opt = this.options; + if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { + opt.windowBits = -15; } - return address; } - /** - * Parses an IPv6 address string into its 8 hexadecimal groups (expanding - * any `::` elision and any trailing v4-in-v6 portion) and stores the result - * on `this.parsedAddress`. Called automatically by the constructor; you - * typically don't need to call it directly. Throws `AddressError` if the - * input is malformed. - */ - // TODO: Make private? - parse(address) { - address = this.parse4in6(address); - const badCharacters = address.match(constants6.RE_BAD_CHARACTERS); - if (badCharacters) { - throw new address_error_1.AddressError(`Bad character${badCharacters.length > 1 ? "s" : ""} detected in address: ${badCharacters.join("")}`, address.replace(constants6.RE_BAD_CHARACTERS, '<span class="parse-error">$1</span>')); + if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { + opt.windowBits += 32; + } + if (opt.windowBits > 15 && opt.windowBits < 48) { + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; } - const badAddress = address.match(constants6.RE_BAD_ADDRESS); - if (badAddress) { - throw new address_error_1.AddressError(`Address failed regex: ${badAddress.join("")}`, address.replace(constants6.RE_BAD_ADDRESS, '<span class="parse-error">$1</span>')); + } + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new ZStream(); + this.strm.avail_out = 0; + let status = zlib_inflate.inflateInit2( + this.strm, + opt.windowBits + ); + if (status !== Z_OK) { + throw new Error(msg[status]); + } + this.header = new GZheader(); + zlib_inflate.inflateGetHeader(this.strm, this.header); + if (opt.dictionary) { + if (typeof opt.dictionary === "string") { + opt.dictionary = strings.string2buf(opt.dictionary); + } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + opt.dictionary = new Uint8Array(opt.dictionary); } - let groups = []; - const halves = address.split("::"); - if (halves.length === 2) { - let first = halves[0].split(":"); - let last = halves[1].split(":"); - if (first.length === 1 && first[0] === "") { - first = []; - } - if (last.length === 1 && last[0] === "") { - last = []; - } - const remaining = this.groups - (first.length + last.length); - if (!remaining) { - throw new address_error_1.AddressError("Error parsing groups"); - } - this.elidedGroups = remaining; - this.elisionBegin = first.length; - this.elisionEnd = first.length + this.elidedGroups; - groups = groups.concat(first); - for (let i = 0; i < remaining; i++) { - groups.push("0"); + if (opt.raw) { + status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); + if (status !== Z_OK) { + throw new Error(msg[status]); } - groups = groups.concat(last); - } else if (halves.length === 1) { - groups = address.split(":"); - this.elidedGroups = 0; - } else { - throw new address_error_1.AddressError("Too many :: groups found"); - } - groups = groups.map((group) => parseInt(group, 16).toString(16)); - if (groups.length !== this.groups) { - throw new address_error_1.AddressError("Incorrect number of groups found"); } - return groups; - } - /** - * Returns the canonical (fully expanded) form of the address: all 8 groups, - * each padded to 4 hex digits, with no `::` collapsing - * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and - * byte-exact comparison. - */ - canonicalForm() { - return this.parsedAddress.map(paddedHex).join(":"); - } - /** - * Return the decimal form of the address - * @returns {String} - */ - decimal() { - return this.parsedAddress.map((n) => parseInt(n, 16).toString(10).padStart(5, "0")).join(":"); } - /** - * Return the address as a BigInt - * @returns {bigint} - */ - bigInt() { - return BigInt(`0x${this.parsedAddress.map(paddedHex).join("")}`); + } + Inflate.prototype.push = function(data, flush_mode) { + const strm = this.strm; + const chunkSize = this.options.chunkSize; + const dictionary = this.options.dictionary; + let status, _flush_mode, last_avail_out; + if (this.ended) return false; + if (flush_mode === ~~flush_mode) _flush_mode = flush_mode; + else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; + if (toString.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; } - /** - * Return the last two groups of this address as an IPv4 address string. - * If this address carries a CIDR prefix that covers the trailing 32 bits - * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the - * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to - * `/32`. - * @returns {Address4} - * @example - * var address = new Address6('2001:4860:4001::1825:bf11'); - * address.to4().correctForm(); // '24.37.191.17' - */ - to4() { - const binary = this.binaryZeroPad().split(""); - const hex = BigInt(`0b${binary.slice(96, 128).join("")}`).toString(16).padStart(8, "0"); - if (this.subnetMask >= 96) { - const v4Mask = this.subnetMask - 96; - const groups = []; - for (let i = 0; i < 8; i += 2) { - groups.push(parseInt(hex.slice(i, i + 2), 16)); + strm.next_in = 0; + strm.avail_in = strm.input.length; + for (; ; ) { + if (strm.avail_out === 0) { + strm.output = new Uint8Array(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_inflate.inflate(strm, _flush_mode); + if (status === Z_NEED_DICT && dictionary) { + status = zlib_inflate.inflateSetDictionary(strm, dictionary); + if (status === Z_OK) { + status = zlib_inflate.inflate(strm, _flush_mode); + } else if (status === Z_DATA_ERROR) { + status = Z_NEED_DICT; } - return new ipv4_1.Address4(`${groups.join(".")}/${v4Mask}`); } - return ipv4_1.Address4.fromHex(hex); - } - /** - * Return the v4-in-v6 form of the address - * @returns {String} - */ - to4in6() { - const address4 = this.to4(); - const address6 = new _Address6(this.parsedAddress.slice(0, 6).join(":"), 6); - const correct = address6.correctForm(); - let infix = ""; - if (!/:$/.test(correct)) { - infix = ":"; + while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap & 2 && strm.state.flags !== 0 && strm.input[strm.next_in] !== 0) { + zlib_inflate.inflateReset(strm); + status = zlib_inflate.inflate(strm, _flush_mode); } - return correct + infix + address4.correctForm(); - } - /** - * Decodes the Teredo tunneling fields embedded in this address. Returns the - * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, - * UDP port, and Microsoft-format flag breakdown (reserved, universal/local, - * group/individual, nonce). Only meaningful for addresses in `2001::/32`. - */ - inspectTeredo() { - const prefix = this.getBitsBase16(0, 32); - const bitsForUdpPort = this.getBits(80, 96); - const udpPort = (bitsForUdpPort ^ BigInt("0xffff")).toString(); - const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64)); - const bitsForClient4 = this.getBits(96, 128); - const client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt("0xffffffff")).toString(16).padStart(8, "0")); - const flagsBase2 = this.getBitsBase2(64, 80); - const coneNat = (0, common_1.testBit)(flagsBase2, 15); - const reserved = (0, common_1.testBit)(flagsBase2, 14); - const groupIndividual = (0, common_1.testBit)(flagsBase2, 8); - const universalLocal = (0, common_1.testBit)(flagsBase2, 9); - const nonce = BigInt(`0b${flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16)}`).toString(10); - return { - prefix: `${prefix.slice(0, 4)}:${prefix.slice(4, 8)}`, - server4: server4.address, - client4: client4.address, - flags: flagsBase2, - coneNat, - microsoft: { - reserved, - universalLocal, - groupIndividual, - nonce - }, - udpPort - }; - } - /** - * Decodes the 6to4 tunneling fields embedded in this address. Returns the - * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for - * addresses in `2002::/16`. - */ - inspect6to4() { - const prefix = this.getBitsBase16(0, 16); - const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48)); - return { - prefix: prefix.slice(0, 4), - gateway: gateway.address - }; - } - /** - * Return a v6 6to4 address from a v6 v4inv6 address - * @returns {Address6} - */ - to6to4() { - if (!this.is4()) { - return null; + switch (status) { + case Z_STREAM_ERROR: + case Z_DATA_ERROR: + case Z_NEED_DICT: + case Z_MEM_ERROR: + this.onEnd(status); + this.ended = true; + return false; } - const addr6to4 = [ - "2002", - this.getBitsBase16(96, 112), - this.getBitsBase16(112, 128), - "", - "/16" - ].join(":"); - return new _Address6(addr6to4); - } - /** - * Embed an IPv4 address into a NAT64 IPv6 address using the encoding - * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). - * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix - * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter - * than /64 the IPv4 octets are split around the reserved bits 64–71. - * @example - * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221' - * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::' - */ - static fromAddress4Nat64(address, prefix = "64:ff9b::/96") { - const v4 = new ipv4_1.Address4(address); - const prefix6 = new _Address6(prefix); - const pl = prefix6.subnetMask; - if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) { - throw new address_error_1.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96"); + last_avail_out = strm.avail_out; + if (strm.next_out) { + if (strm.avail_out === 0 || status === Z_STREAM_END || _flush_mode > 0) { + if (this.options.to === "string") { + let next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + let tail = strm.next_out - next_out_utf8; + let utf8str = strings.buf2string(strm.output, next_out_utf8); + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0); + this.onData(utf8str); + } else { + this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out)); + strm.avail_out = 0; + strm.next_out = 0; + } + } } - const prefixBits = prefix6.binaryZeroPad(); - const v4Bits = v4.binaryZeroPad(); - let bits; - if (pl === 96) { - bits = prefixBits.slice(0, 96) + v4Bits; - } else { - const beforeU = 64 - pl; - bits = [ - prefixBits.slice(0, pl), - v4Bits.slice(0, beforeU), - // Bits 64 to 71 are the reserved u octet and are always zero. - "00000000", - v4Bits.slice(beforeU), - "0".repeat(128 - 72 - (32 - beforeU)) - ].join(""); + if ((status === Z_OK || status === Z_BUF_ERROR) && last_avail_out === 0) continue; + if (status === Z_STREAM_END) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return true; } - const hex = BigInt(`0b${bits}`).toString(16).padStart(32, "0"); - const groups = []; - for (let i = 0; i < 8; i++) { - groups.push(hex.slice(i * 4, (i + 1) * 4)); + if (strm.avail_in === 0) { + if (_flush_mode === Z_FINISH) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status === Z_OK ? Z_BUF_ERROR : status); + this.ended = true; + return false; + } + break; } - return new _Address6(groups.join(":")); } - /** - * Extract the embedded IPv4 address from a NAT64 IPv6 address using the - * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). - * The default prefix is the well-known prefix `64:ff9b::/96`. Returns - * `null` if this address is not contained within the given prefix. - * @example - * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33' - */ - toAddress4Nat64(prefix = "64:ff9b::/96") { - const prefix6 = new _Address6(prefix); - const pl = prefix6.subnetMask; - if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) { - throw new address_error_1.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96"); - } - if (!this.isHostInSubnet(prefix6)) { - return null; - } - const bits = this.binaryZeroPad(); - let v4Bits; - if (pl === 96) { - v4Bits = bits.slice(96, 128); + return true; + }; + Inflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + Inflate.prototype.onEnd = function(status) { + if (status === Z_OK) { + if (this.options.to === "string") { + this.result = this.chunks.join(""); } else { - const beforeU = 64 - pl; - v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU)); + this.result = utils.flattenChunks(this.chunks); } - const octets = []; - for (let i = 0; i < 4; i++) { - octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString()); + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + function inflate(input, options) { + const inflator = new Inflate(options); + inflator.push(input, true); + if (inflator.err) throw inflator.msg || msg[inflator.err]; + return inflator.result; + } + function inflateRaw(input, options) { + options = options || {}; + options.raw = true; + return inflate(input, options); + } + module2.exports.Inflate = Inflate; + module2.exports.inflate = inflate; + module2.exports.inflateRaw = inflateRaw; + module2.exports.ungzip = inflate; + module2.exports.constants = require_constants2(); + } +}); + +// node_modules/pako/index.js +var require_pako = __commonJS({ + "node_modules/pako/index.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + var { Deflate, deflate, deflateRaw, gzip: gzip2 } = require_deflate2(); + var { Inflate, inflate, inflateRaw, ungzip } = require_inflate2(); + var constants = require_constants2(); + module2.exports.Deflate = Deflate; + module2.exports.deflate = deflate; + module2.exports.deflateRaw = deflateRaw; + module2.exports.gzip = gzip2; + module2.exports.Inflate = Inflate; + module2.exports.inflate = inflate; + module2.exports.inflateRaw = inflateRaw; + module2.exports.ungzip = ungzip; + module2.exports.constants = constants; + } +}); + +// node_modules/telegram/tl/core/GZIPPacked.js +var require_GZIPPacked = __commonJS({ + "node_modules/telegram/tl/core/GZIPPacked.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GZIPPacked = void 0; + var __1 = require_tl(); + var pako_1 = require_pako(); + var GZIPPacked = class _GZIPPacked { + constructor(data) { + this.data = data; + this.CONSTRUCTOR_ID = 812830625; + this.classType = "constructor"; + } + static async gzipIfSmaller(contentRelated, data) { + if (contentRelated && data.length > 512) { + const gzipped = await new _GZIPPacked(data).toBytes(); + if (gzipped.length < data.length) { + return gzipped; + } } - return new ipv4_1.Address4(octets.join(".")); + return data; } - /** - * Return a byte array. - * - * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. - * @returns {Array} - */ - toByteArray() { - const value = this.bigInt().toString(16).padStart(constants6.BITS / 4, "0"); - const bytes = []; - for (let i = 0, length = value.length; i < length; i += 2) { - bytes.push(parseInt(value.substring(i, i + 2), 16)); + static gzip(input) { + return Buffer.from(input); + } + static ungzip(input) { + return Buffer.from((0, pako_1.inflate)(input)); + } + async toBytes() { + const g = Buffer.alloc(4); + g.writeUInt32LE(_GZIPPacked.CONSTRUCTOR_ID, 0); + return Buffer.concat([ + g, + (0, __1.serializeBytes)(await _GZIPPacked.gzip(this.data)) + ]); + } + static async read(reader) { + const constructor = reader.readInt(false); + if (constructor !== _GZIPPacked.CONSTRUCTOR_ID) { + throw new Error("not equal"); } - return bytes; + return _GZIPPacked.gzip(reader.tgReadBytes()); } - /** - * Return an unsigned byte array. - * - * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. - * @returns {Array} - */ - toUnsignedByteArray() { - return this.toByteArray().map(unsignByte); + static async fromReader(reader) { + const data = reader.tgReadBytes(); + return new _GZIPPacked(await _GZIPPacked.ungzip(data)); } - /** - * Convert a byte array to an Address6 object. - * - * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an - * `Int8Array` or a Java `byte[]` holds them), folding signed values to their - * unsigned equivalent. Throws `AddressError` unless given exactly 16 - * integers from -128 to 255. - * - * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. - * @returns {Address6} - */ - static fromByteArray(bytes) { - common.assertByteArray(bytes, 16, "IPv6", -128); - return this.fromUnsignedByteArray(bytes.map(unsignByte)); + }; + exports2.GZIPPacked = GZIPPacked; + GZIPPacked.CONSTRUCTOR_ID = 812830625; + GZIPPacked.classType = "constructor"; + } +}); + +// node_modules/telegram/tl/core/index.js +var require_core = __commonJS({ + "node_modules/telegram/tl/core/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GZIPPacked = exports2.MessageContainer = exports2.TLMessage = exports2.RPCResult = exports2.coreObjects = void 0; + var TLMessage_1 = require_TLMessage(); + Object.defineProperty(exports2, "TLMessage", { enumerable: true, get: function() { + return TLMessage_1.TLMessage; + } }); + var RPCResult_1 = require_RPCResult(); + Object.defineProperty(exports2, "RPCResult", { enumerable: true, get: function() { + return RPCResult_1.RPCResult; + } }); + var MessageContainer_1 = require_MessageContainer(); + Object.defineProperty(exports2, "MessageContainer", { enumerable: true, get: function() { + return MessageContainer_1.MessageContainer; + } }); + var GZIPPacked_1 = require_GZIPPacked(); + Object.defineProperty(exports2, "GZIPPacked", { enumerable: true, get: function() { + return GZIPPacked_1.GZIPPacked; + } }); + exports2.coreObjects = /* @__PURE__ */ new Map([ + [RPCResult_1.RPCResult.CONSTRUCTOR_ID, RPCResult_1.RPCResult], + [GZIPPacked_1.GZIPPacked.CONSTRUCTOR_ID, GZIPPacked_1.GZIPPacked], + [MessageContainer_1.MessageContainer.CONSTRUCTOR_ID, MessageContainer_1.MessageContainer] + ]); + } +}); + +// node_modules/telegram/tl/AllTLObjects.js +var require_AllTLObjects = __commonJS({ + "node_modules/telegram/tl/AllTLObjects.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.tlobjects = exports2.LAYER = void 0; + exports2.LAYER = 198; + var _1 = require_tl(); + var tlobjects = {}; + exports2.tlobjects = tlobjects; + for (const tl of Object.values(_1.Api)) { + if ("CONSTRUCTOR_ID" in tl) { + tlobjects[tl.CONSTRUCTOR_ID] = tl; + } else { + for (const sub of Object.values(tl)) { + tlobjects[sub.CONSTRUCTOR_ID] = sub; + } } + } + } +}); + +// node_modules/telegram/extensions/BinaryReader.js +var require_BinaryReader = __commonJS({ + "node_modules/telegram/extensions/BinaryReader.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BinaryReader = void 0; + var errors_1 = require_errors(); + var core_1 = require_core(); + var AllTLObjects_1 = require_AllTLObjects(); + var Helpers_1 = require_Helpers(); + var BinaryReader = class { /** - * Convert an unsigned byte array to an Address6 object. - * - * Throws `AddressError` unless given exactly 16 integers from 0 to 255. - * - * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. - * @returns {Address6} + * Small utility class to read binary data. + * @param data {Buffer} */ - static fromUnsignedByteArray(bytes) { - common.assertByteArray(bytes, 16, "IPv6", 0); - const BYTE_MAX = BigInt("256"); - let result = BigInt("0"); - let multiplier = BigInt("1"); - for (let i = bytes.length - 1; i >= 0; i--) { - result += multiplier * BigInt(bytes[i].toString(10)); - multiplier *= BYTE_MAX; - } - return _Address6.fromBigInt(result); + constructor(data) { + this.stream = data; + this._last = void 0; + this.offset = 0; } + // region Reading + // "All numbers are written as little endian." + // https://core.telegram.org/mtproto /** - * Returns true if the address is in the canonical form, false otherwise - * @returns {boolean} + * Reads a single byte value. */ - isCanonical() { - return this.addressMinusSuffix === this.canonicalForm(); + readByte() { + return this.read(1)[0]; } /** - * Returns true if the address is a link-local unicast address in `fe80::/10` - * ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4)) - * or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local - * (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise. - * @returns {boolean} + * Reads an integer (4 bytes or 32 bits) value. + * @param signed {Boolean} */ - isLinkLocal() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isLinkLocal(); + readInt(signed = true) { + let res; + if (signed) { + res = this.stream.readInt32LE(this.offset); + } else { + res = this.stream.readUInt32LE(this.offset); } - return this.isHostInSubnet(LINK_LOCAL_SUBNET); + this.offset += 4; + return res; } /** - * Returns true if the address is a multicast address, false otherwise - * @returns {boolean} + * Reads a long integer (8 bytes or 64 bits) value. + * @param signed + * @returns {BigInteger} */ - isMulticast() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isMulticast(); - } - const type = this.getType(); - return type === "Multicast" || type.startsWith("Multicast "); + readLong(signed = true) { + return this.readLargeInt(64, signed); } /** - * Returns true if the address was written in v4-in-v6 dotted-quad notation - * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag - * and does not reflect whether the address bits lie in the IPv4-mapped - * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}. - * @returns {boolean} + * Reads a real floating point (4 bytes) value. + * @returns {number} */ - is4() { - return this.v4; + readFloat() { + return this.read(4).readFloatLE(0); } /** - * Returns true if the address is an IPv4-mapped IPv6 address in - * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), - * false otherwise. Unlike {@link is4}, this checks the underlying address - * bits rather than the textual notation, so `::ffff:127.0.0.1` and - * `::ffff:7f00:1` both return true. - * @returns {boolean} + * Reads a real floating point (8 bytes) value. + * @returns {BigInteger} */ - isMapped4() { - return this.isHostInSubnet(IPV4_MAPPED_SUBNET); + readDouble() { + return this.read(8).readDoubleLE(0); } /** - * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped - * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, - * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that - * embedded address as an {@link Address4}; otherwise return null. - * - * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, - * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and - * delegate to the embedded {@link Address4} when present, so a literal such as - * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) - * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). - * This matters wherever the checks back a trust-boundary decision (e.g. an - * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, - * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as - * non-internal. - * @returns {Address4 | null} + * Reads a n-bits long integer value. + * @param bits + * @param signed {Boolean} */ - embeddedIPv4() { - if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) { - return this.to4(); - } - return null; + readLargeInt(bits, signed = true) { + const buffer = this.read(Math.floor(bits / 8)); + return (0, Helpers_1.readBigIntFromBuffer)(buffer, true, signed); } /** - * Returns true if the address is a Teredo address, false otherwise - * @returns {boolean} + * Read the given amount of bytes, or -1 to read all remaining. + * @param length {number} + * @param checkLength {boolean} whether to check if the length overflows or not. */ - isTeredo() { - return this.isHostInSubnet(TEREDO_SUBNET); + read(length = -1, checkLength = true) { + if (length === -1) { + length = this.stream.length - this.offset; + } + const result = this.stream.slice(this.offset, this.offset + length); + this.offset += length; + if (checkLength && result.length !== length) { + throw Error(`No more data left to read (need ${length}, got ${result.length}: ${result}); last read ${this._last}`); + } + this._last = result; + return result; } /** - * Returns true if the address is a 6to4 address, false otherwise - * @returns {boolean} + * Gets the byte array representing the current buffer as a whole. + * @returns {Buffer} */ - is6to4() { - return this.isHostInSubnet(SIX_TO_FOUR_SUBNET); + getBuffer() { + return this.stream; } + // endregion + // region Telegram custom reading /** - * Returns true if the address is a loopback address, false otherwise - * @returns {boolean} + * Reads a Telegram-encoded byte array, without the need of + * specifying its length. + * @returns {Buffer} */ - isLoopback() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isLoopback(); + tgReadBytes() { + const firstByte = this.readByte(); + let padding; + let length; + if (firstByte === 254) { + length = this.readByte() | this.readByte() << 8 | this.readByte() << 16; + padding = length % 4; + } else { + length = firstByte; + padding = (length + 1) % 4; } - return this.getType() === "Loopback"; + const data = this.read(length); + if (padding > 0) { + padding = 4 - padding; + this.read(padding); + } + return data; } /** - * Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses. - * @returns {boolean} + * Reads a Telegram-encoded string. + * @returns {string} */ - isULA() { - return this.isHostInSubnet(ULA_SUBNET); + tgReadString() { + return this.tgReadBytes().toString("utf-8"); } /** - * Returns true if the address is private, i.e. a Unique Local Address in - * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an - * address in the NAT64 local-use range `64:ff9b:1::/48` - * ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an - * IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in - * one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) - * private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to - * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to - * catch mapped RFC 1918 addresses as well as native ULAs. - * - * The local-use NAT64 range is reported private as a whole rather than by - * its embedded IPv4 address: an operator may carve a prefix of any RFC 6052 - * length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4 - * addresses under different deployments and no single decoding is correct. - * Use {@link toAddress4Nat64} with the deployment's prefix to decode one. + * Reads a Telegram boolean value. * @returns {boolean} */ - isPrivate() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isPrivate(); + tgReadBool() { + const value = this.readInt(false); + if (value === 2574415285) { + return true; + } else if (value === 3162085175) { + return false; + } else { + throw new Error(`Invalid boolean code ${value.toString(16)}`); } - return this.isULA() || this.isHostInSubnet(NAT64_LOCAL_USE_SUBNET); } /** - * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded - * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` - * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false - * otherwise. There is no native IPv6 CGNAT range, so this only ever returns - * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). - * @returns {boolean} + * Reads and converts Unix time (used by Telegram) + * into a Javascript {Date} object. + * @returns {Date} */ - isCGNAT() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isCGNAT(); - } - return false; + tgReadDate() { + const value = this.readInt(); + return new Date(value * 1e3); } /** - * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded - * IPv4 address is the limited broadcast address `255.255.255.255` - * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. - * There is no IPv6 broadcast, so this only ever returns true for an embedded - * IPv4 address (e.g. `::ffff:255.255.255.255`). - * @returns {boolean} + * Reads a Telegram object. */ - isBroadcast() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isBroadcast(); + tgReadObject() { + const constructorId = this.readInt(false); + let clazz = AllTLObjects_1.tlobjects[constructorId]; + if (clazz === void 0) { + const value = constructorId; + if (value === 2574415285) { + return true; + } else if (value === 3162085175) { + return false; + } else if (value === 481674261) { + const temp = []; + const length = this.readInt(); + for (let i = 0; i < length; i++) { + temp.push(this.tgReadObject()); + } + return temp; + } + clazz = core_1.coreObjects.get(constructorId); + if (clazz === void 0) { + this.seek(-4); + const pos = this.tellPosition(); + const error = new errors_1.TypeNotFoundError(constructorId, this.read()); + this.setPosition(pos); + throw error; + } } - return false; + return clazz.fromReader(this); } /** - * Returns true if the address is the unspecified address `::`. - * @returns {boolean} + * Reads a vector (a list) of Telegram objects. + * @returns {[Buffer]} */ - isUnspecified() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isUnspecified(); + tgReadVector() { + if (this.readInt(false) !== 481674261) { + throw new Error("Invalid constructor code, vector was expected"); } - return this.getType() === "Unspecified"; + const count = this.readInt(); + const temp = []; + for (let i = 0; i < count; i++) { + temp.push(this.tgReadObject()); + } + return temp; } + // endregion + // region Position related /** - * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). - * @returns {boolean} + * Tells the current position on the stream. + * @returns {number} */ - isDocumentation() { - return DOCUMENTATION_SUBNETS.some((subnet) => this.isHostInSubnet(subnet)); + tellPosition() { + return this.offset; } /** - * Returns true if the address is in the benchmarking range `2001:2::/48` - * ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an - * IPv4-mapped / NAT64 address whose embedded IPv4 address is in - * `198.18.0.0/15`, false otherwise. - * @returns {boolean} + * Sets the current position on the stream. + * @param position */ - isBenchmarking() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isBenchmarking(); - } - return this.isHostInSubnet(BENCHMARKING_SUBNET); + setPosition(position) { + this.offset = position; } /** - * Returns true if the address is globally reachable: inside the global - * unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space - * Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns - * for global unicast; everything else is reserved, ULA, link-local, or - * multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/) - * marks as not globally reachable. An IPv4-mapped or NAT64 well-known - * address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and - * `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4 - * (`2002::/16`) are not global either: the registry lists them as N/A and a - * packet to one needs a relay. - * - * This covers everything the individual classifiers name and the blocks they - * do not: the discard-only prefix `100::/64`, the IETF protocol assignments - * in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible - * `::/96` ranges, and unallocated space such as `4000::/3`. It is the single - * predicate to use where a request must not reach an internal or - * special-purpose destination; see SECURITY.md. - * @returns {boolean} + * Seeks the stream position given an offset from the current position. + * The offset may be negative. + * @param offset */ - isGlobal() { - const embedded = this.embeddedIPv4(); - if (embedded) { - return embedded.isGlobal(); + seek(offset) { + this.offset += offset; + } + }; + exports2.BinaryReader = BinaryReader; + } +}); + +// node_modules/ms/index.js +var require_ms3 = __commonJS({ + "node_modules/ms/index.js"(exports2, module2) { + init_define_import_meta_env(); + var s = 1e3; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + module2.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === "string" && val.length > 0) { + return parse3(val); + } else if (type === "number" && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) + ); + }; + function parse3(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || "ms").toLowerCase(); + switch (type) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return n * y; + case "days": + case "day": + case "d": + return n * d; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return n * h; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return n * m; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return n * s; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return n; + default: + return void 0; + } + } + function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + "d"; + } + if (ms >= h) { + return Math.round(ms / h) + "h"; + } + if (ms >= m) { + return Math.round(ms / m) + "m"; + } + if (ms >= s) { + return Math.round(ms / s) + "s"; + } + return ms + "ms"; + } + function fmtLong(ms) { + return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms"; + } + function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + " " + name; + } + return Math.ceil(ms / n) + " " + name + "s"; + } + } +}); + +// node_modules/debug/src/debug.js +var require_debug2 = __commonJS({ + "node_modules/debug/src/debug.js"(exports2, module2) { + init_define_import_meta_env(); + exports2 = module2.exports = createDebug.debug = createDebug["default"] = createDebug; + exports2.coerce = coerce; + exports2.disable = disable; + exports2.enable = enable; + exports2.enabled = enabled; + exports2.humanize = require_ms3(); + exports2.names = []; + exports2.skips = []; + exports2.formatters = {}; + var prevTime; + function selectColor(namespace) { + var hash2 = 0, i; + for (i in namespace) { + hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i); + hash2 |= 0; + } + return exports2.colors[Math.abs(hash2) % exports2.colors.length]; + } + function createDebug(namespace) { + function debug() { + if (!debug.enabled) return; + var self2 = debug; + var curr = +/* @__PURE__ */ new Date(); + var ms = curr - (prevTime || curr); + self2.diff = ms; + self2.prev = prevTime; + self2.curr = curr; + prevTime = curr; + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; } - return this.isHostInSubnet(GLOBAL_UNICAST_SUBNET) && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V6); + args[0] = exports2.coerce(args[0]); + if ("string" !== typeof args[0]) { + args.unshift("%O"); + } + var index2 = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + if (match === "%%") return match; + index2++; + var formatter = exports2.formatters[format]; + if ("function" === typeof formatter) { + var val = args[index2]; + match = formatter.call(self2, val); + args.splice(index2, 1); + index2--; + } + return match; + }); + exports2.formatArgs.call(self2, args); + var logFn = debug.log || exports2.log || console.log.bind(console); + logFn.apply(self2, args); } - // #endregion - // #region HTML - /** - * Returns the address as an HTTP URL with the host bracketed, e.g. - * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, - * e.g. `http://[2001:db8::1]:8080/`. - */ - href(optionalPort) { - if (optionalPort === void 0) { - optionalPort = ""; + debug.namespace = namespace; + debug.enabled = exports2.enabled(namespace); + debug.useColors = exports2.useColors(); + debug.color = selectColor(namespace); + if ("function" === typeof exports2.init) { + exports2.init(debug); + } + return debug; + } + function enable(namespaces) { + exports2.save(namespaces); + exports2.names = []; + exports2.skips = []; + var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); + var len = split.length; + for (var i = 0; i < len; i++) { + if (!split[i]) continue; + namespaces = split[i].replace(/\*/g, ".*?"); + if (namespaces[0] === "-") { + exports2.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); } else { - optionalPort = `:${optionalPort}`; + exports2.names.push(new RegExp("^" + namespaces + "$")); } - return `http://[${this.correctForm()}]${optionalPort}/`; } - /** - * Returns an HTML `<a>` element whose `href` encodes the address in a URL - * hash fragment (default prefix `/#address=`). Useful for linking between - * pages of an address-inspector UI. - * @param options.className - CSS class for the rendered `<a>` element - * @param options.prefix - hash prefix prepended to the address (default `/#address=`) - * @param options.v4 - when true, render the address in v4-in-v6 form - */ - link(options) { - if (!options) { - options = {}; - } - if (options.className === void 0) { - options.className = ""; - } - if (options.prefix === void 0) { - options.prefix = "/#address="; - } - if (options.v4 === void 0) { - options.v4 = false; - } - let formFunction = this.correctForm; - if (options.v4) { - formFunction = this.to4in6; - } - const form = formFunction.call(this); - const safeHref = helpers.escapeHtml(`${options.prefix}${form}`); - const safeForm = helpers.escapeHtml(form); - if (options.className) { - const safeClass = helpers.escapeHtml(options.className); - return `<a href="${safeHref}" class="${safeClass}">${safeForm}</a>`; + } + function disable() { + exports2.enable(""); + } + function enabled(name) { + var i, len; + for (i = 0, len = exports2.skips.length; i < len; i++) { + if (exports2.skips[i].test(name)) { + return false; } - return `<a href="${safeHref}">${safeForm}</a>`; } - /** - * Groups an address. - * - * Returns an HTML fragment: each group is wrapped in a `<span>` carrying - * the group classes an address-inspector UI hovers on. The address content - * is HTML-escaped; anything you concatenate around it is your - * responsibility. - * @returns {String} - */ - group() { - if (this.elidedGroups === 0) { - return helpers.simpleGroup(this.addressMinusSuffix).join(":"); - } - assert(typeof this.elidedGroups === "number"); - assert(typeof this.elisionBegin === "number"); - const output = []; - const [left, right] = this.addressMinusSuffix.split("::"); - if (left.length) { - output.push(...helpers.simpleGroup(left)); - } else { - output.push(""); + for (i = 0, len = exports2.names.length; i < len; i++) { + if (exports2.names[i].test(name)) { + return true; } - const classes = ["hover-group"]; - for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) { - classes.push(`group-${i}`); + } + return false; + } + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + } +}); + +// node_modules/debug/src/browser.js +var require_browser2 = __commonJS({ + "node_modules/debug/src/browser.js"(exports2, module2) { + init_define_import_meta_env(); + exports2 = module2.exports = require_debug2(); + exports2.log = log; + exports2.formatArgs = formatArgs; + exports2.save = save2; + exports2.load = load2; + exports2.useColors = useColors; + exports2.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage(); + exports2.colors = [ + "lightseagreen", + "forestgreen", + "goldenrod", + "dodgerblue", + "darkorchid", + "crimson" + ]; + function useColors() { + if (typeof window !== "undefined" && window.process && window.process.type === "renderer") { + return true; + } + return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + exports2.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return "[UnexpectedJSONParseError]: " + err.message; + } + }; + function formatArgs(args) { + var useColors2 = this.useColors; + args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports2.humanize(this.diff); + if (!useColors2) return; + var c = "color: " + this.color; + args.splice(1, 0, c, "color: inherit"); + var index2 = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ("%%" === match) return; + index2++; + if ("%c" === match) { + lastC = index2; } - output.push(`<span class="${classes.join(" ")}"></span>`); - if (right.length) { - output.push(...helpers.simpleGroup(right, this.elisionEnd)); + }); + args.splice(lastC, 0, c); + } + function log() { + return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + function save2(namespaces) { + try { + if (null == namespaces) { + exports2.storage.removeItem("debug"); } else { - output.push(""); - } - if (this.is4()) { - assert(this.address4 instanceof ipv4_1.Address4); - output.pop(); - output.push(this.address4.groupForV6()); + exports2.storage.debug = namespaces; } - return output.join(":"); + } catch (e) { } - // #endregion - // #region Regular expressions - /** - * Generate a regular expression string that can be used to find or validate - * all variations of this address - * @param {boolean} substringSearch - * @returns {string} - */ - regularExpressionString(substringSearch = false) { - let output = []; - const address6 = new _Address6(this.correctForm()); - if (address6.elidedGroups === 0) { - output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress)); - } else if (address6.elidedGroups === constants6.GROUPS) { - output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS)); - } else { - const halves = address6.address.split("::"); - if (halves[0].length) { - output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(":"))); + } + function load2() { + var r; + try { + r = exports2.storage.debug; + } catch (e) { + } + if (!r && typeof process !== "undefined" && "env" in process) { + r = process.env.DEBUG; + } + return r; + } + exports2.enable(load2()); + function localstorage() { + try { + return window.localStorage; + } catch (e) { + } + } + } +}); + +// node_modules/debug/src/node.js +var require_node6 = __commonJS({ + "node_modules/debug/src/node.js"(exports2, module2) { + init_define_import_meta_env(); + var tty = require("tty"); + var util = require("util"); + exports2 = module2.exports = require_debug2(); + exports2.init = init; + exports2.log = log; + exports2.formatArgs = formatArgs; + exports2.save = save2; + exports2.load = load2; + exports2.useColors = useColors; + exports2.colors = [6, 2, 3, 4, 5, 1]; + exports2.inspectOpts = Object.keys(process.env).filter(function(key) { + return /^debug_/i.test(key); + }).reduce(function(obj, key) { + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { + return k.toUpperCase(); + }); + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === "null") val = null; + else val = Number(val); + obj[prop] = val; + return obj; + }, {}); + var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + if (1 !== fd && 2 !== fd) { + util.deprecate(function() { + }, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")(); + } + var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd); + function useColors() { + return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(fd); + } + exports2.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts).split("\n").map(function(str) { + return str.trim(); + }).join(" "); + }; + exports2.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); + }; + function formatArgs(args) { + var name = this.namespace; + var useColors2 = this.useColors; + if (useColors2) { + var c = this.color; + var prefix = " \x1B[3" + c + ";1m" + name + " \x1B[0m"; + args[0] = prefix + args[0].split("\n").join("\n" + prefix); + args.push("\x1B[3" + c + "m+" + exports2.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = (/* @__PURE__ */ new Date()).toUTCString() + " " + name + " " + args[0]; + } + } + function log() { + return stream.write(util.format.apply(util, arguments) + "\n"); + } + function save2(namespaces) { + if (null == namespaces) { + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } + } + function load2() { + return process.env.DEBUG; + } + function createWritableStdioStream(fd2) { + var stream2; + var tty_wrap = process.binding("tty_wrap"); + switch (tty_wrap.guessHandleType(fd2)) { + case "TTY": + stream2 = new tty.WriteStream(fd2); + stream2._type = "tty"; + if (stream2._handle && stream2._handle.unref) { + stream2._handle.unref(); } - assert(typeof address6.elidedGroups === "number"); - output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0)); - if (halves[1].length) { - output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(":"))); + break; + case "FILE": + var fs = require("fs"); + stream2 = new fs.SyncWriteStream(fd2, { autoClose: false }); + stream2._type = "fs"; + break; + case "PIPE": + case "TCP": + var net = require("net"); + stream2 = new net.Socket({ + fd: fd2, + readable: false, + writable: true + }); + stream2.readable = false; + stream2.read = null; + stream2._type = "pipe"; + if (stream2._handle && stream2._handle.unref) { + stream2._handle.unref(); } - output = [output.join(":")]; + break; + default: + throw new Error("Implement me. Unknown stream file type!"); + } + stream2.fd = fd2; + stream2._isStdio = true; + return stream2; + } + function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports2.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; + } + } + exports2.enable(load2()); + } +}); + +// node_modules/debug/src/index.js +var require_src2 = __commonJS({ + "node_modules/debug/src/index.js"(exports2, module2) { + init_define_import_meta_env(); + if (typeof process !== "undefined" && process.type === "renderer") { + module2.exports = require_browser2(); + } else { + module2.exports = require_node6(); + } + } +}); + +// node_modules/websocket/lib/utils.js +var require_utils5 = __commonJS({ + "node_modules/websocket/lib/utils.js"(exports2) { + init_define_import_meta_env(); + var noop = exports2.noop = function() { + }; + exports2.extend = function extend(dest, source) { + for (var prop in source) { + dest[prop] = source[prop]; + } + }; + exports2.eventEmitterListenerCount = require("events").EventEmitter.listenerCount || function(emitter, type) { + return emitter.listeners(type).length; + }; + exports2.bufferAllocUnsafe = Buffer.allocUnsafe ? Buffer.allocUnsafe : function oldBufferAllocUnsafe(size) { + return new Buffer(size); + }; + exports2.bufferFromString = Buffer.from ? Buffer.from : function oldBufferFromString(string, encoding) { + return new Buffer(string, encoding); + }; + exports2.BufferingLogger = function createBufferingLogger(identifier, uniqueID) { + var logFunction = require_src2()(identifier); + if (logFunction.enabled) { + var logger = new BufferingLogger(identifier, uniqueID, logFunction); + var debug = logger.log.bind(logger); + debug.printOutput = logger.printOutput.bind(logger); + debug.enabled = logFunction.enabled; + return debug; + } + logFunction.printOutput = noop; + return logFunction; + }; + function BufferingLogger(identifier, uniqueID, logFunction) { + this.logFunction = logFunction; + this.identifier = identifier; + this.uniqueID = uniqueID; + this.buffer = []; + } + BufferingLogger.prototype.log = function() { + this.buffer.push([/* @__PURE__ */ new Date(), Array.prototype.slice.call(arguments)]); + return this; + }; + BufferingLogger.prototype.clear = function() { + this.buffer = []; + return this; + }; + BufferingLogger.prototype.printOutput = function(logFunction) { + if (!logFunction) { + logFunction = this.logFunction; + } + var uniqueID = this.uniqueID; + this.buffer.forEach(function(entry) { + var date = entry[0].toLocaleString(); + var args = entry[1].slice(); + var formatString = args[0]; + if (formatString !== void 0 && formatString !== null) { + formatString = "%s - %s - " + formatString.toString(); + args.splice(0, 1, formatString, date, uniqueID); + logFunction.apply(global, args); } - if (!substringSearch) { - output = [ - "(?=^|", - regular_expressions_1.ADDRESS_BOUNDARY, - "|[^\\w\\:])(", - ...output, - ")(?=[^\\w\\:]|", - regular_expressions_1.ADDRESS_BOUNDARY, - "|$)" - ]; + }); + }; + } +}); + +// node_modules/node-gyp-build/node-gyp-build.js +var require_node_gyp_build = __commonJS({ + "node_modules/node-gyp-build/node-gyp-build.js"(exports2, module2) { + init_define_import_meta_env(); + var fs = require("fs"); + var path2 = require("path"); + var os = require("os"); + var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; + var vars = process.config && process.config.variables || {}; + var prebuildsOnly = !!process.env.PREBUILDS_ONLY; + var abi = process.versions.modules; + var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node"; + var arch = process.env.npm_config_arch || os.arch(); + var platform = process.env.npm_config_platform || os.platform(); + var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc"); + var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || ""; + var uv = (process.versions.uv || "").split(".")[0]; + module2.exports = load2; + function load2(dir) { + return runtimeRequire(load2.resolve(dir)); + } + load2.resolve = load2.path = function(dir) { + dir = path2.resolve(dir || "."); + try { + var name = runtimeRequire(path2.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_"); + if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"]; + } catch (err) { + } + if (!prebuildsOnly) { + var release = getFirst(path2.join(dir, "build/Release"), matchBuild); + if (release) return release; + var debug = getFirst(path2.join(dir, "build/Debug"), matchBuild); + if (debug) return debug; + } + var prebuild = resolve(dir); + if (prebuild) return prebuild; + var nearby = resolve(path2.dirname(process.execPath)); + if (nearby) return nearby; + var target = [ + "platform=" + platform, + "arch=" + arch, + "runtime=" + runtime, + "abi=" + abi, + "uv=" + uv, + armv ? "armv=" + armv : "", + "libc=" + libc, + "node=" + process.versions.node, + process.versions.electron ? "electron=" + process.versions.electron : "", + typeof __webpack_require__ === "function" ? "webpack=true" : "" + // eslint-disable-line + ].filter(Boolean).join(" "); + throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n"); + function resolve(dir2) { + var tuples = readdirSync(path2.join(dir2, "prebuilds")).map(parseTuple); + var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0]; + if (!tuple) return; + var prebuilds = path2.join(dir2, "prebuilds", tuple.name); + var parsed = readdirSync(prebuilds).map(parseTags); + var candidates = parsed.filter(matchTags(runtime, abi)); + var winner = candidates.sort(compareTags(runtime))[0]; + if (winner) return path2.join(prebuilds, winner.file); + } + }; + function readdirSync(dir) { + try { + return fs.readdirSync(dir); + } catch (err) { + return []; + } + } + function getFirst(dir, filter2) { + var files = readdirSync(dir).filter(filter2); + return files[0] && path2.join(dir, files[0]); + } + function matchBuild(name) { + return /\.node$/.test(name); + } + function parseTuple(name) { + var arr = name.split("-"); + if (arr.length !== 2) return; + var platform2 = arr[0]; + var architectures = arr[1].split("+"); + if (!platform2) return; + if (!architectures.length) return; + if (!architectures.every(Boolean)) return; + return { name, platform: platform2, architectures }; + } + function matchTuple(platform2, arch2) { + return function(tuple) { + if (tuple == null) return false; + if (tuple.platform !== platform2) return false; + return tuple.architectures.includes(arch2); + }; + } + function compareTuples(a, b) { + return a.architectures.length - b.architectures.length; + } + function parseTags(file) { + var arr = file.split("."); + var extension = arr.pop(); + var tags = { file, specificity: 0 }; + if (extension !== "node") return; + for (var i = 0; i < arr.length; i++) { + var tag = arr[i]; + if (tag === "node" || tag === "electron" || tag === "node-webkit") { + tags.runtime = tag; + } else if (tag === "napi") { + tags.napi = true; + } else if (tag.slice(0, 3) === "abi") { + tags.abi = tag.slice(3); + } else if (tag.slice(0, 2) === "uv") { + tags.uv = tag.slice(2); + } else if (tag.slice(0, 4) === "armv") { + tags.armv = tag.slice(4); + } else if (tag === "glibc" || tag === "musl") { + tags.libc = tag; + } else { + continue; } - return output.join(""); - } - /** - * Generate a regular expression that can be used to find or validate all - * variations of this address. - * @param {boolean} substringSearch - * @returns {RegExp} - */ - regularExpression(substringSearch = false) { - return new RegExp(this.regularExpressionString(substringSearch), "i"); + tags.specificity++; } - }; - exports2.Address6 = Address6; - var TYPE_SUBNETS = Object.keys(constants6.TYPES).map((subnet) => [ - new Address6(subnet), - constants6.TYPES[subnet] - ]); - var TEREDO_SUBNET = new Address6("2001::/32"); - var SIX_TO_FOUR_SUBNET = new Address6("2002::/16"); - var ULA_SUBNET = new Address6("fc00::/7"); - var LINK_LOCAL_SUBNET = new Address6("fe80::/10"); - var DOCUMENTATION_SUBNETS = [new Address6("2001:db8::/32"), new Address6("3fff::/20")]; - var BENCHMARKING_SUBNET = new Address6("2001:2::/48"); - var GLOBAL_UNICAST_SUBNET = new Address6("2000::/3"); - var SPECIAL_PURPOSE_V6 = constants6.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({ - subnet: new Address6(cidr), - reachable - })); - var IPV4_MAPPED_SUBNET = new Address6("::ffff:0:0/96"); - var NAT64_WELL_KNOWN_SUBNET = new Address6("64:ff9b::/96"); - var NAT64_LOCAL_USE_SUBNET = new Address6("64:ff9b:1::/48"); + return tags; + } + function matchTags(runtime2, abi2) { + return function(tags) { + if (tags == null) return false; + if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false; + if (tags.abi && tags.abi !== abi2 && !tags.napi) return false; + if (tags.uv && tags.uv !== uv) return false; + if (tags.armv && tags.armv !== armv) return false; + if (tags.libc && tags.libc !== libc) return false; + return true; + }; + } + function runtimeAgnostic(tags) { + return tags.runtime === "node" && tags.napi; + } + function compareTags(runtime2) { + return function(a, b) { + if (a.runtime !== b.runtime) { + return a.runtime === runtime2 ? -1 : 1; + } else if (a.abi !== b.abi) { + return a.abi ? -1 : 1; + } else if (a.specificity !== b.specificity) { + return a.specificity > b.specificity ? -1 : 1; + } else { + return 0; + } + }; + } + function isNwjs() { + return !!(process.versions && process.versions.nw); + } + function isElectron() { + if (process.versions && process.versions.electron) return true; + if (process.env.ELECTRON_RUN_AS_NODE) return true; + return typeof window !== "undefined" && window.process && window.process.type === "renderer"; + } + function isAlpine(platform2) { + return platform2 === "linux" && fs.existsSync("/etc/alpine-release"); + } + load2.parseTags = parseTags; + load2.matchTags = matchTags; + load2.compareTags = compareTags; + load2.parseTuple = parseTuple; + load2.matchTuple = matchTuple; + load2.compareTuples = compareTuples; } }); -// node_modules/ip-address/dist/ip-address.js -var require_ip_address = __commonJS({ - "node_modules/ip-address/dist/ip-address.js"(exports2) { +// node_modules/node-gyp-build/index.js +var require_node_gyp_build2 = __commonJS({ + "node_modules/node-gyp-build/index.js"(exports2, module2) { + init_define_import_meta_env(); + var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; + if (typeof runtimeRequire.addon === "function") { + module2.exports = runtimeRequire.addon.bind(runtimeRequire); + } else { + module2.exports = require_node_gyp_build(); + } + } +}); + +// node_modules/bufferutil/fallback.js +var require_fallback = __commonJS({ + "node_modules/bufferutil/fallback.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + var mask = (source, mask2, output, offset, length) => { + for (var i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask2[i & 3]; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + }; + var unmask = (buffer, mask2) => { + const length = buffer.length; + for (var i = 0; i < length; i++) { + buffer[i] ^= mask2[i & 3]; } - __setModuleDefault2(result, mod); - return result; }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.v6 = exports2.AddressError = exports2.Address6 = exports2.Address4 = void 0; - var ipv4_1 = require_ipv4(); - Object.defineProperty(exports2, "Address4", { enumerable: true, get: function() { - return ipv4_1.Address4; - } }); - var ipv6_1 = require_ipv6(); - Object.defineProperty(exports2, "Address6", { enumerable: true, get: function() { - return ipv6_1.Address6; - } }); - var address_error_1 = require_address_error(); - Object.defineProperty(exports2, "AddressError", { enumerable: true, get: function() { - return address_error_1.AddressError; - } }); - var helpers = __importStar2(require_helpers2()); - exports2.v6 = { helpers }; + module2.exports = { mask, unmask }; } }); -// node_modules/socks/build/common/helpers.js -var require_helpers3 = __commonJS({ - "node_modules/socks/build/common/helpers.js"(exports2) { +// node_modules/bufferutil/index.js +var require_bufferutil = __commonJS({ + "node_modules/bufferutil/index.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateSocksClientOptions = validateSocksClientOptions; - exports2.validateSocksClientChainOptions = validateSocksClientChainOptions; - exports2.ipv4ToInt32 = ipv4ToInt32; - exports2.int32ToIpv4 = int32ToIpv4; - exports2.ipToBuffer = ipToBuffer; - var util_1 = require_util(); - var constants_1 = require_constants2(); - var stream = require("stream"); - var ip_address_1 = require_ip_address(); - var net = require("net"); - function validateSocksClientOptions(options, acceptedCommands = ["connect", "bind", "associate"]) { - if (!constants_1.SocksCommand[options.command]) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommand, options); + try { + module2.exports = require_node_gyp_build2()(__dirname); + } catch (e) { + module2.exports = require_fallback(); + } + } +}); + +// node_modules/websocket/lib/WebSocketFrame.js +var require_WebSocketFrame = __commonJS({ + "node_modules/websocket/lib/WebSocketFrame.js"(exports2, module2) { + init_define_import_meta_env(); + var bufferUtil = require_bufferutil(); + var bufferAllocUnsafe = require_utils5().bufferAllocUnsafe; + var DECODE_HEADER = 1; + var WAITING_FOR_16_BIT_LENGTH = 2; + var WAITING_FOR_64_BIT_LENGTH = 3; + var WAITING_FOR_MASK_KEY = 4; + var WAITING_FOR_PAYLOAD = 5; + var COMPLETE = 6; + function WebSocketFrame(maskBytes, frameHeader, config) { + this.maskBytes = maskBytes; + this.frameHeader = frameHeader; + this.config = config; + this.maxReceivedFrameSize = config.maxReceivedFrameSize; + this.protocolError = false; + this.frameTooLarge = false; + this.invalidCloseFrameLength = false; + this.parseState = DECODE_HEADER; + this.closeStatus = -1; + } + WebSocketFrame.prototype.addData = function(bufferList) { + if (this.parseState === DECODE_HEADER) { + if (bufferList.length >= 2) { + bufferList.joinInto(this.frameHeader, 0, 0, 2); + bufferList.advance(2); + var firstByte = this.frameHeader[0]; + var secondByte = this.frameHeader[1]; + this.fin = Boolean(firstByte & 128); + this.rsv1 = Boolean(firstByte & 64); + this.rsv2 = Boolean(firstByte & 32); + this.rsv3 = Boolean(firstByte & 16); + this.mask = Boolean(secondByte & 128); + this.opcode = firstByte & 15; + this.length = secondByte & 127; + if (this.opcode >= 8) { + if (this.length > 125) { + this.protocolError = true; + this.dropReason = "Illegal control frame longer than 125 bytes."; + return true; + } + if (!this.fin) { + this.protocolError = true; + this.dropReason = "Control frames must not be fragmented."; + return true; + } + } + if (this.length === 126) { + this.parseState = WAITING_FOR_16_BIT_LENGTH; + } else if (this.length === 127) { + this.parseState = WAITING_FOR_64_BIT_LENGTH; + } else { + this.parseState = WAITING_FOR_MASK_KEY; + } + } } - if (acceptedCommands.indexOf(options.command) === -1) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandForOperation, options); + if (this.parseState === WAITING_FOR_16_BIT_LENGTH) { + if (bufferList.length >= 2) { + bufferList.joinInto(this.frameHeader, 2, 0, 2); + bufferList.advance(2); + this.length = this.frameHeader.readUInt16BE(2); + this.parseState = WAITING_FOR_MASK_KEY; + } + } else if (this.parseState === WAITING_FOR_64_BIT_LENGTH) { + if (bufferList.length >= 8) { + bufferList.joinInto(this.frameHeader, 2, 0, 8); + bufferList.advance(8); + var lengthPair = [ + this.frameHeader.readUInt32BE(2), + this.frameHeader.readUInt32BE(2 + 4) + ]; + if (lengthPair[0] !== 0) { + this.protocolError = true; + this.dropReason = "Unsupported 64-bit length frame received"; + return true; + } + this.length = lengthPair[1]; + this.parseState = WAITING_FOR_MASK_KEY; + } } - if (!isValidSocksRemoteHost(options.destination)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + if (this.parseState === WAITING_FOR_MASK_KEY) { + if (this.mask) { + if (bufferList.length >= 4) { + bufferList.joinInto(this.maskBytes, 0, 0, 4); + bufferList.advance(4); + this.parseState = WAITING_FOR_PAYLOAD; + } + } else { + this.parseState = WAITING_FOR_PAYLOAD; + } } - if (!isValidSocksProxy(options.proxy)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + if (this.parseState === WAITING_FOR_PAYLOAD) { + if (this.length > this.maxReceivedFrameSize) { + this.frameTooLarge = true; + this.dropReason = "Frame size of " + this.length.toString(10) + " bytes exceeds maximum accepted frame size"; + return true; + } + if (this.length === 0) { + this.binaryPayload = bufferAllocUnsafe(0); + this.parseState = COMPLETE; + return true; + } + if (bufferList.length >= this.length) { + this.binaryPayload = bufferList.take(this.length); + bufferList.advance(this.length); + if (this.mask) { + bufferUtil.unmask(this.binaryPayload, this.maskBytes); + } + if (this.opcode === 8) { + if (this.length === 1) { + this.binaryPayload = bufferAllocUnsafe(0); + this.invalidCloseFrameLength = true; + } + if (this.length >= 2) { + this.closeStatus = this.binaryPayload.readUInt16BE(0); + this.binaryPayload = this.binaryPayload.slice(2); + } + } + this.parseState = COMPLETE; + return true; + } } - validateCustomProxyAuth(options.proxy, options); - if (options.timeout && !isValidTimeoutValue(options.timeout)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + return false; + }; + WebSocketFrame.prototype.throwAwayPayload = function(bufferList) { + if (bufferList.length >= this.length) { + bufferList.advance(this.length); + this.parseState = COMPLETE; + return true; } - if (options.existing_socket && !(options.existing_socket instanceof stream.Duplex)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsExistingSocket, options); + return false; + }; + WebSocketFrame.prototype.toBuffer = function(nullMask) { + var maskKey; + var headerLength = 2; + var data; + var outputPos; + var firstByte = 0; + var secondByte = 0; + if (this.fin) { + firstByte |= 128; } - } - function validateSocksClientChainOptions(options) { - if (options.command !== "connect") { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandChain, options); + if (this.rsv1) { + firstByte |= 64; } - if (!isValidSocksRemoteHost(options.destination)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + if (this.rsv2) { + firstByte |= 32; } - if (!(options.proxies && Array.isArray(options.proxies) && options.proxies.length >= 2)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxiesLength, options); + if (this.rsv3) { + firstByte |= 16; } - options.proxies.forEach((proxy) => { - if (!isValidSocksProxy(proxy)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + if (this.mask) { + secondByte |= 128; + } + firstByte |= this.opcode & 15; + if (this.opcode === 8) { + this.length = 2; + if (this.binaryPayload) { + this.length += this.binaryPayload.length; } - validateCustomProxyAuth(proxy, options); - }); - if (options.timeout && !isValidTimeoutValue(options.timeout)) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + data = bufferAllocUnsafe(this.length); + data.writeUInt16BE(this.closeStatus, 0); + if (this.length > 2) { + this.binaryPayload.copy(data, 2); + } + } else if (this.binaryPayload) { + data = this.binaryPayload; + this.length = data.length; + } else { + this.length = 0; } - } - function validateCustomProxyAuth(proxy, options) { - if (proxy.custom_auth_method !== void 0) { - if (proxy.custom_auth_method < constants_1.SOCKS5_CUSTOM_AUTH_START || proxy.custom_auth_method > constants_1.SOCKS5_CUSTOM_AUTH_END) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthRange, options); + if (this.length <= 125) { + secondByte |= this.length & 127; + } else if (this.length > 125 && this.length <= 65535) { + secondByte |= 126; + headerLength += 2; + } else if (this.length > 65535) { + secondByte |= 127; + headerLength += 8; + } + var output = bufferAllocUnsafe(this.length + headerLength + (this.mask ? 4 : 0)); + output[0] = firstByte; + output[1] = secondByte; + outputPos = 2; + if (this.length > 125 && this.length <= 65535) { + output.writeUInt16BE(this.length, outputPos); + outputPos += 2; + } else if (this.length > 65535) { + output.writeUInt32BE(0, outputPos); + output.writeUInt32BE(this.length, outputPos + 4); + outputPos += 8; + } + if (this.mask) { + maskKey = nullMask ? 0 : Math.random() * 4294967295 >>> 0; + this.maskBytes.writeUInt32BE(maskKey, 0); + this.maskBytes.copy(output, outputPos); + outputPos += 4; + if (data) { + bufferUtil.mask(data, this.maskBytes, output, outputPos, this.length); } - if (proxy.custom_auth_request_handler === void 0 || typeof proxy.custom_auth_request_handler !== "function") { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } else if (data) { + data.copy(output, outputPos); + } + return output; + }; + WebSocketFrame.prototype.toString = function() { + return "Opcode: " + this.opcode + ", fin: " + this.fin + ", length: " + this.length + ", hasPayload: " + Boolean(this.binaryPayload) + ", masked: " + this.mask; + }; + module2.exports = WebSocketFrame; + } +}); + +// node_modules/websocket/vendor/FastBufferList.js +var require_FastBufferList = __commonJS({ + "node_modules/websocket/vendor/FastBufferList.js"(exports2, module2) { + init_define_import_meta_env(); + var Buffer2 = require("buffer").Buffer; + var EventEmitter = require("events").EventEmitter; + var bufferAllocUnsafe = require_utils5().bufferAllocUnsafe; + module2.exports = BufferList; + module2.exports.BufferList = BufferList; + function BufferList(opts) { + if (!(this instanceof BufferList)) return new BufferList(opts); + EventEmitter.call(this); + var self2 = this; + if (typeof opts == "undefined") opts = {}; + self2.encoding = opts.encoding; + var head = { next: null, buffer: null }; + var last = { next: null, buffer: null }; + var length = 0; + self2.__defineGetter__("length", function() { + return length; + }); + var offset = 0; + self2.write = function(buf) { + if (!head.buffer) { + head.buffer = buf; + last = head; + } else { + last.next = { next: null, buffer: buf }; + last = last.next; + } + length += buf.length; + self2.emit("write", buf); + return true; + }; + self2.end = function(buf) { + if (Buffer2.isBuffer(buf)) self2.write(buf); + }; + self2.push = function() { + var args = [].concat.apply([], arguments); + args.forEach(self2.write); + return self2; + }; + self2.forEach = function(fn) { + if (!head.buffer) return bufferAllocUnsafe(0); + if (head.buffer.length - offset <= 0) return self2; + var firstBuf = head.buffer.slice(offset); + var b = { buffer: firstBuf, next: head.next }; + while (b && b.buffer) { + var r = fn(b.buffer); + if (r) break; + b = b.next; + } + return self2; + }; + self2.join = function(start, end) { + if (!head.buffer) return bufferAllocUnsafe(0); + if (start == void 0) start = 0; + if (end == void 0) end = self2.length; + var big = bufferAllocUnsafe(end - start); + var ix = 0; + self2.forEach(function(buffer) { + if (start < ix + buffer.length && ix < end) { + buffer.copy( + big, + Math.max(0, ix - start), + Math.max(0, start - ix), + Math.min(buffer.length, end - ix) + ); + } + ix += buffer.length; + if (ix > end) return true; + }); + return big; + }; + self2.joinInto = function(targetBuffer, targetStart, sourceStart, sourceEnd) { + if (!head.buffer) return new bufferAllocUnsafe(0); + if (sourceStart == void 0) sourceStart = 0; + if (sourceEnd == void 0) sourceEnd = self2.length; + var big = targetBuffer; + if (big.length - targetStart < sourceEnd - sourceStart) { + throw new Error("Insufficient space available in target Buffer."); + } + var ix = 0; + self2.forEach(function(buffer) { + if (sourceStart < ix + buffer.length && ix < sourceEnd) { + buffer.copy( + big, + Math.max(targetStart, targetStart + ix - sourceStart), + Math.max(0, sourceStart - ix), + Math.min(buffer.length, sourceEnd - ix) + ); + } + ix += buffer.length; + if (ix > sourceEnd) return true; + }); + return big; + }; + self2.advance = function(n) { + offset += n; + length -= n; + while (head.buffer && offset >= head.buffer.length) { + offset -= head.buffer.length; + head = head.next ? head.next : { buffer: null, next: null }; } - if (proxy.custom_auth_response_size === void 0) { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + if (head.buffer === null) last = { next: null, buffer: null }; + self2.emit("advance", n); + return self2; + }; + self2.take = function(n, encoding) { + if (n == void 0) n = self2.length; + else if (typeof n !== "number") { + encoding = n; + n = self2.length; } - if (proxy.custom_auth_response_handler === void 0 || typeof proxy.custom_auth_response_handler !== "function") { - throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + var b = head; + if (!encoding) encoding = self2.encoding; + if (encoding) { + var acc = ""; + self2.forEach(function(buffer) { + if (n <= 0) return true; + acc += buffer.toString( + encoding, + 0, + Math.min(n, buffer.length) + ); + n -= buffer.length; + }); + return acc; + } else { + return self2.join(0, n); } - } - } - function isValidSocksRemoteHost(remoteHost) { - return remoteHost && typeof remoteHost.host === "string" && Buffer.byteLength(remoteHost.host) < 256 && typeof remoteHost.port === "number" && remoteHost.port >= 0 && remoteHost.port <= 65535; - } - function isValidSocksProxy(proxy) { - return proxy && (typeof proxy.host === "string" || typeof proxy.ipaddress === "string") && typeof proxy.port === "number" && proxy.port >= 0 && proxy.port <= 65535 && (proxy.type === 4 || proxy.type === 5); - } - function isValidTimeoutValue(value) { - return typeof value === "number" && value > 0; - } - function ipv4ToInt32(ip) { - const address = new ip_address_1.Address4(ip); - return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0; - } - function int32ToIpv4(int32) { - const octet1 = int32 >>> 24 & 255; - const octet2 = int32 >>> 16 & 255; - const octet3 = int32 >>> 8 & 255; - const octet4 = int32 & 255; - return [octet1, octet2, octet3, octet4].join("."); - } - function ipToBuffer(ip) { - if (net.isIPv4(ip)) { - const address = new ip_address_1.Address4(ip); - return Buffer.from(address.toArray()); - } else if (net.isIPv6(ip)) { - const address = new ip_address_1.Address6(ip); - return Buffer.from(address.canonicalForm().split(":").map((segment) => segment.padStart(4, "0")).join(""), "hex"); - } else { - throw new Error("Invalid IP address format"); - } + }; + self2.toString = function() { + return self2.take("binary"); + }; } + require("util").inherits(BufferList, EventEmitter); } }); -// node_modules/socks/build/common/receivebuffer.js -var require_receivebuffer = __commonJS({ - "node_modules/socks/build/common/receivebuffer.js"(exports2) { +// node_modules/utf-8-validate/fallback.js +var require_fallback2 = __commonJS({ + "node_modules/utf-8-validate/fallback.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ReceiveBuffer = void 0; - var ReceiveBuffer = class { - constructor(size = 4096) { - this.buffer = Buffer.allocUnsafe(size); - this.offset = 0; - this.originalSize = size; - } - get length() { - return this.offset; - } - append(data) { - if (!Buffer.isBuffer(data)) { - throw new Error("Attempted to append a non-buffer instance to ReceiveBuffer."); - } - if (this.offset + data.length >= this.buffer.length) { - const tmp = this.buffer; - this.buffer = Buffer.allocUnsafe(Math.max(this.buffer.length + this.originalSize, this.buffer.length + data.length)); - tmp.copy(this.buffer); - } - data.copy(this.buffer, this.offset); - return this.offset += data.length; - } - peek(length) { - if (length > this.offset) { - throw new Error("Attempted to read beyond the bounds of the managed internal data."); - } - return this.buffer.slice(0, length); - } - get(length) { - if (length > this.offset) { - throw new Error("Attempted to read beyond the bounds of the managed internal data."); + function isValidUTF8(buf) { + const len = buf.length; + let i = 0; + while (i < len) { + if ((buf[i] & 128) === 0) { + i++; + } else if ((buf[i] & 224) === 192) { + if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) { + return false; + } + i += 2; + } else if ((buf[i] & 240) === 224) { + if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // overlong + buf[i] === 237 && (buf[i + 1] & 224) === 160) { + return false; + } + i += 3; + } else if ((buf[i] & 248) === 240) { + if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // overlong + buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) { + return false; + } + i += 4; + } else { + return false; } - const value = Buffer.allocUnsafe(length); - this.buffer.slice(0, length).copy(value); - this.buffer.copyWithin(0, length, length + this.offset - length); - this.offset -= length; - return value; } - }; - exports2.ReceiveBuffer = ReceiveBuffer; + return true; + } + module2.exports = isValidUTF8; } }); -// node_modules/socks/build/client/socksclient.js -var require_socksclient = __commonJS({ - "node_modules/socks/build/client/socksclient.js"(exports2) { +// node_modules/utf-8-validate/index.js +var require_utf_8_validate = __commonJS({ + "node_modules/utf-8-validate/index.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + try { + module2.exports = require_node_gyp_build2()(__dirname); + } catch (e) { + module2.exports = require_fallback2(); + } + } +}); + +// node_modules/websocket/lib/WebSocketConnection.js +var require_WebSocketConnection = __commonJS({ + "node_modules/websocket/lib/WebSocketConnection.js"(exports2, module2) { + init_define_import_meta_env(); + var util = require("util"); + var utils = require_utils5(); + var EventEmitter = require("events").EventEmitter; + var WebSocketFrame = require_WebSocketFrame(); + var BufferList = require_FastBufferList(); + var isValidUTF8 = require_utf_8_validate(); + var bufferAllocUnsafe = utils.bufferAllocUnsafe; + var bufferFromString = utils.bufferFromString; + var STATE_OPEN = "open"; + var STATE_PEER_REQUESTED_CLOSE = "peer_requested_close"; + var STATE_ENDING = "ending"; + var STATE_CLOSED = "closed"; + var setImmediateImpl = "setImmediate" in global ? global.setImmediate.bind(global) : process.nextTick.bind(process); + var idCounter = 0; + function WebSocketConnection(socket, extensions, protocol, maskOutgoingPackets, config) { + this._debug = utils.BufferingLogger("websocket:connection", ++idCounter); + this._debug("constructor"); + if (this._debug.enabled) { + instrumentSocketForDebugging(this, socket); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } + EventEmitter.call(this); + this._pingListenerCount = 0; + this.on("newListener", function(ev) { + if (ev === "ping") { + this._pingListenerCount++; } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); + }).on("removeListener", function(ev) { + if (ev === "ping") { + this._pingListenerCount--; + } + }); + this.config = config; + this.socket = socket; + this.protocol = protocol; + this.extensions = extensions; + this.remoteAddress = socket.remoteAddress; + this.closeReasonCode = -1; + this.closeDescription = null; + this.closeEventEmitted = false; + this.maskOutgoingPackets = maskOutgoingPackets; + this.maskBytes = bufferAllocUnsafe(4); + this.frameHeader = bufferAllocUnsafe(10); + this.bufferList = new BufferList(); + this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + this.fragmentationSize = 0; + this.frameQueue = []; + this.connected = true; + this.state = STATE_OPEN; + this.waitingForCloseResponse = false; + this.receivedEnd = false; + this.closeTimeout = this.config.closeTimeout; + this.assembleFragments = this.config.assembleFragments; + this.maxReceivedMessageSize = this.config.maxReceivedMessageSize; + this.outputBufferFull = false; + this.inputPaused = false; + this.receivedDataHandler = this.processReceivedData.bind(this); + this._closeTimerHandler = this.handleCloseTimer.bind(this); + this.socket.setNoDelay(this.config.disableNagleAlgorithm); + this.socket.setTimeout(0); + if (this.config.keepalive && !this.config.useNativeKeepalive) { + if (typeof this.config.keepaliveInterval !== "number") { + throw new Error("keepaliveInterval must be specified and numeric if keepalive is true."); + } + this._keepaliveTimerHandler = this.handleKeepaliveTimer.bind(this); + this.setKeepaliveTimer(); + if (this.config.dropConnectionOnKeepaliveTimeout) { + if (typeof this.config.keepaliveGracePeriod !== "number") { + throw new Error("keepaliveGracePeriod must be specified and numeric if dropConnectionOnKeepaliveTimeout is true."); } + this._gracePeriodTimerHandler = this.handleGracePeriodTimer.bind(this); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } else if (this.config.keepalive && this.config.useNativeKeepalive) { + if (!("setKeepAlive" in this.socket)) { + throw new Error("Unable to use native keepalive: unsupported by this version of Node."); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SocksClientError = exports2.SocksClient = void 0; - var events_1 = require("events"); - var net = require("net"); - var smart_buffer_1 = require_smartbuffer(); - var constants_1 = require_constants2(); - var helpers_1 = require_helpers3(); - var receivebuffer_1 = require_receivebuffer(); - var util_1 = require_util(); - Object.defineProperty(exports2, "SocksClientError", { enumerable: true, get: function() { - return util_1.SocksClientError; - } }); - var ip_address_1 = require_ip_address(); - var SocksClient = class _SocksClient extends events_1.EventEmitter { - constructor(options) { - super(); - this.options = Object.assign({}, options); - (0, helpers_1.validateSocksClientOptions)(options); - this.setState(constants_1.SocksClientState.Created); + this.socket.setKeepAlive(true, this.config.keepaliveInterval); } - /** - * Creates a new SOCKS connection. - * - * Note: Supports callbacks and promises. Only supports the connect command. - * @param options { SocksClientOptions } Options. - * @param callback { Function } An optional callback function. - * @returns { Promise } - */ - static createConnection(options, callback) { - return new Promise((resolve, reject) => { - try { - (0, helpers_1.validateSocksClientOptions)(options, ["connect"]); - } catch (err) { - if (typeof callback === "function") { - callback(err); - return resolve(err); - } else { - return reject(err); - } - } - const client2 = new _SocksClient(options); - client2.connect(options.existing_socket); - client2.once("established", (info) => { - client2.removeAllListeners(); - if (typeof callback === "function") { - callback(null, info); - resolve(info); - } else { - resolve(info); - } - }); - client2.once("error", (err) => { - client2.removeAllListeners(); - if (typeof callback === "function") { - callback(err); - resolve(err); - } else { - reject(err); - } - }); - }); + this.socket.removeAllListeners("error"); + } + WebSocketConnection.CLOSE_REASON_NORMAL = 1e3; + WebSocketConnection.CLOSE_REASON_GOING_AWAY = 1001; + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR = 1002; + WebSocketConnection.CLOSE_REASON_UNPROCESSABLE_INPUT = 1003; + WebSocketConnection.CLOSE_REASON_RESERVED = 1004; + WebSocketConnection.CLOSE_REASON_NOT_PROVIDED = 1005; + WebSocketConnection.CLOSE_REASON_ABNORMAL = 1006; + WebSocketConnection.CLOSE_REASON_INVALID_DATA = 1007; + WebSocketConnection.CLOSE_REASON_POLICY_VIOLATION = 1008; + WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG = 1009; + WebSocketConnection.CLOSE_REASON_EXTENSION_REQUIRED = 1010; + WebSocketConnection.CLOSE_REASON_INTERNAL_SERVER_ERROR = 1011; + WebSocketConnection.CLOSE_REASON_TLS_HANDSHAKE_FAILED = 1015; + WebSocketConnection.CLOSE_DESCRIPTIONS = { + 1e3: "Normal connection closure", + 1001: "Remote peer is going away", + 1002: "Protocol error", + 1003: "Unprocessable input", + 1004: "Reserved", + 1005: "Reason not provided", + 1006: "Abnormal closure, no further detail available", + 1007: "Invalid data received", + 1008: "Policy violation", + 1009: "Message too big", + 1010: "Extension requested by client is required", + 1011: "Internal Server Error", + 1015: "TLS Handshake Failed" + }; + function validateCloseReason(code) { + if (code < 1e3) { + return false; } - /** - * Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies. - * - * Note: Supports callbacks and promises. Only supports the connect method. - * Note: Implemented via createConnection() factory function. - * @param options { SocksClientChainOptions } Options - * @param callback { Function } An optional callback function. - * @returns { Promise } - */ - static createConnectionChain(options, callback) { - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { - try { - (0, helpers_1.validateSocksClientChainOptions)(options); - } catch (err) { - if (typeof callback === "function") { - callback(err); - return resolve(err); - } else { - return reject(err); - } - } - if (options.randomizeChain) { - (0, util_1.shuffleArray)(options.proxies); - } - try { - let sock; - for (let i = 0; i < options.proxies.length; i++) { - const nextProxy = options.proxies[i]; - const nextDestination = i === options.proxies.length - 1 ? options.destination : { - host: options.proxies[i + 1].host || options.proxies[i + 1].ipaddress, - port: options.proxies[i + 1].port - }; - const result = yield _SocksClient.createConnection({ - command: "connect", - proxy: nextProxy, - destination: nextDestination, - existing_socket: sock - }); - sock = sock || result.socket; - } - if (typeof callback === "function") { - callback(null, { socket: sock }); - resolve({ socket: sock }); - } else { - resolve({ socket: sock }); - } - } catch (err) { - if (typeof callback === "function") { - callback(err); - resolve(err); - } else { - reject(err); - } - } - })); + if (code >= 1e3 && code <= 2999) { + return [1e3, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015].indexOf(code) !== -1; } - /** - * Creates a SOCKS UDP Frame. - * @param options - */ - static createUDPFrame(options) { - const buff = new smart_buffer_1.SmartBuffer(); - buff.writeUInt16BE(0); - buff.writeUInt8(options.frameNumber || 0); - if (net.isIPv4(options.remoteHost.host)) { - buff.writeUInt8(constants_1.Socks5HostType.IPv4); - buff.writeUInt32BE((0, helpers_1.ipv4ToInt32)(options.remoteHost.host)); - } else if (net.isIPv6(options.remoteHost.host)) { - buff.writeUInt8(constants_1.Socks5HostType.IPv6); - buff.writeBuffer((0, helpers_1.ipToBuffer)(options.remoteHost.host)); - } else { - buff.writeUInt8(constants_1.Socks5HostType.Hostname); - buff.writeUInt8(Buffer.byteLength(options.remoteHost.host)); - buff.writeString(options.remoteHost.host); - } - buff.writeUInt16BE(options.remoteHost.port); - buff.writeBuffer(options.data); - return buff.toBuffer(); + if (code >= 3e3 && code <= 3999) { + return true; } - /** - * Parses a SOCKS UDP frame. - * @param data - */ - static parseUDPFrame(data) { - const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); - buff.readOffset = 2; - const frameNumber = buff.readUInt8(); - const hostType = buff.readUInt8(); - let remoteHost; - if (hostType === constants_1.Socks5HostType.IPv4) { - remoteHost = (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()); - } else if (hostType === constants_1.Socks5HostType.IPv6) { - remoteHost = ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(); - } else { - remoteHost = buff.readString(buff.readUInt8()); - } - const remotePort = buff.readUInt16BE(); - return { - frameNumber, - remoteHost: { - host: remoteHost, - port: remotePort - }, - data: buff.readBuffer() - }; + if (code >= 4e3 && code <= 4999) { + return true; } - /** - * Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state. - */ - setState(newState) { - if (this.state !== constants_1.SocksClientState.Error) { - this.state = newState; - } + if (code >= 5e3) { + return false; } - /** - * Starts the connection establishment to the proxy and destination. - * @param existingSocket Connected socket to use instead of creating a new one (internal use). - */ - connect(existingSocket) { - this.onDataReceived = (data) => this.onDataReceivedHandler(data); - this.onClose = () => this.onCloseHandler(); - this.onError = (err) => this.onErrorHandler(err); - this.onConnect = () => this.onConnectHandler(); - const timer = setTimeout(() => this.onEstablishedTimeout(), this.options.timeout || constants_1.DEFAULT_TIMEOUT); - if (timer.unref && typeof timer.unref === "function") { - timer.unref(); - } - if (existingSocket) { - this.socket = existingSocket; - } else { - this.socket = new net.Socket(); - } - this.socket.once("close", this.onClose); - this.socket.once("error", this.onError); - this.socket.once("connect", this.onConnect); - this.socket.on("data", this.onDataReceived); - this.setState(constants_1.SocksClientState.Connecting); - this.receiveBuffer = new receivebuffer_1.ReceiveBuffer(); - if (existingSocket) { - this.socket.emit("connect"); - } else { - this.socket.connect(this.getSocketOptions()); - if (this.options.set_tcp_nodelay !== void 0 && this.options.set_tcp_nodelay !== null) { - this.socket.setNoDelay(!!this.options.set_tcp_nodelay); - } - } - this.prependOnceListener("established", (info) => { - setImmediate(() => { - if (this.receiveBuffer.length > 0) { - const excessData = this.receiveBuffer.get(this.receiveBuffer.length); - info.socket.emit("data", excessData); - } - info.socket.resume(); - }); - }); + } + util.inherits(WebSocketConnection, EventEmitter); + WebSocketConnection.prototype._addSocketEventListeners = function() { + this.socket.on("error", this.handleSocketError.bind(this)); + this.socket.on("end", this.handleSocketEnd.bind(this)); + this.socket.on("close", this.handleSocketClose.bind(this)); + this.socket.on("drain", this.handleSocketDrain.bind(this)); + this.socket.on("pause", this.handleSocketPause.bind(this)); + this.socket.on("resume", this.handleSocketResume.bind(this)); + this.socket.on("data", this.handleSocketData.bind(this)); + }; + WebSocketConnection.prototype.setKeepaliveTimer = function() { + this._debug("setKeepaliveTimer"); + if (!this.config.keepalive || this.config.useNativeKeepalive) { + return; } - // Socket options (defaults host/port to options.proxy.host/options.proxy.port) - getSocketOptions() { - return Object.assign(Object.assign({}, this.options.socket_options), { host: this.options.proxy.host || this.options.proxy.ipaddress, port: this.options.proxy.port }); + this.clearKeepaliveTimer(); + this.clearGracePeriodTimer(); + this._keepaliveTimeoutID = setTimeout(this._keepaliveTimerHandler, this.config.keepaliveInterval); + }; + WebSocketConnection.prototype.clearKeepaliveTimer = function() { + if (this._keepaliveTimeoutID) { + clearTimeout(this._keepaliveTimeoutID); } - /** - * Handles internal Socks timeout callback. - * Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed. - */ - onEstablishedTimeout() { - if (this.state !== constants_1.SocksClientState.Established && this.state !== constants_1.SocksClientState.BoundWaitingForConnection) { - this.closeSocket(constants_1.ERRORS.ProxyConnectionTimedOut); - } + }; + WebSocketConnection.prototype.handleKeepaliveTimer = function() { + this._debug("handleKeepaliveTimer"); + this._keepaliveTimeoutID = null; + this.ping(); + if (this.config.dropConnectionOnKeepaliveTimeout) { + this.setGracePeriodTimer(); + } else { + this.setKeepaliveTimer(); } - /** - * Handles Socket connect event. - */ - onConnectHandler() { - this.setState(constants_1.SocksClientState.Connected); - if (this.options.proxy.type === 4) { - this.sendSocks4InitialHandshake(); - } else { - this.sendSocks5InitialHandshake(); - } - this.setState(constants_1.SocksClientState.SentInitialHandshake); + }; + WebSocketConnection.prototype.setGracePeriodTimer = function() { + this._debug("setGracePeriodTimer"); + this.clearGracePeriodTimer(); + this._gracePeriodTimeoutID = setTimeout(this._gracePeriodTimerHandler, this.config.keepaliveGracePeriod); + }; + WebSocketConnection.prototype.clearGracePeriodTimer = function() { + if (this._gracePeriodTimeoutID) { + clearTimeout(this._gracePeriodTimeoutID); } - /** - * Handles Socket data event. - * @param data - */ - onDataReceivedHandler(data) { - this.receiveBuffer.append(data); - this.processData(); + }; + WebSocketConnection.prototype.handleGracePeriodTimer = function() { + this._debug("handleGracePeriodTimer"); + this._gracePeriodTimeoutID = null; + this.drop(WebSocketConnection.CLOSE_REASON_ABNORMAL, "Peer not responding.", true); + }; + WebSocketConnection.prototype.handleSocketData = function(data) { + this._debug("handleSocketData"); + this.setKeepaliveTimer(); + this.bufferList.write(data); + this.processReceivedData(); + }; + WebSocketConnection.prototype.processReceivedData = function() { + this._debug("processReceivedData"); + if (!this.connected) { + return; } - /** - * Handles processing of the data we have received. - */ - processData() { - while (this.state !== constants_1.SocksClientState.Established && this.state !== constants_1.SocksClientState.Error && this.receiveBuffer.length >= this.nextRequiredPacketBufferSize) { - if (this.state === constants_1.SocksClientState.SentInitialHandshake) { - if (this.options.proxy.type === 4) { - this.handleSocks4FinalHandshakeResponse(); - } else { - this.handleInitialSocks5HandshakeResponse(); - } - } else if (this.state === constants_1.SocksClientState.SentAuthentication) { - this.handleInitialSocks5AuthenticationHandshakeResponse(); - } else if (this.state === constants_1.SocksClientState.SentFinalHandshake) { - this.handleSocks5FinalHandshakeResponse(); - } else if (this.state === constants_1.SocksClientState.BoundWaitingForConnection) { - if (this.options.proxy.type === 4) { - this.handleSocks4IncomingConnectionResponse(); - } else { - this.handleSocks5IncomingConnectionResponse(); - } - } else { - this.closeSocket(constants_1.ERRORS.InternalError); - break; - } - } + if (this.inputPaused) { + return; } - /** - * Handles Socket close event. - * @param had_error - */ - onCloseHandler() { - this.closeSocket(constants_1.ERRORS.SocketClosed); + var frame = this.currentFrame; + if (!frame.addData(this.bufferList)) { + this._debug("-- insufficient data for frame"); + return; } - /** - * Handles Socket error event. - * @param err - */ - onErrorHandler(err) { - this.closeSocket(err.message); + var self2 = this; + if (frame.protocolError) { + this._debug("-- protocol error"); + process.nextTick(function() { + self2.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, frame.dropReason); + }); + return; + } else if (frame.frameTooLarge) { + this._debug("-- frame too large"); + process.nextTick(function() { + self2.drop(WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, frame.dropReason); + }); + return; } - /** - * Removes internal event listeners on the underlying Socket. - */ - removeInternalSocketHandlers() { - this.socket.pause(); - this.socket.removeListener("data", this.onDataReceived); - this.socket.removeListener("close", this.onClose); - this.socket.removeListener("error", this.onError); - this.socket.removeListener("connect", this.onConnect); + if (frame.rsv1 || frame.rsv2 || frame.rsv3) { + this._debug("-- illegal rsv flag"); + process.nextTick(function() { + self2.drop( + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Unsupported usage of rsv bits without negotiated extension." + ); + }); + return; } - /** - * Closes and destroys the underlying Socket. Emits an error event. - * @param err { String } An error string to include in error event. - */ - closeSocket(err) { - if (this.state !== constants_1.SocksClientState.Error) { - this.setState(constants_1.SocksClientState.Error); - this.socket.destroy(); - this.removeInternalSocketHandlers(); - this.emit("error", new util_1.SocksClientError(err, this.options)); - } + if (!this.assembleFragments) { + this._debug("-- emitting frame"); + process.nextTick(function() { + self2.emit("frame", frame); + }); } - /** - * Sends initial Socks v4 handshake request. - */ - sendSocks4InitialHandshake() { - const userId = this.options.proxy.userId || ""; - const buff = new smart_buffer_1.SmartBuffer(); - buff.writeUInt8(4); - buff.writeUInt8(constants_1.SocksCommand[this.options.command]); - buff.writeUInt16BE(this.options.destination.port); - if (net.isIPv4(this.options.destination.host)) { - buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); - buff.writeStringNT(userId); - } else { - buff.writeUInt8(0); - buff.writeUInt8(0); - buff.writeUInt8(0); - buff.writeUInt8(1); - buff.writeStringNT(userId); - buff.writeStringNT(this.options.destination.host); - } - this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks4Response; - this.socket.write(buff.toBuffer()); + process.nextTick(function() { + self2.processFrame(frame); + }); + this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + if (this.bufferList.length > 0) { + setImmediateImpl(this.receivedDataHandler); } - /** - * Handles Socks v4 handshake response. - * @param data - */ - handleSocks4FinalHandshakeResponse() { - const data = this.receiveBuffer.get(8); - if (data[1] !== constants_1.Socks4Response.Granted) { - this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedConnection} - (${constants_1.Socks4Response[data[1]]})`); - } else { - if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { - const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); - buff.readOffset = 2; - const remoteHost = { - port: buff.readUInt16BE(), - host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()) - }; - if (remoteHost.host === "0.0.0.0") { - remoteHost.host = this.options.proxy.ipaddress; - } - this.setState(constants_1.SocksClientState.BoundWaitingForConnection); - this.emit("bound", { remoteHost, socket: this.socket }); - } else { - this.setState(constants_1.SocksClientState.Established); - this.removeInternalSocketHandlers(); - this.emit("established", { socket: this.socket }); - } - } + }; + WebSocketConnection.prototype.handleSocketError = function(error) { + this._debug("handleSocketError: %j", error); + if (this.state === STATE_CLOSED) { + this._debug(" --- Socket 'error' after 'close'"); + return; } - /** - * Handles Socks v4 incoming connection request (BIND) - * @param data - */ - handleSocks4IncomingConnectionResponse() { - const data = this.receiveBuffer.get(8); - if (data[1] !== constants_1.Socks4Response.Granted) { - this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${constants_1.Socks4Response[data[1]]})`); - } else { - const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); - buff.readOffset = 2; - const remoteHost = { - port: buff.readUInt16BE(), - host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()) - }; - this.setState(constants_1.SocksClientState.Established); - this.removeInternalSocketHandlers(); - this.emit("established", { remoteHost, socket: this.socket }); - } + this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; + this.closeDescription = "Socket Error: " + error.syscall + " " + error.code; + this.connected = false; + this.state = STATE_CLOSED; + this.fragmentationSize = 0; + if (utils.eventEmitterListenerCount(this, "error") > 0) { + this.emit("error", error); } - /** - * Sends initial Socks v5 handshake request. - */ - sendSocks5InitialHandshake() { - const buff = new smart_buffer_1.SmartBuffer(); - const supportedAuthMethods = [constants_1.Socks5Auth.NoAuth]; - if (this.options.proxy.userId || this.options.proxy.password) { - supportedAuthMethods.push(constants_1.Socks5Auth.UserPass); - } - if (this.options.proxy.custom_auth_method !== void 0) { - supportedAuthMethods.push(this.options.proxy.custom_auth_method); + this.socket.destroy(); + this._debug.printOutput(); + }; + WebSocketConnection.prototype.handleSocketEnd = function() { + this._debug("handleSocketEnd: received socket end. state = %s", this.state); + this.receivedEnd = true; + if (this.state === STATE_CLOSED) { + this._debug(" --- Socket 'end' after 'close'"); + return; + } + if (this.state !== STATE_PEER_REQUESTED_CLOSE && this.state !== STATE_ENDING) { + this._debug(" --- UNEXPECTED socket end."); + this.socket.end(); + } + }; + WebSocketConnection.prototype.handleSocketClose = function(hadError) { + this._debug("handleSocketClose: received socket close"); + this.socketHadError = hadError; + this.connected = false; + this.state = STATE_CLOSED; + if (this.closeReasonCode === -1) { + this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; + this.closeDescription = "Connection dropped by remote peer."; + } + this.clearCloseTimer(); + this.clearKeepaliveTimer(); + this.clearGracePeriodTimer(); + if (!this.closeEventEmitted) { + this.closeEventEmitted = true; + this._debug("-- Emitting WebSocketConnection close event"); + this.emit("close", this.closeReasonCode, this.closeDescription); + } + }; + WebSocketConnection.prototype.handleSocketDrain = function() { + this._debug("handleSocketDrain: socket drain event"); + this.outputBufferFull = false; + this.emit("drain"); + }; + WebSocketConnection.prototype.handleSocketPause = function() { + this._debug("handleSocketPause: socket pause event"); + this.inputPaused = true; + this.emit("pause"); + }; + WebSocketConnection.prototype.handleSocketResume = function() { + this._debug("handleSocketResume: socket resume event"); + this.inputPaused = false; + this.emit("resume"); + this.processReceivedData(); + }; + WebSocketConnection.prototype.pause = function() { + this._debug("pause: pause requested"); + this.socket.pause(); + }; + WebSocketConnection.prototype.resume = function() { + this._debug("resume: resume requested"); + this.socket.resume(); + }; + WebSocketConnection.prototype.close = function(reasonCode, description) { + if (this.connected) { + this._debug("close: Initating clean WebSocket close sequence."); + if ("number" !== typeof reasonCode) { + reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; } - buff.writeUInt8(5); - buff.writeUInt8(supportedAuthMethods.length); - for (const authMethod of supportedAuthMethods) { - buff.writeUInt8(authMethod); + if (!validateCloseReason(reasonCode)) { + throw new Error("Close code " + reasonCode + " is not valid."); } - this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse; - this.socket.write(buff.toBuffer()); - this.setState(constants_1.SocksClientState.SentInitialHandshake); - } - /** - * Handles initial Socks v5 handshake response. - * @param data - */ - handleInitialSocks5HandshakeResponse() { - const data = this.receiveBuffer.get(2); - if (data[0] !== 5) { - this.closeSocket(constants_1.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion); - } else if (data[1] === constants_1.SOCKS5_NO_ACCEPTABLE_AUTH) { - this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType); - } else { - if (data[1] === constants_1.Socks5Auth.NoAuth) { - this.socks5ChosenAuthType = constants_1.Socks5Auth.NoAuth; - this.sendSocks5CommandRequest(); - } else if (data[1] === constants_1.Socks5Auth.UserPass) { - this.socks5ChosenAuthType = constants_1.Socks5Auth.UserPass; - this.sendSocks5UserPassAuthentication(); - } else if (data[1] === this.options.proxy.custom_auth_method) { - this.socks5ChosenAuthType = this.options.proxy.custom_auth_method; - this.sendSocks5CustomAuthentication(); - } else { - this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType); - } + if ("string" !== typeof description) { + description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; } + this.closeReasonCode = reasonCode; + this.closeDescription = description; + this.setCloseTimer(); + this.sendCloseFrame(this.closeReasonCode, this.closeDescription); + this.state = STATE_ENDING; + this.connected = false; } - /** - * Sends Socks v5 user & password auth handshake. - * - * Note: No auth and user/pass are currently supported. - */ - sendSocks5UserPassAuthentication() { - const userId = this.options.proxy.userId || ""; - const password = this.options.proxy.password || ""; - const buff = new smart_buffer_1.SmartBuffer(); - buff.writeUInt8(1); - buff.writeUInt8(Buffer.byteLength(userId)); - buff.writeString(userId); - buff.writeUInt8(Buffer.byteLength(password)); - buff.writeString(password); - this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse; - this.socket.write(buff.toBuffer()); - this.setState(constants_1.SocksClientState.SentAuthentication); + }; + WebSocketConnection.prototype.drop = function(reasonCode, description, skipCloseFrame) { + this._debug("drop"); + if (typeof reasonCode !== "number") { + reasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; } - sendSocks5CustomAuthentication() { - return __awaiter2(this, void 0, void 0, function* () { - this.nextRequiredPacketBufferSize = this.options.proxy.custom_auth_response_size; - this.socket.write(yield this.options.proxy.custom_auth_request_handler()); - this.setState(constants_1.SocksClientState.SentAuthentication); - }); + if (typeof description !== "string") { + description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; } - handleSocks5CustomAuthHandshakeResponse(data) { - return __awaiter2(this, void 0, void 0, function* () { - return yield this.options.proxy.custom_auth_response_handler(data); - }); + this._debug( + "Forcefully dropping connection. skipCloseFrame: %s, code: %d, description: %s", + skipCloseFrame, + reasonCode, + description + ); + this.closeReasonCode = reasonCode; + this.closeDescription = description; + this.frameQueue = []; + this.fragmentationSize = 0; + if (!skipCloseFrame) { + this.sendCloseFrame(reasonCode, description); } - handleSocks5AuthenticationNoAuthHandshakeResponse(data) { - return __awaiter2(this, void 0, void 0, function* () { - return data[1] === 0; - }); + this.connected = false; + this.state = STATE_CLOSED; + this.clearCloseTimer(); + this.clearKeepaliveTimer(); + this.clearGracePeriodTimer(); + if (!this.closeEventEmitted) { + this.closeEventEmitted = true; + this._debug("Emitting WebSocketConnection close event"); + this.emit("close", this.closeReasonCode, this.closeDescription); } - handleSocks5AuthenticationUserPassHandshakeResponse(data) { - return __awaiter2(this, void 0, void 0, function* () { - return data[1] === 0; - }); + this._debug("Drop: destroying socket"); + this.socket.destroy(); + }; + WebSocketConnection.prototype.setCloseTimer = function() { + this._debug("setCloseTimer"); + this.clearCloseTimer(); + this._debug("Setting close timer"); + this.waitingForCloseResponse = true; + this.closeTimer = setTimeout(this._closeTimerHandler, this.closeTimeout); + }; + WebSocketConnection.prototype.clearCloseTimer = function() { + this._debug("clearCloseTimer"); + if (this.closeTimer) { + this._debug("Clearing close timer"); + clearTimeout(this.closeTimer); + this.waitingForCloseResponse = false; + this.closeTimer = null; } - /** - * Handles Socks v5 auth handshake response. - * @param data - */ - handleInitialSocks5AuthenticationHandshakeResponse() { - return __awaiter2(this, void 0, void 0, function* () { - this.setState(constants_1.SocksClientState.ReceivedAuthenticationResponse); - let authResult = false; - if (this.socks5ChosenAuthType === constants_1.Socks5Auth.NoAuth) { - authResult = yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)); - } else if (this.socks5ChosenAuthType === constants_1.Socks5Auth.UserPass) { - authResult = yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)); - } else if (this.socks5ChosenAuthType === this.options.proxy.custom_auth_method) { - authResult = yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size)); - } - if (!authResult) { - this.closeSocket(constants_1.ERRORS.Socks5AuthenticationFailed); - } else { - this.sendSocks5CommandRequest(); - } - }); + }; + WebSocketConnection.prototype.handleCloseTimer = function() { + this._debug("handleCloseTimer"); + this.closeTimer = null; + if (this.waitingForCloseResponse) { + this._debug("Close response not received from client. Forcing socket end."); + this.waitingForCloseResponse = false; + this.state = STATE_CLOSED; + this.socket.end(); } - /** - * Sends Socks v5 final handshake request. - */ - sendSocks5CommandRequest() { - const buff = new smart_buffer_1.SmartBuffer(); - buff.writeUInt8(5); - buff.writeUInt8(constants_1.SocksCommand[this.options.command]); - buff.writeUInt8(0); - if (net.isIPv4(this.options.destination.host)) { - buff.writeUInt8(constants_1.Socks5HostType.IPv4); - buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); - } else if (net.isIPv6(this.options.destination.host)) { - buff.writeUInt8(constants_1.Socks5HostType.IPv6); - buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); - } else { - buff.writeUInt8(constants_1.Socks5HostType.Hostname); - buff.writeUInt8(this.options.destination.host.length); - buff.writeString(this.options.destination.host); - } - buff.writeUInt16BE(this.options.destination.port); - this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; - this.socket.write(buff.toBuffer()); - this.setState(constants_1.SocksClientState.SentFinalHandshake); + }; + WebSocketConnection.prototype.processFrame = function(frame) { + this._debug("processFrame"); + this._debug(" -- frame: %s", frame); + if (this.frameQueue.length !== 0 && (frame.opcode > 0 && frame.opcode < 8)) { + this.drop( + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Illegal frame opcode 0x" + frame.opcode.toString(16) + " received in middle of fragmented message." + ); + return; } - /** - * Handles Socks v5 final handshake response. - * @param data - */ - handleSocks5FinalHandshakeResponse() { - const header = this.receiveBuffer.peek(5); - if (header[0] !== 5 || header[1] !== constants_1.Socks5Response.Granted) { - this.closeSocket(`${constants_1.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${constants_1.Socks5Response[header[1]]}`); - } else { - const addressType = header[3]; - let remoteHost; - let buff; - if (addressType === constants_1.Socks5HostType.IPv4) { - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; - return; + switch (frame.opcode) { + case 2: + this._debug("-- Binary Frame"); + if (this.assembleFragments) { + if (frame.fin) { + this._debug("---- Emitting 'message' event"); + this.emit("message", { + type: "binary", + binaryData: frame.binaryPayload + }); + } else { + this.frameQueue.push(frame); + this.fragmentationSize = frame.length; } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); - remoteHost = { - host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), - port: buff.readUInt16BE() - }; - if (remoteHost.host === "0.0.0.0") { - remoteHost.host = this.options.proxy.ipaddress; + } + break; + case 1: + this._debug("-- Text Frame"); + if (this.assembleFragments) { + if (frame.fin) { + if (!isValidUTF8(frame.binaryPayload)) { + this.drop( + WebSocketConnection.CLOSE_REASON_INVALID_DATA, + "Invalid UTF-8 Data Received" + ); + return; + } + this._debug("---- Emitting 'message' event"); + this.emit("message", { + type: "utf8", + utf8Data: frame.binaryPayload.toString("utf8") + }); + } else { + this.frameQueue.push(frame); + this.fragmentationSize = frame.length; } - } else if (addressType === constants_1.Socks5HostType.Hostname) { - const hostLength = header[4]; - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; + } + break; + case 0: + this._debug("-- Continuation Frame"); + if (this.assembleFragments) { + if (this.frameQueue.length === 0) { + this.drop( + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Unexpected Continuation Frame" + ); return; } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); - remoteHost = { - host: buff.readString(hostLength), - port: buff.readUInt16BE() - }; - } else if (addressType === constants_1.Socks5HostType.IPv6) { - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; + this.fragmentationSize += frame.length; + if (this.fragmentationSize > this.maxReceivedMessageSize) { + this.drop( + WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, + "Maximum message size exceeded." + ); return; } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); - remoteHost = { - host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), - port: buff.readUInt16BE() - }; - } - this.setState(constants_1.SocksClientState.ReceivedFinalResponse); - if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.connect) { - this.setState(constants_1.SocksClientState.Established); - this.removeInternalSocketHandlers(); - this.emit("established", { remoteHost, socket: this.socket }); - } else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { - this.setState(constants_1.SocksClientState.BoundWaitingForConnection); - this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; - this.emit("bound", { remoteHost, socket: this.socket }); - } else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.associate) { - this.setState(constants_1.SocksClientState.Established); - this.removeInternalSocketHandlers(); - this.emit("established", { - remoteHost, - socket: this.socket - }); - } - } - } - /** - * Handles Socks v5 incoming connection request (BIND). - */ - handleSocks5IncomingConnectionResponse() { - const header = this.receiveBuffer.peek(5); - if (header[0] !== 5 || header[1] !== constants_1.Socks5Response.Granted) { - this.closeSocket(`${constants_1.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${constants_1.Socks5Response[header[1]]}`); - } else { - const addressType = header[3]; - let remoteHost; - let buff; - if (addressType === constants_1.Socks5HostType.IPv4) { - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; - return; + this.frameQueue.push(frame); + if (frame.fin) { + var bytesCopied = 0; + var binaryPayload = bufferAllocUnsafe(this.fragmentationSize); + var opcode = this.frameQueue[0].opcode; + this.frameQueue.forEach(function(currentFrame) { + currentFrame.binaryPayload.copy(binaryPayload, bytesCopied); + bytesCopied += currentFrame.binaryPayload.length; + }); + this.frameQueue = []; + this.fragmentationSize = 0; + switch (opcode) { + case 2: + this.emit("message", { + type: "binary", + binaryData: binaryPayload + }); + break; + case 1: + if (!isValidUTF8(binaryPayload)) { + this.drop( + WebSocketConnection.CLOSE_REASON_INVALID_DATA, + "Invalid UTF-8 Data Received" + ); + return; + } + this.emit("message", { + type: "utf8", + utf8Data: binaryPayload.toString("utf8") + }); + break; + default: + this.drop( + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Unexpected first opcode in fragmentation sequence: 0x" + opcode.toString(16) + ); + return; + } } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); - remoteHost = { - host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), - port: buff.readUInt16BE() + } + break; + case 9: + this._debug("-- Ping Frame"); + if (this._pingListenerCount > 0) { + var cancelled = false; + var cancel = function() { + cancelled = true; }; - if (remoteHost.host === "0.0.0.0") { - remoteHost.host = this.options.proxy.ipaddress; - } - } else if (addressType === constants_1.Socks5HostType.Hostname) { - const hostLength = header[4]; - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; - return; + this.emit("ping", cancel, frame.binaryPayload); + if (!cancelled) { + this.pong(frame.binaryPayload); } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); - remoteHost = { - host: buff.readString(hostLength), - port: buff.readUInt16BE() - }; - } else if (addressType === constants_1.Socks5HostType.IPv6) { - const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; - if (this.receiveBuffer.length < dataNeeded) { - this.nextRequiredPacketBufferSize = dataNeeded; + } else { + this.pong(frame.binaryPayload); + } + break; + case 10: + this._debug("-- Pong Frame"); + this.emit("pong", frame.binaryPayload); + break; + case 8: + this._debug("-- Close Frame"); + if (this.waitingForCloseResponse) { + this._debug("---- Got close response from peer. Completing closing handshake."); + this.clearCloseTimer(); + this.waitingForCloseResponse = false; + this.state = STATE_CLOSED; + this.socket.end(); + return; + } + this._debug("---- Closing handshake initiated by peer."); + this.state = STATE_PEER_REQUESTED_CLOSE; + var respondCloseReasonCode; + if (frame.invalidCloseFrameLength) { + this.closeReasonCode = 1005; + respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; + } else if (frame.closeStatus === -1 || validateCloseReason(frame.closeStatus)) { + this.closeReasonCode = frame.closeStatus; + respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; + } else { + this.closeReasonCode = frame.closeStatus; + respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; + } + if (frame.binaryPayload.length > 1) { + if (!isValidUTF8(frame.binaryPayload)) { + this.drop( + WebSocketConnection.CLOSE_REASON_INVALID_DATA, + "Invalid UTF-8 Data Received" + ); return; } - buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); - remoteHost = { - host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), - port: buff.readUInt16BE() - }; + this.closeDescription = frame.binaryPayload.toString("utf8"); + } else { + this.closeDescription = WebSocketConnection.CLOSE_DESCRIPTIONS[this.closeReasonCode]; } - this.setState(constants_1.SocksClientState.Established); - this.removeInternalSocketHandlers(); - this.emit("established", { remoteHost, socket: this.socket }); - } - } - get socksClientOptions() { - return Object.assign({}, this.options); + this._debug( + "------ Remote peer %s - code: %d - %s - close frame payload length: %d", + this.remoteAddress, + this.closeReasonCode, + this.closeDescription, + frame.length + ); + this._debug("------ responding to remote peer's close request."); + this.sendCloseFrame(respondCloseReasonCode, null); + this.connected = false; + break; + default: + this._debug("-- Unrecognized Opcode %d", frame.opcode); + this.drop( + WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Unrecognized Opcode: 0x" + frame.opcode.toString(16) + ); + break; } }; - exports2.SocksClient = SocksClient; - } -}); - -// node_modules/socks/build/index.js -var require_build = __commonJS({ - "node_modules/socks/build/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + WebSocketConnection.prototype.send = function(data, cb) { + this._debug("send"); + if (Buffer.isBuffer(data)) { + this.sendBytes(data, cb); + } else if (typeof data["toString"] === "function") { + this.sendUTF(data, cb); + } else { + throw new Error("Data provided must either be a Node Buffer or implement toString()"); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - __exportStar2(require_socksclient(), exports2); - } -}); - -// node_modules/telegram/extensions/socks.js -var require_socks = __commonJS({ - "node_modules/telegram/extensions/socks.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + WebSocketConnection.prototype.sendUTF = function(data, cb) { + data = bufferFromString(data.toString(), "utf8"); + this._debug("sendUTF: %d bytes", data.length); + var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + frame.opcode = 1; + frame.binaryPayload = data; + this.fragmentAndSend(frame, cb); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - __exportStar2(require_build(), exports2); - } -}); - -// node_modules/telegram/extensions/PromisedNetSockets.js -var require_PromisedNetSockets = __commonJS({ - "node_modules/telegram/extensions/PromisedNetSockets.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + WebSocketConnection.prototype.sendBytes = function(data, cb) { + this._debug("sendBytes"); + if (!Buffer.isBuffer(data)) { + throw new Error("You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()"); } - __setModuleDefault2(result, mod); - return result; + var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + frame.opcode = 2; + frame.binaryPayload = data; + this.fragmentAndSend(frame, cb); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PromisedNetSockets = void 0; - var net = __importStar2(require_net()); - var socks_1 = require_socks(); - var async_mutex_1 = require_lib12(); - var mutex = new async_mutex_1.Mutex(); - var closeError = new Error("NetSocket was closed"); - var PromisedNetSockets = class { - constructor(proxy) { - this.client = void 0; - this.closed = true; - this.stream = Buffer.alloc(0); - if (proxy) { - if (!("MTProxy" in proxy)) { - if (!proxy.ip || !proxy.port || !proxy.socksType) { - throw new Error(`Invalid sockets params: ip=${proxy.ip}, port=${proxy.port}, socksType=${proxy.socksType}`); - } - this.proxy = proxy; - } - } - } - async readExactly(number) { - let readData = Buffer.alloc(0); - while (true) { - const thisTime = await this.read(number); - readData = Buffer.concat([readData, thisTime]); - number = number - thisTime.length; - if (!number || number === -437) { - return readData; - } - } - } - async read(number) { - if (this.closed) { - throw closeError; - } - await this.canRead; - if (this.closed) { - throw closeError; - } - const toReturn = this.stream.slice(0, number); - this.stream = this.stream.slice(number); - if (this.stream.length === 0) { - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - } - return toReturn; - } - async readAll() { - if (this.closed || !await this.canRead) { - throw closeError; - } - const toReturn = this.stream; - this.stream = Buffer.alloc(0); - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - return toReturn; - } - /** - * Creates a new connection - * @param port - * @param ip - * @returns {Promise<void>} - */ - async connect(port, ip) { - this.stream = Buffer.alloc(0); - let connected = false; - if (this.proxy) { - const info = await socks_1.SocksClient.createConnection({ - proxy: { - host: this.proxy.ip, - port: this.proxy.port, - type: this.proxy.socksType, - userId: this.proxy.username, - password: this.proxy.password - }, - command: "connect", - timeout: (this.proxy.timeout || 5) * 1e3, - destination: { - host: ip, - port - } - }); - this.client = info.socket; - connected = true; - } else { - this.client = new net.Socket(); - } - this.canRead = new Promise((resolve) => { - this.resolveRead = resolve; - }); - this.closed = false; - return new Promise((resolve, reject) => { - if (this.client) { - if (connected) { - this.receive(); - resolve(this); - } else { - this.client.connect(port, ip, () => { - this.receive(); - resolve(this); - }); - } - this.client.on("error", reject); - this.client.on("close", () => { - if (this.client && this.client.destroyed) { - if (this.resolveRead) { - this.resolveRead(false); - } - this.closed = true; - } - }); - } - }); - } - write(data) { - if (this.closed) { - throw closeError; - } - if (this.client) { - this.client.write(data); - } - } - async close() { - if (this.client) { - await this.client.destroy(); - this.client.unref(); + WebSocketConnection.prototype.ping = function(data) { + this._debug("ping"); + var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + frame.opcode = 9; + frame.fin = true; + if (data) { + if (!Buffer.isBuffer(data)) { + data = bufferFromString(data.toString(), "utf8"); } - this.closed = true; - } - async receive() { - if (this.client) { - this.client.on("data", async (message) => { - const release = await mutex.acquire(); - try { - let data; - this.stream = Buffer.concat([this.stream, message]); - if (this.resolveRead) { - this.resolveRead(true); - } - } finally { - release(); - } - }); + if (data.length > 125) { + this._debug("WebSocket: Data for ping is longer than 125 bytes. Truncating."); + data = data.slice(0, 124); } + frame.binaryPayload = data; } - toString() { - return "PromisedNetSocket"; + this.sendFrame(frame); + }; + WebSocketConnection.prototype.pong = function(binaryPayload) { + this._debug("pong"); + var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + frame.opcode = 10; + if (Buffer.isBuffer(binaryPayload) && binaryPayload.length > 125) { + this._debug("WebSocket: Data for pong is longer than 125 bytes. Truncating."); + binaryPayload = binaryPayload.slice(0, 124); } + frame.binaryPayload = binaryPayload; + frame.fin = true; + this.sendFrame(frame); }; - exports2.PromisedNetSockets = PromisedNetSockets; - } -}); - -// node_modules/telegram/extensions/MessagePacker.js -var require_MessagePacker = __commonJS({ - "node_modules/telegram/extensions/MessagePacker.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MessagePacker = void 0; - var core_1 = require_core(); - var core_2 = require_core(); - var BinaryWriter_1 = require_BinaryWriter(); - var USE_INVOKE_AFTER_WITH = /* @__PURE__ */ new Set([ - "messages.SendMessage", - "messages.SendMedia", - "messages.SendMultiMedia", - "messages.ForwardMessages", - "messages.SendInlineBotResult" - ]); - var MessagePacker = class { - constructor(state, logger) { - this._state = state; - this._queue = []; - this._pendingStates = []; - this._ready = new Promise((resolve) => { - this.setReady = resolve; - }); - this._log = logger; + WebSocketConnection.prototype.fragmentAndSend = function(frame, cb) { + this._debug("fragmentAndSend"); + if (frame.opcode > 7) { + throw new Error("You cannot fragment control frames."); } - values() { - return this._queue; + var threshold = this.config.fragmentationThreshold; + var length = frame.binaryPayload.length; + if (!this.config.fragmentOutgoingMessages || frame.binaryPayload && length <= threshold) { + frame.fin = true; + this.sendFrame(frame, cb); + return; } - append(state, setReady = true, atStart = false) { - var _a3, _b; - if (state && USE_INVOKE_AFTER_WITH.has(state.request.className)) { - if (atStart) { - for (let i = 0; i < this._queue.length; i++) { - if (USE_INVOKE_AFTER_WITH.has((_a3 = this._queue[i]) === null || _a3 === void 0 ? void 0 : _a3.request.className)) { - this._queue[i].after = state; - break; - } - } - } else { - for (let i = this._queue.length - 1; i >= 0; i--) { - if (USE_INVOKE_AFTER_WITH.has((_b = this._queue[i]) === null || _b === void 0 ? void 0 : _b.request.className)) { - state.after = this._queue[i]; - break; - } - } + var numFragments = Math.ceil(length / threshold); + var sentFragments = 0; + var sentCallback = function fragmentSentCallback(err) { + if (err) { + if (typeof cb === "function") { + cb(err); + cb = null; } + return; } - if (atStart) { - this._queue.unshift(state); - } else { - this._queue.push(state); - } - if (setReady && this.setReady) { - this.setReady(true); - } - if (state && state.request.CONSTRUCTOR_ID !== 1658238041) { - this._pendingStates.push(state); - state.promise.catch((err) => { - }).finally(() => { - this._pendingStates = this._pendingStates.filter((s) => s !== state); - }); + ++sentFragments; + if (sentFragments === numFragments && typeof cb === "function") { + cb(); } + }; + for (var i = 1; i <= numFragments; i++) { + var currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + currentFrame.opcode = i === 1 ? frame.opcode : 0; + currentFrame.fin = i === numFragments; + var currentLength = i === numFragments ? length - threshold * (i - 1) : threshold; + var sliceStart = threshold * (i - 1); + currentFrame.binaryPayload = frame.binaryPayload.slice(sliceStart, sliceStart + currentLength); + this.sendFrame(currentFrame, sentCallback); } - prepend(states) { - states.reverse().forEach((state) => { - this.append(state, false, true); - }); - if (this.setReady) { - this.setReady(true); - } + }; + WebSocketConnection.prototype.sendCloseFrame = function(reasonCode, description, cb) { + if (typeof reasonCode !== "number") { + reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; } - extend(states) { - states.forEach((state) => { - this.append(state, false); - }); - if (this.setReady) { - this.setReady(true); - } + this._debug("sendCloseFrame state: %s, reasonCode: %d, description: %s", this.state, reasonCode, description); + if (this.state !== STATE_OPEN && this.state !== STATE_PEER_REQUESTED_CLOSE) { + return; } - clear() { - this._queue = []; - this.append(void 0); + var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); + frame.fin = true; + frame.opcode = 8; + frame.closeStatus = reasonCode; + if (typeof description === "string") { + frame.binaryPayload = bufferFromString(description, "utf8"); } - async wait() { - if (!this._queue.length) { - this._ready = new Promise((resolve) => { - this.setReady = resolve; - }); - await this._ready; - } + this.sendFrame(frame, cb); + this.socket.end(); + }; + WebSocketConnection.prototype.sendFrame = function(frame, cb) { + this._debug("sendFrame"); + frame.mask = this.maskOutgoingPackets; + var flushed = this.socket.write(frame.toBuffer(), cb); + this.outputBufferFull = !flushed; + return flushed; + }; + module2.exports = WebSocketConnection; + function instrumentSocketForDebugging(connection, socket) { + if (!connection._debug.enabled) { + return; } - async get() { - if (!this._queue[this._queue.length - 1]) { - this._queue = this._queue.filter(Boolean); - return void 0; - } - let data; - let buffer = new BinaryWriter_1.BinaryWriter(Buffer.alloc(0)); - const batch = []; - let size = 0; - while (this._queue.length && batch.length <= core_1.MessageContainer.MAXIMUM_LENGTH) { - const state = this._queue.shift(); - if (!state) { - continue; - } - size += state.data.length + core_2.TLMessage.SIZE_OVERHEAD; - if (size <= core_1.MessageContainer.MAXIMUM_SIZE) { - let afterId; - if (state.after) { - afterId = state.after.msgId; - } - if (state.after) { - afterId = state.after.msgId; - } - state.msgId = await this._state.writeDataAsMessage(buffer, state.data, state.request.classType === "request", afterId); - this._log.debug(`Assigned msgId = ${state.msgId} to ${state.request.className || state.request.constructor.name}`); - batch.push(state); - continue; - } - if (batch.length) { - this._queue.unshift(state); - break; - } - this._log.warn(`Message payload for ${state.request.className || state.request.constructor.name} is too long ${state.data.length} and cannot be sent`); - state.promise.reject("Request Payload is too big"); - size = 0; + var originalSocketEmit = socket.emit; + socket.emit = function(event) { + connection._debug("||| Socket Event '%s'", event); + originalSocketEmit.apply(this, arguments); + }; + for (var key in socket) { + if ("function" !== typeof socket[key]) { + continue; } - if (!batch.length) { - return null; + if (["emit"].indexOf(key) !== -1) { + continue; } - if (batch.length > 1) { - const b = Buffer.alloc(8); - b.writeUInt32LE(core_1.MessageContainer.CONSTRUCTOR_ID, 0); - b.writeInt32LE(batch.length, 4); - data = Buffer.concat([b, buffer.getValue()]); - buffer = new BinaryWriter_1.BinaryWriter(Buffer.alloc(0)); - const containerId = await this._state.writeDataAsMessage(buffer, data, false); - for (const s of batch) { - s.containerId = containerId; + (function(key2) { + var original = socket[key2]; + if (key2 === "on") { + socket[key2] = function proxyMethod__EventEmitter__On() { + connection._debug("||| Socket method called: %s (%s)", key2, arguments[0]); + return original.apply(this, arguments); + }; + return; } - } - data = buffer.getValue(); - return { batch, data }; + socket[key2] = function proxyMethod() { + connection._debug("||| Socket method called: %s", key2); + return original.apply(this, arguments); + }; + })(key); } - }; - exports2.MessagePacker = MessagePacker; + } } }); -// node_modules/telegram/extensions/AsyncQueue.js -var require_AsyncQueue = __commonJS({ - "node_modules/telegram/extensions/AsyncQueue.js"(exports2) { - "use strict"; +// node_modules/websocket/lib/WebSocketRequest.js +var require_WebSocketRequest = __commonJS({ + "node_modules/websocket/lib/WebSocketRequest.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AsyncQueue = void 0; - var AsyncQueue = class { - constructor() { - this._queue = []; - this.canPush = true; - this.resolvePush = (value) => { - }; - this.resolveGet = (value) => { - }; - this.canGet = new Promise((resolve) => { - this.resolveGet = resolve; - }); + var crypto4 = require("crypto"); + var util = require("util"); + var url = require("url"); + var EventEmitter = require("events").EventEmitter; + var WebSocketConnection = require_WebSocketConnection(); + var headerValueSplitRegExp = /,\s*/; + var headerParamSplitRegExp = /;\s*/; + var headerSanitizeRegExp = /[\r\n]/g; + var xForwardedForSeparatorRegExp = /,\s*/; + var separators = [ + "(", + ")", + "<", + ">", + "@", + ",", + ";", + ":", + "\\", + '"', + "/", + "[", + "]", + "?", + "=", + "{", + "}", + " ", + String.fromCharCode(9) + ]; + var controlChars = [ + String.fromCharCode(127) + /* DEL */ + ]; + for (i = 0; i < 31; i++) { + controlChars.push(String.fromCharCode(i)); + } + var i; + var cookieNameValidateRegEx = /([\x00-\x20\x22\x28\x29\x2c\x2f\x3a-\x3f\x40\x5b-\x5e\x7b\x7d\x7f])/; + var cookieValueValidateRegEx = /[^\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]/; + var cookieValueDQuoteValidateRegEx = /^"[^"]*"$/; + var controlCharsAndSemicolonRegEx = /[\x00-\x20\x3b]/g; + var cookieSeparatorRegEx = /[;,] */; + var httpStatusDescriptions = { + 100: "Continue", + 101: "Switching Protocols", + 200: "OK", + 201: "Created", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 307: "Temporary Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 406: "Not Acceptable", + 407: "Proxy Authorization Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Long", + 414: "Request-URI Too Long", + 415: "Unsupported Media Type", + 416: "Requested Range Not Satisfiable", + 417: "Expectation Failed", + 426: "Upgrade Required", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported" + }; + function WebSocketRequest(socket, httpRequest, serverConfig) { + EventEmitter.call(this); + this.socket = socket; + this.httpRequest = httpRequest; + this.resource = httpRequest.url; + this.remoteAddress = socket.remoteAddress; + this.remoteAddresses = [this.remoteAddress]; + this.serverConfig = serverConfig; + this._socketIsClosing = false; + this._socketCloseHandler = this._handleSocketCloseBeforeAccept.bind(this); + this.socket.on("end", this._socketCloseHandler); + this.socket.on("close", this._socketCloseHandler); + this._resolved = false; + } + util.inherits(WebSocketRequest, EventEmitter); + WebSocketRequest.prototype.readHandshake = function() { + var self2 = this; + var request = this.httpRequest; + this.resourceURL = url.parse(this.resource, true); + this.host = request.headers["host"]; + if (!this.host) { + throw new Error("Client must provide a Host header."); } - async push(value) { - await this.canPush; - this._queue.push(value); - this.resolveGet(true); - this.canPush = new Promise((resolve) => { - this.resolvePush = resolve; - }); + this.key = request.headers["sec-websocket-key"]; + if (!this.key) { + throw new Error("Client must provide a value for Sec-WebSocket-Key."); } - async pop() { - await this.canGet; - const returned = this._queue.pop(); - this.resolvePush(true); - this.canGet = new Promise((resolve) => { - this.resolveGet = resolve; + this.webSocketVersion = parseInt(request.headers["sec-websocket-version"], 10); + if (!this.webSocketVersion || isNaN(this.webSocketVersion)) { + throw new Error("Client must provide a value for Sec-WebSocket-Version."); + } + switch (this.webSocketVersion) { + case 8: + case 13: + break; + default: + var e = new Error("Unsupported websocket client version: " + this.webSocketVersion + "Only versions 8 and 13 are supported."); + e.httpCode = 426; + e.headers = { + "Sec-WebSocket-Version": "13" + }; + throw e; + } + if (this.webSocketVersion === 13) { + this.origin = request.headers["origin"]; + } else if (this.webSocketVersion === 8) { + this.origin = request.headers["sec-websocket-origin"]; + } + var protocolString = request.headers["sec-websocket-protocol"]; + this.protocolFullCaseMap = {}; + this.requestedProtocols = []; + if (protocolString) { + var requestedProtocolsFullCase = protocolString.split(headerValueSplitRegExp); + requestedProtocolsFullCase.forEach(function(protocol) { + var lcProtocol = protocol.toLocaleLowerCase(); + self2.requestedProtocols.push(lcProtocol); + self2.protocolFullCaseMap[lcProtocol] = protocol; }); - return returned; } - }; - exports2.AsyncQueue = AsyncQueue; - } -}); - -// node_modules/telegram/extensions/index.js -var require_extensions = __commonJS({ - "node_modules/telegram/extensions/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AsyncQueue = exports2.MessagePacker = exports2.PromisedNetSockets = exports2.PromisedWebSockets = exports2.BinaryReader = exports2.BinaryWriter = exports2.Logger = void 0; - var Logger_1 = require_Logger(); - Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { - return Logger_1.Logger; - } }); - var BinaryWriter_1 = require_BinaryWriter(); - Object.defineProperty(exports2, "BinaryWriter", { enumerable: true, get: function() { - return BinaryWriter_1.BinaryWriter; - } }); - var BinaryReader_1 = require_BinaryReader(); - Object.defineProperty(exports2, "BinaryReader", { enumerable: true, get: function() { - return BinaryReader_1.BinaryReader; - } }); - var PromisedWebSockets_1 = require_PromisedWebSockets(); - Object.defineProperty(exports2, "PromisedWebSockets", { enumerable: true, get: function() { - return PromisedWebSockets_1.PromisedWebSockets; - } }); - var PromisedNetSockets_1 = require_PromisedNetSockets(); - Object.defineProperty(exports2, "PromisedNetSockets", { enumerable: true, get: function() { - return PromisedNetSockets_1.PromisedNetSockets; - } }); - var MessagePacker_1 = require_MessagePacker(); - Object.defineProperty(exports2, "MessagePacker", { enumerable: true, get: function() { - return MessagePacker_1.MessagePacker; - } }); - var AsyncQueue_1 = require_AsyncQueue(); - Object.defineProperty(exports2, "AsyncQueue", { enumerable: true, get: function() { - return AsyncQueue_1.AsyncQueue; - } }); - } -}); - -// node_modules/telegram/network/connection/Connection.js -var require_Connection = __commonJS({ - "node_modules/telegram/network/connection/Connection.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ObfuscatedConnection = exports2.PacketCodec = exports2.Connection = void 0; - var extensions_1 = require_extensions(); - var Connection = class { - constructor({ ip, port, dcId, loggers, proxy, socket, testServers }) { - this._ip = ip; - this._port = port; - this._dcId = dcId; - this._log = loggers; - this._proxy = proxy; - this._connected = false; - this._sendTask = void 0; - this._recvTask = void 0; - this._codec = void 0; - this._obfuscation = void 0; - this._sendArray = new extensions_1.AsyncQueue(); - this._recvArray = new extensions_1.AsyncQueue(); - this.socket = new socket(proxy); - this._testServers = testServers; + if (!this.serverConfig.ignoreXForwardedFor && request.headers["x-forwarded-for"]) { + var immediatePeerIP = this.remoteAddress; + this.remoteAddresses = request.headers["x-forwarded-for"].split(xForwardedForSeparatorRegExp); + this.remoteAddresses.push(immediatePeerIP); + this.remoteAddress = this.remoteAddresses[0]; } - async _connect() { - this._log.debug("Connecting"); - this._codec = new this.PacketCodecClass(this); - await this.socket.connect(this._port, this._ip, this._testServers); - this._log.debug("Finished connecting"); - await this._initConn(); + if (this.serverConfig.parseExtensions) { + var extensionsString = request.headers["sec-websocket-extensions"]; + this.requestedExtensions = this.parseExtensions(extensionsString); + } else { + this.requestedExtensions = []; } - async connect() { - await this._connect(); - this._connected = true; - if (!this._sendTask) { - this._sendTask = this._sendLoop(); - } - this._recvTask = this._recvLoop(); + if (this.serverConfig.parseCookies) { + var cookieString = request.headers["cookie"]; + this.cookies = this.parseCookies(cookieString); + } else { + this.cookies = []; + } + }; + WebSocketRequest.prototype.parseExtensions = function(extensionsString) { + if (!extensionsString || extensionsString.length === 0) { + return []; + } + var extensions = extensionsString.toLocaleLowerCase().split(headerValueSplitRegExp); + extensions.forEach(function(extension, index2, array) { + var params = extension.split(headerParamSplitRegExp); + var extensionName = params[0]; + var extensionParams = params.slice(1); + extensionParams.forEach(function(rawParam, index3, array2) { + var arr = rawParam.split("="); + var obj2 = { + name: arr[0], + value: arr[1] + }; + array2.splice(index3, 1, obj2); + }); + var obj = { + name: extensionName, + params: extensionParams + }; + array.splice(index2, 1, obj); + }); + return extensions; + }; + WebSocketRequest.prototype.parseCookies = function(str) { + if (!str || typeof str !== "string") { + return []; } - async disconnect() { - if (!this._connected) { + var cookies = []; + var pairs = str.split(cookieSeparatorRegEx); + pairs.forEach(function(pair) { + var eq_idx = pair.indexOf("="); + if (eq_idx === -1) { + cookies.push({ + name: pair, + value: null + }); return; } - this._connected = false; - void this._recvArray.push(void 0); - await this.socket.close(); - } - async send(data) { - if (!this._connected) { - throw new Error("Not connected"); + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + if ('"' === val[0]) { + val = val.slice(1, -1); } - await this._sendArray.push(data); - } - async recv() { - while (this._connected) { - const result = await this._recvArray.pop(); - if (result) { - return result; - } + cookies.push({ + name: key, + value: decodeURIComponent(val) + }); + }); + return cookies; + }; + WebSocketRequest.prototype.accept = function(acceptedProtocol, allowedOrigin, cookies) { + this._verifyResolution(); + var protocolFullCase; + if (acceptedProtocol) { + protocolFullCase = this.protocolFullCaseMap[acceptedProtocol.toLocaleLowerCase()]; + if (typeof protocolFullCase === "undefined") { + protocolFullCase = acceptedProtocol; } - throw new Error("Not connected"); + } else { + protocolFullCase = acceptedProtocol; } - async _sendLoop() { - try { - while (this._connected) { - const data = await this._sendArray.pop(); - if (!data) { - this._sendTask = void 0; - return; - } - await this._send(data); + this.protocolFullCaseMap = null; + var sha1 = crypto4.createHash("sha1"); + sha1.update(this.key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + var acceptKey = sha1.digest("base64"); + var response = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: " + acceptKey + "\r\n"; + if (protocolFullCase) { + for (var i2 = 0; i2 < protocolFullCase.length; i2++) { + var charCode = protocolFullCase.charCodeAt(i2); + var character = protocolFullCase.charAt(i2); + if (charCode < 33 || charCode > 126 || separators.indexOf(character) !== -1) { + this.reject(500); + throw new Error('Illegal character "' + String.fromCharCode(character) + '" in subprotocol.'); } - } catch (e) { - this._log.info("The server closed the connection while sending"); } - } - isConnected() { - return this._connected; - } - async _recvLoop() { - let data; - while (this._connected) { - try { - data = await this._recv(); - if (!data) { - throw new Error("no data received"); - } - } catch (e) { - this._log.info("connection closed"); - this.disconnect(); - return; - } - await this._recvArray.push(data); + if (this.requestedProtocols.indexOf(acceptedProtocol) === -1) { + this.reject(500); + throw new Error("Specified protocol was not requested by the client."); } + protocolFullCase = protocolFullCase.replace(headerSanitizeRegExp, ""); + response += "Sec-WebSocket-Protocol: " + protocolFullCase + "\r\n"; } - async _initConn() { - if (this._codec.tag) { - await this.socket.write(this._codec.tag); + this.requestedProtocols = null; + if (allowedOrigin) { + allowedOrigin = allowedOrigin.replace(headerSanitizeRegExp, ""); + if (this.webSocketVersion === 13) { + response += "Origin: " + allowedOrigin + "\r\n"; + } else if (this.webSocketVersion === 8) { + response += "Sec-WebSocket-Origin: " + allowedOrigin + "\r\n"; } } - async _send(data) { - const encodedPacket = this._codec.encodePacket(data); - this.socket.write(encodedPacket); - } - async _recv() { - return await this._codec.readPacket(this.socket); + if (cookies) { + if (!Array.isArray(cookies)) { + this.reject(500); + throw new Error('Value supplied for "cookies" argument must be an array.'); + } + var seenCookies = {}; + cookies.forEach(function(cookie) { + if (!cookie.name || !cookie.value) { + this.reject(500); + throw new Error('Each cookie to set must at least provide a "name" and "value"'); + } + cookie.name = cookie.name.replace(controlCharsAndSemicolonRegEx, ""); + cookie.value = cookie.value.replace(controlCharsAndSemicolonRegEx, ""); + if (seenCookies[cookie.name]) { + this.reject(500); + throw new Error("You may not specify the same cookie name twice."); + } + seenCookies[cookie.name] = true; + var invalidChar = cookie.name.match(cookieNameValidateRegEx); + if (invalidChar) { + this.reject(500); + throw new Error("Illegal character " + invalidChar[0] + " in cookie name"); + } + if (cookie.value.match(cookieValueDQuoteValidateRegEx)) { + invalidChar = cookie.value.slice(1, -1).match(cookieValueValidateRegEx); + } else { + invalidChar = cookie.value.match(cookieValueValidateRegEx); + } + if (invalidChar) { + this.reject(500); + throw new Error("Illegal character " + invalidChar[0] + " in cookie value"); + } + var cookieParts = [cookie.name + "=" + cookie.value]; + if (cookie.path) { + invalidChar = cookie.path.match(controlCharsAndSemicolonRegEx); + if (invalidChar) { + this.reject(500); + throw new Error("Illegal character " + invalidChar[0] + " in cookie path"); + } + cookieParts.push("Path=" + cookie.path); + } + if (cookie.domain) { + if (typeof cookie.domain !== "string") { + this.reject(500); + throw new Error("Domain must be specified and must be a string."); + } + invalidChar = cookie.domain.match(controlCharsAndSemicolonRegEx); + if (invalidChar) { + this.reject(500); + throw new Error("Illegal character " + invalidChar[0] + " in cookie domain"); + } + cookieParts.push("Domain=" + cookie.domain.toLowerCase()); + } + if (cookie.expires) { + if (!(cookie.expires instanceof Date)) { + this.reject(500); + throw new Error('Value supplied for cookie "expires" must be a vaild date object'); + } + cookieParts.push("Expires=" + cookie.expires.toGMTString()); + } + if (cookie.maxage) { + var maxage = cookie.maxage; + if (typeof maxage === "string") { + maxage = parseInt(maxage, 10); + } + if (isNaN(maxage) || maxage <= 0) { + this.reject(500); + throw new Error('Value supplied for cookie "maxage" must be a non-zero number'); + } + maxage = Math.round(maxage); + cookieParts.push("Max-Age=" + maxage.toString(10)); + } + if (cookie.secure) { + if (typeof cookie.secure !== "boolean") { + this.reject(500); + throw new Error('Value supplied for cookie "secure" must be of type boolean'); + } + cookieParts.push("Secure"); + } + if (cookie.httponly) { + if (typeof cookie.httponly !== "boolean") { + this.reject(500); + throw new Error('Value supplied for cookie "httponly" must be of type boolean'); + } + cookieParts.push("HttpOnly"); + } + response += "Set-Cookie: " + cookieParts.join(";") + "\r\n"; + }.bind(this)); } - toString() { - return `${this._ip}:${this._port}/${this.constructor.name.replace("Connection", "")}`; + this._resolved = true; + this.emit("requestResolved", this); + response += "\r\n"; + var connection = new WebSocketConnection(this.socket, [], acceptedProtocol, false, this.serverConfig); + connection.webSocketVersion = this.webSocketVersion; + connection.remoteAddress = this.remoteAddress; + connection.remoteAddresses = this.remoteAddresses; + var self2 = this; + if (this._socketIsClosing) { + cleanupFailedConnection(connection); + } else { + this.socket.write(response, "ascii", function(error) { + if (error) { + cleanupFailedConnection(connection); + return; + } + self2._removeSocketCloseListeners(); + connection._addSocketEventListeners(); + }); } + this.emit("requestAccepted", connection); + return connection; }; - exports2.Connection = Connection; - var ObfuscatedConnection = class extends Connection { - constructor() { - super(...arguments); - this.ObfuscatedIO = void 0; - } - async _initConn() { - this._obfuscation = new this.ObfuscatedIO(this); - await this._obfuscation.initHeader(); - this.socket.write(this._obfuscation.header); + WebSocketRequest.prototype.reject = function(status, reason, extraHeaders) { + this._verifyResolution(); + this._resolved = true; + this.emit("requestResolved", this); + if (typeof status !== "number") { + status = 403; } - async _send(data) { - this._obfuscation.write(this._codec.encodePacket(data)); + var response = "HTTP/1.1 " + status + " " + httpStatusDescriptions[status] + "\r\nConnection: close\r\n"; + if (reason) { + reason = reason.replace(headerSanitizeRegExp, ""); + response += "X-WebSocket-Reject-Reason: " + reason + "\r\n"; } - async _recv() { - return await this._codec.readPacket(this._obfuscation); + if (extraHeaders) { + for (var key in extraHeaders) { + var sanitizedValue = extraHeaders[key].toString().replace(headerSanitizeRegExp, ""); + var sanitizedKey = key.replace(headerSanitizeRegExp, ""); + response += sanitizedKey + ": " + sanitizedValue + "\r\n"; + } } + response += "\r\n"; + this.socket.end(response, "ascii"); + this.emit("requestRejected", this); }; - exports2.ObfuscatedConnection = ObfuscatedConnection; - var PacketCodec = class { - constructor(connection) { - this._conn = connection; - } - encodePacket(data) { - throw new Error("Not Implemented"); - } - async readPacket(reader) { - throw new Error("Not Implemented"); + WebSocketRequest.prototype._handleSocketCloseBeforeAccept = function() { + this._socketIsClosing = true; + this._removeSocketCloseListeners(); + }; + WebSocketRequest.prototype._removeSocketCloseListeners = function() { + this.socket.removeListener("end", this._socketCloseHandler); + this.socket.removeListener("close", this._socketCloseHandler); + }; + WebSocketRequest.prototype._verifyResolution = function() { + if (this._resolved) { + throw new Error("WebSocketRequest may only be accepted or rejected one time."); } }; - exports2.PacketCodec = PacketCodec; + function cleanupFailedConnection(connection) { + process.nextTick(function() { + connection.drop(1006, "TCP connection lost before handshake completed.", true); + }); + } + module2.exports = WebSocketRequest; } }); -// node_modules/telegram/network/connection/TCPFull.js -var require_TCPFull = __commonJS({ - "node_modules/telegram/network/connection/TCPFull.js"(exports2) { - "use strict"; +// node_modules/websocket/lib/WebSocketServer.js +var require_WebSocketServer = __commonJS({ + "node_modules/websocket/lib/WebSocketServer.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPFull = exports2.FullPacketCodec = void 0; - var Connection_1 = require_Connection(); - var Helpers_1 = require_Helpers(); - var errors_1 = require_errors(); - var FullPacketCodec = class extends Connection_1.PacketCodec { - constructor(connection) { - super(connection); - this._sendCounter = 0; - } - encodePacket(data) { - const length = data.length + 12; - const e = Buffer.alloc(8); - e.writeInt32LE(length, 0); - e.writeInt32LE(this._sendCounter, 4); - data = Buffer.concat([e, data]); - const crc = Buffer.alloc(4); - crc.writeUInt32LE((0, Helpers_1.crc32)(data), 0); - this._sendCounter += 1; - return Buffer.concat([data, crc]); + var extend = require_utils5().extend; + var utils = require_utils5(); + var util = require("util"); + var debug = require_src2()("websocket:server"); + var EventEmitter = require("events").EventEmitter; + var WebSocketRequest = require_WebSocketRequest(); + var WebSocketServer = function WebSocketServer2(config) { + EventEmitter.call(this); + this._handlers = { + upgrade: this.handleUpgrade.bind(this), + requestAccepted: this.handleRequestAccepted.bind(this), + requestResolved: this.handleRequestResolved.bind(this) + }; + this.connections = []; + this.pendingRequests = []; + if (config) { + this.mount(config); } - /** - * - * @param reader {PromisedWebSockets} - * @returns {Promise<*>} - */ - async readPacket(reader) { - const packetLenSeq = await reader.readExactly(8); - if (packetLenSeq === void 0) { - return Buffer.alloc(0); - } - const packetLen = packetLenSeq.readInt32LE(0); - if (packetLen < 0) { - const body2 = await reader.readExactly(4); - throw new errors_1.InvalidBufferError(body2); - } - let body = await reader.readExactly(packetLen - 8); - const checksum = body.slice(-4).readUInt32LE(0); - body = body.slice(0, -4); - const validChecksum = (0, Helpers_1.crc32)(Buffer.concat([packetLenSeq, body])); - if (!(validChecksum === checksum)) { - throw new errors_1.InvalidChecksumError(checksum, validChecksum); + }; + util.inherits(WebSocketServer, EventEmitter); + WebSocketServer.prototype.mount = function(config) { + this.config = { + // The http server instance to attach to. Required. + httpServer: null, + // 64KiB max frame size. + maxReceivedFrameSize: 65536, + // 1MiB max message size, only applicable if + // assembleFragments is true + maxReceivedMessageSize: 1048576, + // Outgoing messages larger than fragmentationThreshold will be + // split into multiple fragments. + fragmentOutgoingMessages: true, + // Outgoing frames are fragmented if they exceed this threshold. + // Default is 16KiB + fragmentationThreshold: 16384, + // If true, the server will automatically send a ping to all + // clients every 'keepaliveInterval' milliseconds. The timer is + // reset on any received data from the client. + keepalive: true, + // The interval to send keepalive pings to connected clients if the + // connection is idle. Any received data will reset the counter. + keepaliveInterval: 2e4, + // If true, the server will consider any connection that has not + // received any data within the amount of time specified by + // 'keepaliveGracePeriod' after a keepalive ping has been sent to + // be dead, and will drop the connection. + // Ignored if keepalive is false. + dropConnectionOnKeepaliveTimeout: true, + // The amount of time to wait after sending a keepalive ping before + // closing the connection if the connected peer does not respond. + // Ignored if keepalive is false. + keepaliveGracePeriod: 1e4, + // Whether to use native TCP keep-alive instead of WebSockets ping + // and pong packets. Native TCP keep-alive sends smaller packets + // on the wire and so uses bandwidth more efficiently. This may + // be more important when talking to mobile devices. + // If this value is set to true, then these values will be ignored: + // keepaliveGracePeriod + // dropConnectionOnKeepaliveTimeout + useNativeKeepalive: false, + // If true, fragmented messages will be automatically assembled + // and the full message will be emitted via a 'message' event. + // If false, each frame will be emitted via a 'frame' event and + // the application will be responsible for aggregating multiple + // fragmented frames. Single-frame messages will emit a 'message' + // event in addition to the 'frame' event. + // Most users will want to leave this set to 'true' + assembleFragments: true, + // If this is true, websocket connections will be accepted + // regardless of the path and protocol specified by the client. + // The protocol accepted will be the first that was requested + // by the client. Clients from any origin will be accepted. + // This should only be used in the simplest of cases. You should + // probably leave this set to 'false' and inspect the request + // object to make sure it's acceptable before accepting it. + autoAcceptConnections: false, + // Whether or not the X-Forwarded-For header should be respected. + // It's important to set this to 'true' when accepting connections + // from untrusted clients, as a malicious client could spoof its + // IP address by simply setting this header. It's meant to be added + // by a trusted proxy or other intermediary within your own + // infrastructure. + // See: http://en.wikipedia.org/wiki/X-Forwarded-For + ignoreXForwardedFor: false, + // If this is true, 'cookie' headers are parsed and exposed as WebSocketRequest.cookies + parseCookies: true, + // If this is true, 'sec-websocket-extensions' headers are parsed and exposed as WebSocketRequest.requestedExtensions + parseExtensions: true, + // The Nagle Algorithm makes more efficient use of network resources + // by introducing a small delay before sending small packets so that + // multiple messages can be batched together before going onto the + // wire. This however comes at the cost of latency, so the default + // is to disable it. If you don't need low latency and are streaming + // lots of small messages, you can change this to 'false' + disableNagleAlgorithm: true, + // The number of milliseconds to wait after sending a close frame + // for an acknowledgement to come back before giving up and just + // closing the socket. + closeTimeout: 5e3 + }; + extend(this.config, config); + if (this.config.httpServer) { + if (!Array.isArray(this.config.httpServer)) { + this.config.httpServer = [this.config.httpServer]; } - return body; + var upgradeHandler = this._handlers.upgrade; + this.config.httpServer.forEach(function(httpServer) { + httpServer.on("upgrade", upgradeHandler); + }); + } else { + throw new Error("You must specify an httpServer on which to mount the WebSocket server."); + } + }; + WebSocketServer.prototype.unmount = function() { + var upgradeHandler = this._handlers.upgrade; + this.config.httpServer.forEach(function(httpServer) { + httpServer.removeListener("upgrade", upgradeHandler); + }); + }; + WebSocketServer.prototype.closeAllConnections = function() { + this.connections.forEach(function(connection) { + connection.close(); + }); + this.pendingRequests.forEach(function(request) { + process.nextTick(function() { + request.reject(503); + }); + }); + }; + WebSocketServer.prototype.broadcast = function(data) { + if (Buffer.isBuffer(data)) { + this.broadcastBytes(data); + } else if (typeof data.toString === "function") { + this.broadcastUTF(data); + } + }; + WebSocketServer.prototype.broadcastUTF = function(utfData) { + this.connections.forEach(function(connection) { + connection.sendUTF(utfData); + }); + }; + WebSocketServer.prototype.broadcastBytes = function(binaryData) { + this.connections.forEach(function(connection) { + connection.sendBytes(binaryData); + }); + }; + WebSocketServer.prototype.shutDown = function() { + this.unmount(); + this.closeAllConnections(); + }; + WebSocketServer.prototype.handleUpgrade = function(request, socket) { + var self2 = this; + var wsRequest = new WebSocketRequest(socket, request, this.config); + try { + wsRequest.readHandshake(); + } catch (e) { + wsRequest.reject( + e.httpCode ? e.httpCode : 400, + e.message, + e.headers + ); + debug("Invalid handshake: %s", e.message); + this.emit("upgradeError", e); + return; + } + this.pendingRequests.push(wsRequest); + wsRequest.once("requestAccepted", this._handlers.requestAccepted); + wsRequest.once("requestResolved", this._handlers.requestResolved); + socket.once("close", function() { + self2._handlers.requestResolved(wsRequest); + }); + if (!this.config.autoAcceptConnections && utils.eventEmitterListenerCount(this, "request") > 0) { + this.emit("request", wsRequest); + } else if (this.config.autoAcceptConnections) { + wsRequest.accept(wsRequest.requestedProtocols[0], wsRequest.origin); + } else { + wsRequest.reject(404, "No handler is configured to accept the connection."); + } + }; + WebSocketServer.prototype.handleRequestAccepted = function(connection) { + var self2 = this; + connection.once("close", function(closeReason, description) { + self2.handleConnectionClose(connection, closeReason, description); + }); + this.connections.push(connection); + this.emit("connect", connection); + }; + WebSocketServer.prototype.handleConnectionClose = function(connection, closeReason, description) { + var index2 = this.connections.indexOf(connection); + if (index2 !== -1) { + this.connections.splice(index2, 1); } + this.emit("close", connection, closeReason, description); }; - exports2.FullPacketCodec = FullPacketCodec; - var ConnectionTCPFull = class extends Connection_1.Connection { - constructor() { - super(...arguments); - this.PacketCodecClass = FullPacketCodec; + WebSocketServer.prototype.handleRequestResolved = function(request) { + var index2 = this.pendingRequests.indexOf(request); + if (index2 !== -1) { + this.pendingRequests.splice(index2, 1); } }; - exports2.ConnectionTCPFull = ConnectionTCPFull; + module2.exports = WebSocketServer; } }); -// node_modules/telegram/network/connection/TCPAbridged.js -var require_TCPAbridged = __commonJS({ - "node_modules/telegram/network/connection/TCPAbridged.js"(exports2) { - "use strict"; +// node_modules/websocket/lib/WebSocketClient.js +var require_WebSocketClient = __commonJS({ + "node_modules/websocket/lib/WebSocketClient.js"(exports2, module2) { init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPAbridged = exports2.AbridgedPacketCodec = void 0; - var Helpers_1 = require_Helpers(); - var Connection_1 = require_Connection(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var AbridgedPacketCodec = class _AbridgedPacketCodec extends Connection_1.PacketCodec { - constructor(props) { - super(props); - this.tag = _AbridgedPacketCodec.tag; - this.obfuscateTag = _AbridgedPacketCodec.obfuscateTag; - } - encodePacket(data) { - let length = data.length >> 2; - let temp; - if (length < 127) { - const b = Buffer.alloc(1); - b.writeUInt8(length, 0); - temp = b; + var utils = require_utils5(); + var extend = utils.extend; + var util = require("util"); + var EventEmitter = require("events").EventEmitter; + var http = require("http"); + var https = require("https"); + var url = require("url"); + var crypto4 = require("crypto"); + var WebSocketConnection = require_WebSocketConnection(); + var bufferAllocUnsafe = utils.bufferAllocUnsafe; + var protocolSeparators = [ + "(", + ")", + "<", + ">", + "@", + ",", + ";", + ":", + "\\", + '"', + "/", + "[", + "]", + "?", + "=", + "{", + "}", + " ", + String.fromCharCode(9) + ]; + var excludedTlsOptions = ["hostname", "port", "method", "path", "headers"]; + function WebSocketClient(config) { + EventEmitter.call(this); + this.config = { + // 1MiB max frame size. + maxReceivedFrameSize: 1048576, + // 8MiB max message size, only applicable if + // assembleFragments is true + maxReceivedMessageSize: 8388608, + // Outgoing messages larger than fragmentationThreshold will be + // split into multiple fragments. + fragmentOutgoingMessages: true, + // Outgoing frames are fragmented if they exceed this threshold. + // Default is 16KiB + fragmentationThreshold: 16384, + // Which version of the protocol to use for this session. This + // option will be removed once the protocol is finalized by the IETF + // It is only available to ease the transition through the + // intermediate draft protocol versions. + // At present, it only affects the name of the Origin header. + webSocketVersion: 13, + // If true, fragmented messages will be automatically assembled + // and the full message will be emitted via a 'message' event. + // If false, each frame will be emitted via a 'frame' event and + // the application will be responsible for aggregating multiple + // fragmented frames. Single-frame messages will emit a 'message' + // event in addition to the 'frame' event. + // Most users will want to leave this set to 'true' + assembleFragments: true, + // The Nagle Algorithm makes more efficient use of network resources + // by introducing a small delay before sending small packets so that + // multiple messages can be batched together before going onto the + // wire. This however comes at the cost of latency, so the default + // is to disable it. If you don't need low latency and are streaming + // lots of small messages, you can change this to 'false' + disableNagleAlgorithm: true, + // The number of milliseconds to wait after sending a close frame + // for an acknowledgement to come back before giving up and just + // closing the socket. + closeTimeout: 5e3, + // Options to pass to https.connect if connecting via TLS + tlsOptions: {} + }; + if (config) { + var tlsOptions; + if (config.tlsOptions) { + tlsOptions = config.tlsOptions; + delete config.tlsOptions; } else { - temp = Buffer.concat([ - Buffer.from("7f", "hex"), - (0, Helpers_1.readBufferFromBigInt)((0, big_integer_1.default)(length), 3) - ]); + tlsOptions = {}; } - return Buffer.concat([temp, data]); + extend(this.config, config); + extend(this.config.tlsOptions, tlsOptions); } - async readPacket(reader) { - const readData = await reader.read(1); - let length = readData[0]; - if (length >= 127) { - length = Buffer.concat([ - await reader.read(3), - Buffer.alloc(1) - ]).readInt32LE(0); - } - return reader.read(length << 2); + this._req = null; + switch (this.config.webSocketVersion) { + case 8: + case 13: + break; + default: + throw new Error("Requested webSocketVersion is not supported. Allowed values are 8 and 13."); } - }; - exports2.AbridgedPacketCodec = AbridgedPacketCodec; - AbridgedPacketCodec.tag = Buffer.from("ef", "hex"); - AbridgedPacketCodec.obfuscateTag = Buffer.from("efefefef", "hex"); - var ConnectionTCPAbridged = class extends Connection_1.Connection { - constructor() { - super(...arguments); - this.PacketCodecClass = AbridgedPacketCodec; + } + util.inherits(WebSocketClient, EventEmitter); + WebSocketClient.prototype.connect = function(requestUrl, protocols, origin, headers, extraRequestOptions) { + var self2 = this; + if (typeof protocols === "string") { + if (protocols.length > 0) { + protocols = [protocols]; + } else { + protocols = []; + } } - }; - exports2.ConnectionTCPAbridged = ConnectionTCPAbridged; - } -}); - -// node_modules/@cryptography/aes/dist/cjs/aes.min.js -var require_aes_min = __commonJS({ - "node_modules/@cryptography/aes/dist/cjs/aes.min.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - var t = new Uint8Array(256); - var e = new Uint8Array(256); - var r = new Uint32Array(256); - var n = new Uint32Array(256); - var i = new Uint32Array(256); - var h = new Uint32Array(256); - var o = new Uint32Array(256); - var s = new Uint32Array(256); - var c = new Uint32Array(256); - var y = new Uint32Array(256); - function a(t2) { - if (t2 instanceof Uint32Array) return t2; - if ("string" == typeof t2) { - if (t2.length % 4 != 0) for (var e2 = t2.length % 4; e2 <= 4; e2++) t2 += "\0x00"; - var r3 = new Uint32Array(t2.length / 4); - for (e2 = 0; e2 < t2.length; e2 += 4) r3[e2 / 4] = (i2 = e2, (n2 = t2).charCodeAt(i2) << 24 ^ n2.charCodeAt(i2 + 1) << 16 ^ n2.charCodeAt(i2 + 2) << 8 ^ n2.charCodeAt(i2 + 3)); - return r3; + if (!(protocols instanceof Array)) { + protocols = []; } - var n2, i2; - if (t2 instanceof Uint8Array) { - for (r3 = new Uint32Array(t2.length / 4), e2 = 0; e2 < t2.length; e2 += 4) r3[e2 / 4] = t2[e2] << 24 ^ t2[e2 + 1] << 16 ^ t2[e2 + 2] << 8 ^ t2[e2 + 3]; - return r3; + this.protocols = protocols; + this.origin = origin; + if (typeof requestUrl === "string") { + this.url = url.parse(requestUrl); + } else { + this.url = requestUrl; } - throw new Error("Unable to create 32-bit words"); - } - function l(t2, e2, r3) { - void 0 === r3 && (r3 = t2); - for (var n2 = 0; n2 < t2.length; n2++) r3[n2] = t2[n2] ^ e2[n2]; - } - !(function() { - for (var a2, l2, f2, u2, g2, p = new Uint8Array(256), v = new Uint8Array(256), w = 0, A = 0, d = 0; d < 256; d++) p[d] = d << 1 ^ 283 * (d >> 7), v[p[d] ^ d] = d; - for (; !t[w]; w ^= a2 || 1) f2 = (f2 = A ^ A << 1 ^ A << 2 ^ A << 3 ^ A << 4) >> 8 ^ 255 & f2 ^ 99, t[w] = f2, e[f2] = w, g2 = 16843009 * p[l2 = p[a2 = p[w]]] ^ 65537 * l2 ^ 257 * a2 ^ 16843008 * w, u2 = 257 * p[f2] ^ 16843008 * f2, r[w] = u2 = u2 << 24 ^ u2 >>> 8, n[w] = u2 = u2 << 24 ^ u2 >>> 8, i[w] = u2 = u2 << 24 ^ u2 >>> 8, h[w] = u2 = u2 << 24 ^ u2 >>> 8, o[f2] = g2 = g2 << 24 ^ g2 >>> 8, s[f2] = g2 = g2 << 24 ^ g2 >>> 8, c[f2] = g2 = g2 << 24 ^ g2 >>> 8, y[f2] = g2 = g2 << 24 ^ g2 >>> 8, A = v[A] || 1; - })(); - var f = (function() { - function l2(e2) { - var r3 = a(e2); - if (4 !== r3.length && 6 !== r3.length && 8 !== r3.length) throw new Error("Invalid key size"); - this.encKey = new Uint32Array(4 * r3.length + 28), this.decKey = new Uint32Array(4 * r3.length + 28), this.encKey.set(r3); - for (var n2, i2 = 1, h2 = r3.length; h2 < 4 * r3.length + 28; h2++) n2 = this.encKey[h2 - 1], (h2 % r3.length == 0 || 8 === r3.length && h2 % r3.length == 4) && (n2 = t[n2 >>> 24] << 24 ^ t[n2 >> 16 & 255] << 16 ^ t[n2 >> 8 & 255] << 8 ^ t[255 & n2], h2 % r3.length == 0 && (n2 = n2 << 8 ^ n2 >>> 24 ^ i2 << 24, i2 = i2 << 1 ^ 283 * (i2 >> 7))), this.encKey[h2] = this.encKey[h2 - r3.length] ^ n2; - for (var l3 = 0; h2; l3++, h2--) n2 = this.encKey[3 & l3 ? h2 : h2 - 4], this.decKey[l3] = h2 <= 4 || l3 < 4 ? n2 : o[t[n2 >>> 24]] ^ s[t[n2 >> 16 & 255]] ^ c[t[n2 >> 8 & 255]] ^ y[t[255 & n2]]; + if (!this.url.protocol) { + throw new Error("You must specify a full WebSocket URL, including protocol."); } - return l2.prototype.encrypt = function(e2) { - for (var o2, s2, c2, y2 = a(e2), l3 = new Uint32Array(4), f2 = y2[0] ^ this.encKey[0], u2 = y2[1] ^ this.encKey[1], g2 = y2[2] ^ this.encKey[2], p = y2[3] ^ this.encKey[3], v = this.encKey.length / 4 - 2, w = 4, A = 0; A < v; A++) o2 = r[f2 >>> 24] ^ n[u2 >> 16 & 255] ^ i[g2 >> 8 & 255] ^ h[255 & p] ^ this.encKey[w], s2 = r[u2 >>> 24] ^ n[g2 >> 16 & 255] ^ i[p >> 8 & 255] ^ h[255 & f2] ^ this.encKey[w + 1], c2 = r[g2 >>> 24] ^ n[p >> 16 & 255] ^ i[f2 >> 8 & 255] ^ h[255 & u2] ^ this.encKey[w + 2], p = r[p >>> 24] ^ n[f2 >> 16 & 255] ^ i[u2 >> 8 & 255] ^ h[255 & g2] ^ this.encKey[w + 3], f2 = o2, u2 = s2, g2 = c2, w += 4; - for (A = 0; A < 4; A++) l3[A] = t[f2 >>> 24] << 24 ^ t[u2 >> 16 & 255] << 16 ^ t[g2 >> 8 & 255] << 8 ^ t[255 & p] ^ this.encKey[w++], o2 = f2, f2 = u2, u2 = g2, g2 = p, p = o2; - return l3; - }, l2.prototype.decrypt = function(t2) { - for (var r3, n2, i2, h2 = a(t2), l3 = new Uint32Array(4), f2 = h2[0] ^ this.decKey[0], u2 = h2[3] ^ this.decKey[1], g2 = h2[2] ^ this.decKey[2], p = h2[1] ^ this.decKey[3], v = this.decKey.length / 4 - 2, w = 4, A = 0; A < v; A++) r3 = o[f2 >>> 24] ^ s[u2 >> 16 & 255] ^ c[g2 >> 8 & 255] ^ y[255 & p] ^ this.decKey[w], n2 = o[u2 >>> 24] ^ s[g2 >> 16 & 255] ^ c[p >> 8 & 255] ^ y[255 & f2] ^ this.decKey[w + 1], i2 = o[g2 >>> 24] ^ s[p >> 16 & 255] ^ c[f2 >> 8 & 255] ^ y[255 & u2] ^ this.decKey[w + 2], p = o[p >>> 24] ^ s[f2 >> 16 & 255] ^ c[u2 >> 8 & 255] ^ y[255 & g2] ^ this.decKey[w + 3], f2 = r3, u2 = n2, g2 = i2, w += 4; - for (A = 0; A < 4; A++) l3[3 & -A] = e[f2 >>> 24] << 24 ^ e[u2 >> 16 & 255] << 16 ^ e[g2 >> 8 & 255] << 8 ^ e[255 & p] ^ this.decKey[w++], r3 = f2, f2 = u2, u2 = g2, g2 = p, p = r3; - return l3; - }, l2; - })(); - var u = (function() { - function t2(t3, e2, r3) { - void 0 === r3 && (r3 = 16), this.key = a(t3), this.iv = a(e2), this.cipher = new f(t3), this.blockSize = r3 / 4; + if (!this.url.host) { + throw new Error("You must specify a full WebSocket URL, including hostname. Relative URLs are not supported."); } - return t2.prototype.encrypt = function(t3, e2) { - for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.iv.subarray(this.blockSize, this.iv.length), h2 = this.iv.subarray(0, this.blockSize), o2 = new Uint32Array(this.blockSize), s2 = 0; s2 < r3.length; s2 += this.blockSize) { - var c2 = r3.subarray(s2, s2 + this.blockSize); - l(c2, h2, o2); - var y2 = this.cipher.encrypt(o2); - l(y2, i2), i2 = c2, h2 = y2; - for (var f2 = s2, u2 = 0; f2 < r3.length && u2 < 4; f2++, u2++) n2[f2] = y2[u2]; - } - return n2; - }, t2.prototype.decrypt = function(t3, e2) { - for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.iv.subarray(this.blockSize, this.iv.length), h2 = this.iv.subarray(0, this.blockSize), o2 = new Uint32Array(this.blockSize), s2 = 0; s2 < n2.length; s2 += this.blockSize) { - var c2 = r3.subarray(s2, s2 + this.blockSize); - l(c2, i2, o2); - var y2 = this.cipher.decrypt(o2); - l(y2, h2), h2 = c2, i2 = y2; - for (var f2 = s2, u2 = 0; f2 < n2.length && u2 < 4; f2++, u2++) n2[f2] = y2[u2]; + this.secure = this.url.protocol === "wss:"; + this.protocols.forEach(function(protocol) { + for (var i2 = 0; i2 < protocol.length; i2++) { + var charCode = protocol.charCodeAt(i2); + var character = protocol.charAt(i2); + if (charCode < 33 || charCode > 126 || protocolSeparators.indexOf(character) !== -1) { + throw new Error('Protocol list contains invalid character "' + String.fromCharCode(charCode) + '"'); + } } - return n2; - }, t2; - })(); - var g = (function() { - function t2(t3, e2, r3) { - if (void 0 === r3 && (r3 = 16), this.offset = 0, this.key = a(t3), this.counter = a(e2), this.cipher = new f(t3), this.blockSize = r3 / 4, 4 !== this.counter.length) throw new Error("AES-CTR mode counter must be 16 bytes length"); + }); + var defaultPorts = { + "ws:": "80", + "wss:": "443" + }; + if (!this.url.port) { + this.url.port = defaultPorts[this.url.protocol]; } - return t2.prototype.encrypt = function(t3, e2) { - for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.offset, h2 = 0; h2 < r3.length; h2 += this.blockSize) { - for (var o2 = this.cipher.encrypt(this.counter), s2 = h2, c2 = i2; s2 < r3.length && c2 < this.blockSize; s2++, c2++) n2[s2] = o2[c2] ^ r3[s2]; - r3.length - h2 >= this.blockSize && this.incrementCounter(), i2 && (h2 -= i2, i2 = 0); - } - return this.offset = (this.offset + r3.length % 4) % 4, n2; - }, t2.prototype.decrypt = function(t3, e2) { - return this.encrypt(t3, e2); - }, t2.prototype.incrementCounter = function() { - for (var t3 = this.counter.length - 1; t3 >= 0 && !(++this.counter[t3] < 4294967295); t3--) ; - }, t2; - })(); - exports2.CTR = g, exports2.IGE = u, exports2.default = f; - } -}); - -// node_modules/telegram/crypto/converters.js -var require_converters = __commonJS({ - "node_modules/telegram/crypto/converters.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ab2i = exports2.i2ab = exports2.isBigEndian = void 0; - exports2.i2abLow = i2abLow; - exports2.i2abBig = i2abBig; - exports2.ab2iLow = ab2iLow; - exports2.ab2iBig = ab2iBig; - function i2abLow(buf) { - const uint8 = new Uint8Array(buf.length * 4); - let i = 0; - for (let j = 0; j < buf.length; j++) { - const int = buf[j]; - uint8[i++] = int >>> 24; - uint8[i++] = int >> 16 & 255; - uint8[i++] = int >> 8 & 255; - uint8[i++] = int & 255; + var nonce = bufferAllocUnsafe(16); + for (var i = 0; i < 16; i++) { + nonce[i] = Math.round(Math.random() * 255); } - return uint8.buffer; - } - function i2abBig(buf) { - return buf.buffer; - } - function ab2iLow(ab) { - const uint8 = new Uint8Array(ab); - const buf = new Uint32Array(uint8.length / 4); - for (let i = 0; i < uint8.length; i += 4) { - buf[i / 4] = uint8[i] << 24 ^ uint8[i + 1] << 16 ^ uint8[i + 2] << 8 ^ uint8[i + 3]; + this.base64nonce = nonce.toString("base64"); + var hostHeaderValue = this.url.hostname; + if (this.url.protocol === "ws:" && this.url.port !== "80" || this.url.protocol === "wss:" && this.url.port !== "443") { + hostHeaderValue += ":" + this.url.port; } - return buf; - } - function ab2iBig(ab) { - return new Uint32Array(ab); - } - exports2.isBigEndian = new Uint8Array(new Uint32Array([16909060]))[0] === 1; - exports2.i2ab = exports2.isBigEndian ? i2abBig : i2abLow; - exports2.ab2i = exports2.isBigEndian ? ab2iBig : ab2iLow; - } -}); - -// node_modules/telegram/crypto/words.js -var require_words = __commonJS({ - "node_modules/telegram/crypto/words.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.s2i = s2i; - exports2.getWords = getWords; - exports2.xor = xor; - function s2i(str, pos) { - return str.charCodeAt(pos) << 24 ^ str.charCodeAt(pos + 1) << 16 ^ str.charCodeAt(pos + 2) << 8 ^ str.charCodeAt(pos + 3); - } - function getWords(key2) { - if (key2 instanceof Uint32Array) { - return key2; - } - if (typeof key2 === "string") { - if (key2.length % 4 !== 0) - for (let i = key2.length % 4; i <= 4; i++) - key2 += "\0x00"; - const buf = new Uint32Array(key2.length / 4); - for (let i = 0; i < key2.length; i += 4) - buf[i / 4] = s2i(key2, i); - return buf; + var reqHeaders = {}; + if (this.secure && this.config.tlsOptions.hasOwnProperty("headers")) { + extend(reqHeaders, this.config.tlsOptions.headers); } - if (key2 instanceof Uint8Array) { - const buf = new Uint32Array(key2.length / 4); - for (let i = 0; i < key2.length; i += 4) { - buf[i / 4] = key2[i] << 24 ^ key2[i + 1] << 16 ^ key2[i + 2] << 8 ^ key2[i + 3]; - } - return buf; + if (headers) { + extend(reqHeaders, headers); } - throw new Error("Unable to create 32-bit words"); - } - function xor(left, right, to = left) { - for (let i = 0; i < left.length; i++) - to[i] = left[i] ^ right[i]; - } - } -}); - -// node_modules/telegram/crypto/crypto.js -var require_crypto = __commonJS({ - "node_modules/telegram/crypto/crypto.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Hash = exports2.CTR = exports2.Counter = void 0; - exports2.createDecipheriv = createDecipheriv; - exports2.createCipheriv = createCipheriv; - exports2.randomBytes = randomBytes; - exports2.pbkdf2Sync = pbkdf2Sync; - exports2.createHash = createHash; - var aes_1 = __importDefault2(require_aes_min()); - var converters_1 = require_converters(); - var words_1 = require_words(); - var Counter = class { - constructor(initialValue) { - this._counter = Buffer.from(initialValue); + extend(reqHeaders, { + "Upgrade": "websocket", + "Connection": "Upgrade", + "Sec-WebSocket-Version": this.config.webSocketVersion.toString(10), + "Sec-WebSocket-Key": this.base64nonce, + "Host": reqHeaders.Host || hostHeaderValue + }); + if (this.protocols.length > 0) { + reqHeaders["Sec-WebSocket-Protocol"] = this.protocols.join(", "); } - increment() { - for (let i = 15; i >= 0; i--) { - if (this._counter[i] === 255) { - this._counter[i] = 0; - } else { - this._counter[i]++; - break; - } + if (this.origin) { + if (this.config.webSocketVersion === 13) { + reqHeaders["Origin"] = this.origin; + } else if (this.config.webSocketVersion === 8) { + reqHeaders["Sec-WebSocket-Origin"] = this.origin; } } - }; - exports2.Counter = Counter; - var CTR = class { - constructor(key2, counter) { - if (!(counter instanceof Counter)) { - counter = new Counter(counter); - } - this._counter = counter; - this._remainingCounter = void 0; - this._remainingCounterIndex = 16; - this._aes = new aes_1.default((0, words_1.getWords)(key2)); + var pathAndQuery; + if (this.url.pathname) { + pathAndQuery = this.url.path; + } else if (this.url.path) { + pathAndQuery = "/" + this.url.path; + } else { + pathAndQuery = "/"; } - update(plainText) { - return this.encrypt(plainText); + function handleRequestError(error) { + self2._req = null; + self2.emit("connectFailed", error); } - encrypt(plainText) { - const encrypted = Buffer.from(plainText); - for (let i = 0; i < encrypted.length; i++) { - if (this._remainingCounterIndex === 16) { - this._remainingCounter = Buffer.from((0, converters_1.i2ab)(this._aes.encrypt((0, converters_1.ab2i)(this._counter._counter)))); - this._remainingCounterIndex = 0; - this._counter.increment(); - } - if (this._remainingCounter) { - encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; + var requestOptions = { + agent: false + }; + if (extraRequestOptions) { + extend(requestOptions, extraRequestOptions); + } + extend(requestOptions, { + hostname: this.url.hostname, + port: this.url.port, + method: "GET", + path: pathAndQuery, + headers: reqHeaders + }); + if (this.secure) { + var tlsOptions = this.config.tlsOptions; + for (var key in tlsOptions) { + if (tlsOptions.hasOwnProperty(key) && excludedTlsOptions.indexOf(key) === -1) { + requestOptions[key] = tlsOptions[key]; } } - return encrypted; } + var req = this._req = (this.secure ? https : http).request(requestOptions); + req.on("upgrade", function handleRequestUpgrade(response, socket, head) { + self2._req = null; + req.removeListener("error", handleRequestError); + self2.socket = socket; + self2.response = response; + self2.firstDataChunk = head; + self2.validateHandshake(); + }); + req.on("error", handleRequestError); + req.on("response", function(response) { + self2._req = null; + if (utils.eventEmitterListenerCount(self2, "httpResponse") > 0) { + self2.emit("httpResponse", response, self2); + if (response.socket) { + response.socket.end(); + } + } else { + var headerDumpParts = []; + for (var headerName in response.headers) { + headerDumpParts.push(headerName + ": " + response.headers[headerName]); + } + self2.failHandshake( + "Server responded with a non-101 status: " + response.statusCode + " " + response.statusMessage + "\nResponse Headers Follow:\n" + headerDumpParts.join("\n") + "\n" + ); + } + }); + req.end(); }; - exports2.CTR = CTR; - function createDecipheriv(algorithm, key2, iv) { - if (algorithm.includes("ECB")) { - throw new Error("Not supported"); - } else { - return new CTR(key2, iv); - } - } - function createCipheriv(algorithm, key2, iv) { - if (algorithm.includes("ECB")) { - throw new Error("Not supported"); - } else { - return new CTR(key2, iv); - } - } - function randomBytes(count) { - const bytes = new Uint8Array(count); - crypto.getRandomValues(bytes); - return bytes; - } - var Hash = class { - constructor(algorithm) { - this.algorithm = algorithm; - } - update(data) { - this.data = new Uint8Array(data); - } - async digest() { - if (this.data) { - if (this.algorithm === "sha1") { - return Buffer.from(await self.crypto.subtle.digest("SHA-1", this.data)); - } else if (this.algorithm === "sha256") { - return Buffer.from(await self.crypto.subtle.digest("SHA-256", this.data)); + WebSocketClient.prototype.validateHandshake = function() { + var headers = this.response.headers; + if (this.protocols.length > 0) { + this.protocol = headers["sec-websocket-protocol"]; + if (this.protocol) { + if (this.protocols.indexOf(this.protocol) === -1) { + this.failHandshake("Server did not respond with a requested protocol."); + return; } + } else { + this.failHandshake("Expected a Sec-WebSocket-Protocol header."); + return; } - return Buffer.alloc(0); } - }; - exports2.Hash = Hash; - async function pbkdf2Sync(password, salt, iterations, ...args) { - const passwordKey = await crypto.subtle.importKey("raw", password, { name: "PBKDF2" }, false, ["deriveBits"]); - return Buffer.from(await crypto.subtle.deriveBits({ - name: "PBKDF2", - hash: "SHA-512", - salt, - iterations - }, passwordKey, 512)); - } - function createHash(algorithm) { - return new Hash(algorithm); - } - } -}); - -// node_modules/telegram/crypto/CTR.js -var require_CTR = __commonJS({ - "node_modules/telegram/crypto/CTR.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + if (!(headers["connection"] && headers["connection"].toLocaleLowerCase() === "upgrade")) { + this.failHandshake("Expected a Connection: Upgrade header from the server"); + return; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + if (!(headers["upgrade"] && headers["upgrade"].toLocaleLowerCase() === "websocket")) { + this.failHandshake("Expected an Upgrade: websocket header from the server"); + return; } - __setModuleDefault2(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CTR = void 0; - var crypto4 = __importStar2(require_crypto()); - var CTR = class { - constructor(key2, iv) { - if (!Buffer.isBuffer(key2) || !Buffer.isBuffer(iv) || iv.length !== 16) { - throw new Error("Key and iv need to be a buffer"); - } - this.cipher = crypto4.createCipheriv("AES-256-CTR", key2, iv); + var sha1 = crypto4.createHash("sha1"); + sha1.update(this.base64nonce + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + var expectedKey = sha1.digest("base64"); + if (!headers["sec-websocket-accept"]) { + this.failHandshake("Expected Sec-WebSocket-Accept header from server"); + return; } - encrypt(data) { - return Buffer.from(this.cipher.update(data)); + if (headers["sec-websocket-accept"] !== expectedKey) { + this.failHandshake("Sec-WebSocket-Accept header from server didn't match expected value of " + expectedKey); + return; } + this.succeedHandshake(); }; - exports2.CTR = CTR; - } -}); - -// node_modules/telegram/network/connection/TCPObfuscated.js -var require_TCPObfuscated = __commonJS({ - "node_modules/telegram/network/connection/TCPObfuscated.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPObfuscated = void 0; - var Helpers_1 = require_Helpers(); - var Connection_1 = require_Connection(); - var TCPAbridged_1 = require_TCPAbridged(); - var CTR_1 = require_CTR(); - var ObfuscatedIO = class { - constructor(connection) { - this.header = void 0; - this.connection = connection.socket; - this._packetClass = connection.PacketCodecClass; - } - async initHeader() { - const keywords = [ - Buffer.from("50567247", "hex"), - Buffer.from("474554", "hex"), - Buffer.from("504f5354", "hex"), - Buffer.from("eeeeeeee", "hex") - ]; - let random; - while (true) { - random = (0, Helpers_1.generateRandomBytes)(64); - if (random[0] !== 239 && !random.slice(4, 8).equals(Buffer.alloc(4))) { - let ok = true; - for (const key2 of keywords) { - if (key2.equals(random.slice(0, 4))) { - ok = false; - break; - } - } - if (ok) { - break; - } - } - } - random = random.toJSON().data; - const randomReversed = Buffer.from(random.slice(8, 56)).reverse(); - const encryptKey = Buffer.from(random.slice(8, 40)); - const encryptIv = Buffer.from(random.slice(40, 56)); - const decryptKey = Buffer.from(randomReversed.slice(0, 32)); - const decryptIv = Buffer.from(randomReversed.slice(32, 48)); - const encryptor = new CTR_1.CTR(encryptKey, encryptIv); - const decryptor = new CTR_1.CTR(decryptKey, decryptIv); - random = Buffer.concat([ - Buffer.from(random.slice(0, 56)), - this._packetClass.obfuscateTag, - Buffer.from(random.slice(60)) - ]); - random = Buffer.concat([ - Buffer.from(random.slice(0, 56)), - Buffer.from(encryptor.encrypt(random).slice(56, 64)), - Buffer.from(random.slice(64)) - ]); - this.header = random; - this._encrypt = encryptor; - this._decrypt = decryptor; - } - async read(n) { - const data = await this.connection.readExactly(n); - return this._decrypt.encrypt(data); + WebSocketClient.prototype.failHandshake = function(errorDescription) { + if (this.socket && this.socket.writable) { + this.socket.end(); } - write(data) { - this.connection.write(this._encrypt.encrypt(data)); + this.emit("connectFailed", new Error(errorDescription)); + }; + WebSocketClient.prototype.succeedHandshake = function() { + var connection = new WebSocketConnection(this.socket, [], this.protocol, true, this.config); + connection.webSocketVersion = this.config.webSocketVersion; + connection._addSocketEventListeners(); + this.emit("connect", connection); + if (this.firstDataChunk.length > 0) { + connection.handleSocketData(this.firstDataChunk); } + this.firstDataChunk = null; }; - var ConnectionTCPObfuscated = class extends Connection_1.ObfuscatedConnection { - constructor() { - super(...arguments); - this.ObfuscatedIO = ObfuscatedIO; - this.PacketCodecClass = TCPAbridged_1.AbridgedPacketCodec; + WebSocketClient.prototype.abort = function() { + if (this._req) { + this._req.abort(); } }; - exports2.ConnectionTCPObfuscated = ConnectionTCPObfuscated; - } -}); - -// node_modules/telegram/network/connection/index.js -var require_connection = __commonJS({ - "node_modules/telegram/network/connection/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPObfuscated = exports2.ConnectionTCPAbridged = exports2.ConnectionTCPFull = exports2.Connection = void 0; - var Connection_1 = require_Connection(); - Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { - return Connection_1.Connection; - } }); - var TCPFull_1 = require_TCPFull(); - Object.defineProperty(exports2, "ConnectionTCPFull", { enumerable: true, get: function() { - return TCPFull_1.ConnectionTCPFull; - } }); - var TCPAbridged_1 = require_TCPAbridged(); - Object.defineProperty(exports2, "ConnectionTCPAbridged", { enumerable: true, get: function() { - return TCPAbridged_1.ConnectionTCPAbridged; - } }); - var TCPObfuscated_1 = require_TCPObfuscated(); - Object.defineProperty(exports2, "ConnectionTCPObfuscated", { enumerable: true, get: function() { - return TCPObfuscated_1.ConnectionTCPObfuscated; - } }); + module2.exports = WebSocketClient; } }); -// node_modules/telegram/sessions/Abstract.js -var require_Abstract = __commonJS({ - "node_modules/telegram/sessions/Abstract.js"(exports2) { - "use strict"; +// node_modules/websocket/lib/WebSocketRouterRequest.js +var require_WebSocketRouterRequest = __commonJS({ + "node_modules/websocket/lib/WebSocketRouterRequest.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Session = void 0; - var Session = class { + var util = require("util"); + var EventEmitter = require("events").EventEmitter; + function WebSocketRouterRequest(webSocketRequest, resolvedProtocol) { + EventEmitter.call(this); + this.webSocketRequest = webSocketRequest; + if (resolvedProtocol === "____no_protocol____") { + this.protocol = null; + } else { + this.protocol = resolvedProtocol; + } + this.origin = webSocketRequest.origin; + this.resource = webSocketRequest.resource; + this.resourceURL = webSocketRequest.resourceURL; + this.httpRequest = webSocketRequest.httpRequest; + this.remoteAddress = webSocketRequest.remoteAddress; + this.webSocketVersion = webSocketRequest.webSocketVersion; + this.requestedExtensions = webSocketRequest.requestedExtensions; + this.cookies = webSocketRequest.cookies; + } + util.inherits(WebSocketRouterRequest, EventEmitter); + WebSocketRouterRequest.prototype.accept = function(origin, cookies) { + var connection = this.webSocketRequest.accept(this.protocol, origin, cookies); + this.emit("requestAccepted", connection); + return connection; }; - exports2.Session = Session; + WebSocketRouterRequest.prototype.reject = function(status, reason, extraHeaders) { + this.webSocketRequest.reject(status, reason, extraHeaders); + this.emit("requestRejected", this); + }; + module2.exports = WebSocketRouterRequest; } }); -// node_modules/telegram/sessions/Memory.js -var require_Memory = __commonJS({ - "node_modules/telegram/sessions/Memory.js"(exports2) { - "use strict"; +// node_modules/websocket/lib/WebSocketRouter.js +var require_WebSocketRouter = __commonJS({ + "node_modules/websocket/lib/WebSocketRouter.js"(exports2, module2) { init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MemorySession = void 0; - var Abstract_1 = require_Abstract(); - var tl_1 = require_tl(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var Utils_1 = require_Utils(); - var Helpers_1 = require_Helpers(); - var __1 = require_telegram(); - var MemorySession = class extends Abstract_1.Session { - constructor() { - super(); - this._serverAddress = void 0; - this._dcId = 0; - this._port = void 0; - this._takeoutId = void 0; - this._entities = /* @__PURE__ */ new Set(); - this._updateStates = {}; - } - setDC(dcId, serverAddress, port) { - this._dcId = dcId | 0; - this._serverAddress = serverAddress; - this._port = port; - } - get dcId() { - return this._dcId; - } - get serverAddress() { - return this._serverAddress; - } - get port() { - return this._port; - } - get authKey() { - return this._authKey; - } - set authKey(value) { - this._authKey = value; - } - get takeoutId() { - return this._takeoutId; - } - set takeoutId(value) { - this._takeoutId = value; - } - getAuthKey(dcId) { - if (dcId && dcId !== this.dcId) { - return void 0; - } - return this.authKey; - } - setAuthKey(authKey, dcId) { - if (dcId && dcId !== this.dcId) { - return void 0; - } - this.authKey = authKey; - } - close() { - } - save() { - } - async load() { - } - delete() { - } - _entityValuesToRow(id, hash2, username, phone, name) { - return [id, hash2, username, phone, name]; + var extend = require_utils5().extend; + var util = require("util"); + var EventEmitter = require("events").EventEmitter; + var WebSocketRouterRequest = require_WebSocketRouterRequest(); + function WebSocketRouter(config) { + EventEmitter.call(this); + this.config = { + // The WebSocketServer instance to attach to. + server: null + }; + if (config) { + extend(this.config, config); } - _entityToRow(e) { - if (!(e.classType === "constructor")) { - return; - } - let p; - let markedId; - try { - p = (0, Utils_1.getInputPeer)(e, false); - markedId = (0, Utils_1.getPeerId)(p); - } catch (e2) { - return; - } - let pHash; - if (p instanceof tl_1.Api.InputPeerUser || p instanceof tl_1.Api.InputPeerChannel) { - pHash = p.accessHash; - } else if (p instanceof tl_1.Api.InputPeerChat) { - pHash = big_integer_1.default.zero; - } else { - return; - } - let username = e.username; - if (username) { - username = username.toLowerCase(); - } - const phone = e.phone; - const name = (0, Utils_1.getDisplayName)(e); - return this._entityValuesToRow(markedId, pHash, username, phone, name); + this.handlers = []; + this._requestHandler = this.handleRequest.bind(this); + if (this.config.server) { + this.attachServer(this.config.server); } - _entitiesToRows(tlo) { - let entities2 = []; - if (!(tlo.classType === "constructor") && (0, Helpers_1.isArrayLike)(tlo)) { - entities2 = tlo; - } else { - if (typeof tlo === "object") { - if ("user" in tlo) { - entities2.push(tlo.user); - } - if ("chat" in tlo) { - entities2.push(tlo.chat); - } - if ("channel" in tlo) { - entities2.push(tlo.channel); - } - if ("chats" in tlo && (0, Helpers_1.isArrayLike)(tlo.chats)) { - entities2 = entities2.concat(tlo.chats); - } - if ("users" in tlo && (0, Helpers_1.isArrayLike)(tlo.users)) { - entities2 = entities2.concat(tlo.users); - } - } - } - const rows = []; - for (const e of entities2) { - const row = this._entityToRow(e); - if (row) { - rows.push(row); - } - } - return rows; + } + util.inherits(WebSocketRouter, EventEmitter); + WebSocketRouter.prototype.attachServer = function(server) { + if (server) { + this.server = server; + this.server.on("request", this._requestHandler); + } else { + throw new Error("You must specify a WebSocketServer instance to attach to."); } - processEntities(tlo) { - const entitiesSet = this._entitiesToRows(tlo); - for (const e of entitiesSet) { - this._entities.add(e); - } + }; + WebSocketRouter.prototype.detachServer = function() { + if (this.server) { + this.server.removeListener("request", this._requestHandler); + this.server = null; + } else { + throw new Error("Cannot detach from server: not attached."); } - getEntityRowsByPhone(phone) { - for (const e of this._entities) { - if (e[3] === phone) { - return [e[0], e[1]]; - } - } + }; + WebSocketRouter.prototype.mount = function(path2, protocol, callback) { + if (!path2) { + throw new Error("You must specify a path for this handler."); } - getEntityRowsByUsername(username) { - for (const e of this._entities) { - if (e[2] === username) { - return [e[0], e[1]]; - } - } + if (!protocol) { + protocol = "____no_protocol____"; } - getEntityRowsByName(name) { - for (const e of this._entities) { - if (e[4] === name) { - return [e[0], e[1]]; - } - } + if (!callback) { + throw new Error("You must specify a callback for this handler."); } - getEntityRowsById(id, exact = true) { - if (exact) { - for (const e of this._entities) { - if (e[0] === id) { - return [e[0], e[1]]; - } - } - } else { - const ids = [ - __1.utils.getPeerId(new tl_1.Api.PeerUser({ userId: (0, Helpers_1.returnBigInt)(id) })), - __1.utils.getPeerId(new tl_1.Api.PeerChat({ chatId: (0, Helpers_1.returnBigInt)(id) })), - __1.utils.getPeerId(new tl_1.Api.PeerChannel({ channelId: (0, Helpers_1.returnBigInt)(id) })) - ]; - for (const e of this._entities) { - if (ids.includes(e[0])) { - return [e[0], e[1]]; - } - } - } + path2 = this.pathToRegExp(path2); + if (!(path2 instanceof RegExp)) { + throw new Error("Path must be specified as either a string or a RegExp."); } - getInputEntity(key2) { - let exact; - if (typeof key2 === "object" && !big_integer_1.default.isInstance(key2) && key2.SUBCLASS_OF_ID) { - if (key2.SUBCLASS_OF_ID == 3374092470 || key2.SUBCLASS_OF_ID == 3865689926 || key2.SUBCLASS_OF_ID == 1089602301) { - return key2; - } - return __1.utils.getInputPeer(key2); - } else { - if (typeof key2 === "object") { - key2 = __1.utils.getPeerId(key2); - exact = true; - } else { - exact = false; - } - } - if (big_integer_1.default.isInstance(key2) || typeof key2 == "bigint" || typeof key2 == "number") { - key2 = key2.toString(); - } - let result = void 0; - if (typeof key2 === "string") { - const phone = __1.utils.parsePhone(key2); - if (phone) { - result = this.getEntityRowsByPhone(phone); - } else { - const { username, isInvite } = __1.utils.parseUsername(key2); - if (username && !isInvite) { - result = this.getEntityRowsByUsername(username); - } - } - if (!result) { - const id = __1.utils.parseID(key2); - if (id) { - result = this.getEntityRowsById(id, exact); - } - } - if (!result) { - result = this.getEntityRowsByName(key2); - } - } - if (result) { - let entityId = result[0]; - const entityHash = (0, big_integer_1.default)(result[1]); - const resolved = __1.utils.resolveId((0, Helpers_1.returnBigInt)(entityId)); - entityId = resolved[0]; - const kind = resolved[1]; - if (kind === tl_1.Api.PeerUser) { - return new tl_1.Api.InputPeerUser({ - userId: entityId, - accessHash: entityHash - }); - } else if (kind === tl_1.Api.PeerChat) { - return new tl_1.Api.InputPeerChat({ chatId: entityId }); - } else if (kind === tl_1.Api.PeerChannel) { - return new tl_1.Api.InputPeerChannel({ - channelId: entityId, - accessHash: entityHash - }); - } - } else { - throw new Error("Could not find input entity with key " + key2); - } - throw new Error("Could not find input entity with key " + key2); + var pathString = path2.toString(); + protocol = protocol.toLocaleLowerCase(); + if (this.findHandlerIndex(pathString, protocol) !== -1) { + throw new Error("You may only mount one handler per path/protocol combination."); } + this.handlers.push({ + "path": path2, + "pathString": pathString, + "protocol": protocol, + "callback": callback + }); }; - exports2.MemorySession = MemorySession; - } -}); - -// node_modules/telegram/crypto/AuthKey.js -var require_AuthKey = __commonJS({ - "node_modules/telegram/crypto/AuthKey.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AuthKey = void 0; - var Helpers_1 = require_Helpers(); - var extensions_1 = require_extensions(); - var Helpers_2 = require_Helpers(); - var AuthKey = class _AuthKey { - constructor(value, hash2) { - if (!hash2 || !value) { - return; - } - this._key = value; - this._hash = hash2; - const reader = new extensions_1.BinaryReader(hash2); - this.auxHash = reader.readLong(false); - reader.read(4); - this.keyId = reader.readLong(false); + WebSocketRouter.prototype.unmount = function(path2, protocol) { + var index2 = this.findHandlerIndex(this.pathToRegExp(path2).toString(), protocol); + if (index2 !== -1) { + this.handlers.splice(index2, 1); + } else { + throw new Error("Unable to find a route matching the specified path and protocol."); } - async setKey(value) { - if (!value) { - this._key = this.auxHash = this.keyId = this._hash = void 0; - return; - } - if (value instanceof _AuthKey) { - this._key = value._key; - this.auxHash = value.auxHash; - this.keyId = value.keyId; - this._hash = value._hash; - return; + }; + WebSocketRouter.prototype.findHandlerIndex = function(pathString, protocol) { + protocol = protocol.toLocaleLowerCase(); + for (var i = 0, len = this.handlers.length; i < len; i++) { + var handler = this.handlers[i]; + if (handler.pathString === pathString && handler.protocol === protocol) { + return i; } - this._key = value; - this._hash = await (0, Helpers_1.sha1)(this._key); - const reader = new extensions_1.BinaryReader(this._hash); - this.auxHash = reader.readLong(false); - reader.read(4); - this.keyId = reader.readLong(false); } - async waitForKey() { - while (!this.keyId) { - await (0, Helpers_2.sleep)(20); + return -1; + }; + WebSocketRouter.prototype.pathToRegExp = function(path2) { + if (typeof path2 === "string") { + if (path2 === "*") { + path2 = /^.*$/; + } else { + path2 = path2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + path2 = new RegExp("^" + path2 + "$"); } } - getKey() { - return this._key; + return path2; + }; + WebSocketRouter.prototype.handleRequest = function(request) { + var requestedProtocols = request.requestedProtocols; + if (requestedProtocols.length === 0) { + requestedProtocols = ["____no_protocol____"]; } - // TODO : This doesn't really fit here, it's only used in authentication - /** - * Calculates the new nonce hash based on the current class fields' values - * @param newNonce - * @param number - * @returns {bigInt.BigInteger} - */ - async calcNewNonceHash(newNonce, number) { - if (this.auxHash) { - const nonce = (0, Helpers_1.toSignedLittleBuffer)(newNonce, 32); - const n = Buffer.alloc(1); - n.writeUInt8(number, 0); - const data = Buffer.concat([ - nonce, - Buffer.concat([n, (0, Helpers_1.readBufferFromBigInt)(this.auxHash, 8, true)]) - ]); - const shaData = (await (0, Helpers_1.sha1)(data)).slice(4, 20); - return (0, Helpers_1.readBigIntFromBuffer)(shaData, true, true); + for (var i = 0; i < requestedProtocols.length; i++) { + var requestedProtocol = requestedProtocols[i].toLocaleLowerCase(); + for (var j = 0, len = this.handlers.length; j < len; j++) { + var handler = this.handlers[j]; + if (handler.path.test(request.resourceURL.pathname)) { + if (requestedProtocol === handler.protocol || handler.protocol === "*") { + var routerRequest = new WebSocketRouterRequest(request, requestedProtocol); + handler.callback(routerRequest); + return; + } + } } - throw new Error("Auth key not set"); - } - equals(other) { - var _a3; - return other instanceof this.constructor && this._key && Buffer.isBuffer(other.getKey()) && ((_a3 = other.getKey()) === null || _a3 === void 0 ? void 0 : _a3.equals(this._key)); } + request.reject(404, "No handler is available for the given request."); }; - exports2.AuthKey = AuthKey; + module2.exports = WebSocketRouter; } }); -// node_modules/telegram/sessions/StringSession.js -var require_StringSession = __commonJS({ - "node_modules/telegram/sessions/StringSession.js"(exports2) { - "use strict"; +// node_modules/is-typedarray/index.js +var require_is_typedarray = __commonJS({ + "node_modules/is-typedarray/index.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StringSession = void 0; - var Memory_1 = require_Memory(); - var extensions_1 = require_extensions(); - var AuthKey_1 = require_AuthKey(); - var CURRENT_VERSION = "1"; - var StringSession2 = class _StringSession extends Memory_1.MemorySession { - /** - * This session file can be easily saved and loaded as a string. According - * to the initial design, it contains only the data that is necessary for - * successful connection and authentication, so takeout ID is not stored. - - * It is thought to be used where you don't want to create any on-disk - * files but would still like to be able to save and load existing sessions - * by other means. - - * You can use custom `encode` and `decode` functions, if present: - - * `encode` definition must be ``function encode(value: Buffer) -> string:``. - * `decode` definition must be ``function decode(value: string) -> Buffer:``. - * @param session {string|null} - */ - constructor(session2) { - super(); - if (session2) { - if (session2[0] !== CURRENT_VERSION) { - throw new Error("Not a valid string"); - } - session2 = session2.slice(1); - const r = _StringSession.decode(session2); - const reader = new extensions_1.BinaryReader(r); - this._dcId = reader.read(1).readUInt8(0); - if (session2.length == 352) { - const ip_v4 = reader.read(4); - this._serverAddress = ip_v4[0].toString() + "." + ip_v4[1].toString() + "." + ip_v4[2].toString() + "." + ip_v4[3].toString(); - } else { - const serverAddressLen = reader.read(2).readInt16BE(0); - if (serverAddressLen > 100) { - reader.offset -= 2; - this._serverAddress = reader.read(16).toString("hex").match(/.{1,4}/g).map((val) => val.replace(/^0+/, "")).join(":").replace(/0000\:/g, ":").replace(/:{2,}/g, "::"); - } else { - this._serverAddress = reader.read(serverAddressLen).toString(); - } - } - this._port = reader.read(2).readInt16BE(0); - this._key = reader.read(-1); - } - } - /** - * @param x {Buffer} - * @returns {string} - */ - static encode(x) { - return x.toString("base64"); - } - /** - * @param x {string} - * @returns {Buffer} - */ - static decode(x) { - return Buffer.from(x, "base64"); - } - async load() { - if (this._key) { - this._authKey = new AuthKey_1.AuthKey(); - await this._authKey.setKey(this._key); - } - } - save() { - if (!this.authKey || !this.serverAddress || !this.port) { - return ""; - } - const key2 = this.authKey.getKey(); - if (!key2) { - return ""; - } - const dcBuffer = Buffer.from([this.dcId]); - const addressBuffer = Buffer.from(this.serverAddress); - const addressLengthBuffer = Buffer.alloc(2); - addressLengthBuffer.writeInt16BE(addressBuffer.length, 0); - const portBuffer = Buffer.alloc(2); - portBuffer.writeInt16BE(this.port, 0); - return CURRENT_VERSION + _StringSession.encode(Buffer.concat([ - dcBuffer, - addressLengthBuffer, - addressBuffer, - portBuffer, - key2 - ])); - } + module2.exports = isTypedArray; + isTypedArray.strict = isStrictTypedArray; + isTypedArray.loose = isLooseTypedArray; + var toString = Object.prototype.toString; + var names = { + "[object Int8Array]": true, + "[object Int16Array]": true, + "[object Int32Array]": true, + "[object Uint8Array]": true, + "[object Uint8ClampedArray]": true, + "[object Uint16Array]": true, + "[object Uint32Array]": true, + "[object Float32Array]": true, + "[object Float64Array]": true }; - exports2.StringSession = StringSession2; + function isTypedArray(arr) { + return isStrictTypedArray(arr) || isLooseTypedArray(arr); + } + function isStrictTypedArray(arr) { + return arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array; + } + function isLooseTypedArray(arr) { + return names[toString.call(arr)]; + } } }); -// node_modules/store2/dist/store2.js -var require_store2 = __commonJS({ - "node_modules/store2/dist/store2.js"(exports2, module2) { +// node_modules/typedarray-to-buffer/index.js +var require_typedarray_to_buffer = __commonJS({ + "node_modules/typedarray-to-buffer/index.js"(exports2, module2) { init_define_import_meta_env(); - (function(window3, define2) { - var _ = { - version: "2.14.4", - areas: {}, - apis: {}, - nsdelim: ".", - // utilities - inherit: function(api, o) { - for (var p in api) { - if (!o.hasOwnProperty(p)) { - Object.defineProperty(o, p, Object.getOwnPropertyDescriptor(api, p)); - } - } - return o; - }, - stringify: function(d, fn) { - return d === void 0 || typeof d === "function" ? d + "" : JSON.stringify(d, fn || _.replace); - }, - parse: function(s, fn) { - try { - return JSON.parse(s, fn || _.revive); - } catch (e) { - return s; - } - }, - // extension hooks - fn: function(name, fn) { - _.storeAPI[name] = fn; - for (var api in _.apis) { - _.apis[api][name] = fn; - } - }, - get: function(area, key2) { - return area.getItem(key2); - }, - set: function(area, key2, string) { - area.setItem(key2, string); - }, - remove: function(area, key2) { - area.removeItem(key2); - }, - key: function(area, i) { - return area.key(i); - }, - length: function(area) { - return area.length; - }, - clear: function(area) { - area.clear(); - }, - // core functions - Store: function(id, area, namespace) { - var store2 = _.inherit(_.storeAPI, function(key2, data, overwrite) { - if (arguments.length === 0) { - return store2.getAll(); - } - if (typeof data === "function") { - return store2.transact(key2, data, overwrite); - } - if (data !== void 0) { - return store2.set(key2, data, overwrite); - } - if (typeof key2 === "string" || typeof key2 === "number") { - return store2.get(key2); - } - if (typeof key2 === "function") { - return store2.each(key2); - } - if (!key2) { - return store2.clear(); - } - return store2.setAll(key2, data); - }); - store2._id = id; - try { - var testKey = "__store2_test"; - area.setItem(testKey, "ok"); - store2._area = area; - area.removeItem(testKey); - } catch (e) { - store2._area = _.storage("fake"); - } - store2._ns = namespace || ""; - if (!_.areas[id]) { - _.areas[id] = store2._area; - } - if (!_.apis[store2._ns + store2._id]) { - _.apis[store2._ns + store2._id] = store2; - } - return store2; - }, - storeAPI: { - // admin functions - area: function(id, area) { - var store2 = this[id]; - if (!store2 || !store2.area) { - store2 = _.Store(id, area, this._ns); - if (!this[id]) { - this[id] = store2; - } - } - return store2; - }, - namespace: function(namespace, singleArea, delim) { - delim = delim || this._delim || _.nsdelim; - if (!namespace) { - return this._ns ? this._ns.substring(0, this._ns.length - delim.length) : ""; - } - var ns = namespace, store2 = this[ns]; - if (!store2 || !store2.namespace) { - store2 = _.Store(this._id, this._area, this._ns + ns + delim); - store2._delim = delim; - if (!this[ns]) { - this[ns] = store2; - } - if (!singleArea) { - for (var name in _.areas) { - store2.area(name, _.areas[name]); - } - } - } - return store2; - }, - isFake: function(force) { - if (force) { - this._real = this._area; - this._area = _.storage("fake"); - } else if (force === false) { - this._area = this._real || this._area; - } - return this._area.name === "fake"; - }, - toString: function() { - return "store" + (this._ns ? "." + this.namespace() : "") + "[" + this._id + "]"; - }, - // storage functions - has: function(key2) { - if (this._area.has) { - return this._area.has(this._in(key2)); - } - return !!(this._in(key2) in this._area); - }, - size: function() { - return this.keys().length; - }, - each: function(fn, fill) { - for (var i = 0, m = _.length(this._area); i < m; i++) { - var key2 = this._out(_.key(this._area, i)); - if (key2 !== void 0) { - if (fn.call(this, key2, this.get(key2), fill) === false) { - break; - } - } - if (m > _.length(this._area)) { - m--; - i--; - } - } - return fill || this; - }, - keys: function(fillList) { - return this.each(function(k, v, list) { - list.push(k); - }, fillList || []); - }, - get: function(key2, alt) { - var s = _.get(this._area, this._in(key2)), fn; - if (typeof alt === "function") { - fn = alt; - alt = null; - } - return s !== null ? _.parse(s, fn) : alt != null ? alt : s; - }, - getAll: function(fillObj) { - return this.each(function(k, v, all) { - all[k] = v; - }, fillObj || {}); - }, - transact: function(key2, fn, alt) { - var val = this.get(key2, alt), ret = fn(val); - this.set(key2, ret === void 0 ? val : ret); - return this; - }, - set: function(key2, data, overwrite) { - var d = this.get(key2), replacer; - if (d != null && overwrite === false) { - return data; - } - if (typeof overwrite === "function") { - replacer = overwrite; - overwrite = void 0; - } - return _.set(this._area, this._in(key2), _.stringify(data, replacer), overwrite) || d; - }, - setAll: function(data, overwrite) { - var changed, val; - for (var key2 in data) { - val = data[key2]; - if (this.set(key2, val, overwrite) !== val) { - changed = true; - } - } - return changed; - }, - add: function(key2, data, replacer) { - var d = this.get(key2); - if (d instanceof Array) { - data = d.concat(data); - } else if (d !== null) { - var type = typeof d; - if (type === typeof data && type === "object") { - for (var k in data) { - d[k] = data[k]; - } - data = d; - } else { - data = d + data; - } - } - _.set(this._area, this._in(key2), _.stringify(data, replacer)); - return data; - }, - remove: function(key2, alt) { - var d = this.get(key2, alt); - _.remove(this._area, this._in(key2)); - return d; - }, - clear: function() { - if (!this._ns) { - _.clear(this._area); - } else { - this.each(function(k) { - _.remove(this._area, this._in(k)); - }, 1); - } - return this; - }, - clearAll: function() { - var area = this._area; - for (var id in _.areas) { - if (_.areas.hasOwnProperty(id)) { - this._area = _.areas[id]; - this.clear(); - } - } - this._area = area; - return this; - }, - // internal use functions - _in: function(k) { - if (typeof k !== "string") { - k = _.stringify(k); - } - return this._ns ? this._ns + k : k; - }, - _out: function(k) { - return this._ns ? k && k.indexOf(this._ns) === 0 ? k.substring(this._ns.length) : void 0 : ( - // so each() knows to skip it - k - ); - } - }, - // end _.storeAPI - storage: function(name) { - return _.inherit(_.storageAPI, { items: {}, name }); - }, - storageAPI: { - length: 0, - has: function(k) { - return this.items.hasOwnProperty(k); - }, - key: function(i) { - var c = 0; - for (var k in this.items) { - if (this.has(k) && i === c++) { - return k; - } - } - }, - setItem: function(k, v) { - if (!this.has(k)) { - this.length++; - } - this.items[k] = v; - }, - removeItem: function(k) { - if (this.has(k)) { - delete this.items[k]; - this.length--; - } - }, - getItem: function(k) { - return this.has(k) ? this.items[k] : null; - }, - clear: function() { - for (var k in this.items) { - this.removeItem(k); - } - } - } - // end _.storageAPI - }; - var store = ( - // safely set this up (throws error in IE10/32bit mode for local files) - _.Store("local", (function() { - try { - return localStorage; - } catch (e) { - } - })()) - ); - store.local = store; - store._ = _; - store.area("session", (function() { - try { - return sessionStorage; - } catch (e) { + var isTypedArray = require_is_typedarray().strict; + module2.exports = function typedarrayToBuffer(arr) { + if (isTypedArray(arr)) { + var buf = Buffer.from(arr.buffer); + if (arr.byteLength !== arr.buffer.byteLength) { + buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength); } - })()); - store.area("page", _.storage("page")); - if (typeof define2 === "function" && define2.amd !== void 0) { - define2("store2", [], function() { - return store; - }); - } else if (typeof module2 !== "undefined" && module2.exports) { - module2.exports = store; + return buf; } else { - if (window3.store) { - _.conflict = window3.store; - } - window3.store = store; + return Buffer.from(arr); } - })(exports2, exports2 && exports2.define); + }; } }); -// node_modules/graceful-fs/polyfills.js -var require_polyfills = __commonJS({ - "node_modules/graceful-fs/polyfills.js"(exports2, module2) { +// node_modules/yaeti/lib/EventTarget.js +var require_EventTarget = __commonJS({ + "node_modules/yaeti/lib/EventTarget.js"(exports2, module2) { init_define_import_meta_env(); - var constants = require("constants"); - var origCwd = process.cwd; - var cwd = null; - var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; - process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process); - return cwd; - }; - try { - process.cwd(); - } catch (er) { - } - if (typeof process.chdir === "function") { - chdir = process.chdir; - process.chdir = function(d) { - cwd = null; - chdir.call(process, d); - }; - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir); + module2.exports = _EventTarget; + function _EventTarget() { + if (typeof this.addEventListener === "function") { + return; + } + this._listeners = {}; + this.addEventListener = _addEventListener; + this.removeEventListener = _removeEventListener; + this.dispatchEvent = _dispatchEvent; } - var chdir; - module2.exports = patch; - function patch(fs) { - if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs); + Object.defineProperties(_EventTarget.prototype, { + listeners: { + get: function() { + return this._listeners; + } } - if (!fs.lutimes) { - patchLutimes(fs); + }); + function _addEventListener(type, newListener) { + var listenersType, i, listener; + if (!type || !newListener) { + return; } - fs.chown = chownFix(fs.chown); - fs.fchown = chownFix(fs.fchown); - fs.lchown = chownFix(fs.lchown); - fs.chmod = chmodFix(fs.chmod); - fs.fchmod = chmodFix(fs.fchmod); - fs.lchmod = chmodFix(fs.lchmod); - fs.chownSync = chownFixSync(fs.chownSync); - fs.fchownSync = chownFixSync(fs.fchownSync); - fs.lchownSync = chownFixSync(fs.lchownSync); - fs.chmodSync = chmodFixSync(fs.chmodSync); - fs.fchmodSync = chmodFixSync(fs.fchmodSync); - fs.lchmodSync = chmodFixSync(fs.lchmodSync); - fs.stat = statFix(fs.stat); - fs.fstat = statFix(fs.fstat); - fs.lstat = statFix(fs.lstat); - fs.statSync = statFixSync(fs.statSync); - fs.fstatSync = statFixSync(fs.fstatSync); - fs.lstatSync = statFixSync(fs.lstatSync); - if (fs.chmod && !fs.lchmod) { - fs.lchmod = function(path2, mode, cb) { - if (cb) process.nextTick(cb); - }; - fs.lchmodSync = function() { - }; + listenersType = this._listeners[type]; + if (listenersType === void 0) { + this._listeners[type] = listenersType = []; } - if (fs.chown && !fs.lchown) { - fs.lchown = function(path2, uid, gid, cb) { - if (cb) process.nextTick(cb); - }; - fs.lchownSync = function() { - }; + for (i = 0; !!(listener = listenersType[i]); i++) { + if (listener === newListener) { + return; + } } - if (platform === "win32") { - fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) { - function rename(from, to, cb) { - var start = Date.now(); - var backoff = 0; - fs$rename(from, to, function CB(er) { - if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { - setTimeout(function() { - fs.stat(to, function(stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er); - }); - }, backoff); - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er); - }); - } - if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); - return rename; - })(fs.rename); + listenersType.push(newListener); + } + function _removeEventListener(type, oldListener) { + var listenersType, i, listener; + if (!type || !oldListener) { + return; } - fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) { - function read(fd, buffer, offset, length, position, callback_) { - var callback; - if (callback_ && typeof callback_ === "function") { - var eagCounter = 0; - callback = function(er, _, __) { - if (er && er.code === "EAGAIN" && eagCounter < 10) { - eagCounter++; - return fs$read.call(fs, fd, buffer, offset, length, position, callback); - } - callback_.apply(this, arguments); - }; - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback); - } - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); - return read; - })(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) { - return function(fd, buffer, offset, length, position) { - var eagCounter = 0; - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position); - } catch (er) { - if (er.code === "EAGAIN" && eagCounter < 10) { - eagCounter++; - continue; - } - throw er; - } - } - }; - })(fs.readSync); - function patchLchmod(fs2) { - fs2.lchmod = function(path2, mode, callback) { - fs2.open( - path2, - constants.O_WRONLY | constants.O_SYMLINK, - mode, - function(err, fd) { - if (err) { - if (callback) callback(err); - return; - } - fs2.fchmod(fd, mode, function(err2) { - fs2.close(fd, function(err22) { - if (callback) callback(err2 || err22); - }); - }); - } - ); - }; - fs2.lchmodSync = function(path2, mode) { - var fd = fs2.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode); - var threw = true; - var ret; - try { - ret = fs2.fchmodSync(fd, mode); - threw = false; - } finally { - if (threw) { - try { - fs2.closeSync(fd); - } catch (er) { - } - } else { - fs2.closeSync(fd); - } - } - return ret; - }; + listenersType = this._listeners[type]; + if (listenersType === void 0) { + return; } - function patchLutimes(fs2) { - if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) { - fs2.lutimes = function(path2, at, mt, cb) { - fs2.open(path2, constants.O_SYMLINK, function(er, fd) { - if (er) { - if (cb) cb(er); - return; - } - fs2.futimes(fd, at, mt, function(er2) { - fs2.close(fd, function(er22) { - if (cb) cb(er2 || er22); - }); - }); - }); - }; - fs2.lutimesSync = function(path2, at, mt) { - var fd = fs2.openSync(path2, constants.O_SYMLINK); - var ret; - var threw = true; - try { - ret = fs2.futimesSync(fd, at, mt); - threw = false; - } finally { - if (threw) { - try { - fs2.closeSync(fd); - } catch (er) { - } - } else { - fs2.closeSync(fd); - } - } - return ret; - }; - } else if (fs2.futimes) { - fs2.lutimes = function(_a3, _b, _c, cb) { - if (cb) process.nextTick(cb); - }; - fs2.lutimesSync = function() { - }; + for (i = 0; !!(listener = listenersType[i]); i++) { + if (listener === oldListener) { + listenersType.splice(i, 1); + break; } } - function chmodFix(orig) { - if (!orig) return orig; - return function(target, mode, cb) { - return orig.call(fs, target, mode, function(er) { - if (chownErOk(er)) er = null; - if (cb) cb.apply(this, arguments); - }); - }; + if (listenersType.length === 0) { + delete this._listeners[type]; } - function chmodFixSync(orig) { - if (!orig) return orig; - return function(target, mode) { - try { - return orig.call(fs, target, mode); - } catch (er) { - if (!chownErOk(er)) throw er; - } - }; + } + function _dispatchEvent(event) { + var type, listenersType, dummyListener, stopImmediatePropagation = false, i, listener; + if (!event || typeof event.type !== "string") { + throw new Error("`event` must have a valid `type` property"); } - function chownFix(orig) { - if (!orig) return orig; - return function(target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function(er) { - if (chownErOk(er)) er = null; - if (cb) cb.apply(this, arguments); - }); - }; + if (event._yaeti) { + event.target = this; + event.cancelable = true; } - function chownFixSync(orig) { - if (!orig) return orig; - return function(target, uid, gid) { - try { - return orig.call(fs, target, uid, gid); - } catch (er) { - if (!chownErOk(er)) throw er; - } + try { + event.stopImmediatePropagation = function() { + stopImmediatePropagation = true; }; + } catch (error) { } - function statFix(orig) { - if (!orig) return orig; - return function(target, options, cb) { - if (typeof options === "function") { - cb = options; - options = null; + type = event.type; + listenersType = this._listeners[type] || []; + dummyListener = this["on" + type]; + if (typeof dummyListener === "function") { + dummyListener.call(this, event); + } + for (i = 0; !!(listener = listenersType[i]); i++) { + if (stopImmediatePropagation) { + break; + } + listener.call(this, event); + } + return !event.defaultPrevented; + } + } +}); + +// node_modules/yaeti/lib/Event.js +var require_Event = __commonJS({ + "node_modules/yaeti/lib/Event.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = _Event; + function _Event(type) { + this.type = type; + this.isTrusted = false; + this._yaeti = true; + } + } +}); + +// node_modules/yaeti/index.js +var require_yaeti = __commonJS({ + "node_modules/yaeti/index.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = { + EventTarget: require_EventTarget(), + Event: require_Event() + }; + } +}); + +// node_modules/websocket/lib/W3CWebSocket.js +var require_W3CWebSocket = __commonJS({ + "node_modules/websocket/lib/W3CWebSocket.js"(exports2, module2) { + init_define_import_meta_env(); + var WebSocketClient = require_WebSocketClient(); + var toBuffer = require_typedarray_to_buffer(); + var yaeti = require_yaeti(); + var CONNECTING = 0; + var OPEN = 1; + var CLOSING = 2; + var CLOSED = 3; + module2.exports = W3CWebSocket; + function W3CWebSocket(url, protocols, origin, headers, requestOptions, clientConfig) { + yaeti.EventTarget.call(this); + clientConfig = clientConfig || {}; + clientConfig.assembleFragments = true; + var self2 = this; + this._url = url; + this._readyState = CONNECTING; + this._protocol = void 0; + this._extensions = ""; + this._bufferedAmount = 0; + this._binaryType = "arraybuffer"; + this._connection = void 0; + this._client = new WebSocketClient(clientConfig); + this._client.on("connect", function(connection) { + onConnect.call(self2, connection); + }); + this._client.on("connectFailed", function() { + onConnectFailed.call(self2); + }); + this._client.connect(url, protocols, origin, headers, requestOptions); + } + Object.defineProperties(W3CWebSocket.prototype, { + url: { get: function() { + return this._url; + } }, + readyState: { get: function() { + return this._readyState; + } }, + protocol: { get: function() { + return this._protocol; + } }, + extensions: { get: function() { + return this._extensions; + } }, + bufferedAmount: { get: function() { + return this._bufferedAmount; + } } + }); + Object.defineProperties(W3CWebSocket.prototype, { + binaryType: { + get: function() { + return this._binaryType; + }, + set: function(type) { + if (type !== "arraybuffer") { + throw new SyntaxError('just "arraybuffer" type allowed for "binaryType" attribute'); } - function callback(er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 4294967296; - if (stats.gid < 0) stats.gid += 4294967296; + this._binaryType = type; + } + } + }); + [["CONNECTING", CONNECTING], ["OPEN", OPEN], ["CLOSING", CLOSING], ["CLOSED", CLOSED]].forEach(function(property) { + Object.defineProperty(W3CWebSocket.prototype, property[0], { + get: function() { + return property[1]; + } + }); + }); + [["CONNECTING", CONNECTING], ["OPEN", OPEN], ["CLOSING", CLOSING], ["CLOSED", CLOSED]].forEach(function(property) { + Object.defineProperty(W3CWebSocket, property[0], { + get: function() { + return property[1]; + } + }); + }); + W3CWebSocket.prototype.send = function(data) { + if (this._readyState !== OPEN) { + throw new Error("cannot call send() while not connected"); + } + if (typeof data === "string" || data instanceof String) { + this._connection.sendUTF(data); + } else { + if (data instanceof Buffer) { + this._connection.sendBytes(data); + } else if (data.byteLength || data.byteLength === 0) { + data = toBuffer(data); + this._connection.sendBytes(data); + } else { + throw new Error("unknown binary data:", data); + } + } + }; + W3CWebSocket.prototype.close = function(code, reason) { + switch (this._readyState) { + case CONNECTING: + onConnectFailed.call(this); + this._client.on("connect", function(connection) { + if (code) { + connection.close(code, reason); + } else { + connection.close(); } - if (cb) cb.apply(this, arguments); + }); + break; + case OPEN: + this._readyState = CLOSING; + if (code) { + this._connection.close(code, reason); + } else { + this._connection.close(); } - return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback); - }; + break; + case CLOSING: + case CLOSED: + break; } - function statFixSync(orig) { - if (!orig) return orig; - return function(target, options) { - var stats = options ? orig.call(fs, target, options) : orig.call(fs, target); - if (stats) { - if (stats.uid < 0) stats.uid += 4294967296; - if (stats.gid < 0) stats.gid += 4294967296; + }; + function createCloseEvent(code, reason) { + var event = new yaeti.Event("close"); + event.code = code; + event.reason = reason; + event.wasClean = typeof code === "undefined" || code === 1e3; + return event; + } + function createMessageEvent(data) { + var event = new yaeti.Event("message"); + event.data = data; + return event; + } + function onConnect(connection) { + var self2 = this; + this._readyState = OPEN; + this._connection = connection; + this._protocol = connection.protocol; + this._extensions = connection.extensions; + this._connection.on("close", function(code, reason) { + onClose.call(self2, code, reason); + }); + this._connection.on("message", function(msg) { + onMessage.call(self2, msg); + }); + this.dispatchEvent(new yaeti.Event("open")); + } + function onConnectFailed() { + destroy.call(this); + this._readyState = CLOSED; + try { + this.dispatchEvent(new yaeti.Event("error")); + } finally { + this.dispatchEvent(createCloseEvent(1006, "connection failed")); + } + } + function onClose(code, reason) { + destroy.call(this); + this._readyState = CLOSED; + this.dispatchEvent(createCloseEvent(code, reason || "")); + } + function onMessage(message) { + if (message.utf8Data) { + this.dispatchEvent(createMessageEvent(message.utf8Data)); + } else if (message.binaryData) { + if (this.binaryType === "arraybuffer") { + var buffer = message.binaryData; + var arraybuffer = new ArrayBuffer(buffer.length); + var view = new Uint8Array(arraybuffer); + for (var i = 0, len = buffer.length; i < len; ++i) { + view[i] = buffer[i]; } - return stats; - }; - } - function chownErOk(er) { - if (!er) - return true; - if (er.code === "ENOSYS") - return true; - var nonroot = !process.getuid || process.getuid() !== 0; - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true; + this.dispatchEvent(createMessageEvent(arraybuffer)); } - return false; + } + } + function destroy() { + this._client.removeAllListeners(); + if (this._connection) { + this._connection.removeAllListeners(); } } } }); -// node_modules/graceful-fs/legacy-streams.js -var require_legacy_streams = __commonJS({ - "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { +// node_modules/websocket/lib/Deprecation.js +var require_Deprecation = __commonJS({ + "node_modules/websocket/lib/Deprecation.js"(exports2, module2) { init_define_import_meta_env(); - var Stream = require("stream").Stream; - module2.exports = legacy; - function legacy(fs) { - return { - ReadStream, - WriteStream - }; - function ReadStream(path2, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path2, options); - Stream.call(this); - var self2 = this; - this.path = path2; - this.fd = null; - this.readable = true; - this.paused = false; - this.flags = "r"; - this.mode = 438; - this.bufferSize = 64 * 1024; - options = options || {}; - var keys2 = Object.keys(options); - for (var index2 = 0, length = keys2.length; index2 < length; index2++) { - var key2 = keys2[index2]; - this[key2] = options[key2]; - } - if (this.encoding) this.setEncoding(this.encoding); - if (this.start !== void 0) { - if ("number" !== typeof this.start) { - throw TypeError("start must be a Number"); - } - if (this.end === void 0) { - this.end = Infinity; - } else if ("number" !== typeof this.end) { - throw TypeError("end must be a Number"); - } - if (this.start > this.end) { - throw new Error("start must be <= end"); - } - this.pos = this.start; - } - if (this.fd !== null) { - process.nextTick(function() { - self2._read(); - }); - return; - } - fs.open(this.path, this.flags, this.mode, function(err, fd) { - if (err) { - self2.emit("error", err); - self2.readable = false; - return; - } - self2.fd = fd; - self2.emit("open", fd); - self2._read(); - }); - } - function WriteStream(path2, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path2, options); - Stream.call(this); - this.path = path2; - this.fd = null; - this.writable = true; - this.flags = "w"; - this.encoding = "binary"; - this.mode = 438; - this.bytesWritten = 0; - options = options || {}; - var keys2 = Object.keys(options); - for (var index2 = 0, length = keys2.length; index2 < length; index2++) { - var key2 = keys2[index2]; - this[key2] = options[key2]; - } - if (this.start !== void 0) { - if ("number" !== typeof this.start) { - throw TypeError("start must be a Number"); - } - if (this.start < 0) { - throw new Error("start must be >= zero"); - } - this.pos = this.start; - } - this.busy = false; - this._queue = []; - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); - this.flush(); + var Deprecation = { + disableWarnings: false, + deprecationWarningMap: {}, + warn: function(deprecationName) { + if (!this.disableWarnings && this.deprecationWarningMap[deprecationName]) { + console.warn("DEPRECATION WARNING: " + this.deprecationWarningMap[deprecationName]); + this.deprecationWarningMap[deprecationName] = false; } } - } + }; + module2.exports = Deprecation; } }); -// node_modules/graceful-fs/clone.js -var require_clone2 = __commonJS({ - "node_modules/graceful-fs/clone.js"(exports2, module2) { - "use strict"; +// node_modules/websocket/package.json +var require_package = __commonJS({ + "node_modules/websocket/package.json"(exports2, module2) { + module2.exports = { + name: "websocket", + description: "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.", + keywords: [ + "websocket", + "websockets", + "socket", + "networking", + "comet", + "push", + "RFC-6455", + "realtime", + "server", + "client" + ], + author: "Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)", + contributors: [ + "I\xF1aki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)" + ], + version: "1.0.35", + repository: { + type: "git", + url: "https://github.com/theturtle32/WebSocket-Node.git" + }, + homepage: "https://github.com/theturtle32/WebSocket-Node", + engines: { + node: ">=4.0.0" + }, + dependencies: { + bufferutil: "^4.0.1", + debug: "^2.2.0", + "es5-ext": "^0.10.63", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + yaeti: "^0.0.6" + }, + devDependencies: { + "buffer-equal": "^1.0.0", + gulp: "^4.0.2", + "gulp-jshint": "^2.0.4", + "jshint-stylish": "^2.2.1", + jshint: "^2.0.0", + tape: "^4.9.1" + }, + config: { + verbose: false + }, + scripts: { + test: "tape test/unit/*.js", + gulp: "gulp" + }, + main: "index", + directories: { + lib: "./lib" + }, + browser: "lib/browser.js", + license: "Apache-2.0" + }; + } +}); + +// node_modules/websocket/lib/version.js +var require_version = __commonJS({ + "node_modules/websocket/lib/version.js"(exports2, module2) { init_define_import_meta_env(); - module2.exports = clone; - var getPrototypeOf = Object.getPrototypeOf || function(obj) { - return obj.__proto__; + module2.exports = require_package().version; + } +}); + +// node_modules/websocket/lib/websocket.js +var require_websocket = __commonJS({ + "node_modules/websocket/lib/websocket.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = { + "server": require_WebSocketServer(), + "client": require_WebSocketClient(), + "router": require_WebSocketRouter(), + "frame": require_WebSocketFrame(), + "request": require_WebSocketRequest(), + "connection": require_WebSocketConnection(), + "w3cwebsocket": require_W3CWebSocket(), + "deprecation": require_Deprecation(), + "version": require_version() }; - function clone(obj) { - if (obj === null || typeof obj !== "object") - return obj; - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) }; - else - var copy = /* @__PURE__ */ Object.create(null); - Object.getOwnPropertyNames(obj).forEach(function(key2) { - Object.defineProperty(copy, key2, Object.getOwnPropertyDescriptor(obj, key2)); - }); - return copy; - } } }); -// node_modules/graceful-fs/graceful-fs.js -var require_graceful_fs = __commonJS({ - "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { +// node_modules/websocket/index.js +var require_websocket2 = __commonJS({ + "node_modules/websocket/index.js"(exports2, module2) { init_define_import_meta_env(); - var fs = require("fs"); - var polyfills = require_polyfills(); - var legacy = require_legacy_streams(); - var clone = require_clone2(); - var util = require("util"); - var gracefulQueue; - var previousSymbol; - if (typeof Symbol === "function" && typeof Symbol.for === "function") { - gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue"); - previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous"); - } else { - gracefulQueue = "___graceful-fs.queue"; - previousSymbol = "___graceful-fs.previous"; - } - function noop() { - } - function publishQueue(context2, queue2) { - Object.defineProperty(context2, gracefulQueue, { - get: function() { - return queue2; - } - }); - } - var debug = noop; - if (util.debuglog) - debug = util.debuglog("gfs4"); - else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) - debug = function() { - var m = util.format.apply(util, arguments); - m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); - console.error(m); - }; - if (!fs[gracefulQueue]) { - queue = global[gracefulQueue] || []; - publishQueue(fs, queue); - fs.close = (function(fs$close) { - function close(fd, cb) { - return fs$close.call(fs, fd, function(err) { - if (!err) { - resetQueue(); - } - if (typeof cb === "function") - cb.apply(this, arguments); - }); - } - Object.defineProperty(close, previousSymbol, { - value: fs$close - }); - return close; - })(fs.close); - fs.closeSync = (function(fs$closeSync) { - function closeSync(fd) { - fs$closeSync.apply(fs, arguments); - resetQueue(); - } - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }); - return closeSync; - })(fs.closeSync); - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { - process.on("exit", function() { - debug(fs[gracefulQueue]); - require("assert").equal(fs[gracefulQueue].length, 0); - }); - } - } - var queue; - if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); - } - module2.exports = patch(clone(fs)); - if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module2.exports = patch(fs); - fs.__patched = true; + module2.exports = require_websocket(); + } +}); + +// node_modules/tslib/tslib.es6.mjs +var tslib_es6_exports = {}; +__export(tslib_es6_exports, { + __addDisposableResource: () => __addDisposableResource, + __assign: () => __assign, + __asyncDelegator: () => __asyncDelegator, + __asyncGenerator: () => __asyncGenerator, + __asyncValues: () => __asyncValues, + __await: () => __await, + __awaiter: () => __awaiter, + __classPrivateFieldGet: () => __classPrivateFieldGet, + __classPrivateFieldIn: () => __classPrivateFieldIn, + __classPrivateFieldSet: () => __classPrivateFieldSet, + __createBinding: () => __createBinding, + __decorate: () => __decorate, + __disposeResources: () => __disposeResources, + __esDecorate: () => __esDecorate, + __exportStar: () => __exportStar, + __extends: () => __extends, + __generator: () => __generator, + __importDefault: () => __importDefault, + __importStar: () => __importStar, + __makeTemplateObject: () => __makeTemplateObject, + __metadata: () => __metadata, + __param: () => __param, + __propKey: () => __propKey, + __read: () => __read, + __rest: () => __rest, + __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension, + __runInitializers: () => __runInitializers, + __setFunctionName: () => __setFunctionName, + __spread: () => __spread, + __spreadArray: () => __spreadArray, + __spreadArrays: () => __spreadArrays, + __values: () => __values2, + default: () => tslib_es6_default +}); +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; } - function patch(fs2) { - polyfills(fs2); - fs2.gracefulify = patch; - fs2.createReadStream = createReadStream; - fs2.createWriteStream = createWriteStream; - var fs$readFile = fs2.readFile; - fs2.readFile = readFile; - function readFile(path2, options, cb) { - if (typeof options === "function") - cb = options, options = null; - return go$readFile(path2, options, cb); - function go$readFile(path3, options2, cb2, startTime) { - return fs$readFile(path3, options2, function(err) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]); - else { - if (typeof cb2 === "function") - cb2.apply(this, arguments); - } - }); - } - } - var fs$writeFile = fs2.writeFile; - fs2.writeFile = writeFile; - function writeFile(path2, data, options, cb) { - if (typeof options === "function") - cb = options, options = null; - return go$writeFile(path2, data, options, cb); - function go$writeFile(path3, data2, options2, cb2, startTime) { - return fs$writeFile(path3, data2, options2, function(err) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); - else { - if (typeof cb2 === "function") - cb2.apply(this, arguments); - } - }); - } - } - var fs$appendFile = fs2.appendFile; - if (fs$appendFile) - fs2.appendFile = appendFile; - function appendFile(path2, data, options, cb) { - if (typeof options === "function") - cb = options, options = null; - return go$appendFile(path2, data, options, cb); - function go$appendFile(path3, data2, options2, cb2, startTime) { - return fs$appendFile(path3, data2, options2, function(err) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); - else { - if (typeof cb2 === "function") - cb2.apply(this, arguments); - } - }); - } - } - var fs$copyFile = fs2.copyFile; - if (fs$copyFile) - fs2.copyFile = copyFile; - function copyFile(src, dest, flags, cb) { - if (typeof flags === "function") { - cb = flags; - flags = 0; - } - return go$copyFile(src, dest, flags, cb); - function go$copyFile(src2, dest2, flags2, cb2, startTime) { - return fs$copyFile(src2, dest2, flags2, function(err) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]); - else { - if (typeof cb2 === "function") - cb2.apply(this, arguments); - } - }); - } - } - var fs$readdir = fs2.readdir; - fs2.readdir = readdir; - var noReaddirOptionVersions = /^v[0-5]\./; - function readdir(path2, options, cb) { - if (typeof options === "function") - cb = options, options = null; - var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) { - return fs$readdir(path3, fs$readdirCallback( - path3, - options2, - cb2, - startTime - )); - } : function go$readdir2(path3, options2, cb2, startTime) { - return fs$readdir(path3, options2, fs$readdirCallback( - path3, - options2, - cb2, - startTime - )); - }; - return go$readdir(path2, options, cb); - function fs$readdirCallback(path3, options2, cb2, startTime) { - return function(err, files) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([ - go$readdir, - [path3, options2, cb2], - err, - startTime || Date.now(), - Date.now() - ]); - else { - if (files && files.sort) - files.sort(); - if (typeof cb2 === "function") - cb2.call(this, err, files); - } - }; - } - } - if (process.version.substr(0, 4) === "v0.8") { - var legStreams = legacy(fs2); - ReadStream = legStreams.ReadStream; - WriteStream = legStreams.WriteStream; - } - var fs$ReadStream = fs2.ReadStream; - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype); - ReadStream.prototype.open = ReadStream$open; - } - var fs$WriteStream = fs2.WriteStream; - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype); - WriteStream.prototype.open = WriteStream$open; + return t; +} +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} +function __param(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; +} +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { + if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); + return f; + } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context2 = {}; + for (var p in contextIn) context2[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context2.access[p] = contextIn.access[p]; + context2.addInitializer = function(f) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f || null)); + }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +} +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +} +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +} +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +} +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); } - Object.defineProperty(fs2, "ReadStream", { - get: function() { - return ReadStream; - }, - set: function(val) { - ReadStream = val; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(fs2, "WriteStream", { - get: function() { - return WriteStream; - }, - set: function(val) { - WriteStream = val; - }, - enumerable: true, - configurable: true - }); - var FileReadStream = ReadStream; - Object.defineProperty(fs2, "FileReadStream", { - get: function() { - return FileReadStream; - }, - set: function(val) { - FileReadStream = val; - }, - enumerable: true, - configurable: true - }); - var FileWriteStream = WriteStream; - Object.defineProperty(fs2, "FileWriteStream", { - get: function() { - return FileWriteStream; - }, - set: function(val) { - FileWriteStream = val; - }, - enumerable: true, - configurable: true - }); - function ReadStream(path2, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this; - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments); + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); } - function ReadStream$open() { - var that = this; - open(that.path, that.flags, that.mode, function(err, fd) { - if (err) { - if (that.autoClose) - that.destroy(); - that.emit("error", err); - } else { - that.fd = fd; - that.emit("open", fd); - that.read(); + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; } - }); - } - function WriteStream(path2, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this; - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments); - } - function WriteStream$open() { - var that = this; - open(that.path, that.flags, that.mode, function(err, fd) { - if (err) { - that.destroy(); - that.emit("error", err); - } else { - that.fd = fd; - that.emit("open", fd); + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; } - }); - } - function createReadStream(path2, options) { - return new fs2.ReadStream(path2, options); - } - function createWriteStream(path2, options) { - return new fs2.WriteStream(path2, options); - } - var fs$open = fs2.open; - fs2.open = open; - function open(path2, flags, mode, cb) { - if (typeof mode === "function") - cb = mode, mode = null; - return go$open(path2, flags, mode, cb); - function go$open(path3, flags2, mode2, cb2, startTime) { - return fs$open(path3, flags2, mode2, function(err, fd) { - if (err && (err.code === "EMFILE" || err.code === "ENFILE")) - enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]); - else { - if (typeof cb2 === "function") - cb2.apply(this, arguments); - } - }); - } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; } - return fs2; + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; } - function enqueue(elem) { - debug("ENQUEUE", elem[0].name, elem[1]); - fs[gracefulQueue].push(elem); - retry(); + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } +} +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} +function __values2(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function() { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; } - var retryTimer; - function resetQueue() { - var now = Date.now(); - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now; - fs[gracefulQueue][i][4] = now; - } - } - retry(); + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { error }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; } - function retry() { - clearTimeout(retryTimer); - retryTimer = void 0; - if (fs[gracefulQueue].length === 0) - return; - var elem = fs[gracefulQueue].shift(); - var fn = elem[0]; - var args = elem[1]; - var err = elem[2]; - var startTime = elem[3]; - var lastTime = elem[4]; - if (startTime === void 0) { - debug("RETRY", fn.name, args); - fn.apply(null, args); - } else if (Date.now() - startTime >= 6e4) { - debug("TIMEOUT", fn.name, args); - var cb = args.pop(); - if (typeof cb === "function") - cb.call(null, err); - } else { - var sinceAttempt = Date.now() - lastTime; - var sinceStart = Math.max(lastTime - startTime, 1); - var desiredDelay = Math.min(sinceStart * 1.2, 100); - if (sinceAttempt >= desiredDelay) { - debug("RETRY", fn.name, args); - fn.apply(null, args.concat([startTime])); - } else { - fs[gracefulQueue].push(elem); - } - } - if (retryTimer === void 0) { - retryTimer = setTimeout(retry, 0); - } + } + return ar; +} +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; } } -}); - -// node_modules/slide/lib/async-map.js -var require_async_map = __commonJS({ - "node_modules/slide/lib/async-map.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = asyncMap; - function asyncMap() { - var steps = Array.prototype.slice.call(arguments), list = steps.shift() || [], cb_ = steps.pop(); - if (typeof cb_ !== "function") throw new Error( - "No callback provided to asyncMap" - ); - if (!list) return cb_(null, []); - if (!Array.isArray(list)) list = [list]; - var n = steps.length, data = [], errState = null, l = list.length, a = l * n; - if (!a) return cb_(null, []); - function cb(er) { - if (er && !errState) errState = er; - var argLen = arguments.length; - for (var i = 1; i < argLen; i++) if (arguments[i] !== void 0) { - data[i - 1] = (data[i - 1] || []).concat(arguments[i]); - } - if (list.length > l) { - var newList = list.slice(l); - a += (list.length - l) * n; - l = list.length; - process.nextTick(function() { - newList.forEach(function(ar) { - steps.forEach(function(fn) { - fn(ar, cb); - }); - }); - }); - } - if (--a === 0) cb_.apply(null, [errState].concat(data)); - } - list.forEach(function(ar) { - steps.forEach(function(fn) { - fn(ar, cb); + return to.concat(ar || Array.prototype.slice.call(from)); +} +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function awaitReturn(f) { + return function(v) { + return Promise.resolve(v).then(f, reject); + }; + } + function verb(n, f) { + if (g[n]) { + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); }); - }); + }; + if (f) i[n] = f(i[n]); } } -}); - -// node_modules/slide/lib/bind-actor.js -var require_bind_actor = __commonJS({ - "node_modules/slide/lib/bind-actor.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = bindActor; - function bindActor() { - var args = Array.prototype.slice.call(arguments), obj = null, fn; - if (typeof args[0] === "object") { - obj = args.shift(); - fn = args.shift(); - if (typeof fn === "string") - fn = obj[fn]; - } else fn = args.shift(); - return function(cb) { - fn.apply(obj, args.concat(cb)); - }; + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f, v) { + if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); + } +} +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function(e) { + throw e; + }), verb("return"), i[Symbol.iterator] = function() { + return this; + }, i; + function verb(n, f) { + i[n] = o[n] ? function(v) { + return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; + } : f; + } +} +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } +} +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; + } + return cooked; +} +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + } + __setModuleDefault(result, mod); + return result; +} +function __importDefault(mod) { + return mod && mod.__esModule ? mod : { default: mod }; +} +function __classPrivateFieldGet(receiver, state2, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f : !state2.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state2.get(receiver); +} +function __classPrivateFieldSet(receiver, state2, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f : !state2.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state2.set(receiver, value), value; +} +function __classPrivateFieldIn(state2, receiver) { + if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state2 === "function" ? receiver === state2 : state2.has(receiver); +} +function __addDisposableResource(env2, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { + try { + inner.call(this); + } catch (e) { + return Promise.reject(e); + } + }; + env2.stack.push({ value, dispose, async }); + } else if (async) { + env2.stack.push({ async: true }); + } + return value; +} +function __disposeResources(env2) { + function fail(e) { + env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e; + env2.hasError = true; } -}); - -// node_modules/slide/lib/chain.js -var require_chain = __commonJS({ - "node_modules/slide/lib/chain.js"(exports2, module2) { - init_define_import_meta_env(); - module2.exports = chain; - var bindActor = require_bind_actor(); - chain.first = {}; - chain.last = {}; - function chain(things, cb) { - var res = []; - (function LOOP(i, len) { - if (i >= len) return cb(null, res); - if (Array.isArray(things[i])) - things[i] = bindActor.apply( - null, - things[i].map(function(i2) { - return i2 === chain.first ? res[0] : i2 === chain.last ? res[res.length - 1] : i2; - }) - ); - if (!things[i]) return LOOP(i + 1, len); - things[i](function(er, data) { - if (er) return cb(er, res); - if (data !== void 0) res = res.concat(data); - LOOP(i + 1, len); - }); - })(0, things.length); + var r, s = 0; + function next() { + while (r = env2.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { + fail(e); + return next(); + }); + } else s |= 1; + } catch (e) { + fail(e); + } } + if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve(); + if (env2.hasError) throw env2.error; } -}); - -// node_modules/slide/lib/slide.js -var require_slide = __commonJS({ - "node_modules/slide/lib/slide.js"(exports2) { - init_define_import_meta_env(); - exports2.asyncMap = require_async_map(); - exports2.bindActor = require_bind_actor(); - exports2.chain = require_chain(); + return next(); +} +function __rewriteRelativeImportExtension(path2, preserveJsx) { + if (typeof path2 === "string" && /^\.\.?\//.test(path2)) { + return path2.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { + return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js"; + }); } -}); - -// node_modules/imurmurhash/imurmurhash.js -var require_imurmurhash = __commonJS({ - "node_modules/imurmurhash/imurmurhash.js"(exports2, module2) { + return path2; +} +var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default; +var init_tslib_es6 = __esm({ + "node_modules/tslib/tslib.es6.mjs"() { init_define_import_meta_env(); - (function() { - var cache; - function MurmurHash3(key2, seed) { - var m = this instanceof MurmurHash3 ? this : cache; - m.reset(seed); - if (typeof key2 === "string" && key2.length > 0) { - m.hash(key2); - } - if (m !== this) { - return m; - } - } - ; - MurmurHash3.prototype.hash = function(key2) { - var h1, k1, i, top, len; - len = key2.length; - this.len += len; - k1 = this.k1; - i = 0; - switch (this.rem) { - case 0: - k1 ^= len > i ? key2.charCodeAt(i++) & 65535 : 0; - case 1: - k1 ^= len > i ? (key2.charCodeAt(i++) & 65535) << 8 : 0; - case 2: - k1 ^= len > i ? (key2.charCodeAt(i++) & 65535) << 16 : 0; - case 3: - k1 ^= len > i ? (key2.charCodeAt(i) & 255) << 24 : 0; - k1 ^= len > i ? (key2.charCodeAt(i++) & 65280) >> 8 : 0; - } - this.rem = len + this.rem & 3; - len -= this.rem; - if (len > 0) { - h1 = this.h1; - while (1) { - k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295; - k1 = k1 << 15 | k1 >>> 17; - k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295; - h1 ^= k1; - h1 = h1 << 13 | h1 >>> 19; - h1 = h1 * 5 + 3864292196 & 4294967295; - if (i >= len) { - break; - } - k1 = key2.charCodeAt(i++) & 65535 ^ (key2.charCodeAt(i++) & 65535) << 8 ^ (key2.charCodeAt(i++) & 65535) << 16; - top = key2.charCodeAt(i++); - k1 ^= (top & 255) << 24 ^ (top & 65280) >> 8; - } - k1 = 0; - switch (this.rem) { - case 3: - k1 ^= (key2.charCodeAt(i + 2) & 65535) << 16; - case 2: - k1 ^= (key2.charCodeAt(i + 1) & 65535) << 8; - case 1: - k1 ^= key2.charCodeAt(i) & 65535; - } - this.h1 = h1; - } - this.k1 = k1; - return this; + extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; - MurmurHash3.prototype.result = function() { - var k1, h1; - k1 = this.k1; - h1 = this.h1; - if (k1 > 0) { - k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295; - k1 = k1 << 15 | k1 >>> 17; - k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295; - h1 ^= k1; + return extendStatics(d, b); + }; + __assign = function() { + __assign = Object.assign || function __assign2(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } - h1 ^= this.len; - h1 ^= h1 >>> 16; - h1 = h1 * 51819 + (h1 & 65535) * 2246770688 & 4294967295; - h1 ^= h1 >>> 13; - h1 = h1 * 44597 + (h1 & 65535) * 3266445312 & 4294967295; - h1 ^= h1 >>> 16; - return h1 >>> 0; - }; - MurmurHash3.prototype.reset = function(seed) { - this.h1 = typeof seed === "number" ? seed : 0; - this.rem = this.k1 = this.len = 0; - return this; + return t; }; - cache = new MurmurHash3(); - if (typeof module2 != "undefined") { - module2.exports = MurmurHash3; - } else { - this.MurmurHash3 = MurmurHash3; + return __assign.apply(this, arguments); + }; + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - })(); + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + tslib_es6_default = { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values: __values2, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, + __rewriteRelativeImportExtension + }; } }); -// node_modules/write-file-atomic/index.js -var require_write_file_atomic = __commonJS({ - "node_modules/write-file-atomic/index.js"(exports2, module2) { +// node_modules/async-mutex/lib/errors.js +var require_errors2 = __commonJS({ + "node_modules/async-mutex/lib/errors.js"(exports2) { "use strict"; init_define_import_meta_env(); - module2.exports = writeFile; - module2.exports.sync = writeFileSync; - module2.exports._getTmpname = getTmpname; - var fs = require_graceful_fs(); - var chain = require_slide().chain; - var MurmurHash3 = require_imurmurhash(); - var extend = Object.assign || require("util")._extend; - var invocations = 0; - function getTmpname(filename) { - return filename + "." + MurmurHash3(__filename).hash(String(process.pid)).hash(String(++invocations)).result(); - } - function writeFile(filename, data, options, callback) { - if (options instanceof Function) { - callback = options; - options = null; - } - if (!options) options = {}; - fs.realpath(filename, function(_, realname) { - _writeFile(realname || filename, data, options, callback); - }); - } - function _writeFile(filename, data, options, callback) { - var tmpfile = getTmpname(filename); - if (options.mode && options.chown) { - return thenWriteFile(); - } else { - return fs.stat(filename, function(err, stats) { - if (err || !stats) return thenWriteFile(); - options = extend({}, options); - if (!options.mode) { - options.mode = stats.mode; - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid }; - } - return thenWriteFile(); - }); - } - function thenWriteFile() { - chain([ - [writeFileAsync, tmpfile, data, options.mode, options.encoding || "utf8"], - options.chown && [fs, fs.chown, tmpfile, options.chown.uid, options.chown.gid], - options.mode && [fs, fs.chmod, tmpfile, options.mode], - [fs, fs.rename, tmpfile, filename] - ], function(err) { - err ? fs.unlink(tmpfile, function() { - callback(err); - }) : callback(); - }); - } - function writeFileAsync(file, data2, mode, encoding, cb) { - fs.open(file, "w", options.mode, function(err, fd) { - if (err) return cb(err); - if (Buffer.isBuffer(data2)) { - return fs.write(fd, data2, 0, data2.length, 0, syncAndClose); - } else if (data2 != null) { - return fs.write(fd, String(data2), 0, String(encoding), syncAndClose); - } else { - return syncAndClose(); - } - function syncAndClose(err2) { - if (err2) return cb(err2); - fs.fsync(fd, function(err3) { - if (err3) return cb(err3); - fs.close(fd, cb); - }); - } - }); - } - } - function writeFileSync(filename, data, options) { - if (!options) options = {}; - try { - filename = fs.realpathSync(filename); - } catch (ex) { - } - var tmpfile = getTmpname(filename); - try { - if (!options.mode || !options.chown) { - try { - var stats = fs.statSync(filename); - options = extend({}, options); - if (!options.mode) { - options.mode = stats.mode; - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid }; - } - } catch (ex) { - } - } - var fd = fs.openSync(tmpfile, "w", options.mode); - if (Buffer.isBuffer(data)) { - fs.writeSync(fd, data, 0, data.length, 0); - } else if (data != null) { - fs.writeSync(fd, String(data), 0, String(options.encoding || "utf8")); - } - fs.fsyncSync(fd); - fs.closeSync(fd); - if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid); - if (options.mode) fs.chmodSync(tmpfile, options.mode); - fs.renameSync(tmpfile, filename); - } catch (err) { - try { - fs.unlinkSync(tmpfile); - } catch (e) { - } - throw err; - } - } + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.E_CANCELED = exports2.E_ALREADY_LOCKED = exports2.E_TIMEOUT = void 0; + exports2.E_TIMEOUT = new Error("timeout while waiting for mutex to become available"); + exports2.E_ALREADY_LOCKED = new Error("mutex already locked"); + exports2.E_CANCELED = new Error("request for lock canceled"); } }); -// node_modules/node-localstorage/LocalStorage.js -var require_LocalStorage = __commonJS({ - "node_modules/node-localstorage/LocalStorage.js"(exports2) { +// node_modules/async-mutex/lib/Semaphore.js +var require_Semaphore = __commonJS({ + "node_modules/async-mutex/lib/Semaphore.js"(exports2) { + "use strict"; init_define_import_meta_env(); - (function() { - var JSONStorage, KEY_FOR_EMPTY_STRING, LocalStorage, MetaKey, QUOTA_EXCEEDED_ERR, StorageEvent, _emptyDirectory, _escapeKey, _rm, createMap, events, fs, path2, writeSync, extend = function(child, parent) { - for (var key2 in parent) { - if (hasProp.call(parent, key2)) child[key2] = parent[key2]; - } - function ctor() { - this.constructor = child; - } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - child.__super__ = parent.prototype; - return child; - }, hasProp = {}.hasOwnProperty; - path2 = require("path"); - fs = require("fs"); - events = require("events"); - writeSync = require_write_file_atomic().sync; - KEY_FOR_EMPTY_STRING = "---.EMPTY_STRING.---"; - _emptyDirectory = function(target) { - var i, len, p, ref, results; - ref = fs.readdirSync(target); - results = []; - for (i = 0, len = ref.length; i < len; i++) { - p = ref[i]; - results.push(_rm(path2.join(target, p))); - } - return results; - }; - _rm = function(target) { - if (fs.statSync(target).isDirectory()) { - _emptyDirectory(target); - return fs.rmdirSync(target); - } else { - return fs.unlinkSync(target); - } - }; - _escapeKey = function(key2) { - var newKey; - if (key2 === "") { - newKey = KEY_FOR_EMPTY_STRING; - } else { - newKey = "" + key2; - } - return newKey; - }; - QUOTA_EXCEEDED_ERR = (function(superClass) { - extend(QUOTA_EXCEEDED_ERR2, superClass); - function QUOTA_EXCEEDED_ERR2(message) { - this.message = message != null ? message : "Unknown error."; - QUOTA_EXCEEDED_ERR2.__super__.constructor.call(this); - if (Error.captureStackTrace != null) { - Error.captureStackTrace(this, this.constructor); - } - this.name = this.constructor.name; - } - QUOTA_EXCEEDED_ERR2.prototype.toString = function() { - return this.name + ": " + this.message; - }; - return QUOTA_EXCEEDED_ERR2; - })(Error); - StorageEvent = /* @__PURE__ */ (function() { - function StorageEvent2(key1, oldValue1, newValue1, url, storageArea) { - this.key = key1; - this.oldValue = oldValue1; - this.newValue = newValue1; - this.url = url; - this.storageArea = storageArea != null ? storageArea : "localStorage"; - } - return StorageEvent2; - })(); - MetaKey = /* @__PURE__ */ (function() { - function MetaKey2(key1, index1) { - this.key = key1; - this.index = index1; - if (!(this instanceof MetaKey2)) { - return new MetaKey2(this.key, this.index); - } - } - return MetaKey2; - })(); - createMap = function() { - var Map2; - Map2 = function() { - }; - Map2.prototype = /* @__PURE__ */ Object.create(null); - return new Map2(); - }; - LocalStorage = (function(superClass) { - var instanceMap; - extend(LocalStorage2, superClass); - instanceMap = {}; - function LocalStorage2(_location, quota) { - var handler4; - this._location = _location; - this.quota = quota != null ? quota : 5 * 1024 * 1024; - LocalStorage2.__super__.constructor.call(this); - if (!(this instanceof LocalStorage2)) { - return new LocalStorage2(this._location, this.quota); - } - this._location = path2.resolve(this._location); - if (instanceMap[this._location] != null) { - return instanceMap[this._location]; + Object.defineProperty(exports2, "__esModule", { value: true }); + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var errors_1 = require_errors2(); + var Semaphore = ( + /** @class */ + (function() { + function Semaphore2(_maxConcurrency, _cancelError) { + if (_cancelError === void 0) { + _cancelError = errors_1.E_CANCELED; } - this.length = 0; - this._bytesInUse = 0; - this._keys = []; - this._metaKeyMap = createMap(); - this._eventUrl = "pid:" + process.pid; - this._init(); - this._QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR; - if (typeof Proxy !== "undefined" && Proxy !== null) { - handler4 = { - set: /* @__PURE__ */ (function(_this) { - return function(receiver, key2, value) { - if (_this[key2] != null) { - return _this[key2] = value; - } else { - return _this.setItem(key2, value); - } - }; - })(this), - get: /* @__PURE__ */ (function(_this) { - return function(receiver, key2) { - if (_this[key2] != null) { - return _this[key2]; - } else { - return _this.getItem(key2); - } - }; - })(this) - }; - instanceMap[this._location] = new Proxy(this, handler4); - return instanceMap[this._location]; + this._maxConcurrency = _maxConcurrency; + this._cancelError = _cancelError; + this._queue = []; + this._waiters = []; + if (_maxConcurrency <= 0) { + throw new Error("semaphore must be initialized to a positive value"); } - instanceMap[this._location] = this; - return instanceMap[this._location]; + this._value = _maxConcurrency; } - LocalStorage2.prototype._init = function() { - var _MetaKey, _decodedKey, _keys, e, i, index2, k, len, stat; - try { - stat = fs.statSync(this._location); - if (stat != null && !stat.isDirectory()) { - throw new Error("A file exists at the location '" + this._location + "' when trying to create/open localStorage"); - } - this._bytesInUse = 0; - this.length = 0; - _keys = fs.readdirSync(this._location); - for (index2 = i = 0, len = _keys.length; i < len; index2 = ++i) { - k = _keys[index2]; - _decodedKey = decodeURIComponent(k); - this._keys.push(_decodedKey); - _MetaKey = new MetaKey(k, index2); - this._metaKeyMap[_decodedKey] = _MetaKey; - stat = this._getStat(k); - if ((stat != null ? stat.size : void 0) != null) { - _MetaKey.size = stat.size; - this._bytesInUse += stat.size; + Semaphore2.prototype.acquire = function() { + var _this = this; + var locked = this.isLocked(); + var ticketPromise = new Promise(function(resolve, reject) { + return _this._queue.push({ resolve, reject }); + }); + if (!locked) + this._dispatch(); + return ticketPromise; + }; + Semaphore2.prototype.runExclusive = function(callback) { + return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { + var _a, value, release; + return (0, tslib_1.__generator)(this, function(_b) { + switch (_b.label) { + case 0: + return [4, this.acquire()]; + case 1: + _a = _b.sent(), value = _a[0], release = _a[1]; + _b.label = 2; + case 2: + _b.trys.push([2, , 4, 5]); + return [4, callback(value)]; + case 3: + return [2, _b.sent()]; + case 4: + release(); + return [ + 7 + /*endfinally*/ + ]; + case 5: + return [ + 2 + /*return*/ + ]; } - } - this.length = _keys.length; - } catch (error) { - e = error; - if (e.code !== "ENOENT") { - throw e; - } - try { - fs.mkdirSync(this._location, { - recursive: true - }); - } catch (error2) { - e = error2; - if (e.code !== "EEXIST") { - throw e; + }); + }); + }; + Semaphore2.prototype.waitForUnlock = function() { + return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { + var waitPromise; + var _this = this; + return (0, tslib_1.__generator)(this, function(_a) { + if (!this.isLocked()) { + return [2, Promise.resolve()]; } - } - } + waitPromise = new Promise(function(resolve) { + return _this._waiters.push({ resolve }); + }); + return [2, waitPromise]; + }); + }); }; - LocalStorage2.prototype.setItem = function(key2, value) { - var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; - hasListeners = this.listenerCount("storage"); - oldValue = null; - if (hasListeners) { - oldValue = this.getItem(key2); - } - key2 = _escapeKey(key2); - encodedKey = encodeURIComponent(key2).replace(/[!'()]/g, escape).replace(/\*/g, "%2A"); - filename = path2.join(this._location, encodedKey); - valueString = "" + value; - valueStringLength = valueString.length; - metaKey = this._metaKeyMap[key2]; - existsBeforeSet = !!metaKey; - if (existsBeforeSet) { - oldLength = metaKey.size; - } else { - oldLength = 0; + Semaphore2.prototype.isLocked = function() { + return this._value <= 0; + }; + Semaphore2.prototype.release = function() { + if (this._maxConcurrency > 1) { + throw new Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead"); } - if (this._bytesInUse - oldLength + valueStringLength > this.quota) { - throw new QUOTA_EXCEEDED_ERR(); + if (this._currentReleaser) { + var releaser = this._currentReleaser; + this._currentReleaser = void 0; + releaser(); } - writeSync(filename, valueString, { - encoding: "utf8" + }; + Semaphore2.prototype.cancel = function() { + var _this = this; + this._queue.forEach(function(ticket) { + return ticket.reject(_this._cancelError); }); - if (!existsBeforeSet) { - metaKey = new MetaKey(encodedKey, this._keys.push(key2) - 1); - metaKey.size = valueStringLength; - this._metaKeyMap[key2] = metaKey; - this.length += 1; - this._bytesInUse += valueStringLength; - } - if (hasListeners) { - evnt = new StorageEvent(key2, oldValue, value, this._eventUrl); - return this.emit("storage", evnt); - } + this._queue = []; }; - LocalStorage2.prototype.getItem = function(key2) { - var filename, metaKey; - key2 = _escapeKey(key2); - metaKey = this._metaKeyMap[key2]; - if (!!metaKey) { - filename = path2.join(this._location, metaKey.key); - return fs.readFileSync(filename, "utf8"); - } else { - return null; - } + Semaphore2.prototype._dispatch = function() { + var _this = this; + var nextTicket = this._queue.shift(); + if (!nextTicket) + return; + var released = false; + this._currentReleaser = function() { + if (released) + return; + released = true; + _this._value++; + _this._resolveWaiters(); + _this._dispatch(); + }; + nextTicket.resolve([this._value--, this._currentReleaser]); }; - LocalStorage2.prototype._getStat = function(key2) { - var filename; - key2 = _escapeKey(key2); - filename = path2.join(this._location, encodeURIComponent(key2)); - try { - return fs.statSync(filename); - } catch (error) { - return null; - } + Semaphore2.prototype._resolveWaiters = function() { + this._waiters.forEach(function(waiter) { + return waiter.resolve(); + }); + this._waiters = []; }; - LocalStorage2.prototype.removeItem = function(key2) { - var evnt, filename, hasListeners, k, meta, metaKey, oldValue, ref, v; - key2 = _escapeKey(key2); - metaKey = this._metaKeyMap[key2]; - if (!!metaKey) { - hasListeners = this.listenerCount("storage"); - oldValue = null; - if (hasListeners) { - oldValue = this.getItem(key2); - } - delete this._metaKeyMap[key2]; - this.length -= 1; - this._bytesInUse -= metaKey.size; - filename = path2.join(this._location, metaKey.key); - this._keys.splice(metaKey.index, 1); - ref = this._metaKeyMap; - for (k in ref) { - v = ref[k]; - meta = this._metaKeyMap[k]; - if (meta.index > metaKey.index) { - meta.index -= 1; + return Semaphore2; + })() + ); + exports2.default = Semaphore; + } +}); + +// node_modules/async-mutex/lib/Mutex.js +var require_Mutex = __commonJS({ + "node_modules/async-mutex/lib/Mutex.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var Semaphore_1 = require_Semaphore(); + var Mutex = ( + /** @class */ + (function() { + function Mutex2(cancelError) { + this._semaphore = new Semaphore_1.default(1, cancelError); + } + Mutex2.prototype.acquire = function() { + return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { + var _a, releaser; + return (0, tslib_1.__generator)(this, function(_b) { + switch (_b.label) { + case 0: + return [4, this._semaphore.acquire()]; + case 1: + _a = _b.sent(), releaser = _a[1]; + return [2, releaser]; } - } - _rm(filename); - if (hasListeners) { - evnt = new StorageEvent(key2, oldValue, null, this._eventUrl); - return this.emit("storage", evnt); - } - } - }; - LocalStorage2.prototype.key = function(n) { - var rawKey; - rawKey = this._keys[n]; - if (rawKey === KEY_FOR_EMPTY_STRING) { - return ""; - } else { - return rawKey; - } + }); + }); }; - LocalStorage2.prototype.clear = function() { - var evnt; - _emptyDirectory(this._location); - this._metaKeyMap = createMap(); - this._keys = []; - this.length = 0; - this._bytesInUse = 0; - if (this.listenerCount("storage")) { - evnt = new StorageEvent(null, null, null, this._eventUrl); - return this.emit("storage", evnt); - } + Mutex2.prototype.runExclusive = function(callback) { + return this._semaphore.runExclusive(function() { + return callback(); + }); }; - LocalStorage2.prototype._getBytesInUse = function() { - return this._bytesInUse; + Mutex2.prototype.isLocked = function() { + return this._semaphore.isLocked(); }; - LocalStorage2.prototype._deleteLocation = function() { - delete instanceMap[this._location]; - _rm(this._location); - this._metaKeyMap = {}; - this._keys = []; - this.length = 0; - return this._bytesInUse = 0; + Mutex2.prototype.waitForUnlock = function() { + return this._semaphore.waitForUnlock(); }; - return LocalStorage2; - })(events.EventEmitter); - JSONStorage = (function(superClass) { - extend(JSONStorage2, superClass); - function JSONStorage2() { - return JSONStorage2.__super__.constructor.apply(this, arguments); - } - JSONStorage2.prototype.setItem = function(key2, value) { - var newValue; - newValue = JSON.stringify(value); - return JSONStorage2.__super__.setItem.call(this, key2, newValue); + Mutex2.prototype.release = function() { + this._semaphore.release(); }; - JSONStorage2.prototype.getItem = function(key2) { - return JSON.parse(JSONStorage2.__super__.getItem.call(this, key2)); + Mutex2.prototype.cancel = function() { + return this._semaphore.cancel(); }; - return JSONStorage2; - })(LocalStorage); - exports2.LocalStorage = LocalStorage; - exports2.JSONStorage = JSONStorage; - exports2.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR; - }).call(exports2); + return Mutex2; + })() + ); + exports2.default = Mutex; } }); -// node_modules/telegram/sessions/localStorage.js -var require_localStorage = __commonJS({ - "node_modules/telegram/sessions/localStorage.js"(exports2) { +// node_modules/async-mutex/lib/withTimeout.js +var require_withTimeout = __commonJS({ + "node_modules/async-mutex/lib/withTimeout.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LocalStorage = void 0; - exports2.LocalStorage = require_LocalStorage().LocalStorage; + exports2.withTimeout = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var errors_1 = require_errors2(); + function withTimeout(sync, timeout, timeoutError) { + var _this = this; + if (timeoutError === void 0) { + timeoutError = errors_1.E_TIMEOUT; + } + return { + acquire: function() { + return new Promise(function(resolve, reject) { + return (0, tslib_1.__awaiter)(_this, void 0, void 0, function() { + var isTimeout, handle2, ticket, release, e_1; + return (0, tslib_1.__generator)(this, function(_a) { + switch (_a.label) { + case 0: + isTimeout = false; + handle2 = setTimeout(function() { + isTimeout = true; + reject(timeoutError); + }, timeout); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, sync.acquire()]; + case 2: + ticket = _a.sent(); + if (isTimeout) { + release = Array.isArray(ticket) ? ticket[1] : ticket; + release(); + } else { + clearTimeout(handle2); + resolve(ticket); + } + return [3, 4]; + case 3: + e_1 = _a.sent(); + if (!isTimeout) { + clearTimeout(handle2); + reject(e_1); + } + return [3, 4]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }); + }, + runExclusive: function(callback) { + return (0, tslib_1.__awaiter)(this, void 0, void 0, function() { + var release, ticket; + return (0, tslib_1.__generator)(this, function(_a) { + switch (_a.label) { + case 0: + release = function() { + return void 0; + }; + _a.label = 1; + case 1: + _a.trys.push([1, , 7, 8]); + return [4, this.acquire()]; + case 2: + ticket = _a.sent(); + if (!Array.isArray(ticket)) return [3, 4]; + release = ticket[1]; + return [4, callback(ticket[0])]; + case 3: + return [2, _a.sent()]; + case 4: + release = ticket; + return [4, callback()]; + case 5: + return [2, _a.sent()]; + case 6: + return [3, 8]; + case 7: + release(); + return [ + 7 + /*endfinally*/ + ]; + case 8: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }, + /** @deprecated Deprecated in 0.3.0, will be removed in 0.4.0. Use runExclusive instead. */ + release: function() { + sync.release(); + }, + cancel: function() { + return sync.cancel(); + }, + waitForUnlock: function() { + return sync.waitForUnlock(); + }, + isLocked: function() { + return sync.isLocked(); + } + }; + } + exports2.withTimeout = withTimeout; } }); -// node_modules/telegram/sessions/StoreSession.js -var require_StoreSession = __commonJS({ - "node_modules/telegram/sessions/StoreSession.js"(exports2) { +// node_modules/async-mutex/lib/tryAcquire.js +var require_tryAcquire = __commonJS({ + "node_modules/async-mutex/lib/tryAcquire.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StoreSession = void 0; - var Memory_1 = require_Memory(); - var store2_1 = __importDefault2(require_store2()); - var AuthKey_1 = require_AuthKey(); - var StoreSession = class extends Memory_1.MemorySession { - constructor(sessionName, divider = ":") { - super(); - if (sessionName === "session") { - throw new Error("Session name can't be 'session'. Please use a different name."); + exports2.tryAcquire = void 0; + var errors_1 = require_errors2(); + var withTimeout_1 = require_withTimeout(); + function tryAcquire(sync, alreadyAcquiredError) { + if (alreadyAcquiredError === void 0) { + alreadyAcquiredError = errors_1.E_ALREADY_LOCKED; + } + return (0, withTimeout_1.withTimeout)(sync, 0, alreadyAcquiredError); + } + exports2.tryAcquire = tryAcquire; + } +}); + +// node_modules/async-mutex/lib/index.js +var require_lib16 = __commonJS({ + "node_modules/async-mutex/lib/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.tryAcquire = exports2.withTimeout = exports2.Semaphore = exports2.Mutex = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var Mutex_1 = require_Mutex(); + Object.defineProperty(exports2, "Mutex", { enumerable: true, get: function() { + return Mutex_1.default; + } }); + var Semaphore_1 = require_Semaphore(); + Object.defineProperty(exports2, "Semaphore", { enumerable: true, get: function() { + return Semaphore_1.default; + } }); + var withTimeout_1 = require_withTimeout(); + Object.defineProperty(exports2, "withTimeout", { enumerable: true, get: function() { + return withTimeout_1.withTimeout; + } }); + var tryAcquire_1 = require_tryAcquire(); + Object.defineProperty(exports2, "tryAcquire", { enumerable: true, get: function() { + return tryAcquire_1.tryAcquire; + } }); + (0, tslib_1.__exportStar)(require_errors2(), exports2); + } +}); + +// node_modules/telegram/extensions/PromisedWebSockets.js +var require_PromisedWebSockets = __commonJS({ + "node_modules/telegram/extensions/PromisedWebSockets.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PromisedWebSockets = void 0; + var websocket_1 = require_websocket2(); + var async_mutex_1 = require_lib16(); + var platform_1 = require_platform(); + var mutex = new async_mutex_1.Mutex(); + var closeError = new Error("WebSocket was closed"); + var PromisedWebSockets = class { + constructor() { + this.client = void 0; + this.stream = Buffer.alloc(0); + this.closed = true; + } + async readExactly(number) { + let readData = Buffer.alloc(0); + while (true) { + const thisTime = await this.read(number); + readData = Buffer.concat([readData, thisTime]); + number = number - thisTime.length; + if (!number) { + return readData; + } } - if (typeof localStorage === "undefined" || localStorage === null) { - const LocalStorage = require_localStorage().LocalStorage; - this.store = store2_1.default.area(sessionName, new LocalStorage("./" + sessionName)); - } else { - this.store = store2_1.default.area(sessionName, localStorage); + } + async read(number) { + if (this.closed) { + throw closeError; } - if (divider == void 0) { - divider = ":"; + await this.canRead; + if (this.closed) { + throw closeError; } - this.sessionName = sessionName + divider; + const toReturn = this.stream.slice(0, number); + this.stream = this.stream.slice(number); + if (this.stream.length === 0) { + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); + } + return toReturn; } - async load() { - let authKey = this.store.get(this.sessionName + "authKey"); - if (authKey && typeof authKey === "object") { - this._authKey = new AuthKey_1.AuthKey(); - if ("data" in authKey) { - authKey = Buffer.from(authKey.data); - } - await this._authKey.setKey(authKey); + async readAll() { + if (this.closed || !await this.canRead) { + throw closeError; } - const dcId = this.store.get(this.sessionName + "dcId"); - if (dcId) { - this._dcId = dcId; + const toReturn = this.stream; + this.stream = Buffer.alloc(0); + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); + return toReturn; + } + getWebSocketLink(ip, port, testServers) { + if (port === 443) { + return `wss://${ip}:${port}/apiws${testServers ? "_test" : ""}`; + } else { + return `ws://${ip}:${port}/apiws${testServers ? "_test" : ""}`; } - const port = this.store.get(this.sessionName + "port"); - if (port) { - this._port = port; + } + async connect(port, ip, testServers = false) { + this.stream = Buffer.alloc(0); + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); + this.closed = false; + this.website = this.getWebSocketLink(ip, port, testServers); + this.client = new websocket_1.w3cwebsocket(this.website, "binary"); + return new Promise((resolve, reject) => { + if (this.client) { + this.client.onopen = () => { + this.receive(); + resolve(this); + }; + this.client.onerror = (error) => { + reject(error); + }; + this.client.onclose = () => { + if (this.resolveRead) { + this.resolveRead(false); + } + this.closed = true; + }; + if (platform_1.isBrowser) { + window.addEventListener("offline", async () => { + await this.close(); + if (this.resolveRead) { + this.resolveRead(false); + } + }); + } + } + }); + } + write(data) { + if (this.closed) { + throw closeError; } - const serverAddress = this.store.get(this.sessionName + "serverAddress"); - if (serverAddress) { - this._serverAddress = serverAddress; + if (this.client) { + this.client.send(data); } } - setDC(dcId, serverAddress, port) { - this.store.set(this.sessionName + "dcId", dcId); - this.store.set(this.sessionName + "port", port); - this.store.set(this.sessionName + "serverAddress", serverAddress); - super.setDC(dcId, serverAddress, port); - } - set authKey(value) { - this._authKey = value; - this.store.set(this.sessionName + "authKey", value === null || value === void 0 ? void 0 : value.getKey()); - } - get authKey() { - return this._authKey; - } - processEntities(tlo) { - const rows = this._entitiesToRows(tlo); - if (!rows) { - return; + async close() { + if (this.client) { + await this.client.close(); } - for (const row of rows) { - row.push((/* @__PURE__ */ new Date()).getTime().toString()); - this.store.set(this.sessionName + row[0], row); + this.closed = true; + } + async receive() { + if (this.client) { + this.client.onmessage = async (message) => { + const release = await mutex.acquire(); + try { + let data; + data = Buffer.from(await new Response(message.data).arrayBuffer()); + this.stream = Buffer.concat([this.stream, data]); + if (this.resolveRead) { + this.resolveRead(true); + } + } finally { + release(); + } + }; } } - getEntityRowsById(id, exact = true) { - return this.store.get(this.sessionName + id.toString()); + toString() { + return "PromisedWebSocket"; } }; - exports2.StoreSession = StoreSession; - } -}); - -// node_modules/telegram/sessions/index.js -var require_sessions = __commonJS({ - "node_modules/telegram/sessions/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Session = exports2.StoreSession = exports2.StringSession = exports2.MemorySession = void 0; - var Memory_1 = require_Memory(); - Object.defineProperty(exports2, "MemorySession", { enumerable: true, get: function() { - return Memory_1.MemorySession; - } }); - var StringSession_1 = require_StringSession(); - Object.defineProperty(exports2, "StringSession", { enumerable: true, get: function() { - return StringSession_1.StringSession; - } }); - var StoreSession_1 = require_StoreSession(); - Object.defineProperty(exports2, "StoreSession", { enumerable: true, get: function() { - return StoreSession_1.StoreSession; - } }); - var Abstract_1 = require_Abstract(); - Object.defineProperty(exports2, "Session", { enumerable: true, get: function() { - return Abstract_1.Session; - } }); + exports2.PromisedWebSockets = PromisedWebSockets; } }); -// node_modules/telegram/client/os.js -var require_os = __commonJS({ - "node_modules/telegram/client/os.js"(exports2) { +// node_modules/telegram/extensions/net.js +var require_net = __commonJS({ + "node_modules/telegram/extensions/net.js"(exports2) { "use strict"; init_define_import_meta_env(); var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { @@ -61700,2110 +66978,2253 @@ var require_os = __commonJS({ if (k2 === void 0) k2 = k; o[k2] = m[k]; })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; Object.defineProperty(exports2, "__esModule", { value: true }); - var os = __importStar2(require("os")); - exports2.default = os; + __exportStar2(require("net"), exports2); } }); -// node_modules/telegram/entityCache.js -var require_entityCache = __commonJS({ - "node_modules/telegram/entityCache.js"(exports2) { +// node_modules/smart-buffer/build/utils.js +var require_utils6 = __commonJS({ + "node_modules/smart-buffer/build/utils.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EntityCache = void 0; - var Utils_1 = require_Utils(); - var Helpers_1 = require_Helpers(); - var tl_1 = require_tl(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var EntityCache = class { - constructor() { - this.cacheMap = /* @__PURE__ */ new Map(); + var buffer_1 = require("buffer"); + var ERRORS2 = { + INVALID_ENCODING: "Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.", + INVALID_SMARTBUFFER_SIZE: "Invalid size provided. Size must be a valid integer greater than zero.", + INVALID_SMARTBUFFER_BUFFER: "Invalid Buffer provided in SmartBufferOptions.", + INVALID_SMARTBUFFER_OBJECT: "Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.", + INVALID_OFFSET: "An invalid offset value was provided.", + INVALID_OFFSET_NON_NUMBER: "An invalid offset value was provided. A numeric value is required.", + INVALID_LENGTH: "An invalid length value was provided.", + INVALID_LENGTH_NON_NUMBER: "An invalid length value was provived. A numeric value is required.", + INVALID_TARGET_OFFSET: "Target offset is beyond the bounds of the internal SmartBuffer data.", + INVALID_TARGET_LENGTH: "Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.", + INVALID_READ_BEYOND_BOUNDS: "Attempted to read beyond the bounds of the managed data.", + INVALID_WRITE_BEYOND_BOUNDS: "Attempted to write beyond the bounds of the managed data." + }; + exports2.ERRORS = ERRORS2; + function checkEncoding(encoding) { + if (!buffer_1.Buffer.isEncoding(encoding)) { + throw new Error(ERRORS2.INVALID_ENCODING); } - add(entities2) { - const temp = []; - if (!(0, Helpers_1.isArrayLike)(entities2)) { - if (entities2 != void 0) { - if (typeof entities2 == "object") { - if ("chats" in entities2) { - temp.push(...entities2.chats); - } - if ("users" in entities2) { - temp.push(...entities2.users); - } - if ("user" in entities2) { - temp.push(entities2.user); - } - } - } - if (temp.length) { - entities2 = temp; - } else { - return; - } - } - for (const entity of entities2) { - try { - const pid = (0, Utils_1.getPeerId)(entity); - if (!this.cacheMap.has(pid.toString())) { - this.cacheMap.set(pid.toString(), (0, Utils_1.getInputPeer)(entity)); - } - } catch (e) { - } + } + exports2.checkEncoding = checkEncoding; + function isFiniteInteger(value) { + return typeof value === "number" && isFinite(value) && isInteger(value); + } + exports2.isFiniteInteger = isFiniteInteger; + function checkOffsetOrLengthValue(value, offset) { + if (typeof value === "number") { + if (!isFiniteInteger(value) || value < 0) { + throw new Error(offset ? ERRORS2.INVALID_OFFSET : ERRORS2.INVALID_LENGTH); } + } else { + throw new Error(offset ? ERRORS2.INVALID_OFFSET_NON_NUMBER : ERRORS2.INVALID_LENGTH_NON_NUMBER); } - get(item) { - if (item == void 0) { - throw new Error("No cached entity for the given key"); - } - item = (0, Helpers_1.returnBigInt)(item); - if (item.lesser(big_integer_1.default.zero)) { - let res; - try { - res = this.cacheMap.get((0, Utils_1.getPeerId)(item).toString()); - if (res) { - return res; - } - } catch (e) { - throw new Error("Invalid key will not have entity"); - } - } - for (const cls of [tl_1.Api.PeerUser, tl_1.Api.PeerChat, tl_1.Api.PeerChannel]) { - const result = this.cacheMap.get((0, Utils_1.getPeerId)(new cls({ - userId: item, - chatId: item, - channelId: item - })).toString()); - if (result) { - return result; - } - } - throw new Error("No cached entity for the given key"); + } + function checkLengthValue(length) { + checkOffsetOrLengthValue(length, false); + } + exports2.checkLengthValue = checkLengthValue; + function checkOffsetValue(offset) { + checkOffsetOrLengthValue(offset, true); + } + exports2.checkOffsetValue = checkOffsetValue; + function checkTargetOffset(offset, buff) { + if (offset < 0 || offset > buff.length) { + throw new Error(ERRORS2.INVALID_TARGET_OFFSET); } - }; - exports2.EntityCache = EntityCache; + } + exports2.checkTargetOffset = checkTargetOffset; + function isInteger(value) { + return typeof value === "number" && isFinite(value) && Math.floor(value) === value; + } + function bigIntAndBufferInt64Check(bufferMethod) { + if (typeof BigInt === "undefined") { + throw new Error("Platform does not support JS BigInt type."); + } + if (typeof buffer_1.Buffer.prototype[bufferMethod] === "undefined") { + throw new Error(`Platform does not support Buffer.prototype.${bufferMethod}.`); + } + } + exports2.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check; } }); -// node_modules/telegram/crypto/IGE.js -var require_IGE = __commonJS({ - "node_modules/telegram/crypto/IGE.js"(exports2) { +// node_modules/smart-buffer/build/smartbuffer.js +var require_smartbuffer = __commonJS({ + "node_modules/smart-buffer/build/smartbuffer.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.IGE = void 0; - var Helpers = require_Helpers(); - var { IGE: aes_ige } = require_aes_min(); - var IGENEW = class { - constructor(key2, iv) { - this.ige = new aes_ige(key2, iv); + var utils_1 = require_utils6(); + var DEFAULT_SMARTBUFFER_SIZE = 4096; + var DEFAULT_SMARTBUFFER_ENCODING = "utf8"; + var SmartBuffer = class _SmartBuffer { + /** + * Creates a new SmartBuffer instance. + * + * @param options { SmartBufferOptions } The SmartBufferOptions to apply to this instance. + */ + constructor(options) { + this.length = 0; + this._encoding = DEFAULT_SMARTBUFFER_ENCODING; + this._writeOffset = 0; + this._readOffset = 0; + if (_SmartBuffer.isSmartBufferOptions(options)) { + if (options.encoding) { + utils_1.checkEncoding(options.encoding); + this._encoding = options.encoding; + } + if (options.size) { + if (utils_1.isFiniteInteger(options.size) && options.size > 0) { + this._buff = Buffer.allocUnsafe(options.size); + } else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_SIZE); + } + } else if (options.buff) { + if (Buffer.isBuffer(options.buff)) { + this._buff = options.buff; + this.length = options.buff.length; + } else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_BUFFER); + } + } else { + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } + } else { + if (typeof options !== "undefined") { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_OBJECT); + } + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } } /** - * Decrypts the given text in 16-bytes blocks by using the given key and 32-bytes initialization vector - * @param cipherText {Buffer} - * @returns {Buffer} + * Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding. + * + * @param size { Number } The size of the internal Buffer. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } */ - decryptIge(cipherText) { - return Helpers.convertToLittle(this.ige.decrypt(cipherText)); + static fromSize(size, encoding) { + return new this({ + size, + encoding + }); } /** - * Encrypts the given text in 16-bytes blocks by using the given key and 32-bytes initialization vector - * @param plainText {Buffer} - * @returns {Buffer} + * Creates a new SmartBuffer instance with the provided Buffer and optional encoding. + * + * @param buffer { Buffer } The Buffer to use as the internal Buffer value. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } */ - encryptIge(plainText) { - const padding = plainText.length % 16; - if (padding) { - plainText = Buffer.concat([ - plainText, - Helpers.generateRandomBytes(16 - padding) - ]); - } - return Helpers.convertToLittle(this.ige.encrypt(plainText)); + static fromBuffer(buff, encoding) { + return new this({ + buff, + encoding + }); } - }; - exports2.IGE = IGENEW; - } -}); - -// node_modules/telegram/network/MTProtoState.js -var require_MTProtoState = __commonJS({ - "node_modules/telegram/network/MTProtoState.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MTProtoState = void 0; - var big_integer_1 = __importDefault2(require_BigInteger()); - var __1 = require_telegram(); - var tl_1 = require_tl(); - var Helpers_1 = require_Helpers(); - var core_1 = require_core(); - var extensions_1 = require_extensions(); - var IGE_1 = require_IGE(); - var errors_1 = require_errors(); - var MTProtoState = class { /** - * - `telethon.network.mtprotosender.MTProtoSender` needs to hold a state - in order to be able to encrypt and decrypt incoming/outgoing messages, - as well as generating the message IDs. Instances of this class hold - together all the required information. - - It doesn't make sense to use `telethon.sessions.abstract.Session` for - the sender because the sender should *not* be concerned about storing - this information to disk, as one may create as many senders as they - desire to any other data center, or some CDN. Using the same session - for all these is not a good idea as each need their own authkey, and - the concept of "copying" sessions with the unnecessary entities or - updates state for these connections doesn't make sense. - - While it would be possible to have a `MTProtoPlainState` that does no - encryption so that it was usable through the `MTProtoLayer` and thus - avoid the need for a `MTProtoPlainSender`, the `MTProtoLayer` is more - focused to efficiency and this state is also more advanced (since it - supports gzipping and invoking after other message IDs). There are too - many methods that would be needed to make it convenient to use for the - authentication process, at which point the `MTProtoPlainSender` is better - * @param authKey - * @param loggers - * @param securityChecks - */ - constructor(authKey, loggers, securityChecks = true) { - this.authKey = authKey; - this._log = loggers; - this.timeOffset = 0; - this.salt = big_integer_1.default.zero; - this._sequence = 0; - this.id = this._lastMsgId = big_integer_1.default.zero; - this.msgIds = []; - this.securityChecks = securityChecks; - this.reset(); + * Creates a new SmartBuffer instance with the provided SmartBufferOptions options. + * + * @param options { SmartBufferOptions } The options to use when creating the SmartBuffer instance. + */ + static fromOptions(options) { + return new this(options); + } + /** + * Type checking function that determines if an object is a SmartBufferOptions object. + */ + static isSmartBufferOptions(options) { + const castOptions = options; + return castOptions && (castOptions.encoding !== void 0 || castOptions.size !== void 0 || castOptions.buff !== void 0); + } + // Signed integers + /** + * Reads an Int8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt8(offset) { + return this._readNumberValue(Buffer.prototype.readInt8, 1, offset); + } + /** + * Reads an Int16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16BE, 2, offset); + } + /** + * Reads an Int16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16LE, 2, offset); + } + /** + * Reads an Int32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32BE, 4, offset); + } + /** + * Reads an Int32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32LE, 4, offset); + } + /** + * Reads a BigInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check("readBigInt64BE"); + return this._readNumberValue(Buffer.prototype.readBigInt64BE, 8, offset); + } + /** + * Reads a BigInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check("readBigInt64LE"); + return this._readNumberValue(Buffer.prototype.readBigInt64LE, 8, offset); + } + /** + * Writes an Int8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt8(value, offset) { + this._writeNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + return this; + } + /** + * Inserts an Int8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + } + /** + * Writes an Int16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + } + /** + * Inserts an Int16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); } /** - * Resets the state + * Writes an Int16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this */ - reset() { - this.id = __1.helpers.generateRandomLong(true); - this._sequence = 0; - this._lastMsgId = big_integer_1.default.zero; - this.msgIds = []; + writeInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); } /** - * Updates the message ID to a new one, - * used when the time offset changed. - * @param message + * Inserts an Int16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - updateMessageId(message) { - message.msgId = this._getNewMsgId(); + insertInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); } /** - * Calculate the key based on Telegram guidelines, specifying whether it's the client or not - * @param authKey - * @param msgKey - * @param client - * @returns {{iv: Buffer, key: Buffer}} + * Writes an Int32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this */ - async _calcKey(authKey, msgKey, client2) { - const x = client2 ? 0 : 8; - const [sha256a, sha256b] = await Promise.all([ - (0, Helpers_1.sha256)(Buffer.concat([msgKey, authKey.slice(x, x + 36)])), - (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(x + 40, x + 76), msgKey])) - ]); - const key2 = Buffer.concat([ - sha256a.slice(0, 8), - sha256b.slice(8, 24), - sha256a.slice(24, 32) - ]); - const iv = Buffer.concat([ - sha256b.slice(0, 8), - sha256a.slice(8, 24), - sha256b.slice(24, 32) - ]); - return { key: key2, iv }; + writeInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); } /** - * Writes a message containing the given data into buffer. - * Returns the message id. - * @param buffer - * @param data - * @param contentRelated - * @param afterId + * Inserts an Int32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - async writeDataAsMessage(buffer, data, contentRelated, afterId) { - const msgId = this._getNewMsgId(); - const seqNo = this._getSeqNo(contentRelated); - let body; - if (!afterId) { - body = await core_1.GZIPPacked.gzipIfSmaller(contentRelated, data); - } else { - body = await core_1.GZIPPacked.gzipIfSmaller(contentRelated, new tl_1.Api.InvokeAfterMsg({ - msgId: afterId, - query: { - getBytes() { - return data; - } - } - }).getBytes()); - } - const s = Buffer.alloc(4); - s.writeInt32LE(seqNo, 0); - const b = Buffer.alloc(4); - b.writeInt32LE(body.length, 0); - const m = (0, Helpers_1.toSignedLittleBuffer)(msgId, 8); - buffer.write(Buffer.concat([m, s, b])); - buffer.write(body); - return msgId; + insertInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); } /** - * Encrypts the given message data using the current authorization key - * following MTProto 2.0 guidelines core.telegram.org/mtproto/description. - * @param data + * Writes an Int32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this */ - async encryptMessageData(data) { - if (!this.authKey) { - throw new Error("Auth key unset"); - } - await this.authKey.waitForKey(); - const authKey = this.authKey.getKey(); - if (!authKey) { - throw new Error("Auth key unset"); - } - if (!this.salt || !this.id || !authKey || !this.authKey.keyId) { - throw new Error("Unset params"); - } - const s = (0, Helpers_1.toSignedLittleBuffer)(this.salt, 8); - const i = (0, Helpers_1.toSignedLittleBuffer)(this.id, 8); - data = Buffer.concat([Buffer.concat([s, i]), data]); - const padding = __1.helpers.generateRandomBytes(__1.helpers.mod(-(data.length + 12), 16) + 12); - const msgKeyLarge = await (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(88, 88 + 32), data, padding])); - const msgKey = msgKeyLarge.slice(8, 24); - const { iv, key: key2 } = await this._calcKey(authKey, msgKey, true); - const keyId = __1.helpers.readBufferFromBigInt(this.authKey.keyId, 8); - return Buffer.concat([ - keyId, - msgKey, - new IGE_1.IGE(key2, iv).encryptIge(Buffer.concat([data, padding])) - ]); + writeInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); } /** - * Inverse of `encrypt_message_data` for incoming server messages. - * @param body + * Inserts an Int32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - async decryptMessageData(body) { - if (!this.authKey) { - throw new Error("Auth key unset"); - } - if (body.length < 8) { - throw new errors_1.InvalidBufferError(body); - } - const keyId = __1.helpers.readBigIntFromBuffer(body.slice(0, 8)); - if (!this.authKey.keyId || keyId.neq(this.authKey.keyId)) { - throw new errors_1.SecurityError("Server replied with an invalid auth key"); - } - const authKey = this.authKey.getKey(); - if (!authKey) { - throw new errors_1.SecurityError("Unset AuthKey"); - } - const msgKey = body.slice(8, 24); - const { iv, key: key2 } = await this._calcKey(authKey, msgKey, false); - body = new IGE_1.IGE(key2, iv).decryptIge(body.slice(24)); - const ourKey = await (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(96, 96 + 32), body])); - if (!msgKey.equals(ourKey.slice(8, 24))) { - throw new errors_1.SecurityError("Received msg_key doesn't match with expected one"); - } - const reader = new extensions_1.BinaryReader(body); - reader.readLong(); - const serverId = reader.readLong(); - if (serverId.neq(this.id)) { - } - const remoteMsgId = reader.readLong(); - if (this.msgIds.includes(remoteMsgId.toString()) && this.securityChecks) { - throw new errors_1.SecurityError("Duplicate msgIds"); - } - if (this.msgIds.length > 500) { - this.msgIds.shift(); - } - this.msgIds.push(remoteMsgId.toString()); - const remoteSequence = reader.readInt(); - reader.readInt(); - const obj = reader.tgReadObject(); - return new core_1.TLMessage(remoteMsgId, remoteSequence, obj); + insertInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); } /** - * Generates a new unique message ID based on the current - * time (in ms) since epoch, applying a known time offset. - * @private + * Writes a BigInt64BE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this */ - _getNewMsgId() { - const now = (/* @__PURE__ */ new Date()).getTime() / 1e3 + this.timeOffset; - const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9); - let newMsgId = (0, big_integer_1.default)(Math.floor(now)).shiftLeft((0, big_integer_1.default)(32)).or((0, big_integer_1.default)(nanoseconds).shiftLeft((0, big_integer_1.default)(2))); - if (this._lastMsgId.greaterOrEquals(newMsgId)) { - newMsgId = this._lastMsgId.add((0, big_integer_1.default)(4)); - } - this._lastMsgId = newMsgId; - return newMsgId; + writeBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigInt64BE"); + return this._writeNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); } /** - * Updates the time offset to the correct - * one given a known valid message ID. - * @param correctMsgId {BigInteger} + * Inserts a BigInt64BE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - updateTimeOffset(correctMsgId) { - const bad = this._getNewMsgId(); - const old = this.timeOffset; - const now = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3); - const correct = correctMsgId.shiftRight((0, big_integer_1.default)(32)).toJSNumber(); - this.timeOffset = correct - now; - if (this.timeOffset !== old) { - this._lastMsgId = big_integer_1.default.zero; - this._log.debug(`Updated time offset (old offset ${old}, bad ${bad}, good ${correctMsgId}, new ${this.timeOffset})`); - } - return this.timeOffset; + insertBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigInt64BE"); + return this._insertNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); } /** - * Generates the next sequence number depending on whether - * it should be for a content-related query or not. - * @param contentRelated - * @private + * Writes a BigInt64LE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this */ - _getSeqNo(contentRelated) { - if (contentRelated) { - const result = this._sequence * 2 + 1; - this._sequence += 1; - return result; - } else { - return this._sequence * 2; - } + writeBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigInt64LE"); + return this._writeNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); } - }; - exports2.MTProtoState = MTProtoState; - } -}); - -// node_modules/telegram/network/MTProtoPlainSender.js -var require_MTProtoPlainSender = __commonJS({ - "node_modules/telegram/network/MTProtoPlainSender.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MTProtoPlainSender = void 0; - var big_integer_1 = __importDefault2(require_BigInteger()); - var MTProtoState_1 = require_MTProtoState(); - var Helpers_1 = require_Helpers(); - var errors_1 = require_errors(); - var extensions_1 = require_extensions(); - var MTProtoPlainSender = class { /** - * Initializes the MTProto plain sender. - * @param connection connection: the Connection to be used. - * @param loggers + * Inserts a Int64LE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - constructor(connection, loggers) { - this._state = new MTProtoState_1.MTProtoState(void 0, loggers); - this._connection = connection; + insertBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigInt64LE"); + return this._insertNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); } + // Unsigned Integers /** - * Sends and receives the result for the given request. - * @param request + * Reads an UInt8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } */ - async send(request) { - let body = request.getBytes(); - let msgId = this._state._getNewMsgId(); - const m = (0, Helpers_1.toSignedLittleBuffer)(msgId, 8); - const b = Buffer.alloc(4); - b.writeInt32LE(body.length, 0); - const res = Buffer.concat([ - Buffer.concat([Buffer.alloc(8), m, b]), - body - ]); - await this._connection.send(res); - body = await this._connection.recv(); - if (body.length < 8) { - throw new errors_1.InvalidBufferError(body); - } - const reader = new extensions_1.BinaryReader(body); - const authKeyId = reader.readLong(); - if (authKeyId.neq((0, big_integer_1.default)(0))) { - throw new Error("Bad authKeyId"); - } - msgId = reader.readLong(); - if (msgId.eq((0, big_integer_1.default)(0))) { - throw new Error("Bad msgId"); - } - const length = reader.readInt(); - if (length <= 0) { - throw new Error("Bad length"); - } - return reader.tgReadObject(); + readUInt8(offset) { + return this._readNumberValue(Buffer.prototype.readUInt8, 1, offset); } - }; - exports2.MTProtoPlainSender = MTProtoPlainSender; - } -}); - -// node_modules/telegram/crypto/Factorizator.js -var require_Factorizator = __commonJS({ - "node_modules/telegram/crypto/Factorizator.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Factorizator = void 0; - var big_integer_1 = __importDefault2(require_BigInteger()); - var Helpers_1 = require_Helpers(); - var Factorizator = class _Factorizator { /** - * Calculates the greatest common divisor - * @param a {BigInteger} - * @param b {BigInteger} - * @returns {BigInteger} + * Reads an UInt16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } */ - static gcd(a, b) { - while (b.neq(big_integer_1.default.zero)) { - const temp = b; - b = a.remainder(b); - a = temp; - } - return a; + readUInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16BE, 2, offset); } /** - * Factorizes the given number and returns both the divisor and the number divided by the divisor - * @param pq {BigInteger} - * @returns {{p: *, q: *}} + * Reads an UInt16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } */ - static factorize(pq) { - if (pq.remainder(2).equals(big_integer_1.default.zero)) { - return { p: (0, big_integer_1.default)(2), q: pq.divide((0, big_integer_1.default)(2)) }; - } - let y = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); - const c = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); - const m = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); - let g = big_integer_1.default.one; - let r = big_integer_1.default.one; - let q = big_integer_1.default.one; - let x = big_integer_1.default.zero; - let ys = big_integer_1.default.zero; - let k; - while (g.eq(big_integer_1.default.one)) { - x = y; - for (let i = 0; (0, big_integer_1.default)(i).lesser(r); i++) { - y = (0, Helpers_1.modExp)(y, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); - } - k = big_integer_1.default.zero; - while (k.lesser(r) && g.eq(big_integer_1.default.one)) { - ys = y; - const condition = big_integer_1.default.min(m, r.minus(k)); - for (let i = 0; (0, big_integer_1.default)(i).lesser(condition); i++) { - y = (0, Helpers_1.modExp)(y, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); - q = q.multiply(x.minus(y).abs()).remainder(pq); - } - g = _Factorizator.gcd(q, pq); - k = k.add(m); - } - r = r.multiply(2); - } - if (g.eq(pq)) { - while (true) { - ys = (0, Helpers_1.modExp)(ys, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); - g = _Factorizator.gcd(x.minus(ys).abs(), pq); - if (g.greater(1)) { - break; - } - } - } - const p = g; - q = pq.divide(g); - return p < q ? { p, q } : { p: q, q: p }; - } - }; - exports2.Factorizator = Factorizator; - } -}); - -// node_modules/telegram/crypto/RSA.js -var require_RSA = __commonJS({ - "node_modules/telegram/crypto/RSA.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __rest2 = exports2 && exports2.__rest || function(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._serverKeys = void 0; - exports2.encrypt = encrypt2; - var big_integer_1 = __importDefault2(require_BigInteger()); - var Helpers_1 = require_Helpers(); - var PUBLIC_KEYS = [ - { - fingerprint: (0, big_integer_1.default)("-3414540481677951611"), - n: (0, big_integer_1.default)("29379598170669337022986177149456128565388431120058863768162556424047512191330847455146576344487764408661701890505066208632169112269581063774293102577308490531282748465986139880977280302242772832972539403531316010870401287642763009136156734339538042419388722777357134487746169093539093850251243897188928735903389451772730245253062963384108812842079887538976360465290946139638691491496062099570836476454855996319192747663615955633778034897140982517446405334423701359108810182097749467210509584293428076654573384828809574217079944388301239431309115013843331317877374435868468779972014486325557807783825502498215169806323"), - e: 65537 - }, - { - fingerprint: (0, big_integer_1.default)("-5595554452916591101"), - n: (0, big_integer_1.default)("25342889448840415564971689590713473206898847759084779052582026594546022463853940585885215951168491965708222649399180603818074200620463776135424884632162512403163793083921641631564740959529419359595852941166848940585952337613333022396096584117954892216031229237302943701877588456738335398602461675225081791820393153757504952636234951323237820036543581047826906120927972487366805292115792231423684261262330394324750785450942589751755390156647751460719351439969059949569615302809050721500330239005077889855323917509948255722081644689442127297605422579707142646660768825302832201908302295573257427896031830742328565032949"), - e: 65537 + readUInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16LE, 2, offset); } - ]; - exports2._serverKeys = /* @__PURE__ */ new Map(); - PUBLIC_KEYS.forEach((_a3) => { - var { fingerprint } = _a3, keyInfo = __rest2(_a3, ["fingerprint"]); - exports2._serverKeys.set(fingerprint.toString(), keyInfo); - }); - async function encrypt2(fingerprint, data) { - const key2 = exports2._serverKeys.get(fingerprint.toString()); - if (!key2) { - return void 0; + /** + * Reads an UInt32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32BE, 4, offset); } - const rand = (0, Helpers_1.generateRandomBytes)(235 - data.length); - const toEncrypt = Buffer.concat([await (0, Helpers_1.sha1)(data), data, rand]); - const payload = (0, Helpers_1.readBigIntFromBuffer)(toEncrypt, false); - const encrypted = (0, Helpers_1.modExp)(payload, (0, big_integer_1.default)(key2.e), key2.n); - return (0, Helpers_1.readBufferFromBigInt)(encrypted, 256, false); - } - } -}); - -// node_modules/telegram/network/Authenticator.js -var require_Authenticator = __commonJS({ - "node_modules/telegram/network/Authenticator.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.doAuthentication = doAuthentication; - var Helpers_1 = require_Helpers(); - var tl_1 = require_tl(); - var errors_1 = require_errors(); - var Factorizator_1 = require_Factorizator(); - var RSA_1 = require_RSA(); - var IGE_1 = require_IGE(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var extensions_1 = require_extensions(); - var AuthKey_1 = require_AuthKey(); - var RETRIES = 20; - async function doAuthentication(sender, log) { - let bytes = (0, Helpers_1.generateRandomBytes)(16); - const nonce = (0, Helpers_1.readBigIntFromBuffer)(bytes, false, true); - const resPQ = await sender.send(new tl_1.Api.ReqPqMulti({ nonce })); - log.debug("Starting authKey generation step 1"); - if (!(resPQ instanceof tl_1.Api.ResPQ)) { - throw new errors_1.SecurityError(`Step 1 answer was ${resPQ}`); + /** + * Reads an UInt32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32LE, 4, offset); } - if (resPQ.nonce.neq(nonce)) { - throw new errors_1.SecurityError("Step 1 invalid nonce from server"); + /** + * Reads a BigUInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check("readBigUInt64BE"); + return this._readNumberValue(Buffer.prototype.readBigUInt64BE, 8, offset); } - const pq = (0, Helpers_1.readBigIntFromBuffer)(resPQ.pq, false, true); - log.debug("Finished authKey generation step 1"); - const { p, q } = Factorizator_1.Factorizator.factorize(pq); - const pBuffer = (0, Helpers_1.getByteArray)(p); - const qBuffer = (0, Helpers_1.getByteArray)(q); - bytes = (0, Helpers_1.generateRandomBytes)(32); - const newNonce = (0, Helpers_1.readBigIntFromBuffer)(bytes, true, true); - const pqInnerData = new tl_1.Api.PQInnerData({ - pq: (0, Helpers_1.getByteArray)(pq), - // unsigned - p: pBuffer, - q: qBuffer, - nonce: resPQ.nonce, - serverNonce: resPQ.serverNonce, - newNonce - }).getBytes(); - if (pqInnerData.length > 144) { - throw new errors_1.SecurityError("Step 1 invalid nonce from server"); + /** + * Reads a BigUInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check("readBigUInt64LE"); + return this._readNumberValue(Buffer.prototype.readBigUInt64LE, 8, offset); } - let targetFingerprint; - let targetKey; - for (const fingerprint of resPQ.serverPublicKeyFingerprints) { - targetKey = RSA_1._serverKeys.get(fingerprint.toString()); - if (targetKey !== void 0) { - targetFingerprint = fingerprint; - break; - } + /** + * Writes an UInt8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt8(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); } - if (targetFingerprint === void 0 || targetKey === void 0) { - throw new errors_1.SecurityError("Step 2 could not find a valid key for fingerprints"); + /** + * Inserts an UInt8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); } - const padding = (0, Helpers_1.generateRandomBytes)(192 - pqInnerData.length); - const dataWithPadding = Buffer.concat([pqInnerData, padding]); - const dataPadReversed = Buffer.from(dataWithPadding).reverse(); - let encryptedData; - for (let i = 0; i < RETRIES; i++) { - const tempKey = (0, Helpers_1.generateRandomBytes)(32); - const shaDigestKeyWithData = await (0, Helpers_1.sha256)(Buffer.concat([tempKey, dataWithPadding])); - const dataWithHash = Buffer.concat([ - dataPadReversed, - shaDigestKeyWithData - ]); - const ige2 = new IGE_1.IGE(tempKey, Buffer.alloc(32)); - const aesEncrypted = ige2.encryptIge(dataWithHash); - const tempKeyXor = (0, Helpers_1.bufferXor)(tempKey, await (0, Helpers_1.sha256)(aesEncrypted)); - const keyAesEncrypted = Buffer.concat([tempKeyXor, aesEncrypted]); - const keyAesEncryptedInt = (0, Helpers_1.readBigIntFromBuffer)(keyAesEncrypted, false, false); - if (keyAesEncryptedInt.greaterOrEquals(targetKey.n)) { - log.debug("Aes key greater than RSA. retrying"); - continue; - } - const encryptedDataBuffer = (0, Helpers_1.modExp)(keyAesEncryptedInt, (0, big_integer_1.default)(targetKey.e), targetKey.n); - encryptedData = (0, Helpers_1.readBufferFromBigInt)(encryptedDataBuffer, 256, false, false); - break; + /** + * Writes an UInt16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); } - if (encryptedData === void 0) { - throw new errors_1.SecurityError("Step 2 could create a secure encrypted key"); + /** + * Inserts an UInt16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); } - log.debug("Step 2 : Generated a secure aes encrypted data"); - const serverDhParams = await sender.send(new tl_1.Api.ReqDHParams({ - nonce: resPQ.nonce, - serverNonce: resPQ.serverNonce, - p: pBuffer, - q: qBuffer, - publicKeyFingerprint: targetFingerprint, - encryptedData - })); - if (!(serverDhParams instanceof tl_1.Api.ServerDHParamsOk || serverDhParams instanceof tl_1.Api.ServerDHParamsFail)) { - throw new Error(`Step 2.1 answer was ${serverDhParams}`); + /** + * Writes an UInt16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); } - if (serverDhParams.nonce.neq(resPQ.nonce)) { - throw new errors_1.SecurityError("Step 2 invalid nonce from server"); + /** + * Inserts an UInt16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); } - if (serverDhParams.serverNonce.neq(resPQ.serverNonce)) { - throw new errors_1.SecurityError("Step 2 invalid server nonce from server"); + /** + * Writes an UInt32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); } - if (serverDhParams instanceof tl_1.Api.ServerDHParamsFail) { - const sh = await (0, Helpers_1.sha1)((0, Helpers_1.toSignedLittleBuffer)(newNonce, 32).slice(4, 20)); - const nnh = (0, Helpers_1.readBigIntFromBuffer)(sh, true, true); - if (serverDhParams.newNonceHash.neq(nnh)) { - throw new errors_1.SecurityError("Step 2 invalid DH fail nonce from server"); - } + /** + * Inserts an UInt32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); } - if (!(serverDhParams instanceof tl_1.Api.ServerDHParamsOk)) { - throw new Error(`Step 2.2 answer was ${serverDhParams}`); + /** + * Writes an UInt32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); } - log.debug("Finished authKey generation step 2"); - log.debug("Starting authKey generation step 3"); - const { key: key2, iv } = await (0, Helpers_1.generateKeyDataFromNonce)(resPQ.serverNonce, newNonce); - if (serverDhParams.encryptedAnswer.length % 16 !== 0) { - throw new errors_1.SecurityError("Step 3 AES block size mismatch"); + /** + * Inserts an UInt32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); } - const ige = new IGE_1.IGE(key2, iv); - const plainTextAnswer = ige.decryptIge(serverDhParams.encryptedAnswer); - const reader = new extensions_1.BinaryReader(plainTextAnswer); - reader.read(20); - const serverDhInner = reader.tgReadObject(); - if (!(serverDhInner instanceof tl_1.Api.ServerDHInnerData)) { - throw new Error(`Step 3 answer was ${serverDhInner}`); + /** + * Writes a BigUInt64BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigUInt64BE"); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); } - if (serverDhInner.nonce.neq(resPQ.nonce)) { - throw new errors_1.SecurityError("Step 3 Invalid nonce in encrypted answer"); + /** + * Inserts a BigUInt64BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigUInt64BE"); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); } - if (serverDhInner.serverNonce.neq(resPQ.serverNonce)) { - throw new errors_1.SecurityError("Step 3 Invalid server nonce in encrypted answer"); + /** + * Writes a BigUInt64LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigUInt64LE"); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); } - const dhPrime = (0, Helpers_1.readBigIntFromBuffer)(serverDhInner.dhPrime, false, false); - const ga = (0, Helpers_1.readBigIntFromBuffer)(serverDhInner.gA, false, false); - const timeOffset = serverDhInner.serverTime - Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3); - const b = (0, Helpers_1.readBigIntFromBuffer)((0, Helpers_1.generateRandomBytes)(256), false, false); - const gb = (0, Helpers_1.modExp)((0, big_integer_1.default)(serverDhInner.g), b, dhPrime); - const gab = (0, Helpers_1.modExp)(ga, b, dhPrime); - const clientDhInner = new tl_1.Api.ClientDHInnerData({ - nonce: resPQ.nonce, - serverNonce: resPQ.serverNonce, - retryId: big_integer_1.default.zero, - // TODO Actual retry ID - gB: (0, Helpers_1.getByteArray)(gb, false) - }).getBytes(); - const clientDdhInnerHashed = Buffer.concat([ - await (0, Helpers_1.sha1)(clientDhInner), - clientDhInner - ]); - const clientDhEncrypted = ige.encryptIge(clientDdhInnerHashed); - const dhGen = await sender.send(new tl_1.Api.SetClientDHParams({ - nonce: resPQ.nonce, - serverNonce: resPQ.serverNonce, - encryptedData: clientDhEncrypted - })); - const nonceTypes = [tl_1.Api.DhGenOk, tl_1.Api.DhGenRetry, tl_1.Api.DhGenFail]; - const nonceTypesString = ["DhGenOk", "DhGenRetry", "DhGenFail"]; - if (!(dhGen instanceof nonceTypes[0] || dhGen instanceof nonceTypes[1] || dhGen instanceof nonceTypes[2])) { - throw new Error(`Step 3.1 answer was ${dhGen}`); + /** + * Inserts a BigUInt64LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check("writeBigUInt64LE"); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); } - const { name } = dhGen.constructor; - if (dhGen.nonce.neq(resPQ.nonce)) { - throw new errors_1.SecurityError(`Step 3 invalid ${name} nonce from server`); + // Floating Point + /** + * Reads an FloatBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatBE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatBE, 4, offset); } - if (dhGen.serverNonce.neq(resPQ.serverNonce)) { - throw new errors_1.SecurityError(`Step 3 invalid ${name} server nonce from server`); + /** + * Reads an FloatLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatLE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatLE, 4, offset); } - const authKey = new AuthKey_1.AuthKey(); - await authKey.setKey((0, Helpers_1.getByteArray)(gab)); - const nonceNumber = 1 + nonceTypesString.indexOf(dhGen.className); - const newNonceHash = await authKey.calcNewNonceHash(newNonce, nonceNumber); - const dhHash = dhGen[`newNonceHash${nonceNumber}`]; - if (dhHash.neq(newNonceHash)) { - throw new errors_1.SecurityError("Step 3 invalid new nonce hash"); + /** + * Writes a FloatBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); } - if (!(dhGen instanceof tl_1.Api.DhGenOk)) { - throw new Error(`Step 3.2 answer was ${dhGen}`); + /** + * Inserts a FloatBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); } - log.debug("Finished authKey generation step 3"); - return { authKey, timeOffset }; - } - } -}); - -// node_modules/telegram/extensions/PendingState.js -var require_PendingState = __commonJS({ - "node_modules/telegram/extensions/PendingState.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PendingState = void 0; - var PendingState = class { - constructor() { - this._pending = /* @__PURE__ */ new Map(); + /** + * Writes a FloatLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); } - set(msgId, state) { - this._pending.set(msgId.toString(), state); + /** + * Inserts a FloatLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); } - get(msgId) { - return this._pending.get(msgId.toString()); + // Double Floating Point + /** + * Reads an DoublEBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleBE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleBE, 8, offset); } - getAndDelete(msgId) { - const state = this.get(msgId); - this.delete(msgId); - return state; + /** + * Reads an DoubleLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleLE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleLE, 8, offset); } - values() { - return Array.from(this._pending.values()); + /** + * Writes a DoubleBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); } - delete(msgId) { - this._pending.delete(msgId.toString()); + /** + * Inserts a DoubleBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertDoubleBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); } - clear() { - this._pending.clear(); + /** + * Writes a DoubleLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); } - }; - exports2.PendingState = PendingState; - } -}); - -// node_modules/telegram/network/MTProtoSender.js -var require_MTProtoSender = __commonJS({ - "node_modules/telegram/network/MTProtoSender.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MTProtoSender = void 0; - var AuthKey_1 = require_AuthKey(); - var MTProtoState_1 = require_MTProtoState(); - var extensions_1 = require_extensions(); - var core_1 = require_core(); - var tl_1 = require_tl(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var Helpers_1 = require_Helpers(); - var RequestState_1 = require_RequestState(); - var Authenticator_1 = require_Authenticator(); - var MTProtoPlainSender_1 = require_MTProtoPlainSender(); - var errors_1 = require_errors(); - var _1 = require_network(); - var Logger_1 = require_Logger(); - var async_mutex_1 = require_lib12(); - var PendingState_1 = require_PendingState(); - var MsgsAck = tl_1.Api.MsgsAck; - var MTProtoSender = class _MTProtoSender { /** - * @param authKey - * @param opts + * Inserts a DoubleLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this */ - constructor(authKey, opts) { - this._exportedSenderPromises = /* @__PURE__ */ new Map(); - const args = Object.assign(Object.assign({}, _MTProtoSender.DEFAULT_OPTIONS), opts); - this._finishedConnecting = false; - this._cancelSend = false; - this._connection = void 0; - this._log = args.logger; - this._dcId = args.dcId; - this._retries = args.retries; - this._currentRetries = 0; - this._reconnectRetries = args.reconnectRetries; - this._delay = args.delay; - this._autoReconnect = args.autoReconnect; - this._connectTimeout = args.connectTimeout; - this._authKeyCallback = args.authKeyCallback; - this._updateCallback = args.updateCallback; - this._autoReconnectCallback = args.autoReconnectCallback; - this._isMainSender = args.isMainSender; - this._senderCallback = args.senderCallback; - this._client = args.client; - this._onConnectionBreak = args.onConnectionBreak; - this._securityChecks = args.securityChecks; - this._connectMutex = new async_mutex_1.Mutex(); - this._exportedSenderPromises = args._exportedSenderPromises; - this.userDisconnected = false; - this.isConnecting = false; - this._authenticated = false; - this._userConnected = false; - this.isReconnecting = false; - this._reconnecting = false; - this._disconnected = true; - this._sendLoopHandle = null; - this._recvLoopHandle = null; - this.authKey = authKey || new AuthKey_1.AuthKey(); - this._state = new MTProtoState_1.MTProtoState(this.authKey, this._log, this._securityChecks); - this._sendQueue = new extensions_1.MessagePacker(this._state, this._log); - this._pendingState = new PendingState_1.PendingState(); - this._pendingAck = /* @__PURE__ */ new Set(); - this._lastAcks = []; - this._handlers = { - [core_1.RPCResult.CONSTRUCTOR_ID.toString()]: this._handleRPCResult.bind(this), - [core_1.MessageContainer.CONSTRUCTOR_ID.toString()]: this._handleContainer.bind(this), - [core_1.GZIPPacked.CONSTRUCTOR_ID.toString()]: this._handleGzipPacked.bind(this), - [tl_1.Api.Pong.CONSTRUCTOR_ID.toString()]: this._handlePong.bind(this), - [tl_1.Api.BadServerSalt.CONSTRUCTOR_ID.toString()]: this._handleBadServerSalt.bind(this), - [tl_1.Api.BadMsgNotification.CONSTRUCTOR_ID.toString()]: this._handleBadNotification.bind(this), - [tl_1.Api.MsgDetailedInfo.CONSTRUCTOR_ID.toString()]: this._handleDetailedInfo.bind(this), - [tl_1.Api.MsgNewDetailedInfo.CONSTRUCTOR_ID.toString()]: this._handleNewDetailedInfo.bind(this), - [tl_1.Api.NewSessionCreated.CONSTRUCTOR_ID.toString()]: this._handleNewSessionCreated.bind(this), - [tl_1.Api.MsgsAck.CONSTRUCTOR_ID.toString()]: this._handleAck.bind(this), - [tl_1.Api.FutureSalts.CONSTRUCTOR_ID.toString()]: this._handleFutureSalts.bind(this), - [tl_1.Api.MsgsStateReq.CONSTRUCTOR_ID.toString()]: this._handleStateForgotten.bind(this), - [tl_1.Api.MsgResendReq.CONSTRUCTOR_ID.toString()]: this._handleStateForgotten.bind(this), - [tl_1.Api.MsgsAllInfo.CONSTRUCTOR_ID.toString()]: this._handleMsgAll.bind(this) - }; + insertDoubleLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); } - set dcId(dcId) { - this._dcId = dcId; + // Strings + /** + * Reads a String from the current read position. + * + * @param arg1 { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for + * the string (Defaults to instance level encoding). + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readString(arg1, encoding) { + let lengthVal; + if (typeof arg1 === "number") { + utils_1.checkLengthValue(arg1); + lengthVal = Math.min(arg1, this.length - this._readOffset); + } else { + encoding = arg1; + lengthVal = this.length - this._readOffset; + } + if (typeof encoding !== "undefined") { + utils_1.checkEncoding(encoding); + } + const value = this._buff.slice(this._readOffset, this._readOffset + lengthVal).toString(encoding || this._encoding); + this._readOffset += lengthVal; + return value; } - get dcId() { - return this._dcId; + /** + * Inserts a String + * + * @param value { String } The String value to insert. + * @param offset { Number } The offset to insert the string at. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertString(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + return this._handleString(value, true, offset, encoding); } - // Public API /** - * Connects to the specified given connection using the given auth key. + * Writes a String + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this */ - async connect(connection, force) { - this.userDisconnected = false; - if (this._userConnected && !force) { - this._log.info("User is already connected!"); - return false; + writeString(value, arg2, encoding) { + return this._handleString(value, false, arg2, encoding); + } + /** + * Reads a null-terminated String from the current read position. + * + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readStringNT(encoding) { + if (typeof encoding !== "undefined") { + utils_1.checkEncoding(encoding); } - this.isConnecting = true; - this._connection = connection; - this._finishedConnecting = false; - for (let attempt = 0; attempt < this._retries; attempt++) { - try { - await this._connect(); - if (this._updateCallback) { - this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.connected)); - } - this._finishedConnecting = true; + let nullPos = this.length; + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0) { + nullPos = i; break; - } catch (err) { - if (this._updateCallback && attempt === 0) { - this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.disconnected)); - } - this._log.error(`WebSocket connection failed attempt: ${attempt + 1}`); - if (this._client._errorHandler) { - await this._client._errorHandler(err); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(err); - } - await (0, Helpers_1.sleep)(this._delay); } } - this.isConnecting = false; - return this._finishedConnecting; + const value = this._buff.slice(this._readOffset, nullPos); + this._readOffset = nullPos + 1; + return value.toString(encoding || this._encoding); } - isConnected() { - return this._userConnected; + /** + * Inserts a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertStringNT(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + this.insertString(value, offset, encoding); + this.insertUInt8(0, offset + value.length); + return this; } - _transportConnected() { - return !this._reconnecting && this._connection && this._connection._connected; + /** + * Writes a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + writeStringNT(value, arg2, encoding) { + this.writeString(value, arg2, encoding); + this.writeUInt8(0, typeof arg2 === "number" ? arg2 + value.length : this.writeOffset); + return this; } + // Buffers /** - * Cleanly disconnects the instance from the network, cancels - * all pending requests, and closes the send and receive loops. + * Reads a Buffer from the internal read position. + * + * @param length { Number } The length of data to read as a Buffer. + * + * @return { Buffer } */ - async disconnect() { - this.userDisconnected = true; - this._log.warn("Disconnecting..."); - await this._disconnect(); + readBuffer(length) { + if (typeof length !== "undefined") { + utils_1.checkLengthValue(length); + } + const lengthVal = typeof length === "number" ? length : this.length; + const endPoint = Math.min(this.length, this._readOffset + lengthVal); + const value = this._buff.slice(this._readOffset, endPoint); + this._readOffset = endPoint; + return value; } /** - * - This method enqueues the given request to be sent. Its send - state will be saved until a response arrives, and a ``Future`` - that will be resolved when the response arrives will be returned: - - .. code-block:: javascript - - async def method(): - # Sending (enqueued for the send loop) - future = sender.send(request) - # Receiving (waits for the receive loop to read the result) - result = await future - - Designed like this because Telegram may send the response at - any point, and it can send other items while one waits for it. - Once the response for this future arrives, it is set with the - received result, quite similar to how a ``receive()`` call - would otherwise work. - - Since the receiving part is "built in" the future, it's - impossible to await receive a result that was never sent. - * @param request - * @returns {RequestState} - */ - send(request) { - const state = new RequestState_1.RequestState(request); - this._log.debug(`Send ${request.className}`); - this._sendQueue.append(state); - return state.promise; + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBuffer(value, offset) { + utils_1.checkOffsetValue(offset); + return this._handleBuffer(value, true, offset); } - addStateToQueue(state) { - this._sendQueue.append(state); + /** + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBuffer(value, offset) { + return this._handleBuffer(value, false, offset); } /** - * Performs the actual connection, retrying, generating the - * authorization key if necessary, and starting the send and - * receive loops. - * @returns {Promise<void>} - * @private + * Reads a null-terminated Buffer from the current read poisiton. + * + * @return { Buffer } */ - async _connect() { - const connection = this._connection; - if (!connection.isConnected()) { - this._log.info("Connecting to {0}...".replace("{0}", connection.toString())); - await connection.connect(); - this._log.debug("Connection success!"); - } - if (!this.authKey.getKey()) { - const plain = new MTProtoPlainSender_1.MTProtoPlainSender(connection, this._log); - this._log.debug("New auth_key attempt ..."); - const res = await (0, Authenticator_1.doAuthentication)(plain, this._log); - this._log.debug("Generated new auth_key successfully"); - await this.authKey.setKey(res.authKey); - this._state.timeOffset = res.timeOffset; - if (this._authKeyCallback) { - await this._authKeyCallback(this.authKey, this._dcId); + readBufferNT() { + let nullPos = this.length; + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0) { + nullPos = i; + break; } - } else { - this._authenticated = true; - this._log.debug("Already have an auth key ..."); - } - this._userConnected = true; - this.isReconnecting = false; - if (!this._sendLoopHandle) { - this._log.debug("Starting send loop"); - this._sendLoopHandle = this._sendLoop(); - } - if (!this._recvLoopHandle) { - this._log.debug("Starting receive loop"); - this._recvLoopHandle = this._recvLoop(); } - this._log.info("Connection to %s complete!".replace("%s", connection.toString())); + const value = this._buff.slice(this._readOffset, nullPos); + this._readOffset = nullPos + 1; + return value; } - async _disconnect() { - const connection = this._connection; - if (this._updateCallback) { - this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.disconnected)); - } - if (connection === void 0) { - this._log.info("Not disconnecting (already have no connection)"); - return; + /** + * Inserts a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBufferNT(value, offset) { + utils_1.checkOffsetValue(offset); + this.insertBuffer(value, offset); + this.insertUInt8(0, offset + value.length); + return this; + } + /** + * Writes a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBufferNT(value, offset) { + if (typeof offset !== "undefined") { + utils_1.checkOffsetValue(offset); } - this._log.info("Disconnecting from %s...".replace("%s", connection.toString())); - this._userConnected = false; - this._log.debug("Closing current connection..."); - await connection.disconnect(); + this.writeBuffer(value, offset); + this.writeUInt8(0, typeof offset === "number" ? offset + value.length : this._writeOffset); + return this; } - _cancelLoops() { - this._cancelSend = true; - this.cancellableRecvLoopPromise.cancel(); + /** + * Clears the SmartBuffer instance to its original empty state. + */ + clear() { + this._writeOffset = 0; + this._readOffset = 0; + this.length = 0; + return this; } /** - * This loop is responsible for popping items off the send - * queue, encrypting them, and sending them over the network. - * Besides `connect`, only this method ever sends data. - * @returns {Promise<void>} - * @private + * Gets the remaining data left to be read from the SmartBuffer instance. + * + * @return { Number } */ - async _sendLoop() { - this._sendQueue.prepend(this._pendingState.values()); - this._pendingState.clear(); - while (this._userConnected && !this.isReconnecting) { - const appendAcks = () => { - if (this._pendingAck.size) { - const ack = new RequestState_1.RequestState(new MsgsAck({ msgIds: Array(...this._pendingAck) })); - this._sendQueue.append(ack); - this._lastAcks.push(ack); - if (this._lastAcks.length >= 10) { - this._lastAcks.shift(); - } - this._pendingAck.clear(); - } - }; - appendAcks(); - this._log.debug(`Waiting for messages to send... ${this.isReconnecting}`); - await this._sendQueue.wait(); - appendAcks(); - const res = await this._sendQueue.get(); - this._log.debug(`Got ${res === null || res === void 0 ? void 0 : res.batch.length} message(s) to send`); - if (this.isReconnecting) { - this._log.debug("Reconnecting"); - this._sendLoopHandle = void 0; - return; - } - if (!res) { - continue; - } - let { data } = res; - const { batch } = res; - this._log.debug(`Encrypting ${batch.length} message(s) in ${data.length} bytes for sending`); - this._log.debug(`Sending ${batch.map((m) => m.request.className)}`); - data = await this._state.encryptMessageData(data); - for (const state of batch) { - if (!Array.isArray(state)) { - if (state.request.classType === "request") { - this._pendingState.set(state.msgId, state); - } - } else { - for (const s of state) { - if (s.request.classType === "request") { - this._pendingState.set(s.msgId, s); - } - } - } - } - try { - await this._connection.send(data); - } catch (e) { - if (!this.userDisconnected) { - this._log.debug(`Connection closed while sending data ${e}`); - if (this._log.canSend(Logger_1.LogLevel.DEBUG)) { - console.error(e); - } - this.reconnect(); - } - this._sendLoopHandle = void 0; - return; - } - this._log.debug("Encrypted messages put in a queue to be sent"); - } - this._sendLoopHandle = void 0; + remaining() { + return this.length - this._readOffset; } - async _recvLoop() { - let body; - let message; - while (this._userConnected && !this.isReconnecting) { - this._log.debug("Receiving items from the network..."); - try { - body = await this._connection.recv(); - } catch (e) { - if (this._currentRetries > this._reconnectRetries) { - for (const state of this._pendingState.values()) { - state.reject("Maximum reconnection retries reached. Aborting!"); - } - this.userDisconnected = true; - return; - } - if (!this.userDisconnected) { - this._log.warn("Connection closed while receiving data"); - if (this._log.canSend(Logger_1.LogLevel.WARN)) { - console.error(e); - } - this.reconnect(); - } - this._recvLoopHandle = void 0; - return; - } - try { - message = await this._state.decryptMessageData(body); - } catch (e) { - this._log.debug(`Error while receiving items from the network ${e}`); - if (e instanceof errors_1.TypeNotFoundError) { - this._log.info(`Type ${e.invalidConstructorId} not found, remaining data ${e.remaining}`); - continue; - } else if (e instanceof errors_1.SecurityError) { - this._log.warn(`Security error while unpacking a received message: ${e}`); - continue; - } else if (e instanceof errors_1.InvalidBufferError) { - if (e.code === 404) { - this._handleBadAuthKey(); - } else { - this._log.warn(`Invalid buffer ${e.code} for dc ${this._dcId}`); - this.reconnect(); - } - this._recvLoopHandle = void 0; - return; - } else { - this._log.error("Unhandled error while receiving data"); - if (this._client._errorHandler) { - await this._client._errorHandler(e); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.log(e); - } - this.reconnect(); - this._recvLoopHandle = void 0; - return; - } - } - try { - await this._processMessage(message); - } catch (e) { - if (e instanceof errors_1.RPCError) { - if (e.message === "AUTH_KEY_UNREGISTERED" || e.message === "SESSION_REVOKED") { - this._handleBadAuthKey(true); - } - } else { - this._log.error("Unhandled error while receiving data"); - if (this._client._errorHandler) { - await this._client._errorHandler(e); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.log(e); - } - } - } - this._currentRetries = 0; - } - this._recvLoopHandle = void 0; + /** + * Gets the current read offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get readOffset() { + return this._readOffset; } - // Response Handlers - _handleBadAuthKey(shouldSkipForMain = false) { - if (shouldSkipForMain && this._isMainSender) { - return; - } - this._log.warn(`Broken authorization key for dc ${this._dcId}, resetting...`); - if (this._isMainSender && this._updateCallback) { - this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.broken)); - } else if (!this._isMainSender && this._onConnectionBreak) { - this._onConnectionBreak(this._dcId); - } + /** + * Sets the read offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set readOffset(offset) { + utils_1.checkOffsetValue(offset); + utils_1.checkTargetOffset(offset, this); + this._readOffset = offset; + } + /** + * Gets the current write offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get writeOffset() { + return this._writeOffset; + } + /** + * Sets the write offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set writeOffset(offset) { + utils_1.checkOffsetValue(offset); + utils_1.checkTargetOffset(offset, this); + this._writeOffset = offset; + } + /** + * Gets the currently set string encoding of the SmartBuffer instance. + * + * @return { BufferEncoding } The string Buffer encoding currently set. + */ + get encoding() { + return this._encoding; + } + /** + * Sets the string encoding of the SmartBuffer instance. + * + * @param encoding { BufferEncoding } The string Buffer encoding to set. + */ + set encoding(encoding) { + utils_1.checkEncoding(encoding); + this._encoding = encoding; + } + /** + * Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer) + * + * @return { Buffer } The Buffer value. + */ + get internalBuffer() { + return this._buff; + } + /** + * Gets the value of the internal managed Buffer (Includes managed data only) + * + * @param { Buffer } + */ + toBuffer() { + return this._buff.slice(0, this.length); } /** - * Adds the given message to the list of messages that must be - * acknowledged and dispatches control to different ``_handle_*`` - * method based on its type. - * @param message - * @returns {Promise<void>} - * @private + * Gets the String value of the internal managed Buffer + * + * @param encoding { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding). */ - async _processMessage(message) { - this._pendingAck.add(message.msgId); - message.obj = await message.obj; - let handler4 = this._handlers[message.obj.CONSTRUCTOR_ID.toString()]; - if (!handler4) { - handler4 = this._handleUpdate.bind(this); - } - await handler4(message); + toString(encoding) { + const encodingVal = typeof encoding === "string" ? encoding : this._encoding; + utils_1.checkEncoding(encodingVal); + return this._buff.toString(encodingVal, 0, this.length); } /** - * Pops the states known to match the given ID from pending messages. - * This method should be used when the response isn't specific. - * @param msgId - * @returns {*[]} - * @private + * Destroys the SmartBuffer instance. */ - _popStates(msgId) { - var _a3; - const state = this._pendingState.getAndDelete(msgId); - if (state) { - return [state]; + destroy() { + this.clear(); + return this; + } + /** + * Handles inserting and writing strings. + * + * @param value { String } The String value to insert. + * @param isInsert { Boolean } True if inserting a string, false if writing. + * @param arg2 { Number | String } The offset to insert the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + */ + _handleString(value, isInsert, arg3, encoding) { + let offsetVal = this._writeOffset; + let encodingVal = this._encoding; + if (typeof arg3 === "number") { + offsetVal = arg3; + } else if (typeof arg3 === "string") { + utils_1.checkEncoding(arg3); + encodingVal = arg3; } - const toPop = []; - for (const pendingState of this._pendingState.values()) { - if ((_a3 = pendingState.containerId) === null || _a3 === void 0 ? void 0 : _a3.equals(msgId)) { - toPop.push(pendingState.msgId); - } + if (typeof encoding === "string") { + utils_1.checkEncoding(encoding); + encodingVal = encoding; } - if (toPop.length) { - const temp = []; - for (const x of toPop) { - temp.push(this._pendingState.getAndDelete(x)); - } - return temp; + const byteLength = Buffer.byteLength(value, encodingVal); + if (isInsert) { + this.ensureInsertable(byteLength, offsetVal); + } else { + this._ensureWriteable(byteLength, offsetVal); } - for (const ack of this._lastAcks) { - if (ack.msgId === msgId) { - return [ack]; + this._buff.write(value, offsetVal, byteLength, encodingVal); + if (isInsert) { + this._writeOffset += byteLength; + } else { + if (typeof arg3 === "number") { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteLength); + } else { + this._writeOffset += byteLength; } } - return []; + return this; } /** - * Handles the result for Remote Procedure Calls: - * rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult; - * This is where the future results for sent requests are set. - * @param message - * @returns {Promise<void>} - * @private + * Handles writing or insert of a Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. */ - _handleRPCResult(message) { - const result = message.obj; - const state = this._pendingState.getAndDelete(result.reqMsgId); - this._log.debug(`Handling RPC result for message ${result.reqMsgId}`); - if (!state) { - try { - const reader = new extensions_1.BinaryReader(result.body); - if (!(reader.tgReadObject() instanceof tl_1.Api.upload.File)) { - throw new errors_1.TypeNotFoundError(0, Buffer.alloc(0)); - } - } catch (e) { - if (e instanceof errors_1.TypeNotFoundError) { - this._log.info(`Received response without parent request: ${result.body}`); - return; - } - throw e; - } - return; + _handleBuffer(value, isInsert, offset) { + const offsetVal = typeof offset === "number" ? offset : this._writeOffset; + if (isInsert) { + this.ensureInsertable(value.length, offsetVal); + } else { + this._ensureWriteable(value.length, offsetVal); } - if (result.error) { - const error = (0, errors_1.RPCMessageToError)(result.error, state.request); - this._sendQueue.append(new RequestState_1.RequestState(new MsgsAck({ msgIds: [state.msgId] }))); - state.reject(error); - throw error; + value.copy(this._buff, offsetVal); + if (isInsert) { + this._writeOffset += value.length; } else { - try { - const reader = new extensions_1.BinaryReader(result.body); - const read = state.request.readResult(reader); - this._log.debug(`Handling RPC result ${read === null || read === void 0 ? void 0 : read.className}`); - state.resolve(read); - } catch (err) { - state.reject(err); - throw err; + if (typeof offset === "number") { + this._writeOffset = Math.max(this._writeOffset, offsetVal + value.length); + } else { + this._writeOffset += value.length; } } + return this; } /** - * Processes the inner messages of a container with many of them: - * msg_container#73f1f8dc messages:vector<%Message> = MessageContainer; - * @param message - * @returns {Promise<void>} - * @private + * Ensures that the internal Buffer is large enough to read data. + * + * @param length { Number } The length of the data that needs to be read. + * @param offset { Number } The offset of the data that needs to be read. */ - async _handleContainer(message) { - this._log.debug("Handling container"); - for (const innerMessage of message.obj.messages) { - await this._processMessage(innerMessage); + ensureReadable(length, offset) { + let offsetVal = this._readOffset; + if (typeof offset !== "undefined") { + utils_1.checkOffsetValue(offset); + offsetVal = offset; + } + if (offsetVal < 0 || offsetVal + length > this.length) { + throw new Error(utils_1.ERRORS.INVALID_READ_BEYOND_BOUNDS); } } /** - * Unpacks the data from a gzipped object and processes it: - * gzip_packed#3072cfa1 packed_data:bytes = Object; - * @param message - * @returns {Promise<void>} - * @private + * Ensures that the internal Buffer is large enough to insert data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written. */ - async _handleGzipPacked(message) { - this._log.debug("Handling gzipped data"); - const reader = new extensions_1.BinaryReader(message.obj.data); - message.obj = reader.tgReadObject(); - await this._processMessage(message); - } - async _handleUpdate(message) { - if (message.obj.SUBCLASS_OF_ID !== 2331323052) { - this._log.warn(`Note: ${message.obj.className} is not an update, not dispatching it`); - return; + ensureInsertable(dataLength, offset) { + utils_1.checkOffsetValue(offset); + this._ensureCapacity(this.length + dataLength); + if (offset < this.length) { + this._buff.copy(this._buff, offset + dataLength, offset, this._buff.length); } - this._log.debug("Handling update " + message.obj.className); - if (this._updateCallback) { - this._updateCallback(this._client, message.obj); + if (offset + dataLength > this.length) { + this.length = offset + dataLength; + } else { + this.length += dataLength; } } /** - * Handles pong results, which don't come inside a ``RPCResult`` - * but are still sent through a request: - * pong#347773c5 msg_id:long ping_id:long = Pong; - * @param message - * @returns {Promise<void>} - * @private + * Ensures that the internal Buffer is large enough to write data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written (defaults to writeOffset). */ - async _handlePong(message) { - const pong = message.obj; - this._log.debug(`Handling pong for message ${pong.msgId}`); - const state = this._pendingState.get(pong.msgId.toString()); - this._pendingState.delete(pong.msgId.toString()); - if (state) { - state.resolve(pong); + _ensureWriteable(dataLength, offset) { + const offsetVal = typeof offset === "number" ? offset : this._writeOffset; + this._ensureCapacity(offsetVal + dataLength); + if (offsetVal + dataLength > this.length) { + this.length = offsetVal + dataLength; } } /** - * Corrects the currently used server salt to use the right value - * before enqueuing the rejected message to be re-sent: - * bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int - * error_code:int new_server_salt:long = BadMsgNotification; - * @param message - * @returns {Promise<void>} - * @private - */ - async _handleBadServerSalt(message) { - const badSalt = message.obj; - this._log.debug(`Handling bad salt for message ${badSalt.badMsgId}`); - this._state.salt = badSalt.newServerSalt; - const states = this._popStates(badSalt.badMsgId); - this._sendQueue.extend(states); - this._log.debug(`${states.length} message(s) will be resent`); - } - /** - * Adjusts the current state to be correct based on the - * received bad message notification whenever possible: - * bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int - * error_code:int = BadMsgNotification; - * @param message - * @returns {Promise<void>} - * @private + * Ensures that the internal Buffer is large enough to write at least the given amount of data. + * + * @param minLength { Number } The minimum length of the data needs to be written. */ - async _handleBadNotification(message) { - const badMsg = message.obj; - const states = this._popStates(badMsg.badMsgId); - this._log.debug(`Handling bad msg ${JSON.stringify(badMsg)}`); - if ([16, 17].includes(badMsg.errorCode)) { - const to = this._state.updateTimeOffset((0, big_integer_1.default)(message.msgId)); - this._log.info(`System clock is wrong, set time offset to ${to}s`); - } else if (badMsg.errorCode === 32) { - this._state._sequence += 64; - } else if (badMsg.errorCode === 33) { - this._state._sequence -= 16; - } else { - for (const state of states) { - state.reject(new errors_1.BadMessageError(state.request, badMsg.errorCode)); + _ensureCapacity(minLength) { + const oldLength = this._buff.length; + if (minLength > oldLength) { + let data = this._buff; + let newLength = oldLength * 3 / 2 + 1; + if (newLength < minLength) { + newLength = minLength; } - return; + this._buff = Buffer.allocUnsafe(newLength); + data.copy(this._buff, 0, 0, oldLength); } - this._sendQueue.extend(states); - this._log.debug(`${states.length} messages will be resent due to bad msg`); - } - /** - * Updates the current status with the received detailed information: - * msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long - * bytes:int status:int = MsgDetailedInfo; - * @param message - * @returns {Promise<void>} - * @private - */ - async _handleDetailedInfo(message) { - const msgId = message.obj.answerMsgId; - this._log.debug(`Handling detailed info for message ${msgId}`); - this._pendingAck.add(msgId); - } - /** - * Updates the current status with the received detailed information: - * msg_new_detailed_info#809db6df answer_msg_id:long - * bytes:int status:int = MsgDetailedInfo; - * @param message - * @returns {Promise<void>} - * @private - */ - async _handleNewDetailedInfo(message) { - const msgId = message.obj.answerMsgId; - this._log.debug(`Handling new detailed info for message ${msgId}`); - this._pendingAck.add(msgId); - } - /** - * Updates the current status with the received session information: - * new_session_created#9ec20908 first_msg_id:long unique_id:long - * server_salt:long = NewSession; - * @param message - * @returns {Promise<void>} - * @private - */ - async _handleNewSessionCreated(message) { - this._log.debug("Handling new session created"); - this._state.salt = message.obj.serverSalt; - } - /** - * Handles a server acknowledge about our messages. Normally these can be ignored - */ - _handleAck() { } /** - * Handles future salt results, which don't come inside a - * ``rpc_result`` but are still sent through a request: - * future_salts#ae500895 req_msg_id:long now:int - * salts:vector<future_salt> = FutureSalts; - * @param message - * @returns {Promise<void>} - * @private + * Reads a numeric number value using the provided function. + * + * @typeparam T { number | bigint } The type of the value to be read + * + * @param func { Function(offset: number) => number } The function to read data on the internal Buffer with. + * @param byteSize { Number } The number of bytes read. + * @param offset { Number } The offset to read from (optional). When this is not provided, the managed readOffset is used instead. + * + * @returns { T } the number value */ - async _handleFutureSalts(message) { - this._log.debug(`Handling future salts for message ${message.msgId}`); - const state = this._pendingState.getAndDelete(message.msgId); - if (state) { - state.resolve(message.obj); + _readNumberValue(func, byteSize, offset) { + this.ensureReadable(byteSize, offset); + const value = func.call(this._buff, typeof offset === "number" ? offset : this._readOffset); + if (typeof offset === "undefined") { + this._readOffset += byteSize; } + return value; } /** - * Handles both :tl:`MsgsStateReq` and :tl:`MsgResendReq` by - * enqueuing a :tl:`MsgsStateInfo` to be sent at a later point. - * @param message - * @returns {Promise<void>} - * @private + * Inserts a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer */ - async _handleStateForgotten(message) { - this._sendQueue.append(new RequestState_1.RequestState(new tl_1.Api.MsgsStateInfo({ - reqMsgId: message.msgId, - info: String.fromCharCode(1).repeat(message.obj.msgIds) - }))); + _insertNumberValue(func, byteSize, value, offset) { + utils_1.checkOffsetValue(offset); + this.ensureInsertable(byteSize, offset); + func.call(this._buff, value, offset); + this._writeOffset += byteSize; + return this; } /** - * Handles :tl:`MsgsAllInfo` by doing nothing (yet). - * @param message - * @returns {Promise<void>} - * @private + * Writes a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer */ - async _handleMsgAll(message) { - } - reconnect() { - if (this._userConnected && !this.isReconnecting) { - this.isReconnecting = true; - this._currentRetries++; - if (this._isMainSender) { - this._log.debug("Reconnecting all senders"); - for (const promise of this._exportedSenderPromises.values()) { - promise.then((sender) => { - if (sender && !sender._isMainSender) { - sender.reconnect(); - } - }).catch((error) => { - this._log.warn("Error getting sender to reconnect to"); - }); - } - } - (0, Helpers_1.sleep)(1e3).then(() => { - this._log.info("Started reconnecting"); - this._reconnect(); - }); - } - } - async _reconnect() { - try { - this._log.warn("[Reconnect] Closing current connection..."); - await this._disconnect(); - } catch (err) { - this._log.warn("Error happened while disconnecting"); - if (this._client._errorHandler) { - await this._client._errorHandler(err); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(err); - } - } - this._log.debug(`Adding ${this._sendQueue._pendingStates.length} old request to resend`); - for (let i = 0; i < this._sendQueue._pendingStates.length; i++) { - if (this._sendQueue._pendingStates[i].msgId != void 0) { - this._pendingState.set(this._sendQueue._pendingStates[i].msgId, this._sendQueue._pendingStates[i]); + _writeNumberValue(func, byteSize, value, offset) { + if (typeof offset === "number") { + if (offset < 0) { + throw new Error(utils_1.ERRORS.INVALID_WRITE_BEYOND_BOUNDS); } + utils_1.checkOffsetValue(offset); } - this._sendQueue.clear(); - this._state.reset(); - const connection = this._connection; - const newConnection = new connection.constructor({ - ip: connection._ip, - port: connection._port, - dcId: connection._dcId, - loggers: connection._log, - proxy: connection._proxy, - testServers: connection._testServers, - socket: this._client.networkSocket - }); - await this.connect(newConnection, true); - this.isReconnecting = false; - this._sendQueue.prepend(this._pendingState.values()); - this._pendingState.clear(); - if (this._autoReconnectCallback) { - await this._autoReconnectCallback(); + const offsetVal = typeof offset === "number" ? offset : this._writeOffset; + this._ensureWriteable(byteSize, offsetVal); + func.call(this._buff, value, offsetVal); + if (typeof offset === "number") { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteSize); + } else { + this._writeOffset += byteSize; } + return this; + } + }; + exports2.SmartBuffer = SmartBuffer; + } +}); + +// node_modules/socks/build/common/constants.js +var require_constants3 = __commonJS({ + "node_modules/socks/build/common/constants.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SOCKS5_NO_ACCEPTABLE_AUTH = exports2.SOCKS5_CUSTOM_AUTH_END = exports2.SOCKS5_CUSTOM_AUTH_START = exports2.SOCKS_INCOMING_PACKET_SIZES = exports2.SocksClientState = exports2.Socks5Response = exports2.Socks5HostType = exports2.Socks5Auth = exports2.Socks4Response = exports2.SocksCommand = exports2.ERRORS = exports2.DEFAULT_TIMEOUT = void 0; + var DEFAULT_TIMEOUT = 3e4; + exports2.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; + var ERRORS2 = { + InvalidSocksCommand: "An invalid SOCKS command was provided. Valid options are connect, bind, and associate.", + InvalidSocksCommandForOperation: "An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.", + InvalidSocksCommandChain: "An invalid SOCKS command was provided. Chaining currently only supports the connect command.", + InvalidSocksClientOptionsDestination: "An invalid destination host was provided.", + InvalidSocksClientOptionsExistingSocket: "An invalid existing socket was provided. This should be an instance of stream.Duplex.", + InvalidSocksClientOptionsProxy: "Invalid SOCKS proxy details were provided.", + InvalidSocksClientOptionsTimeout: "An invalid timeout value was provided. Please enter a value above 0 (in ms).", + InvalidSocksClientOptionsProxiesLength: "At least two socks proxies must be provided for chaining.", + InvalidSocksClientOptionsCustomAuthRange: "Custom auth must be a value between 0x80 and 0xFE.", + InvalidSocksClientOptionsCustomAuthOptions: "When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.", + NegotiationError: "Negotiation error", + SocketClosed: "Socket closed", + ProxyConnectionTimedOut: "Proxy connection timed out", + InternalError: "SocksClient internal error (this should not happen)", + InvalidSocks4HandshakeResponse: "Received invalid Socks4 handshake response", + Socks4ProxyRejectedConnection: "Socks4 Proxy rejected connection", + InvalidSocks4IncomingConnectionResponse: "Socks4 invalid incoming connection response", + Socks4ProxyRejectedIncomingBoundConnection: "Socks4 Proxy rejected incoming bound connection", + InvalidSocks5InitialHandshakeResponse: "Received invalid Socks5 initial handshake response", + InvalidSocks5IntiailHandshakeSocksVersion: "Received invalid Socks5 initial handshake (invalid socks version)", + InvalidSocks5InitialHandshakeNoAcceptedAuthType: "Received invalid Socks5 initial handshake (no accepted authentication type)", + InvalidSocks5InitialHandshakeUnknownAuthType: "Received invalid Socks5 initial handshake (unknown authentication type)", + Socks5AuthenticationFailed: "Socks5 Authentication failed", + InvalidSocks5FinalHandshake: "Received invalid Socks5 final handshake response", + InvalidSocks5FinalHandshakeRejected: "Socks5 proxy rejected connection", + InvalidSocks5IncomingConnectionResponse: "Received invalid Socks5 incoming connection response", + Socks5ProxyRejectedIncomingBoundConnection: "Socks5 Proxy rejected incoming bound connection" + }; + exports2.ERRORS = ERRORS2; + var SOCKS_INCOMING_PACKET_SIZES = { + Socks5InitialHandshakeResponse: 2, + Socks5UserPassAuthenticationResponse: 2, + // Command response + incoming connection (bind) + Socks5ResponseHeader: 5, + // We need at least 5 to read the hostname length, then we wait for the address+port information. + Socks5ResponseIPv4: 10, + // 4 header + 4 ip + 2 port + Socks5ResponseIPv6: 22, + // 4 header + 16 ip + 2 port + Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, + // 4 header + 1 host length + host + 2 port + // Command response + incoming connection (bind) + Socks4Response: 8 + // 2 header + 2 port + 4 ip + }; + exports2.SOCKS_INCOMING_PACKET_SIZES = SOCKS_INCOMING_PACKET_SIZES; + var SocksCommand; + (function(SocksCommand2) { + SocksCommand2[SocksCommand2["connect"] = 1] = "connect"; + SocksCommand2[SocksCommand2["bind"] = 2] = "bind"; + SocksCommand2[SocksCommand2["associate"] = 3] = "associate"; + })(SocksCommand || (exports2.SocksCommand = SocksCommand = {})); + var Socks4Response; + (function(Socks4Response2) { + Socks4Response2[Socks4Response2["Granted"] = 90] = "Granted"; + Socks4Response2[Socks4Response2["Failed"] = 91] = "Failed"; + Socks4Response2[Socks4Response2["Rejected"] = 92] = "Rejected"; + Socks4Response2[Socks4Response2["RejectedIdent"] = 93] = "RejectedIdent"; + })(Socks4Response || (exports2.Socks4Response = Socks4Response = {})); + var Socks5Auth; + (function(Socks5Auth2) { + Socks5Auth2[Socks5Auth2["NoAuth"] = 0] = "NoAuth"; + Socks5Auth2[Socks5Auth2["GSSApi"] = 1] = "GSSApi"; + Socks5Auth2[Socks5Auth2["UserPass"] = 2] = "UserPass"; + })(Socks5Auth || (exports2.Socks5Auth = Socks5Auth = {})); + var SOCKS5_CUSTOM_AUTH_START = 128; + exports2.SOCKS5_CUSTOM_AUTH_START = SOCKS5_CUSTOM_AUTH_START; + var SOCKS5_CUSTOM_AUTH_END = 254; + exports2.SOCKS5_CUSTOM_AUTH_END = SOCKS5_CUSTOM_AUTH_END; + var SOCKS5_NO_ACCEPTABLE_AUTH = 255; + exports2.SOCKS5_NO_ACCEPTABLE_AUTH = SOCKS5_NO_ACCEPTABLE_AUTH; + var Socks5Response; + (function(Socks5Response2) { + Socks5Response2[Socks5Response2["Granted"] = 0] = "Granted"; + Socks5Response2[Socks5Response2["Failure"] = 1] = "Failure"; + Socks5Response2[Socks5Response2["NotAllowed"] = 2] = "NotAllowed"; + Socks5Response2[Socks5Response2["NetworkUnreachable"] = 3] = "NetworkUnreachable"; + Socks5Response2[Socks5Response2["HostUnreachable"] = 4] = "HostUnreachable"; + Socks5Response2[Socks5Response2["ConnectionRefused"] = 5] = "ConnectionRefused"; + Socks5Response2[Socks5Response2["TTLExpired"] = 6] = "TTLExpired"; + Socks5Response2[Socks5Response2["CommandNotSupported"] = 7] = "CommandNotSupported"; + Socks5Response2[Socks5Response2["AddressNotSupported"] = 8] = "AddressNotSupported"; + })(Socks5Response || (exports2.Socks5Response = Socks5Response = {})); + var Socks5HostType; + (function(Socks5HostType2) { + Socks5HostType2[Socks5HostType2["IPv4"] = 1] = "IPv4"; + Socks5HostType2[Socks5HostType2["Hostname"] = 3] = "Hostname"; + Socks5HostType2[Socks5HostType2["IPv6"] = 4] = "IPv6"; + })(Socks5HostType || (exports2.Socks5HostType = Socks5HostType = {})); + var SocksClientState; + (function(SocksClientState2) { + SocksClientState2[SocksClientState2["Created"] = 0] = "Created"; + SocksClientState2[SocksClientState2["Connecting"] = 1] = "Connecting"; + SocksClientState2[SocksClientState2["Connected"] = 2] = "Connected"; + SocksClientState2[SocksClientState2["SentInitialHandshake"] = 3] = "SentInitialHandshake"; + SocksClientState2[SocksClientState2["ReceivedInitialHandshakeResponse"] = 4] = "ReceivedInitialHandshakeResponse"; + SocksClientState2[SocksClientState2["SentAuthentication"] = 5] = "SentAuthentication"; + SocksClientState2[SocksClientState2["ReceivedAuthenticationResponse"] = 6] = "ReceivedAuthenticationResponse"; + SocksClientState2[SocksClientState2["SentFinalHandshake"] = 7] = "SentFinalHandshake"; + SocksClientState2[SocksClientState2["ReceivedFinalResponse"] = 8] = "ReceivedFinalResponse"; + SocksClientState2[SocksClientState2["BoundWaitingForConnection"] = 9] = "BoundWaitingForConnection"; + SocksClientState2[SocksClientState2["Established"] = 10] = "Established"; + SocksClientState2[SocksClientState2["Disconnected"] = 11] = "Disconnected"; + SocksClientState2[SocksClientState2["Error"] = 99] = "Error"; + })(SocksClientState || (exports2.SocksClientState = SocksClientState = {})); + } +}); + +// node_modules/socks/build/common/util.js +var require_util = __commonJS({ + "node_modules/socks/build/common/util.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SocksClientError = void 0; + exports2.shuffleArray = shuffleArray; + var SocksClientError = class extends Error { + constructor(message, options) { + super(message); + this.options = options; } }; - exports2.MTProtoSender = MTProtoSender; - MTProtoSender.DEFAULT_OPTIONS = { - logger: null, - reconnectRetries: Infinity, - retries: Infinity, - delay: 2e3, - autoReconnect: true, - connectTimeout: null, - authKeyCallback: null, - updateCallback: null, - autoReconnectCallback: null, - isMainSender: null, - senderCallback: null, - onConnectionBreak: void 0, - securityChecks: true - }; + exports2.SocksClientError = SocksClientError; + function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + } } }); -// node_modules/telegram/network/index.js -var require_network = __commonJS({ - "node_modules/telegram/network/index.js"(exports2) { +// node_modules/ip-address/dist/address-error.js +var require_address_error = __commonJS({ + "node_modules/ip-address/dist/address-error.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPObfuscated = exports2.ConnectionTCPAbridged = exports2.ConnectionTCPFull = exports2.Connection = exports2.UpdateConnectionState = exports2.MTProtoSender = exports2.doAuthentication = exports2.MTProtoPlainSender = void 0; - var MTProtoPlainSender_1 = require_MTProtoPlainSender(); - Object.defineProperty(exports2, "MTProtoPlainSender", { enumerable: true, get: function() { - return MTProtoPlainSender_1.MTProtoPlainSender; - } }); - var Authenticator_1 = require_Authenticator(); - Object.defineProperty(exports2, "doAuthentication", { enumerable: true, get: function() { - return Authenticator_1.doAuthentication; - } }); - var MTProtoSender_1 = require_MTProtoSender(); - Object.defineProperty(exports2, "MTProtoSender", { enumerable: true, get: function() { - return MTProtoSender_1.MTProtoSender; - } }); - var UpdateConnectionState = class { - constructor(state) { - this.state = state; + exports2.AddressError = void 0; + var AddressError = class extends Error { + constructor(message, parseMessage) { + super(message); + this.name = "AddressError"; + this.parseMessage = parseMessage; } }; - exports2.UpdateConnectionState = UpdateConnectionState; - UpdateConnectionState.disconnected = -1; - UpdateConnectionState.connected = 1; - UpdateConnectionState.broken = 0; - var connection_1 = require_connection(); - Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { - return connection_1.Connection; - } }); - Object.defineProperty(exports2, "ConnectionTCPFull", { enumerable: true, get: function() { - return connection_1.ConnectionTCPFull; - } }); - Object.defineProperty(exports2, "ConnectionTCPAbridged", { enumerable: true, get: function() { - return connection_1.ConnectionTCPAbridged; - } }); - Object.defineProperty(exports2, "ConnectionTCPObfuscated", { enumerable: true, get: function() { - return connection_1.ConnectionTCPObfuscated; - } }); + exports2.AddressError = AddressError; } }); -// node_modules/telegram/network/connection/TCPMTProxy.js -var require_TCPMTProxy = __commonJS({ - "node_modules/telegram/network/connection/TCPMTProxy.js"(exports2) { +// node_modules/ip-address/dist/common.js +var require_common2 = __commonJS({ + "node_modules/ip-address/dist/common.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConnectionTCPMTProxyAbridged = exports2.TCPMTProxy = void 0; - var Connection_1 = require_Connection(); - var TCPAbridged_1 = require_TCPAbridged(); - var Helpers_1 = require_Helpers(); - var CTR_1 = require_CTR(); - var MTProxyIO = class { - constructor(connection) { - this.header = void 0; - this.connection = connection.socket; - this._packetClass = connection.PacketCodecClass; - this._secret = connection._secret; - this._dcId = connection._dcId; + exports2.isInSubnet = isInSubnet; + exports2.isHostInSubnet = isHostInSubnet; + exports2.isGloballyReachable = isGloballyReachable; + exports2.offsetBigInt = offsetBigInt; + exports2.isCorrect = isCorrect; + exports2.prefixLengthFromMask = prefixLengthFromMask; + exports2.assertByteArray = assertByteArray; + exports2.numberToPaddedHex = numberToPaddedHex; + exports2.stringToPaddedHex = stringToPaddedHex; + exports2.testBit = testBit; + var address_error_1 = require_address_error(); + function isInSubnet(address) { + if (this.subnetMask < address.subnetMask) { + return false; } - async initHeader() { - let secret = this._secret; - const isDD = secret.length == 17 && secret[0] == 221; - secret = isDD ? secret.slice(1) : secret; - if (secret.length != 16) { - throw new Error("MTProxy secret must be a hex-string representing 16 bytes"); - } - const keywords = [ - Buffer.from("50567247", "hex"), - Buffer.from("474554", "hex"), - Buffer.from("504f5354", "hex"), - Buffer.from("eeeeeeee", "hex") - ]; - let random; - while (true) { - random = (0, Helpers_1.generateRandomBytes)(64); - if (random[0] !== 239 && !random.slice(4, 8).equals(Buffer.alloc(4))) { - let ok = true; - for (const key2 of keywords) { - if (key2.equals(random.slice(0, 4))) { - ok = false; - break; - } - } - if (ok) { - break; - } - } + return isHostInSubnet.call(this, address); + } + function isHostInSubnet(address) { + if (this.binaryZeroPad().length !== address.binaryZeroPad().length) { + return false; + } + return this.mask(address.subnetMask) === address.mask(); + } + function isGloballyReachable(entries) { + let best = null; + for (let i = 0; i < entries.length; i++) { + const entry = entries[i]; + if (entry.reachable !== null && isHostInSubnet.call(this, entry.subnet) && (best === null || entry.subnet.subnetMask > best.subnet.subnetMask)) { + best = entry; } - random = random.toJSON().data; - const randomReversed = Buffer.from(random.slice(8, 56)).reverse(); - const encryptKey = await (0, Helpers_1.sha256)(Buffer.concat([Buffer.from(random.slice(8, 40)), secret])); - const encryptIv = Buffer.from(random.slice(40, 56)); - const decryptKey = await (0, Helpers_1.sha256)(Buffer.concat([Buffer.from(randomReversed.slice(0, 32)), secret])); - const decryptIv = Buffer.from(randomReversed.slice(32, 48)); - const encryptor = new CTR_1.CTR(encryptKey, encryptIv); - const decryptor = new CTR_1.CTR(decryptKey, decryptIv); - random = Buffer.concat([ - Buffer.from(random.slice(0, 56)), - this._packetClass.obfuscateTag, - Buffer.from(random.slice(60)) - ]); - const dcIdBytes = Buffer.alloc(2); - dcIdBytes.writeInt8(this._dcId, 0); - random = Buffer.concat([ - Buffer.from(random.slice(0, 60)), - dcIdBytes, - Buffer.from(random.slice(62)) - ]); - random = Buffer.concat([ - Buffer.from(random.slice(0, 56)), - Buffer.from(encryptor.encrypt(random).slice(56, 64)), - Buffer.from(random.slice(64)) - ]); - this.header = random; - this._encrypt = encryptor; - this._decrypt = decryptor; } - async read(n) { - const data = await this.connection.readExactly(n); - return this._decrypt.encrypt(data); + return best === null ? true : best.reachable; + } + function offsetBigInt(value, n, bits, family) { + if (typeof n === "number" && !Number.isSafeInteger(n)) { + throw new address_error_1.AddressError(`${family} offset must be an integer`); } - write(data) { - this.connection.write(this._encrypt.encrypt(data)); + if (typeof n !== "number" && typeof n !== "bigint") { + throw new address_error_1.AddressError(`${family} offset must be an integer`); } - }; - var TCPMTProxy = class extends Connection_1.ObfuscatedConnection { - constructor({ ip, port, dcId, loggers, proxy, socket, testServers }) { - super({ - ip: proxy.ip, - port: proxy.port, - dcId, - loggers, - socket, - proxy, - testServers - }); - this.ObfuscatedIO = MTProxyIO; - if (!("MTProxy" in proxy)) { - throw new Error("This connection only supports MPTProxies"); + const result = value + BigInt(n); + if (result < BigInt(0) || result > (BigInt(1) << BigInt(bits)) - BigInt(1)) { + throw new address_error_1.AddressError(`${family} offset leaves the address space`); + } + return result; + } + function isCorrect(defaultBits) { + return function isCorrectForm() { + if (this.addressMinusSuffix !== this.correctForm()) { + return false; } - if (!proxy.secret) { - throw new Error("You need to provide the secret for the MTProxy"); + if (this.subnetMask === defaultBits && !this.parsedSubnet) { + return true; } - if (proxy.secret && proxy.secret.match(/^[0-9a-f]+$/i)) { - this._secret = Buffer.from(proxy.secret, "hex"); - } else { - this._secret = Buffer.from(proxy.secret, "base64"); + return this.parsedSubnet === String(this.subnetMask); + }; + } + function prefixLengthFromMask(value, totalBits) { + const binary = value.toString(2).padStart(totalBits, "0"); + if (binary.length > totalBits) { + throw new address_error_1.AddressError("Invalid subnet mask."); + } + const firstZero = binary.indexOf("0"); + if (firstZero === -1) { + return totalBits; + } + if (binary.slice(firstZero).includes("1")) { + throw new address_error_1.AddressError("Invalid subnet mask."); + } + return firstZero; + } + function assertByteArray(bytes, byteCount, family, minimum) { + if (bytes.length !== byteCount) { + throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`); + } + for (let i = 0; i < bytes.length; i++) { + if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) { + throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`); } } - }; - exports2.TCPMTProxy = TCPMTProxy; - var ConnectionTCPMTProxyAbridged = class extends TCPMTProxy { - constructor() { - super(...arguments); - this.PacketCodecClass = TCPAbridged_1.AbridgedPacketCodec; + } + function numberToPaddedHex(number) { + return number.toString(16).padStart(2, "0"); + } + function stringToPaddedHex(numberString) { + return numberToPaddedHex(parseInt(numberString, 10)); + } + function testBit(binaryValue, position) { + const { length } = binaryValue; + if (position >= length) { + return false; } - }; - exports2.ConnectionTCPMTProxyAbridged = ConnectionTCPMTProxyAbridged; + const positionInString = length - position - 1; + return binaryValue.substring(positionInString, positionInString + 1) === "1"; + } } }); -// node_modules/telegram/client/telegramBaseClient.js -var require_telegramBaseClient = __commonJS({ - "node_modules/telegram/client/telegramBaseClient.js"(exports2) { +// node_modules/ip-address/dist/v4/constants.js +var require_constants4 = __commonJS({ + "node_modules/ip-address/dist/v4/constants.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TelegramBaseClient = void 0; - var __1 = require_telegram(); - var Helpers_1 = require_Helpers(); - var connection_1 = require_connection(); - var sessions_1 = require_sessions(); - var extensions_1 = require_extensions(); - var tl_1 = require_tl(); - var os_1 = __importDefault2(require_os()); - var entityCache_1 = require_entityCache(); - var markdown_1 = require_markdown(); - var network_1 = require_network(); - var AllTLObjects_1 = require_AllTLObjects(); - var TCPMTProxy_1 = require_TCPMTProxy(); - var async_mutex_1 = require_lib12(); - var Logger_1 = require_Logger(); - var platform_1 = require_platform(); - var Deferred_1 = __importDefault2(require_Deferred()); - var EXPORTED_SENDER_RECONNECT_TIMEOUT = 1e3; - var EXPORTED_SENDER_RELEASE_TIMEOUT = 3e4; - var DEFAULT_DC_ID = 4; - var DEFAULT_IPV4_IP = platform_1.isNode ? "149.154.167.91" : "vesta.web.telegram.org"; - var DEFAULT_IPV6_IP = "2001:067c:04e8:f004:0000:0000:0000:000a"; - var clientParamsDefault = { - connection: platform_1.isNode ? connection_1.ConnectionTCPFull : connection_1.ConnectionTCPObfuscated, - networkSocket: platform_1.isNode ? extensions_1.PromisedNetSockets : extensions_1.PromisedWebSockets, - useIPV6: false, - timeout: 10, - requestRetries: 5, - connectionRetries: Infinity, - retryDelay: 1e3, - downloadRetries: 5, - autoReconnect: true, - sequentialUpdates: false, - floodSleepThreshold: 60, - deviceModel: "", - systemVersion: "", - appVersion: "", - langCode: "en", - systemLangCode: "en", - _securityChecks: true, - useWSS: platform_1.isBrowser ? window.location.protocol == "https:" : false, - testServers: false + exports2.SPECIAL_PURPOSE = exports2.RE_SUBNET_STRING = exports2.RE_ADDRESS = exports2.GROUPS = exports2.BITS = void 0; + exports2.BITS = 32; + exports2.GROUPS = 4; + exports2.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g; + exports2.RE_SUBNET_STRING = /\/\d{1,2}$/; + exports2.SPECIAL_PURPOSE = [ + ["0.0.0.0/8", "This network", false], + ["0.0.0.0/32", "This host on this network", false], + ["10.0.0.0/8", "Private-Use", false], + ["100.64.0.0/10", "Shared Address Space", false], + ["127.0.0.0/8", "Loopback", false], + ["169.254.0.0/16", "Link Local", false], + ["172.16.0.0/12", "Private-Use", false], + ["192.0.0.0/24", "IETF Protocol Assignments", false], + ["192.0.0.0/29", "IPv4 Service Continuity Prefix", false], + ["192.0.0.8/32", "IPv4 dummy address", false], + ["192.0.0.9/32", "Port Control Protocol Anycast", true], + ["192.0.0.10/32", "Traversal Using Relays around NAT Anycast", true], + ["192.0.0.170/32", "NAT64/DNS64 Discovery", false], + ["192.0.0.171/32", "NAT64/DNS64 Discovery", false], + ["192.0.2.0/24", "Documentation (TEST-NET-1)", false], + ["192.31.196.0/24", "AS112-v4", true], + ["192.52.193.0/24", "AMT", true], + ["192.88.99.0/24", "Deprecated (6to4 Relay Anycast)", null], + ["192.88.99.2/32", "6a44-relay anycast address", false], + ["192.168.0.0/16", "Private-Use", false], + ["192.175.48.0/24", "Direct Delegation AS112 Service", true], + ["198.18.0.0/15", "Benchmarking", false], + ["198.51.100.0/24", "Documentation (TEST-NET-2)", false], + ["203.0.113.0/24", "Documentation (TEST-NET-3)", false], + ["240.0.0.0/4", "Reserved", false], + ["255.255.255.255/32", "Limited Broadcast", false] + ]; + } +}); + +// node_modules/ip-address/dist/ipv4.js +var require_ipv4 = __commonJS({ + "node_modules/ip-address/dist/ipv4.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; }; - var TelegramBaseClient = class { - constructor(session2, apiId, apiHash, clientParams) { - this.__version__ = __1.version; - this._ALBUMS = /* @__PURE__ */ new Map(); - this._exportedSenderPromises = /* @__PURE__ */ new Map(); - this._exportedSenderReleaseTimeouts = /* @__PURE__ */ new Map(); - clientParams = Object.assign(Object.assign({}, clientParamsDefault), clientParams); - if (!apiId || !apiHash) { - throw new Error("Your API ID or Hash cannot be empty or undefined"); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Address4 = void 0; + var common = __importStar2(require_common2()); + var constants = __importStar2(require_constants4()); + var address_error_1 = require_address_error(); + var isCorrect4 = common.isCorrect(constants.BITS); + var Address4 = class _Address4 { + constructor(address) { + this.addressMinusSuffix = ""; + this.groups = constants.GROUPS; + this.parsedAddress = []; + this.parsedSubnet = ""; + this.subnet = "/32"; + this.subnetMask = 32; + this.v4 = true; + this.isCorrect = isCorrect4; + this.isInSubnet = common.isInSubnet; + this.isHostInSubnet = common.isHostInSubnet; + this.address = address; + const subnet = constants.RE_SUBNET_STRING.exec(address); + if (subnet) { + this.parsedSubnet = subnet[0].replace("/", ""); + this.subnetMask = parseInt(this.parsedSubnet, 10); + this.subnet = `/${this.subnetMask}`; + if (this.subnetMask < 0 || this.subnetMask > constants.BITS) { + throw new address_error_1.AddressError("Invalid subnet mask."); + } + address = address.replace(constants.RE_SUBNET_STRING, ""); + } + const longest = constants.GROUPS * 4 - 1; + if (address.length > longest) { + throw new address_error_1.AddressError(`IPv4 addresses are at most ${longest} characters.`); + } + this.addressMinusSuffix = address; + this.parsedAddress = this.parse(address); + } + /** + * Returns true if the given string is a valid IPv4 address (with optional + * CIDR subnet), false otherwise. Host bits in the subnet portion are + * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address + * validation compare `correctForm()` to `startAddress().correctForm()`, + * or use `networkForm()`. + */ + static isValid(address) { + try { + new _Address4(address); + return true; + } catch { + return false; + } + } + /** + * Parses an IPv4 address string into its four octet groups and stores the + * result on `this.parsedAddress`. Called automatically by the constructor; + * you typically don't need to call it directly. Throws `AddressError` if + * the input is not a valid IPv4 address. + */ + parse(address) { + const groups = address.split("."); + if (groups.some((group) => /^0\d/.test(group))) { + throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes."); + } + if (!address.match(constants.RE_ADDRESS)) { + throw new address_error_1.AddressError("Invalid IPv4 address."); + } + return groups; + } + /** + * Returns the address in correct form: octets joined with `.` and any + * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the + * canonical dotted-decimal representation. + */ + correctForm() { + return this.parsedAddress.map((part) => parseInt(part, 10)).join("."); + } + /** + * Construct an `Address4` from an address and a dotted-decimal subnet + * mask given as separate strings (e.g. as returned by Node's + * `os.networkInterfaces()`). Throws `AddressError` if the mask is + * non-contiguous (e.g. `255.0.255.0`). + * @example + * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0'); + * address.subnetMask; // 24 + */ + static fromAddressAndMask(address, mask) { + const bits = common.prefixLengthFromMask(new _Address4(mask).bigInt(), constants.BITS); + return new _Address4(`${address}/${bits}`); + } + /** + * Construct an `Address4` from an address and a Cisco-style wildcard mask + * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard + * mask is the bitwise inverse of the subnet mask. Throws `AddressError` + * if the mask is non-contiguous (e.g. `0.255.0.255`). + * @example + * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255'); + * address.subnetMask; // 24 + */ + static fromAddressAndWildcardMask(address, wildcardMask) { + const wildcard = new _Address4(wildcardMask).bigInt(); + const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1); + const mask = wildcard ^ allOnes; + const bits = common.prefixLengthFromMask(mask, constants.BITS); + return new _Address4(`${address}/${bits}`); + } + /** + * Construct an `Address4` from a wildcard pattern with trailing `*` + * octets. The number of trailing wildcards determines the prefix + * length: each `*` represents 8 bits. + * + * Only trailing whole-octet wildcards are supported. Partial-octet + * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g. + * `192.*.0.1`) throw `AddressError`. + * @example + * Address4.fromWildcard('192.168.0.*').subnet; // '/24' + * Address4.fromWildcard('192.168.*.*').subnet; // '/16' + * Address4.fromWildcard('*.*.*.*').subnet; // '/0' + */ + static fromWildcard(input) { + const groups = input.split("."); + if (groups.length !== constants.GROUPS) { + throw new address_error_1.AddressError("Wildcard pattern must have 4 octets"); } - if (clientParams.baseLogger) { - this._log = clientParams.baseLogger; - } else { - this._log = new extensions_1.Logger(); + let firstWildcard = -1; + for (let i = 0; i < groups.length; i++) { + if (groups[i] === "*") { + if (firstWildcard === -1) { + firstWildcard = i; + } + } else if (firstWildcard !== -1) { + throw new address_error_1.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)"); + } } - this._log.info("Running gramJS version " + __1.version); - if (session2 && typeof session2 == "string") { - session2 = new sessions_1.StoreSession(session2); + const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard; + const replaced = groups.map((g) => g === "*" ? "0" : g); + const subnetBits = constants.BITS - trailing * 8; + return new _Address4(`${replaced.join(".")}/${subnetBits}`); + } + /** + * Converts a hex string to an IPv4 address object. Accepts 8 hex digits + * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`). + * Throws `AddressError` for any other length or for non-hex characters. + * @param {string} hex - a hex string to convert + * @returns {Address4} + */ + static fromHex(hex) { + const stripped = hex.replace(/:/g, ""); + if (!/^[0-9a-fA-F]{8}$/.test(stripped)) { + throw new address_error_1.AddressError("IPv4 hex must be exactly 8 hex digits"); } - if (!(session2 instanceof sessions_1.Session)) { - throw new Error("Only StringSession and StoreSessions are supported currently :( "); + const groups = []; + for (let i = 0; i < 8; i += 2) { + groups.push(parseInt(stripped.slice(i, i + 2), 16)); } - this._floodSleepThreshold = clientParams.floodSleepThreshold; - this.session = session2; - this.apiId = apiId; - this.apiHash = apiHash; - this._useIPV6 = clientParams.useIPV6; - this._requestRetries = clientParams.requestRetries; - this._downloadRetries = clientParams.downloadRetries; - this._connectionRetries = clientParams.connectionRetries; - this._reconnectRetries = clientParams.reconnectRetries; - this._retryDelay = clientParams.retryDelay || 0; - this._timeout = clientParams.timeout; - this._autoReconnect = clientParams.autoReconnect; - this._proxy = clientParams.proxy; - this._semaphore = new async_mutex_1.Semaphore(clientParams.maxConcurrentDownloads || 1); - this.testServers = clientParams.testServers || false; - this.networkSocket = clientParams.networkSocket || extensions_1.PromisedNetSockets; - if (!(clientParams.connection instanceof Function)) { - throw new Error("Connection should be a class not an instance"); + return new _Address4(groups.join(".")); + } + /** + * Converts an integer into a IPv4 address object. The integer must be a + * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise + * `AddressError` is thrown. + * @param {integer} integer - a number to convert + * @returns {Address4} + */ + static fromInteger(integer) { + if (!Number.isInteger(integer) || integer < 0 || integer > 4294967295) { + throw new address_error_1.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1"); } - this._connection = clientParams.connection; - let initProxy; - if (this._proxy && "MTProxy" in this._proxy) { - this._connection = TCPMTProxy_1.ConnectionTCPMTProxyAbridged; - initProxy = new tl_1.Api.InputClientProxy({ - address: this._proxy.ip, - port: this._proxy.port - }); + return _Address4.fromHex(integer.toString(16).padStart(8, "0")); + } + /** + * Return an address from in-addr.arpa form: the four octets reversed, with + * or without the `.in-addr.arpa` suffix and root dot, in any case. Throws + * `AddressError` unless the reversed labels form a valid IPv4 address, so + * `fromArpa(x.reverseForm())` round-trips {@link reverseForm}. + * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address + * @returns {Adress4} + * @example + * var address = Address4.fromArpa('42.2.0.192.in-addr.arpa.') + * address.correctForm(); // '192.0.2.42' + */ + static fromArpa(arpaFormAddress) { + const longest = constants.GROUPS * 4 - 1 + "/32".length + ".in-addr.arpa.".length; + if (arpaFormAddress.length > longest) { + throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`); } - this._initRequest = new tl_1.Api.InitConnection({ - apiId: this.apiId, - deviceModel: clientParams.deviceModel || os_1.default.type().toString() || "Unknown", - systemVersion: clientParams.systemVersion || os_1.default.release().toString() || "1.0", - appVersion: clientParams.appVersion || "1.0", - langCode: clientParams.langCode, - langPack: "", - // this should be left empty. - systemLangCode: clientParams.systemLangCode, - proxy: initProxy - }); - this._eventBuilders = []; - this._floodWaitedRequests = {}; - this._borrowedSenderPromises = {}; - this._bot = void 0; - this._selfInputPeer = void 0; - this.useWSS = clientParams.useWSS; - this._securityChecks = !!clientParams.securityChecks; - if (this.useWSS && this._proxy) { - throw new Error("Cannot use SSL with proxies. You need to disable the useWSS client param in TelegramClient"); + const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, ""); + const address = leader.split(".").reverse().join("."); + return new _Address4(address); + } + /** + * Converts an IPv4 address object to a hex string + * @returns {String} + */ + toHex() { + return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(":"); + } + /** + * Converts an IPv4 address object to an array of bytes. + * + * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`. + * @returns {Array} + */ + toArray() { + return this.parsedAddress.map((part) => parseInt(part, 10)); + } + /** + * Converts an IPv4 address object to an IPv6 address group + * @returns {String} + */ + toGroup6() { + const output = []; + let i; + for (i = 0; i < constants.GROUPS; i += 2) { + output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`); } - this._entityCache = new entityCache_1.EntityCache(); - this._config = void 0; - this._loopStarted = false; - this._reconnecting = false; - this._destroyed = false; - this._isSwitchingDc = false; - this._connectedDeferred = new Deferred_1.default(); - this._parseMode = markdown_1.MarkdownParser; + return output.join(":"); } - get floodSleepThreshold() { - return this._floodSleepThreshold; + /** + * Returns the address as a `bigint` + * @returns {bigint} + */ + bigInt() { + return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join("")}`); } - set floodSleepThreshold(value) { - this._floodSleepThreshold = Math.min(value || 0, 24 * 60 * 60); + /** + * Helper function getting start address. + * @returns {bigint} + */ + _startAddress() { + return BigInt(`0b${this.mask() + "0".repeat(constants.BITS - this.subnetMask)}`); } - set maxConcurrentDownloads(value) { - this._semaphore._value = value; + /** + * The first address in the range given by this address' subnet. + * Often referred to as the Network Address. + * @returns {Address4} + */ + startAddress() { + return _Address4.fromBigInt(this._startAddress()); } - // region connecting - async _initSession() { - await this.session.load(); - if (!this.session.serverAddress) { - this.session.setDC(DEFAULT_DC_ID, this._useIPV6 ? DEFAULT_IPV6_IP : DEFAULT_IPV4_IP, this.useWSS ? 443 : 80); - } else { - this._useIPV6 = this.session.serverAddress.includes(":"); - } + /** + * The first host address in the range given by this address's subnet ie + * the first address after the Network Address + * @returns {Address4} + */ + startAddressExclusive() { + const adjust = BigInt("1"); + return _Address4.fromBigInt(this._startAddress() + adjust); } - get connected() { - return this._sender && this._sender.isConnected(); + /** + * Returns the address `n` addresses after this one (or before, when `n` is + * negative), keeping this address's subnet mask. Throws `AddressError` when + * the result would fall outside the IPv4 address space or `n` is not an + * integer. + * @param {number | bigint} n + * @returns {Address4} + * @example + * new Address4('10.0.0.0/24').offset(1).correctForm(); // '10.0.0.1' + */ + offset(n) { + return _Address4.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants.BITS, "IPv4")).withSubnetMask(this.subnetMask); } - async disconnect() { - await this._disconnect(); - await Promise.all(Object.values(this._exportedSenderPromises).map((promises) => { - return Object.values(promises).map((promise) => { - return promise && promise.then((sender) => { - if (sender) { - return sender.disconnect(); - } - return void 0; - }); - }); - }).flat()); - Object.values(this._exportedSenderReleaseTimeouts).forEach((timeouts) => { - Object.values(timeouts).forEach((releaseTimeout) => { - clearTimeout(releaseTimeout); - }); - }); - this._exportedSenderPromises.clear(); + /** + * Returns the network that follows this address's network: the address after + * {@link endAddress}, with the same subnet mask. Throws `AddressError` when + * this network is the last one in the address space. + * @returns {Address4} + * @example + * new Address4('10.0.0.0/24').nextNetwork().networkForm(); // '10.0.1.0/24' + */ + nextNetwork() { + return _Address4.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants.BITS, "IPv4")).withSubnetMask(this.subnetMask); } - get disconnected() { - return !this._sender || this._sender._disconnected; + withSubnetMask(subnetMask) { + return new _Address4(`${this.correctForm()}/${subnetMask}`); } - async _disconnect() { - var _a3; - await ((_a3 = this._sender) === null || _a3 === void 0 ? void 0 : _a3.disconnect()); + /** + * Helper function getting end address. + * @returns {bigint} + */ + _endAddress() { + return BigInt(`0b${this.mask() + "1".repeat(constants.BITS - this.subnetMask)}`); } /** - * Disconnects all senders and removes all handlers - * Disconnect is safer as it will not remove your event handlers + * The last address in the range given by this address' subnet + * Often referred to as the Broadcast + * @returns {Address4} */ - async destroy() { - this._destroyed = true; - await Promise.all([ - this.disconnect(), - ...Object.values(this._borrowedSenderPromises).map((promise) => { - return promise.then((sender) => sender.disconnect()); - }) - ]); - this._eventBuilders = []; + endAddress() { + return _Address4.fromBigInt(this._endAddress()); } - /** @hidden */ - async _authKeyCallback(authKey, dcId) { - this.session.setAuthKey(authKey, dcId); - await this.session.save(); + /** + * The last host address in the range given by this address's subnet ie + * the last address prior to the Broadcast Address + * @returns {Address4} + */ + endAddressExclusive() { + const adjust = BigInt("1"); + return _Address4.fromBigInt(this._endAddress() - adjust); } - /** @hidden */ - async _cleanupExportedSender(dcId) { - if (this.session.dcId !== dcId) { - this.session.setAuthKey(void 0, dcId); + /** + * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for + * a `/20`. Returns an `Address4`; call `.correctForm()` for the string. + * @returns {Address4} + */ + subnetMaskAddress() { + return _Address4.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(constants.BITS - this.subnetMask)}`)); + } + /** + * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is + * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`; + * call `.correctForm()` for the string. + * @returns {Address4} + */ + wildcardMask() { + return _Address4.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(constants.BITS - this.subnetMask)}`)); + } + /** + * The network address in CIDR string form, e.g. `192.168.1.0/24` for + * `192.168.1.5/24`. For an address with no explicit subnet the prefix is + * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`. + * @returns {string} + */ + networkForm() { + return `${this.startAddress().correctForm()}/${this.subnetMask}`; + } + /** + * Converts a BigInt to a v4 address object. The value must be in the + * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. + * @param {bigint} bigInt - a BigInt to convert + * @returns {Address4} + */ + static fromBigInt(bigInt) { + if (bigInt < BigInt(0) || bigInt > BigInt(4294967295)) { + throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1"); } - let sender = await this._exportedSenderPromises.get(dcId); - this._exportedSenderPromises.delete(dcId); - await (sender === null || sender === void 0 ? void 0 : sender.disconnect()); + return _Address4.fromHex(bigInt.toString(16).padStart(8, "0")); } - /** @hidden */ - async _connectSender(sender, dcId) { - const dc = await this.getDC(dcId, !!sender.authKey.getKey()); - while (true) { - try { - await sender.connect(new this._connection({ - ip: dc.ipAddress, - port: dc.port, - dcId, - loggers: this._log, - proxy: this._proxy, - testServers: this.testServers, - socket: this.networkSocket - }), false); - if (this.session.dcId !== dcId && !sender._authenticated) { - this._log.info(`Exporting authorization for data center ${dc.ipAddress} with layer ${AllTLObjects_1.LAYER}`); - const auth = await this.invoke(new tl_1.Api.auth.ExportAuthorization({ dcId })); - this._initRequest.query = new tl_1.Api.auth.ImportAuthorization({ - id: auth.id, - bytes: auth.bytes - }); - const req = new tl_1.Api.InvokeWithLayer({ - layer: AllTLObjects_1.LAYER, - query: this._initRequest - }); - await sender.send(req); - sender._authenticated = true; - } - sender.dcId = dcId; - sender.userDisconnected = false; - return sender; - } catch (err) { - if (err.errorMessage === "DC_ID_INVALID") { - sender._authenticated = true; - sender.userDisconnected = false; - return sender; - } - if (this._errorHandler) { - await this._errorHandler(err); - } else if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(err); - } - await (0, Helpers_1.sleep)(1e3); - await sender.disconnect(); - } + /** + * Convert a byte array to an Address4 object. Throws `AddressError` unless + * given exactly 4 integers from 0 to 255. Signed bytes are rejected, so + * this differs from `Address6.fromByteArray`, which folds them; the two + * contracts converge on this stricter form in the next major version. + * + * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`. + * @param {Array<number>} bytes - an array of 4 bytes (0-255) + * @returns {Address4} + */ + static fromByteArray(bytes) { + common.assertByteArray(bytes, 4, "IPv4", 0); + return this.fromUnsignedByteArray(bytes); + } + /** + * Convert an unsigned byte array to an Address4 object. Throws + * `AddressError` unless given exactly 4 bytes, and rejects values outside + * 0 to 255 when parsing the resulting address. + * + * To convert from a Node.js `Buffer`, spread it: + * `Address4.fromUnsignedByteArray([...buf])`. + * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255) + * @returns {Address4} + */ + static fromUnsignedByteArray(bytes) { + if (bytes.length !== 4) { + throw new address_error_1.AddressError("IPv4 addresses require exactly 4 bytes"); } + const address = bytes.join("."); + return new _Address4(address); } - /** @hidden */ - async _borrowExportedSender(dcId, shouldReconnect, existingSender) { - if (!this._exportedSenderPromises.get(dcId) || shouldReconnect) { - this._exportedSenderPromises.set(dcId, this._connectSender(existingSender || this._createExportedSender(dcId), dcId)); + /** + * Returns the first n bits of the address, defaulting to the + * subnet mask + * @returns {String} + */ + mask(mask) { + if (mask === void 0) { + mask = this.subnetMask; } - let sender; - try { - sender = await this._exportedSenderPromises.get(dcId); - if (!sender.isConnected()) { - if (sender.isConnecting) { - await (0, Helpers_1.sleep)(EXPORTED_SENDER_RECONNECT_TIMEOUT); - return this._borrowExportedSender(dcId, false, sender); - } else { - return this._borrowExportedSender(dcId, true, sender); - } - } - } catch (err) { - if (this._errorHandler) { - await this._errorHandler(err); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(err); - } - return this._borrowExportedSender(dcId, true); + return this.getBitsBase2(0, mask); + } + /** + * Returns the bits in the given range as a base-2 string + * @returns {string} + */ + getBitsBase2(start, end) { + return this.binaryZeroPad().slice(start, end); + } + /** + * Return the reversed in-addr.arpa form of the address, e.g. + * `42.2.0.192.in-addr.arpa.` for `192.0.2.42`. + * @param {Object} options + * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix + * @returns {String} + */ + reverseForm(options) { + if (!options) { + options = {}; } - if (this._exportedSenderReleaseTimeouts.get(dcId)) { - clearTimeout(this._exportedSenderReleaseTimeouts.get(dcId)); - this._exportedSenderReleaseTimeouts.delete(dcId); + const reversed = this.correctForm().split(".").reverse().join("."); + if (options.omitSuffix) { + return reversed; } - this._exportedSenderReleaseTimeouts.set(dcId, setTimeout(() => { - this._exportedSenderReleaseTimeouts.delete(dcId); - if (sender._pendingState.values().length) { - console.log("sender already has some hanging states. reconnecting"); - sender._reconnect(); - this._borrowExportedSender(dcId, false, sender); - } else { - sender.disconnect(); - } - }, EXPORTED_SENDER_RELEASE_TIMEOUT)); - return sender; + return `${reversed}.in-addr.arpa.`; + } + /** + * Returns true if the given address is a multicast address + * @returns {boolean} + */ + isMulticast() { + return this.isHostInSubnet(MULTICAST_V4); + } + /** + * Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`). + * @returns {boolean} + */ + isPrivate() { + return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet)); + } + /** + * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)). + * @returns {boolean} + */ + isLoopback() { + return this.isHostInSubnet(LOOPBACK_V4); } - /** @hidden */ - _createExportedSender(dcId) { - return new network_1.MTProtoSender(this.session.getAuthKey(dcId), { - logger: this._log, - dcId, - retries: this._connectionRetries, - delay: this._retryDelay, - autoReconnect: this._autoReconnect, - connectTimeout: this._timeout, - authKeyCallback: this._authKeyCallback.bind(this), - isMainSender: dcId === this.session.dcId, - onConnectionBreak: this._cleanupExportedSender.bind(this), - client: this, - securityChecks: this._securityChecks, - _exportedSenderPromises: this._exportedSenderPromises, - reconnectRetries: this._reconnectRetries - }); + /** + * Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)). + * @returns {boolean} + */ + isLinkLocal() { + return this.isHostInSubnet(LINK_LOCAL_V4); } - /** @hidden */ - getSender(dcId) { - return dcId ? this._borrowExportedSender(dcId) : Promise.resolve(this._sender); + /** + * Returns true if the address is the unspecified address `0.0.0.0`. + * @returns {boolean} + */ + isUnspecified() { + return this.isHostInSubnet(UNSPECIFIED_V4); } - // endregion - async getDC(dcId, download) { - throw new Error("Cannot be called from here!"); + /** + * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)). + * @returns {boolean} + */ + isBroadcast() { + return this.isHostInSubnet(BROADCAST_V4); } - invoke(request) { - throw new Error("Cannot be called from here!"); + /** + * Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)). + * @returns {boolean} + */ + isCGNAT() { + return this.isHostInSubnet(CGNAT_V4); } - setLogLevel(level) { - this._log.setLevel(level); + /** + * Returns true if the address is in one of the documentation ranges + * `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)). + * @returns {boolean} + */ + isDocumentation() { + return DOCUMENTATION_V4.some((subnet) => this.isHostInSubnet(subnet)); } - get logger() { - return this._log; + /** + * Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)). + * @returns {boolean} + */ + isBenchmarking() { + return this.isHostInSubnet(BENCHMARKING_V4); } /** - * Custom error handler for the client - * @example - * ```ts - * client.onError = async (error)=>{ - * console.log("error is",error) - * } - * ``` + * Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)), + * which includes the limited broadcast address. + * @returns {boolean} */ - set onError(handler4) { - this._errorHandler = async (error) => { - try { - await handler4(error); - } catch (e) { - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - e.message = `Error ${e.message} thrown while handling top-level error: ${error.message}`; - console.error(e); - } - } - }; + isReserved() { + return this.isHostInSubnet(RESERVED_V4); + } + /** + * Returns true if the address is globally reachable: not multicast, and not + * in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/) + * marks as not globally reachable. That covers everything the individual + * classifiers name (private, loopback, link-local, CGNAT, unspecified, + * broadcast, documentation, benchmarking, reserved) and the blocks they do + * not, such as `0.0.0.0/8` and the IETF protocol assignments in + * `192.0.0.0/24`. This is the single predicate to use where a request must + * not reach an internal or special-purpose destination; see SECURITY.md. + * @returns {boolean} + */ + isGlobal() { + return !this.isMulticast() && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V4); + } + /** + * Returns a zero-padded base-2 string representation of the address + * @returns {string} + */ + binaryZeroPad() { + if (this._binaryZeroPad === void 0) { + this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, "0"); + } + return this._binaryZeroPad; + } + /** + * Groups an IPv4 address for inclusion at the end of an IPv6 address. + * + * Returns an HTML fragment: each half of the address is wrapped in a + * `<span>` carrying the group classes an address-inspector UI hovers on. + * The address content is HTML-escaped; anything you concatenate around it + * is your responsibility. + * @returns {String} + */ + groupForV6() { + const segments = this.parsedAddress; + return this.correctForm().replace(constants.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments.slice(0, 2).join(".")}</span>.<span class="hover-group group-v4 group-7">${segments.slice(2, 4).join(".")}</span>`); } }; - exports2.TelegramBaseClient = TelegramBaseClient; + exports2.Address4 = Address4; + var MULTICAST_V4 = new Address4("224.0.0.0/4"); + var PRIVATE_V4 = [ + new Address4("10.0.0.0/8"), + new Address4("172.16.0.0/12"), + new Address4("192.168.0.0/16") + ]; + var LOOPBACK_V4 = new Address4("127.0.0.0/8"); + var LINK_LOCAL_V4 = new Address4("169.254.0.0/16"); + var UNSPECIFIED_V4 = new Address4("0.0.0.0/32"); + var BROADCAST_V4 = new Address4("255.255.255.255/32"); + var CGNAT_V4 = new Address4("100.64.0.0/10"); + var DOCUMENTATION_V4 = [ + new Address4("192.0.2.0/24"), + new Address4("198.51.100.0/24"), + new Address4("203.0.113.0/24") + ]; + var BENCHMARKING_V4 = new Address4("198.18.0.0/15"); + var RESERVED_V4 = new Address4("240.0.0.0/4"); + var SPECIAL_PURPOSE_V4 = constants.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({ + subnet: new Address4(cidr), + reachable + })); } }); -// node_modules/telegram/client/auth.js -var require_auth = __commonJS({ - "node_modules/telegram/client/auth.js"(exports2) { +// node_modules/ip-address/dist/v6/constants.js +var require_constants5 = __commonJS({ + "node_modules/ip-address/dist/v6/constants.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SPECIAL_PURPOSE = exports2.RE_URL_WITH_PORT = exports2.RE_URL = exports2.RE_ZONE_STRING = exports2.RE_SUBNET_STRING = exports2.RE_BAD_ADDRESS = exports2.RE_BAD_CHARACTERS = exports2.TYPES = exports2.SCOPES = exports2.GROUPS = exports2.BITS = void 0; + exports2.BITS = 128; + exports2.GROUPS = 8; + exports2.SCOPES = { + 0: "Reserved", + 1: "Interface local", + 2: "Link local", + 4: "Admin local", + 5: "Site local", + 8: "Organization local", + 14: "Global", + 15: "Reserved" + }; + exports2.TYPES = { + "ff01::1/128": "Multicast (All nodes on this interface)", + "ff01::2/128": "Multicast (All routers on this interface)", + "ff02::1/128": "Multicast (All nodes on this link)", + "ff02::2/128": "Multicast (All routers on this link)", + "ff05::2/128": "Multicast (All routers in this site)", + "ff02::5/128": "Multicast (OSPFv3 AllSPF routers)", + "ff02::6/128": "Multicast (OSPFv3 AllDR routers)", + "ff02::9/128": "Multicast (RIP routers)", + "ff02::a/128": "Multicast (EIGRP routers)", + "ff02::d/128": "Multicast (PIM routers)", + "ff02::16/128": "Multicast (MLDv2 reports)", + "ff01::fb/128": "Multicast (mDNSv6)", + "ff02::fb/128": "Multicast (mDNSv6)", + "ff05::fb/128": "Multicast (mDNSv6)", + "ff02::1:2/128": "Multicast (All DHCP servers and relay agents on this link)", + "ff05::1:2/128": "Multicast (All DHCP servers and relay agents in this site)", + "ff02::1:3/128": "Multicast (All DHCP servers on this link)", + "ff05::1:3/128": "Multicast (All DHCP servers in this site)", + "::/128": "Unspecified", + "::1/128": "Loopback", + "::ffff:0:0/96": "IPv4-mapped", + "ff00::/8": "Multicast", + "fe80::/10": "Link-local unicast", + "fc00::/7": "Unique local", + "2001::/32": "Teredo", + "2001:2::/48": "Benchmarking", + "2002::/16": "6to4", + "2001:db8::/32": "Documentation", + "3fff::/20": "Documentation", + "100::/64": "Discard-only", + "fec0::/10": "Site-local unicast (deprecated)", + "::/96": "IPv4-compatible (deprecated)", + "64:ff9b::/96": "NAT64 (well-known)", + "64:ff9b:1::/48": "NAT64 (local-use)" + }; + exports2.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi; + exports2.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi; + exports2.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/; + exports2.RE_ZONE_STRING = /%.*$/; + exports2.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i; + exports2.RE_URL_WITH_PORT = /^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i; + exports2.SPECIAL_PURPOSE = [ + ["::1/128", "Loopback Address", false], + ["::/128", "Unspecified Address", false], + ["::ffff:0:0/96", "IPv4-mapped Address", false], + ["64:ff9b::/96", "IPv4-IPv6 Translat.", true], + ["64:ff9b:1::/48", "IPv4-IPv6 Translat.", false], + ["100::/64", "Discard-Only Address Block", false], + ["100:0:0:1::/64", "Dummy IPv6 Prefix", false], + ["2001::/23", "IETF Protocol Assignments", false], + ["2001::/32", "TEREDO", false], + ["2001:1::1/128", "Port Control Protocol Anycast", true], + ["2001:1::2/128", "Traversal Using Relays around NAT Anycast", true], + ["2001:1::3/128", "DNS-SD Service Registration Protocol Anycast", true], + ["2001:2::/48", "Benchmarking", false], + ["2001:3::/32", "AMT", true], + ["2001:4:112::/48", "AS112-v6", true], + ["2001:10::/28", "Deprecated (previously ORCHID)", null], + ["2001:20::/28", "ORCHIDv2", true], + ["2001:30::/28", "Drone Remote ID Protocol Entity Tags (DETs) Prefix", true], + ["2001:db8::/32", "Documentation", false], + ["2002::/16", "6to4", false], + ["2620:4f:8000::/48", "Direct Delegation AS112 Service", true], + ["3fff::/20", "Documentation", false], + ["5f00::/16", "Segment Routing (SRv6) SIDs", false], + ["fc00::/7", "Unique-Local", false], + ["fe80::/10", "Link-Local Unicast", false] + ]; + } +}); + +// node_modules/ip-address/dist/v6/helpers.js +var require_helpers3 = __commonJS({ + "node_modules/ip-address/dist/v6/helpers.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.escapeHtml = escapeHtml; + exports2.spanAllZeroes = spanAllZeroes; + exports2.spanAll = spanAll; + exports2.spanLeadingZeroes = spanLeadingZeroes; + exports2.simpleGroup = simpleGroup; + function escapeHtml(s) { + return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); + } + function spanAllZeroes(s) { + return escapeHtml(s).replace(/(0+)/g, '<span class="zero">$1</span>'); + } + function spanAll(s, offset = 0) { + const letters = s.split(""); + return letters.map((n, i) => `<span class="digit value-${escapeHtml(n)} position-${i + offset}">${spanAllZeroes(n)}</span>`).join(""); + } + function spanLeadingZeroesSimple(group) { + return escapeHtml(group).replace(/^(0+)/, '<span class="zero">$1</span>'); + } + function spanLeadingZeroes(address) { + const groups = address.split(":"); + return groups.map((g) => spanLeadingZeroesSimple(g)).join(":"); + } + function simpleGroup(addressString, offset = 0) { + const groups = addressString.split(":"); + return groups.map((g, i) => { + if (/group-v4/.test(g)) { + return g; + } + return `<span class="hover-group group-${i + offset}">${spanLeadingZeroesSimple(g)}</span>`; + }); + } + } +}); + +// node_modules/ip-address/dist/v6/regular-expressions.js +var require_regular_expressions = __commonJS({ + "node_modules/ip-address/dist/v6/regular-expressions.js"(exports2) { "use strict"; init_define_import_meta_env(); var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { @@ -63834,15897 +69255,12977 @@ var require_auth = __commonJS({ return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.start = start; - exports2.checkAuthorization = checkAuthorization; - exports2.signInUser = signInUser; - exports2.signInUserWithQrCode = signInUserWithQrCode; - exports2.sendCode = sendCode; - exports2.signInWithPassword = signInWithPassword; - exports2.signInBot = signInBot; - exports2._authFlow = _authFlow; - var tl_1 = require_tl(); - var utils = __importStar2(require_Utils()); - var Helpers_1 = require_Helpers(); - var Password_1 = require_Password(); - var QR_CODE_TIMEOUT = 3e4; - async function start(client2, authParams) { - if (!client2.connected) { - await client2.connect(); + exports2.ADDRESS_BOUNDARY = void 0; + exports2.groupPossibilities = groupPossibilities; + exports2.padGroup = padGroup; + exports2.simpleRegularExpression = simpleRegularExpression; + exports2.possibleElisions = possibleElisions; + var v6 = __importStar2(require_constants5()); + function groupPossibilities(possibilities) { + return `(${possibilities.join("|")})`; + } + function padGroup(group) { + if (group.length < 4) { + return `0{0,${4 - group.length}}${group}`; } - if (await client2.checkAuthorization()) { - return; + return group; + } + exports2.ADDRESS_BOUNDARY = "[^A-Fa-f0-9:]"; + function simpleRegularExpression(groups) { + const zeroIndexes = []; + groups.forEach((group, i) => { + const groupInteger = parseInt(group, 16); + if (groupInteger === 0) { + zeroIndexes.push(i); + } + }); + const possibilities = zeroIndexes.map((zeroIndex) => groups.map((group, i) => { + if (i === zeroIndex) { + const elision = i === 0 || i === v6.GROUPS - 1 ? ":" : ""; + return groupPossibilities([padGroup(group), elision]); + } + return padGroup(group); + }).join(":")); + possibilities.push(groups.map(padGroup).join(":")); + return groupPossibilities(possibilities); + } + function possibleElisions(elidedGroups, moreLeft, moreRight) { + const left = moreLeft ? "" : ":"; + const right = moreRight ? "" : ":"; + const possibilities = []; + if (!moreLeft && !moreRight) { + possibilities.push("::"); } - const apiCredentials = { - apiId: client2.apiId, - apiHash: client2.apiHash - }; - await _authFlow(client2, apiCredentials, authParams); + if (moreLeft && moreRight) { + possibilities.push(""); + } + if (moreRight && !moreLeft || !moreRight && moreLeft) { + possibilities.push(":"); + } + possibilities.push(`${left}(:0{1,4}){1,${elidedGroups - 1}}`); + possibilities.push(`(0{1,4}:){1,${elidedGroups - 1}}${right}`); + possibilities.push(`(0{1,4}:){${elidedGroups - 1}}0{1,4}`); + for (let groups = 1; groups < elidedGroups - 1; groups++) { + for (let position = 1; position < elidedGroups - groups; position++) { + possibilities.push(`(0{1,4}:){${position}}:(0{1,4}:){${elidedGroups - position - groups - 1}}0{1,4}`); + } + } + return groupPossibilities(possibilities); } - async function checkAuthorization(client2) { - try { - await client2.invoke(new tl_1.Api.updates.GetState()); - return true; - } catch (e) { - return false; + } +}); + +// node_modules/ip-address/dist/ipv6.js +var require_ipv6 = __commonJS({ + "node_modules/ip-address/dist/ipv6.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Address6 = void 0; + var common = __importStar2(require_common2()); + var constants4 = __importStar2(require_constants4()); + var constants6 = __importStar2(require_constants5()); + var helpers = __importStar2(require_helpers3()); + var ipv4_1 = require_ipv4(); + var regular_expressions_1 = require_regular_expressions(); + var address_error_1 = require_address_error(); + var common_1 = require_common2(); + var isCorrect6 = common.isCorrect(constants6.BITS); + function assert(condition) { + if (!condition) { + throw new Error("Assertion failed."); } } - async function signInUser(client2, apiCredentials, authParams) { - let phoneNumber; - let phoneCodeHash; - let isCodeViaApp = false; - while (1) { - try { - if (typeof authParams.phoneNumber === "function") { - try { - phoneNumber = await authParams.phoneNumber(); - } catch (err) { - if (err.errorMessage === "RESTART_AUTH_WITH_QR") { - return client2.signInUserWithQrCode(apiCredentials, authParams); - } - throw err; - } - } else { - phoneNumber = authParams.phoneNumber; - } - const sendCodeResult = await client2.sendCode(apiCredentials, phoneNumber, authParams.forceSMS); - phoneCodeHash = sendCodeResult.phoneCodeHash; - isCodeViaApp = sendCodeResult.isCodeViaApp; - if (typeof phoneCodeHash !== "string") { - throw new Error("Failed to retrieve phone code hash"); - } - break; - } catch (err) { - if (typeof authParams.phoneNumber !== "function") { - throw err; - } - const shouldWeStop = await authParams.onError(err); - if (shouldWeStop) { - throw new Error("AUTH_USER_CANCEL"); + function addCommas(number) { + const r = /(\d+)(\d{3})/; + while (r.test(number)) { + number = number.replace(r, "$1,$2"); + } + return number; + } + function spanLeadingZeroes4(n) { + n = n.replace(/^(0{1,})([1-9]+)$/, '<span class="parse-error">$1</span>$2'); + n = n.replace(/^(0{1,})(0)$/, '<span class="parse-error">$1</span>$2'); + return n; + } + function compact(address, slice) { + const s1 = []; + const s2 = []; + let i; + for (i = 0; i < address.length; i++) { + if (i < slice[0]) { + s1.push(address[i]); + } else if (i > slice[1]) { + s2.push(address[i]); + } + } + return s1.concat(["compact"]).concat(s2); + } + function paddedHex(octet) { + return parseInt(octet, 16).toString(16).padStart(4, "0"); + } + function unsignByte(b) { + return b & 255; + } + var Address6 = class _Address6 { + constructor(address, optionalGroups) { + this.addressMinusSuffix = ""; + this.parsedSubnet = ""; + this.subnet = "/128"; + this.subnetMask = 128; + this.v4 = false; + this.zone = ""; + this.isInSubnet = common.isInSubnet; + this.isHostInSubnet = common.isHostInSubnet; + this.isCorrect = isCorrect6; + if (optionalGroups === void 0) { + this.groups = constants6.GROUPS; + } else { + this.groups = optionalGroups; + } + this.address = address; + const subnet = constants6.RE_SUBNET_STRING.exec(address); + if (subnet) { + this.parsedSubnet = subnet[0].replace("/", ""); + this.subnetMask = parseInt(this.parsedSubnet, 10); + this.subnet = `/${this.subnetMask}`; + if (Number.isNaN(this.subnetMask) || this.subnetMask < 0 || this.subnetMask > constants6.BITS) { + throw new address_error_1.AddressError("Invalid subnet mask."); } + address = address.replace(constants6.RE_SUBNET_STRING, ""); + } + if (/\//.test(address)) { + throw new address_error_1.AddressError("Invalid subnet mask."); + } + const zoneStart = address.indexOf("%"); + if (zoneStart !== -1 && /^.*$/.test(address.slice(zoneStart))) { + this.zone = address.slice(zoneStart); + address = address.slice(0, zoneStart); + } + const longest = this.groups * 5 + 5; + if (address.length > longest) { + throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`); } + this.addressMinusSuffix = address; + this.parsedAddress = this.parse(this.addressMinusSuffix); } - let phoneCode; - let isRegistrationRequired = false; - let termsOfService; - while (1) { + /** + * Returns true if the given string is a valid IPv6 address (with optional + * CIDR subnet and zone identifier), false otherwise. Host bits in the + * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict + * network-address validation compare `correctForm()` to + * `startAddress().correctForm()`, or use `networkForm()`. + */ + static isValid(address) { try { - try { - phoneCode = await authParams.phoneCode(isCodeViaApp); - } catch (err) { - if (err.errorMessage === "RESTART_AUTH") { - return client2.signInUser(apiCredentials, authParams); - } - } - if (!phoneCode) { - throw new Error("Code is empty"); - } - const result = await client2.invoke(new tl_1.Api.auth.SignIn({ - phoneNumber, - phoneCodeHash, - phoneCode - })); - if (result instanceof tl_1.Api.auth.AuthorizationSignUpRequired) { - isRegistrationRequired = true; - termsOfService = result.termsOfService; - break; - } - return result.user; - } catch (err) { - if (err.errorMessage === "SESSION_PASSWORD_NEEDED") { - return client2.signInWithPassword(apiCredentials, authParams); - } else { - const shouldWeStop = await authParams.onError(err); - if (shouldWeStop) { - throw new Error("AUTH_USER_CANCEL"); - } - } + new _Address6(address); + return true; + } catch { + return false; } } - if (isRegistrationRequired) { - while (1) { - try { - let lastName; - let firstName = "first name"; - if (authParams.firstAndLastNames) { - const result = await authParams.firstAndLastNames(); - firstName = result[0]; - lastName = result[1]; - } - if (!firstName) { - throw new Error("First name is required"); - } - const { user } = await client2.invoke(new tl_1.Api.auth.SignUp({ - phoneNumber, - phoneCodeHash, - firstName, - lastName - })); - if (termsOfService) { - await client2.invoke(new tl_1.Api.help.AcceptTermsOfService({ - id: termsOfService.id - })); - } - return user; - } catch (err) { - const shouldWeStop = await authParams.onError(err); - if (shouldWeStop) { - throw new Error("AUTH_USER_CANCEL"); - } - } + /** + * Convert a BigInt to a v6 address object. The value must be in the + * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown. + * @param {bigint} bigInt - a BigInt to convert + * @returns {Address6} + * @example + * var bigInt = BigInt('1000000000000'); + * var address = Address6.fromBigInt(bigInt); + * address.correctForm(); // '::e8:d4a5:1000' + */ + static fromBigInt(bigInt) { + if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) { + throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1"); } + const hex = bigInt.toString(16).padStart(32, "0"); + const groups = []; + for (let i = 0; i < constants6.GROUPS; i++) { + groups.push(hex.slice(i * 4, (i + 1) * 4)); + } + return new _Address6(groups.join(":")); } - await authParams.onError(new Error("Auth failed")); - return client2.signInUser(apiCredentials, authParams); - } - async function signInUserWithQrCode(client2, apiCredentials, authParams) { - let isScanningComplete = false; - if (authParams.qrCode == void 0) { - throw new Error("qrCode callback not defined"); - } - const inputPromise = (async () => { - while (1) { - if (isScanningComplete) { - break; + /** + * Parse a URL (with optional bracketed host and port) into an address and + * port. Returns either `{ address, port }` on success or + * `{ error, address: null, port: null }` if the URL could not be parsed. + * Ports are returned as numbers (or `null` if absent or out of range). + * @example + * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/'); + * addressAndPort.address.correctForm(); // 'ffff::' + * addressAndPort.port; // 8080 + */ + static fromURL(url) { + var _a; + let host; + let port = null; + let result; + let error; + const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, ""); + if (stripped.indexOf("[") !== -1 && stripped.indexOf("]:") !== -1) { + error = "failed to parse address with port"; + result = constants6.RE_URL_WITH_PORT.exec(stripped); + if (result === null) { + return { error, address: null, port: null }; } - const result = await client2.invoke(new tl_1.Api.auth.ExportLoginToken({ - apiId: Number(apiCredentials.apiId), - apiHash: apiCredentials.apiHash, - exceptIds: [] - })); - if (!(result instanceof tl_1.Api.auth.LoginToken)) { - throw new Error("Unexpected"); + host = result[1]; + port = result[2]; + } else { + error = "failed to parse address from URL"; + result = constants6.RE_URL.exec(stripped); + if (result === null) { + return { error, address: null, port: null }; } - const { token, expires } = result; - await Promise.race([ - authParams.qrCode({ token, expires }), - (0, Helpers_1.sleep)(QR_CODE_TIMEOUT) - ]); - await (0, Helpers_1.sleep)(QR_CODE_TIMEOUT); + host = (_a = result[1]) !== null && _a !== void 0 ? _a : result[2]; } - })(); - const updatePromise = new Promise((resolve) => { - client2.addEventHandler((update2) => { - if (update2 instanceof tl_1.Api.UpdateLoginToken) { - resolve(void 0); - } - }); - }); - try { - await Promise.race([updatePromise, inputPromise]); - } catch (err) { - throw err; - } finally { - isScanningComplete = true; - } - try { - const result2 = await client2.invoke(new tl_1.Api.auth.ExportLoginToken({ - apiId: Number(apiCredentials.apiId), - apiHash: apiCredentials.apiHash, - exceptIds: [] - })); - if (result2 instanceof tl_1.Api.auth.LoginTokenSuccess && result2.authorization instanceof tl_1.Api.auth.Authorization) { - return result2.authorization.user; - } else if (result2 instanceof tl_1.Api.auth.LoginTokenMigrateTo) { - await client2._switchDC(result2.dcId); - const migratedResult = await client2.invoke(new tl_1.Api.auth.ImportLoginToken({ - token: result2.token - })); - if (migratedResult instanceof tl_1.Api.auth.LoginTokenSuccess && migratedResult.authorization instanceof tl_1.Api.auth.Authorization) { - return migratedResult.authorization.user; - } else { - client2._log.error(`Received unknown result while scanning QR ${result2.className}`); - throw new Error(`Received unknown result while scanning QR ${result2.className}`); + if (port) { + port = parseInt(port, 10); + if (port < 0 || port > 65535) { + port = null; } } else { - client2._log.error(`Received unknown result while scanning QR ${result2.className}`); - throw new Error(`Received unknown result while scanning QR ${result2.className}`); + port = null; } - } catch (err) { - if (err.errorMessage === "SESSION_PASSWORD_NEEDED") { - return client2.signInWithPassword(apiCredentials, authParams); + let address; + try { + address = new _Address6(host); + } catch { + return { error, address: null, port: null }; } - throw err; + return { address, port }; } - await authParams.onError(new Error("QR auth failed")); - throw new Error("QR auth failed"); - } - async function sendCode(client2, apiCredentials, phoneNumber, forceSMS = false) { - try { - const { apiId, apiHash } = apiCredentials; - const sendResult = await client2.invoke(new tl_1.Api.auth.SendCode({ - phoneNumber, - apiId, - apiHash, - settings: new tl_1.Api.CodeSettings({}) - })); - if (sendResult instanceof tl_1.Api.auth.SentCodeSuccess) - throw new Error("logged in right after sending the code"); - if (!forceSMS || sendResult.type instanceof tl_1.Api.auth.SentCodeTypeSms) { - return { - phoneCodeHash: sendResult.phoneCodeHash, - isCodeViaApp: sendResult.type instanceof tl_1.Api.auth.SentCodeTypeApp - }; + /** + * Construct an `Address6` from an address and a hex subnet mask given as + * separate strings (e.g. as returned by Node's `os.networkInterfaces()`). + * Throws `AddressError` if the mask is non-contiguous (e.g. + * `ffff::ffff`). + * @example + * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::'); + * address.subnetMask; // 64 + */ + static fromAddressAndMask(address, mask) { + const bits = common.prefixLengthFromMask(new _Address6(mask).bigInt(), constants6.BITS); + return new _Address6(`${address}/${bits}`); + } + /** + * Construct an `Address6` from an address and a Cisco-style wildcard mask + * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`). + * The wildcard mask is the bitwise inverse of the subnet mask. Throws + * `AddressError` if the mask is non-contiguous. + * @example + * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff'); + * address.subnetMask; // 64 + */ + static fromAddressAndWildcardMask(address, wildcardMask) { + const wildcard = new _Address6(wildcardMask).bigInt(); + const allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1); + const mask = wildcard ^ allOnes; + const bits = common.prefixLengthFromMask(mask, constants6.BITS); + return new _Address6(`${address}/${bits}`); + } + /** + * Construct an `Address6` from a wildcard pattern with trailing `*` + * groups. The number of trailing wildcards determines the prefix + * length: each `*` represents 16 bits. `::` is expanded to zero groups + * (not wildcards) before evaluating trailing wildcards. + * + * Only trailing whole-group wildcards are supported. Partial-group + * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g. + * `*::1`) throw `AddressError`. + * @example + * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32' + * Address6.fromWildcard('2001:db8::*').subnet; // '/112' + * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0' + */ + static fromWildcard(input) { + if (input.includes("%") || input.includes("/")) { + throw new address_error_1.AddressError("Wildcard pattern must not include a zone or CIDR suffix"); } - const resendResult = await client2.invoke(new tl_1.Api.auth.ResendCode({ - phoneNumber, - phoneCodeHash: sendResult.phoneCodeHash - })); - if (resendResult instanceof tl_1.Api.auth.SentCodeSuccess) - throw new Error("logged in right after resending the code"); - return { - phoneCodeHash: resendResult.phoneCodeHash, - isCodeViaApp: resendResult.type instanceof tl_1.Api.auth.SentCodeTypeApp - }; - } catch (err) { - if (err.errorMessage === "AUTH_RESTART") { - return client2.sendCode(apiCredentials, phoneNumber, forceSMS); - } else { - throw err; + const halves = input.split("::"); + if (halves.length > 2) { + throw new address_error_1.AddressError("Wildcard pattern cannot contain more than one '::'"); } - } - } - async function signInWithPassword(client2, apiCredentials, authParams) { - let emptyPassword = false; - while (1) { - try { - const passwordSrpResult = await client2.invoke(new tl_1.Api.account.GetPassword()); - if (!authParams.password) { - emptyPassword = true; - break; - } - const password = await authParams.password(passwordSrpResult.hint); - if (!password) { - throw new Error("Password is empty"); + let groups; + if (halves.length === 2) { + const left = halves[0] === "" ? [] : halves[0].split(":"); + const right = halves[1] === "" ? [] : halves[1].split(":"); + const remaining = constants6.GROUPS - left.length - right.length; + if (remaining < 1) { + throw new address_error_1.AddressError("Wildcard pattern with '::' has too many groups"); } - const passwordSrpCheck = await (0, Password_1.computeCheck)(passwordSrpResult, password); - const { user } = await client2.invoke(new tl_1.Api.auth.CheckPassword({ - password: passwordSrpCheck - })); - return user; - } catch (err) { - const shouldWeStop = await authParams.onError(err); - if (shouldWeStop) { - throw new Error("AUTH_USER_CANCEL"); + groups = [...left, ...new Array(remaining).fill("0"), ...right]; + } else { + groups = input.split(":"); + } + if (groups.length !== constants6.GROUPS) { + throw new address_error_1.AddressError("Wildcard pattern must have 8 groups"); + } + let firstWildcard = -1; + for (let i = 0; i < groups.length; i++) { + if (groups[i] === "*") { + if (firstWildcard === -1) { + firstWildcard = i; + } + } else if (firstWildcard !== -1) { + throw new address_error_1.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)"); } } + const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard; + const replaced = groups.map((g) => g === "*" ? "0" : g); + const subnetBits = constants6.BITS - trailing * 16; + return new _Address6(`${replaced.join(":")}/${subnetBits}`); } - if (emptyPassword) { - throw new Error("Account has 2FA enabled."); + /** + * Create an IPv6-mapped address given an IPv4 address + * @param {string} address - An IPv4 address string + * @returns {Address6} + * @example + * var address = Address6.fromAddress4('192.168.0.1'); + * address.correctForm(); // '::ffff:c0a8:1' + * address.to4in6(); // '::ffff:192.168.0.1' + */ + static fromAddress4(address) { + const address4 = new ipv4_1.Address4(address); + const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask); + return new _Address6(`::ffff:${address4.correctForm()}/${mask6}`); } - return void 0; - } - async function signInBot(client2, apiCredentials, authParams) { - const { apiId, apiHash } = apiCredentials; - let { botAuthToken } = authParams; - if (!botAuthToken) { - throw new Error("a valid BotToken is required"); + /** + * Return an address from ip6.arpa form. A full 32-nibble name gives a /128 + * address; a shorter name, as used for a delegated reverse zone, gives the + * network it covers, with a subnet mask of four bits per nibble, so + * `fromArpa(x.reverseForm())` round-trips {@link reverseForm} for any prefix. + * @param {string} arpaFormAddress - an 'ip6.arpa' form address + * @returns {Adress6} + * @example + * var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.) + * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe' + * Address6.fromArpa('8.b.d.0.1.0.0.2.ip6.arpa.').networkForm(); // '2001:db8::/32' + */ + static fromArpa(arpaFormAddress) { + const nibbles = arpaFormAddress.replace(/(\.ip6\.arpa)?\.?$/i, ""); + if (!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(nibbles)) { + throw new address_error_1.AddressError("Invalid 'ip6.arpa' form."); + } + const reversed = nibbles.split(".").reverse(); + const subnetMask = reversed.length * 4; + const hex = reversed.join("").padEnd(32, "0"); + const groups = []; + for (let i = 0; i < constants6.GROUPS; i++) { + groups.push(hex.slice(i * 4, (i + 1) * 4)); + } + return new _Address6(`${groups.join(":")}/${subnetMask}`); } - if (typeof botAuthToken === "function") { - let token; - while (true) { - token = await botAuthToken(); - if (token) { - botAuthToken = token; - break; - } + /** + * Return the Microsoft UNC transcription of the address + * @returns {String} the Microsoft UNC transcription of the address + */ + microsoftTranscription() { + return `${this.correctForm().replace(/:/g, "-")}.ipv6-literal.net`; + } + /** + * Return the first n bits of the address, defaulting to the subnet mask + * @param {number} [mask=subnet] - the number of bits to mask + * @returns {String} the first n bits of the address as a string + */ + mask(mask = this.subnetMask) { + return this.getBitsBase2(0, mask); + } + /** + * Return the number of possible subnets of a given size in the address + * @param {number} [subnetSize=128] - the subnet size + * @returns {String} + */ + // TODO: probably useful to have a numeric version of this too + possibleSubnets(subnetSize = 128) { + const availableBits = constants6.BITS - this.subnetMask; + const subnetBits = Math.abs(subnetSize - constants6.BITS); + const subnetPowers = availableBits - subnetBits; + if (subnetPowers < 0) { + return "0"; } + return addCommas((BigInt("2") ** BigInt(subnetPowers)).toString(10)); } - const { user } = await client2.invoke(new tl_1.Api.auth.ImportBotAuthorization({ - apiId, - apiHash, - botAuthToken - })); - return user; - } - async function _authFlow(client2, apiCredentials, authParams) { - const me = "phoneNumber" in authParams ? await client2.signInUser(apiCredentials, authParams) : await client2.signInBot(apiCredentials, authParams); - client2._log.info("Signed in successfully as " + utils.getDisplayName(me)); - } - } -}); - -// node_modules/telegram/tl/custom/inlineResult.js -var require_inlineResult = __commonJS({ - "node_modules/telegram/tl/custom/inlineResult.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineResult = void 0; - var api_1 = require_api(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var Utils_1 = require_Utils(); - var InlineResult = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + /** + * Helper function getting start address. + * @returns {bigint} + */ + _startAddress() { + return BigInt(`0b${this.mask() + "0".repeat(constants6.BITS - this.subnetMask)}`); } - constructor(client2, original, queryId, entity) { - this._ARTICLE = "article"; - this._PHOTO = "photo"; - this._GIF = "gif"; - this._VIDEO = "video"; - this._VIDEO_GIF = "mpeg4_gif"; - this._AUDIO = "audio"; - this._DOCUMENT = "document"; - this._LOCATION = "location"; - this._VENUE = "venue"; - this._CONTACT = "contact"; - this._GAME = "game"; - this._client = client2; - this.result = original; - this._queryId = queryId; - this._entity = entity; + /** + * The first address in the range given by this address' subnet + * Often referred to as the Network Address. + * @returns {Address6} + */ + startAddress() { + return _Address6.fromBigInt(this._startAddress()); + } + /** + * The first host address in the range given by this address's subnet ie + * the first address after the Network Address + * @returns {Address6} + */ + startAddressExclusive() { + const adjust = BigInt("1"); + return _Address6.fromBigInt(this._startAddress() + adjust); + } + /** + * Helper function getting end address. + * @returns {bigint} + */ + _endAddress() { + return BigInt(`0b${this.mask() + "1".repeat(constants6.BITS - this.subnetMask)}`); + } + /** + * The last address in the range given by this address's subnet. IPv6 has + * no broadcast address, so this is an ordinary assignable address (in a + * 64-bit-interface-identifier subnet it falls inside the reserved + * subnet-anycast block of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526)). + * @returns {Address6} + */ + endAddress() { + return _Address6.fromBigInt(this._endAddress()); + } + /** + * The address one before {@link endAddress}. This is the IPv6 counterpart + * of the IPv4 method that skips the broadcast address; IPv6 has no broadcast, + * so it drops exactly one address and does not model the 128 reserved + * subnet-anycast identifiers of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526). + * @returns {Address6} + */ + endAddressExclusive() { + const adjust = BigInt("1"); + return _Address6.fromBigInt(this._endAddress() - adjust); } - get type() { - return this.result.type; + /** + * Returns the address `n` addresses after this one (or before, when `n` is + * negative), keeping this address's subnet mask. Throws `AddressError` when + * the result would fall outside the IPv6 address space or `n` is not an + * integer. + * @param {number | bigint} n + * @returns {Address6} + * @example + * new Address6('2001:db8::/64').offset(1).correctForm(); // '2001:db8::1' + */ + offset(n) { + return _Address6.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants6.BITS, "IPv6")).withSubnetMask(this.subnetMask); } - get message() { - return this.result.sendMessage; + /** + * Returns the network that follows this address's network: the address after + * {@link endAddress}, with the same subnet mask. Throws `AddressError` when + * this network is the last one in the address space. + * @returns {Address6} + * @example + * new Address6('2001:db8::/64').nextNetwork().networkForm(); // '2001:db8:0:1::/64' + */ + nextNetwork() { + return _Address6.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants6.BITS, "IPv6")).withSubnetMask(this.subnetMask); } - get description() { - return this.result.description; + withSubnetMask(subnetMask) { + return new _Address6(`${this.correctForm()}/${subnetMask}`); } - get url() { - if (this.result instanceof api_1.Api.BotInlineResult) { - return this.result.url; - } + /** + * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a + * `/64`. Returns an `Address6`; call `.correctForm()` for the string. + * @returns {Address6} + */ + subnetMaskAddress() { + return _Address6.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(constants6.BITS - this.subnetMask)}`)); } - get photo() { - if (this.result instanceof api_1.Api.BotInlineResult) { - return this.result.thumb; - } else { - return this.result.photo; - } + /** + * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a + * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns + * an `Address6`; call `.correctForm()` for the string. + * @returns {Address6} + */ + wildcardMask() { + return _Address6.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(constants6.BITS - this.subnetMask)}`)); } - get document() { - if (this.result instanceof api_1.Api.BotInlineResult) { - return this.result.content; - } else { - return this.result.document; - } + /** + * The network address in CIDR string form, e.g. `2001:db8::/32` for + * `2001:db8::1/32`. For an address with no explicit subnet the prefix + * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns + * `2001:db8::1/128`. + * @returns {string} + */ + networkForm() { + return `${this.startAddress().correctForm()}/${this.subnetMask}`; } - async click(entity, replyTo, silent = false, clearDraft = false, hideVia = false) { - if (entity) { - entity = await this._client.getInputEntity(entity); - } else if (this._entity) { - entity = this._entity; - } else { - throw new Error("You must provide the entity where the result should be sent to"); + /** + * Return the scope of the address. The 4-bit scope field + * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7)) + * is only defined for multicast addresses; for unicast addresses the scope + * is derived from the address type per + * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6). + * @returns {String} + */ + getScope() { + const type = this.getType(); + if (type === "Multicast" || type.startsWith("Multicast ")) { + const scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)]; + return scope || "Unknown"; } - let replyObject = void 0; - if (replyTo != void 0) { - replyObject = new api_1.Api.InputReplyToMessage({ - replyToMsgId: (0, Utils_1.getMessageId)(replyTo) - }); + if (type === "Link-local unicast" || type === "Loopback") { + return "Link local"; } - const request = new api_1.Api.messages.SendInlineBotResult({ - peer: entity, - queryId: this._queryId, - id: this.result.id, - silent, - clearDraft, - hideVia, - replyTo: replyObject - }); - return await this._client.invoke(request); - } - }; - exports2.InlineResult = InlineResult; - } -}); - -// node_modules/telegram/tl/custom/inlineResults.js -var require_inlineResults = __commonJS({ - "node_modules/telegram/tl/custom/inlineResults.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineResults = void 0; - var inlineResult_1 = require_inlineResult(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var InlineResults = class extends Array { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(client2, original, entity) { - super(...original.results.map((res) => new inlineResult_1.InlineResult(client2, res, original.queryId, entity))); - this.result = original; - this.queryId = original.queryId; - this.cacheTime = original.cacheTime; - this._validUntil = (/* @__PURE__ */ new Date()).getTime() / 1e3 + this.cacheTime; - this.users = original.users; - this.gallery = Boolean(original.gallery); - this.nextOffset = original.nextOffset; - this.switchPm = original.switchPm; + if (type === "Unspecified") { + return "Unknown"; + } + return "Global"; } - resultsValid() { - return (/* @__PURE__ */ new Date()).getTime() / 1e3 < this._validUntil; + /** + * Return the type of the address + * @returns {String} + */ + getType() { + for (let i = 0; i < TYPE_SUBNETS.length; i++) { + const entry = TYPE_SUBNETS[i]; + if (this.isHostInSubnet(entry[0])) { + return entry[1]; + } + } + return "Global unicast"; } - }; - exports2.InlineResults = InlineResults; - } -}); - -// node_modules/telegram/client/bots.js -var require_bots = __commonJS({ - "node_modules/telegram/client/bots.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.inlineQuery = inlineQuery; - var tl_1 = require_tl(); - var inlineResults_1 = require_inlineResults(); - var GetInlineBotResults = tl_1.Api.messages.GetInlineBotResults; - async function inlineQuery(client2, bot, query2, entity, offset, geoPoint) { - bot = await client2.getInputEntity(bot); - let peer = new tl_1.Api.InputPeerSelf(); - if (entity) { - peer = await client2.getInputEntity(entity); + /** + * Return the bits in the given range as a BigInt + * @returns {bigint} + */ + getBits(start, end) { + return BigInt(`0b${this.getBitsBase2(start, end)}`); } - const result = await client2.invoke(new GetInlineBotResults({ - bot, - peer, - query: query2, - offset: offset || "", - geoPoint - })); - return new inlineResults_1.InlineResults(client2, result, entity ? peer : void 0); - } - } -}); - -// node_modules/telegram/client/buttons.js -var require_buttons = __commonJS({ - "node_modules/telegram/client/buttons.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.buildReplyMarkup = buildReplyMarkup; - var tl_1 = require_tl(); - var button_1 = require_button(); - var messageButton_1 = require_messageButton(); - var Helpers_1 = require_Helpers(); - function buildReplyMarkup(buttons, inlineOnly = false) { - if (buttons == void 0) { - return void 0; + /** + * Return the bits in the given range as a base-2 string + * @returns {String} + */ + getBitsBase2(start, end) { + return this.binaryZeroPad().slice(start, end); } - if ("SUBCLASS_OF_ID" in buttons) { - if (buttons.SUBCLASS_OF_ID == 3806400242) { - return buttons; + /** + * Return the bits in the given range as a base-16 string + * @returns {String} + */ + getBitsBase16(start, end) { + const length = end - start; + if (length % 4 !== 0) { + throw new Error("Length of bits to retrieve must be divisible by four"); } + return this.getBits(start, end).toString(16).padStart(length / 4, "0"); } - if (!(0, Helpers_1.isArrayLike)(buttons)) { - buttons = [[buttons]]; - } else if (!buttons || !(0, Helpers_1.isArrayLike)(buttons[0])) { - buttons = [buttons]; + /** + * Return the bits that are set past the subnet mask length + * @returns {String} + */ + getBitsPastSubnet() { + return this.getBitsBase2(this.subnetMask, constants6.BITS); } - let isInline = false; - let isNormal = false; - let resize = void 0; - const singleUse = false; - const selective = false; - const rows = []; - for (const row of buttons) { - const current = []; - for (let button of row) { - if (button instanceof button_1.Button) { - if (button.resize != void 0) { - resize = button.resize; - } - if (button.singleUse != void 0) { - resize = button.singleUse; - } - if (button.selective != void 0) { - resize = button.selective; - } - button = button.button; - } else if (button instanceof messageButton_1.MessageButton) { - button = button.button; - } - const inline = button_1.Button._isInline(button); - if (!isInline && inline) { - isInline = true; + /** + * Return the reversed ip6.arpa form of the address + * @param {Object} options + * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix + * @returns {String} + */ + reverseForm(options) { + if (!options) { + options = {}; + } + const characters = Math.floor(this.subnetMask / 4); + const reversed = this.canonicalForm().replace(/:/g, "").split("").slice(0, characters).reverse().join("."); + if (characters > 0) { + if (options.omitSuffix) { + return reversed; } - if (!isNormal && inline) { - isNormal = false; + return `${reversed}.ip6.arpa.`; + } + if (options.omitSuffix) { + return ""; + } + return "ip6.arpa."; + } + /** + * Returns the address in correct form, per + * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros + * stripped, the longest run of zero groups collapsed to `::`, and hex digits + * lowercased (e.g. `2001:db8::1`). This is the recommended form for display. + */ + correctForm() { + let i; + let groups = []; + let zeroCounter = 0; + const zeroes = []; + for (i = 0; i < this.parsedAddress.length; i++) { + const value = parseInt(this.parsedAddress[i], 16); + if (value === 0) { + zeroCounter++; } - if (button.SUBCLASS_OF_ID == 195916963) { - current.push(button); + if (value !== 0 && zeroCounter > 0) { + if (zeroCounter > 1) { + zeroes.push([i - zeroCounter, i - 1]); + } + zeroCounter = 0; } } - if (current) { - rows.push(new tl_1.Api.KeyboardButtonRow({ - buttons: current - })); + if (zeroCounter > 1) { + zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]); } + const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1); + if (zeroes.length > 0) { + const index2 = zeroLengths.indexOf(Math.max(...zeroLengths)); + groups = compact(this.parsedAddress, zeroes[index2]); + } else { + groups = this.parsedAddress; + } + for (i = 0; i < groups.length; i++) { + if (groups[i] !== "compact") { + groups[i] = parseInt(groups[i], 16).toString(16); + } + } + let correct = groups.join(":"); + correct = correct.replace(/^compact$/, "::"); + correct = correct.replace(/(^compact)|(compact$)/, ":"); + correct = correct.replace(/compact/, ""); + return correct; } - if (inlineOnly && isNormal) { - throw new Error("You cannot use non-inline buttons here"); - } else if (isInline === isNormal && isNormal) { - throw new Error("You cannot mix inline with normal buttons"); - } else if (isInline) { - return new tl_1.Api.ReplyInlineMarkup({ - rows - }); - } - return new tl_1.Api.ReplyKeyboardMarkup({ - rows, - resize, - singleUse, - selective - }); - } - } -}); - -// node_modules/telegram/requestIter.js -var require_requestIter = __commonJS({ - "node_modules/telegram/requestIter.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RequestIter = void 0; - var Helpers_1 = require_Helpers(); - var _1 = require_telegram(); - var RequestIter = class { - constructor(client2, limit, params = {}, args = {}) { - this.client = client2; - this.reverse = params.reverse; - this.waitTime = params.waitTime; - this.limit = Math.max(!limit ? Number.MAX_SAFE_INTEGER : limit, 0); - this.left = this.limit; - this.buffer = void 0; - this.kwargs = args; - this.index = 0; - this.total = void 0; - this.lastLoad = 0; + /** + * Return a zero-padded base-2 string representation of the address + * @returns {String} + * @example + * var address = new Address6('2001:4860:4001:803::1011'); + * address.binaryZeroPad(); + * // '0010000000000001010010000110000001000000000000010000100000000011 + * // 0000000000000000000000000000000000000000000000000001000000010001' + */ + binaryZeroPad() { + if (this._binaryZeroPad === void 0) { + this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, "0"); + } + return this._binaryZeroPad; } - async _init(kwargs) { + /** + * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the + * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and + * returning the address with the v4 portion converted to two v6 groups. + * Used internally by `parse()`. + */ + // TODO: Improve the semantics of this helper function + parse4in6(address) { + if (address.indexOf(".") === -1) { + return address; + } + const groups = address.split(":"); + const lastGroup = groups.slice(-1)[0]; + const v4Octets = lastGroup.split("."); + if (v4Octets.length === constants4.GROUPS && v4Octets.every((octet) => /^\d{1,3}$/.test(octet))) { + if (v4Octets.some((octet) => /^0\d/.test(octet))) { + const highlighted = v4Octets.map(spanLeadingZeroes4).join("."); + const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(":"); + const separator = groups.length > 1 ? ":" : ""; + throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`); + } + } + const address4 = lastGroup.match(constants4.RE_ADDRESS); + if (address4) { + this.parsedAddress4 = address4[0]; + const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : ""; + this.address4 = new ipv4_1.Address4(`${this.parsedAddress4}${v4Suffix}`); + this.v4 = true; + groups[groups.length - 1] = this.address4.toGroup6(); + address = groups.join(":"); + } + return address; } - [Symbol.asyncIterator]() { - this.buffer = void 0; - this.index = 0; - this.lastLoad = 0; - this.left = this.limit; - return { - next: async () => { - if (this.buffer == void 0) { - this.buffer = []; - if (await this._init(this.kwargs)) { - this.left = this.buffer.length; - } - } - if (this.left <= 0) { - return { - value: void 0, - done: true - }; - } - if (this.index == this.buffer.length) { - if (this.waitTime) { - await (0, Helpers_1.sleep)(this.waitTime - ((/* @__PURE__ */ new Date()).getTime() / 1e3 - this.lastLoad)); - } - this.lastLoad = (/* @__PURE__ */ new Date()).getTime() / 1e3; - this.index = 0; - this.buffer = []; - const nextChunk = await this._loadNextChunk(); - if (nextChunk === false) { - return { - value: void 0, - done: true - }; - } - if (nextChunk) { - this.left = this.buffer.length; - } - } - if (!this.buffer || !this.buffer.length) { - return { - value: void 0, - done: true - }; - } - const result = this.buffer[this.index]; - this.left -= 1; - this.index += 1; - return { - value: result, - done: false - }; + /** + * Parses an IPv6 address string into its 8 hexadecimal groups (expanding + * any `::` elision and any trailing v4-in-v6 portion) and stores the result + * on `this.parsedAddress`. Called automatically by the constructor; you + * typically don't need to call it directly. Throws `AddressError` if the + * input is malformed. + */ + // TODO: Make private? + parse(address) { + address = this.parse4in6(address); + const badCharacters = address.match(constants6.RE_BAD_CHARACTERS); + if (badCharacters) { + throw new address_error_1.AddressError(`Bad character${badCharacters.length > 1 ? "s" : ""} detected in address: ${badCharacters.join("")}`, address.replace(constants6.RE_BAD_CHARACTERS, '<span class="parse-error">$1</span>')); + } + const badAddress = address.match(constants6.RE_BAD_ADDRESS); + if (badAddress) { + throw new address_error_1.AddressError(`Address failed regex: ${badAddress.join("")}`, address.replace(constants6.RE_BAD_ADDRESS, '<span class="parse-error">$1</span>')); + } + let groups = []; + const halves = address.split("::"); + if (halves.length === 2) { + let first = halves[0].split(":"); + let last = halves[1].split(":"); + if (first.length === 1 && first[0] === "") { + first = []; + } + if (last.length === 1 && last[0] === "") { + last = []; } - }; - } - async collect() { - var _a3, e_1, _b, _c; - const result = new _1.helpers.TotalList(); - try { - for (var _d = true, _e = __asyncValues2(this), _f; _f = await _e.next(), _a3 = _f.done, !_a3; _d = true) { - _c = _f.value; - _d = false; - const message = _c; - result.push(message); + const remaining = this.groups - (first.length + last.length); + if (!remaining) { + throw new address_error_1.AddressError("Error parsing groups"); } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a3 && (_b = _e.return)) await _b.call(_e); - } finally { - if (e_1) throw e_1.error; + this.elidedGroups = remaining; + this.elisionBegin = first.length; + this.elisionEnd = first.length + this.elidedGroups; + groups = groups.concat(first); + for (let i = 0; i < remaining; i++) { + groups.push("0"); } + groups = groups.concat(last); + } else if (halves.length === 1) { + groups = address.split(":"); + this.elidedGroups = 0; + } else { + throw new address_error_1.AddressError("Too many :: groups found"); } - result.total = this.total; - return result; + groups = groups.map((group) => parseInt(group, 16).toString(16)); + if (groups.length !== this.groups) { + throw new address_error_1.AddressError("Incorrect number of groups found"); + } + return groups; } - async _loadNextChunk() { - throw new Error("Not Implemented"); + /** + * Returns the canonical (fully expanded) form of the address: all 8 groups, + * each padded to 4 hex digits, with no `::` collapsing + * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and + * byte-exact comparison. + */ + canonicalForm() { + return this.parsedAddress.map(paddedHex).join(":"); } - }; - exports2.RequestIter = RequestIter; - } -}); - -// node_modules/telegram/client/fs.js -var require_fs = __commonJS({ - "node_modules/telegram/client/fs.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + /** + * Return the decimal form of the address + * @returns {String} + */ + decimal() { + return this.parsedAddress.map((n) => parseInt(n, 16).toString(10).padStart(5, "0")).join(":"); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - __exportStar2(require("fs"), exports2); - } -}); - -// node_modules/telegram/client/path.js -var require_path = __commonJS({ - "node_modules/telegram/client/path.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var path_1 = __importDefault2(require("path")); - exports2.default = path_1.default; - } -}); - -// node_modules/telegram/client/downloads.js -var require_downloads = __commonJS({ - "node_modules/telegram/client/downloads.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + /** + * Return the address as a BigInt + * @returns {bigint} + */ + bigInt() { + return BigInt(`0x${this.parsedAddress.map(paddedHex).join("")}`); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + /** + * Return the last two groups of this address as an IPv4 address string. + * If this address carries a CIDR prefix that covers the trailing 32 bits + * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the + * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to + * `/32`. + * @returns {Address4} + * @example + * var address = new Address6('2001:4860:4001::1825:bf11'); + * address.to4().correctForm(); // '24.37.191.17' + */ + to4() { + const binary = this.binaryZeroPad().split(""); + const hex = BigInt(`0b${binary.slice(96, 128).join("")}`).toString(16).padStart(8, "0"); + if (this.subnetMask >= 96) { + const v4Mask = this.subnetMask - 96; + const groups = []; + for (let i = 0; i < 8; i += 2) { + groups.push(parseInt(hex.slice(i, i + 2), 16)); + } + return new ipv4_1.Address4(`${groups.join(".")}/${v4Mask}`); + } + return ipv4_1.Address4.fromHex(hex); } - __setModuleDefault2(result, mod); - return result; - }; - var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; + /** + * Return the v4-in-v6 form of the address + * @returns {String} + */ + to4in6() { + const address4 = this.to4(); + const address6 = new _Address6(this.parsedAddress.slice(0, 6).join(":"), 6); + const correct = address6.correctForm(); + let infix = ""; + if (!/:$/.test(correct)) { + infix = ":"; + } + return correct + infix + address4.correctForm(); } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); + /** + * Decodes the Teredo tunneling fields embedded in this address. Returns the + * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, + * UDP port, and Microsoft-format flag breakdown (reserved, universal/local, + * group/individual, nonce). Only meaningful for addresses in `2001::/32`. + */ + inspectTeredo() { + const prefix = this.getBitsBase16(0, 32); + const bitsForUdpPort = this.getBits(80, 96); + const udpPort = (bitsForUdpPort ^ BigInt("0xffff")).toString(); + const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64)); + const bitsForClient4 = this.getBits(96, 128); + const client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt("0xffffffff")).toString(16).padStart(8, "0")); + const flagsBase2 = this.getBitsBase2(64, 80); + const coneNat = (0, common_1.testBit)(flagsBase2, 15); + const reserved = (0, common_1.testBit)(flagsBase2, 14); + const groupIndividual = (0, common_1.testBit)(flagsBase2, 8); + const universalLocal = (0, common_1.testBit)(flagsBase2, 9); + const nonce = BigInt(`0b${flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16)}`).toString(10); + return { + prefix: `${prefix.slice(0, 4)}:${prefix.slice(4, 8)}`, + server4: server4.address, + client4: client4.address, + flags: flagsBase2, + coneNat, + microsoft: { + reserved, + universalLocal, + groupIndividual, + nonce + }, + udpPort + }; } - }; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GenericDownloadIter = exports2.DirectDownloadIter = void 0; - exports2.iterDownload = iterDownload; - exports2.downloadFileV2 = downloadFileV2; - exports2.downloadMedia = downloadMedia; - exports2._downloadDocument = _downloadDocument; - exports2._downloadContact = _downloadContact; - exports2._downloadWebDocument = _downloadWebDocument; - exports2._downloadCachedPhotoSize = _downloadCachedPhotoSize; - exports2._downloadPhoto = _downloadPhoto; - exports2.downloadProfilePhoto = downloadProfilePhoto; - var tl_1 = require_tl(); - var Utils_1 = require_Utils(); - var Helpers_1 = require_Helpers(); - var __1 = require_telegram(); - var requestIter_1 = require_requestIter(); - var errors_1 = require_errors(); - var fs_1 = require_fs(); - var extensions_1 = require_extensions(); - var fs = __importStar2(require_fs()); - var path_1 = __importDefault2(require_path()); - var big_integer_1 = __importDefault2(require_BigInteger()); - var MIN_CHUNK_SIZE = 4096; - var ONE_MB = 1024 * 1024; - var TIMED_OUT_SLEEP = 1e3; - var MAX_CHUNK_SIZE = 512 * 1024; - var DirectDownloadIter = class extends requestIter_1.RequestIter { - constructor() { - super(...arguments); - this._timedOut = false; + /** + * Decodes the 6to4 tunneling fields embedded in this address. Returns the + * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for + * addresses in `2002::/16`. + */ + inspect6to4() { + const prefix = this.getBitsBase16(0, 16); + const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48)); + return { + prefix: prefix.slice(0, 4), + gateway: gateway.address + }; } - async _init({ fileLocation, dcId, offset, stride, chunkSize, requestSize, fileSize, msgData }) { - this.request = new tl_1.Api.upload.GetFile({ - location: fileLocation, - offset, - limit: requestSize - }); - this.total = fileSize; - this._stride = stride; - this._chunkSize = chunkSize; - this._lastPart = void 0; - this._timedOut = false; - this._sender = await this.client.getSender(dcId); + /** + * Return a v6 6to4 address from a v6 v4inv6 address + * @returns {Address6} + */ + to6to4() { + if (!this.is4()) { + return null; + } + const addr6to4 = [ + "2002", + this.getBitsBase16(96, 112), + this.getBitsBase16(112, 128), + "", + "/16" + ].join(":"); + return new _Address6(addr6to4); } - async _loadNextChunk() { - const current = await this._request(); - this.buffer.push(current); - if (current.length < this.request.limit) { - this.left = this.buffer.length; - await this.close(); - return true; + /** + * Embed an IPv4 address into a NAT64 IPv6 address using the encoding + * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). + * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix + * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter + * than /64 the IPv4 octets are split around the reserved bits 64–71. + * @example + * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221' + * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::' + */ + static fromAddress4Nat64(address, prefix = "64:ff9b::/96") { + const v4 = new ipv4_1.Address4(address); + const prefix6 = new _Address6(prefix); + const pl = prefix6.subnetMask; + if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) { + throw new address_error_1.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96"); + } + const prefixBits = prefix6.binaryZeroPad(); + const v4Bits = v4.binaryZeroPad(); + let bits; + if (pl === 96) { + bits = prefixBits.slice(0, 96) + v4Bits; } else { - this.request.offset = this.request.offset.add(this._stride); + const beforeU = 64 - pl; + bits = [ + prefixBits.slice(0, pl), + v4Bits.slice(0, beforeU), + // Bits 64 to 71 are the reserved u octet and are always zero. + "00000000", + v4Bits.slice(beforeU), + "0".repeat(128 - 72 - (32 - beforeU)) + ].join(""); } - } - async _request() { - try { - this._sender = await this.client.getSender(this._sender.dcId); - const result = await this.client.invokeWithSender(this.request, this._sender); - this._timedOut = false; - if (result instanceof tl_1.Api.upload.FileCdnRedirect) { - throw new Error("CDN Not supported. Please Add an issue in github"); - } - return result.bytes; - } catch (e) { - if (e.errorMessage == "TIMEOUT") { - if (this._timedOut) { - this.client._log.warn("Got two timeouts in a row while downloading file"); - throw e; - } - this._timedOut = true; - this.client._log.info("Got timeout while downloading file, retrying once"); - await (0, Helpers_1.sleep)(TIMED_OUT_SLEEP); - return await this._request(); - } else if (e instanceof errors_1.FileMigrateError) { - this.client._log.info("File lives in another DC"); - this._sender = await this.client.getSender(e.newDc); - return await this._request(); - } else if (e.errorMessage == "FILEREF_UPGRADE_NEEDED") { - throw e; - } else { - throw e; - } + const hex = BigInt(`0b${bits}`).toString(16).padStart(32, "0"); + const groups = []; + for (let i = 0; i < 8; i++) { + groups.push(hex.slice(i * 4, (i + 1) * 4)); } + return new _Address6(groups.join(":")); } - async close() { - this.client._log.debug("Finished downloading file ..."); - } - [Symbol.asyncIterator]() { - return super[Symbol.asyncIterator](); - } - }; - exports2.DirectDownloadIter = DirectDownloadIter; - var GenericDownloadIter = class extends DirectDownloadIter { - async _loadNextChunk() { - let data = Buffer.alloc(0); - const bad = this.request.offset.mod(this.request.limit).toJSNumber(); - const before2 = this.request.offset; - this.request.offset = this.request.offset.subtract(bad); - let done = false; - while (!done && data.length - bad < this._chunkSize) { - const current = await this._request(); - this.request.offset = this.request.offset.add(this.request.limit); - data = Buffer.concat([data, current]); - done = current.length < this.request.limit; + /** + * Extract the embedded IPv4 address from a NAT64 IPv6 address using the + * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). + * The default prefix is the well-known prefix `64:ff9b::/96`. Returns + * `null` if this address is not contained within the given prefix. + * @example + * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33' + */ + toAddress4Nat64(prefix = "64:ff9b::/96") { + const prefix6 = new _Address6(prefix); + const pl = prefix6.subnetMask; + if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) { + throw new address_error_1.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96"); } - this.request.offset = before2; - for (let i = bad; i < data.length; i += this._stride) { - this.buffer.push(data.slice(i, i + this._chunkSize)); - this.request.offset = this.request.offset.add(this._stride); + if (!this.isHostInSubnet(prefix6)) { + return null; } - if (done) { - this.left = this.buffer.length; - await this.close(); - return; + const bits = this.binaryZeroPad(); + let v4Bits; + if (pl === 96) { + v4Bits = bits.slice(96, 128); + } else { + const beforeU = 64 - pl; + v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU)); } - if (this.buffer[this.buffer.length - 1].length != this._chunkSize) { - this._lastPart = this.buffer.pop(); - this.request.offset = this.request.offset.subtract(this._stride); + const octets = []; + for (let i = 0; i < 4; i++) { + octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString()); } + return new ipv4_1.Address4(octets.join(".")); } - }; - exports2.GenericDownloadIter = GenericDownloadIter; - function iterDownload(client2, { file, offset = big_integer_1.default.zero, stride, limit, chunkSize, requestSize = MAX_CHUNK_SIZE, fileSize, dcId, msgData }) { - const info = __1.utils.getFileInfo(file); - if (info.dcId != void 0) { - dcId = info.dcId; + /** + * Return a byte array. + * + * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. + * @returns {Array} + */ + toByteArray() { + const value = this.bigInt().toString(16).padStart(constants6.BITS / 4, "0"); + const bytes = []; + for (let i = 0, length = value.length; i < length; i += 2) { + bytes.push(parseInt(value.substring(i, i + 2), 16)); + } + return bytes; } - if (fileSize == void 0) { - fileSize = info.size; + /** + * Return an unsigned byte array. + * + * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. + * @returns {Array} + */ + toUnsignedByteArray() { + return this.toByteArray().map(unsignByte); } - file = info.location; - if (chunkSize == void 0) { - chunkSize = requestSize; + /** + * Convert a byte array to an Address6 object. + * + * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an + * `Int8Array` or a Java `byte[]` holds them), folding signed values to their + * unsigned equivalent. Throws `AddressError` unless given exactly 16 + * integers from -128 to 255. + * + * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. + * @returns {Address6} + */ + static fromByteArray(bytes) { + common.assertByteArray(bytes, 16, "IPv6", -128); + return this.fromUnsignedByteArray(bytes.map(unsignByte)); } - if (limit == void 0 && fileSize != void 0) { - limit = Math.floor(fileSize.add(chunkSize).subtract(1).divide(chunkSize).toJSNumber()); + /** + * Convert an unsigned byte array to an Address6 object. + * + * Throws `AddressError` unless given exactly 16 integers from 0 to 255. + * + * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. + * @returns {Address6} + */ + static fromUnsignedByteArray(bytes) { + common.assertByteArray(bytes, 16, "IPv6", 0); + const BYTE_MAX = BigInt("256"); + let result = BigInt("0"); + let multiplier = BigInt("1"); + for (let i = bytes.length - 1; i >= 0; i--) { + result += multiplier * BigInt(bytes[i].toString(10)); + multiplier *= BYTE_MAX; + } + return _Address6.fromBigInt(result); } - if (stride == void 0) { - stride = chunkSize; - } else if (stride < chunkSize) { - throw new Error("Stride must be >= chunkSize"); + /** + * Returns true if the address is in the canonical form, false otherwise + * @returns {boolean} + */ + isCanonical() { + return this.addressMinusSuffix === this.canonicalForm(); + } + /** + * Returns true if the address is a link-local unicast address in `fe80::/10` + * ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4)) + * or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local + * (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise. + * @returns {boolean} + */ + isLinkLocal() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isLinkLocal(); + } + return this.isHostInSubnet(LINK_LOCAL_SUBNET); } - requestSize -= requestSize % MIN_CHUNK_SIZE; - if (requestSize < MIN_CHUNK_SIZE) { - requestSize = MIN_CHUNK_SIZE; - } else if (requestSize > MAX_CHUNK_SIZE) { - requestSize = MAX_CHUNK_SIZE; + /** + * Returns true if the address is a multicast address, false otherwise + * @returns {boolean} + */ + isMulticast() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isMulticast(); + } + const type = this.getType(); + return type === "Multicast" || type.startsWith("Multicast "); } - let cls; - if (chunkSize == requestSize && offset.divide(MAX_CHUNK_SIZE).eq(big_integer_1.default.zero) && stride % MIN_CHUNK_SIZE == 0 && (limit == void 0 || offset.divide(limit).eq(big_integer_1.default.zero))) { - cls = DirectDownloadIter; - client2._log.info(`Starting direct file download in chunks of ${requestSize} at ${offset}, stride ${stride}`); - } else { - cls = GenericDownloadIter; - client2._log.info(`Starting indirect file download in chunks of ${requestSize} at ${offset}, stride ${stride}`); + /** + * Returns true if the address was written in v4-in-v6 dotted-quad notation + * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag + * and does not reflect whether the address bits lie in the IPv4-mapped + * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}. + * @returns {boolean} + */ + is4() { + return this.v4; } - return new cls(client2, limit, {}, { - fileLocation: file, - dcId, - offset, - stride, - chunkSize, - requestSize, - fileSize, - msgData - }); - } - function getWriter(outputFile) { - if (!outputFile || Buffer.isBuffer(outputFile)) { - return new extensions_1.BinaryWriter(Buffer.alloc(0)); - } else if (typeof outputFile == "string") { - return (0, fs_1.createWriteStream)(outputFile); - } else { - return outputFile; + /** + * Returns true if the address is an IPv4-mapped IPv6 address in + * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), + * false otherwise. Unlike {@link is4}, this checks the underlying address + * bits rather than the textual notation, so `::ffff:127.0.0.1` and + * `::ffff:7f00:1` both return true. + * @returns {boolean} + */ + isMapped4() { + return this.isHostInSubnet(IPV4_MAPPED_SUBNET); } - } - function closeWriter(writer) { - if ("close" in writer && writer.close) { - writer.close(); + /** + * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped + * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, + * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that + * embedded address as an {@link Address4}; otherwise return null. + * + * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, + * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and + * delegate to the embedded {@link Address4} when present, so a literal such as + * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) + * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). + * This matters wherever the checks back a trust-boundary decision (e.g. an + * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, + * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as + * non-internal. + * @returns {Address4 | null} + */ + embeddedIPv4() { + if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) { + return this.to4(); + } + return null; } - } - function returnWriterValue(writer) { - if (writer instanceof extensions_1.BinaryWriter) { - return writer.getValue(); + /** + * Returns true if the address is a Teredo address, false otherwise + * @returns {boolean} + */ + isTeredo() { + return this.isHostInSubnet(TEREDO_SUBNET); } - if (writer instanceof fs.WriteStream) { - if (typeof writer.path == "string") { - return path_1.default.resolve(writer.path); - } else { - return Buffer.from(writer.path); - } + /** + * Returns true if the address is a 6to4 address, false otherwise + * @returns {boolean} + */ + is6to4() { + return this.isHostInSubnet(SIX_TO_FOUR_SUBNET); } - } - async function downloadFileV2(client2, inputLocation, { outputFile = void 0, partSizeKb = void 0, fileSize = void 0, progressCallback = void 0, dcId = void 0, msgData = void 0 }) { - var _a3, e_1, _b, _c; - if (!partSizeKb) { - if (!fileSize) { - partSizeKb = 64; - } else { - partSizeKb = __1.utils.getAppropriatedPartSize(fileSize); + /** + * Returns true if the address is a loopback address, false otherwise + * @returns {boolean} + */ + isLoopback() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isLoopback(); } + return this.getType() === "Loopback"; } - const partSize = Math.floor(partSizeKb * 1024); - if (partSize % MIN_CHUNK_SIZE != 0) { - throw new Error("The part size must be evenly divisible by 4096"); + /** + * Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses. + * @returns {boolean} + */ + isULA() { + return this.isHostInSubnet(ULA_SUBNET); } - const writer = getWriter(outputFile); - let downloaded = big_integer_1.default.zero; - try { - try { - for (var _d = true, _e = __asyncValues2(iterDownload(client2, { - file: inputLocation, - requestSize: partSize, - dcId, - msgData - })), _f; _f = await _e.next(), _a3 = _f.done, !_a3; _d = true) { - _c = _f.value; - _d = false; - const chunk = _c; - await writer.write(chunk); - downloaded = downloaded.add(chunk.length); - if (progressCallback) { - await progressCallback(downloaded, (0, big_integer_1.default)(fileSize || big_integer_1.default.zero)); - } - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a3 && (_b = _e.return)) await _b.call(_e); - } finally { - if (e_1) throw e_1.error; - } + /** + * Returns true if the address is private, i.e. a Unique Local Address in + * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an + * address in the NAT64 local-use range `64:ff9b:1::/48` + * ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an + * IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in + * one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) + * private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to + * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to + * catch mapped RFC 1918 addresses as well as native ULAs. + * + * The local-use NAT64 range is reported private as a whole rather than by + * its embedded IPv4 address: an operator may carve a prefix of any RFC 6052 + * length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4 + * addresses under different deployments and no single decoding is correct. + * Use {@link toAddress4Nat64} with the deployment's prefix to decode one. + * @returns {boolean} + */ + isPrivate() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isPrivate(); } - return returnWriterValue(writer); - } finally { - closeWriter(writer); + return this.isULA() || this.isHostInSubnet(NAT64_LOCAL_USE_SUBNET); } - } - async function downloadMedia(client2, messageOrMedia, outputFile, thumb, progressCallback) { - let msgData; - let date; - let media; - if (messageOrMedia instanceof tl_1.Api.Message) { - media = messageOrMedia.media; - date = messageOrMedia.date; - msgData = messageOrMedia.inputChat ? [messageOrMedia.inputChat, messageOrMedia.id] : void 0; - } else { - media = messageOrMedia; - date = Date.now(); + /** + * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded + * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` + * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false + * otherwise. There is no native IPv6 CGNAT range, so this only ever returns + * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). + * @returns {boolean} + */ + isCGNAT() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isCGNAT(); + } + return false; } - if (typeof media == "string") { - throw new Error("not implemented"); + /** + * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded + * IPv4 address is the limited broadcast address `255.255.255.255` + * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. + * There is no IPv6 broadcast, so this only ever returns true for an embedded + * IPv4 address (e.g. `::ffff:255.255.255.255`). + * @returns {boolean} + */ + isBroadcast() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isBroadcast(); + } + return false; } - if (media instanceof tl_1.Api.MessageMediaWebPage) { - if (media.webpage instanceof tl_1.Api.WebPage) { - media = media.webpage.document || media.webpage.photo; + /** + * Returns true if the address is the unspecified address `::`. + * @returns {boolean} + */ + isUnspecified() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isUnspecified(); } + return this.getType() === "Unspecified"; } - if (media instanceof tl_1.Api.MessageMediaPhoto || media instanceof tl_1.Api.Photo) { - return _downloadPhoto(client2, media, outputFile, date, thumb, progressCallback); - } else if (media instanceof tl_1.Api.MessageMediaDocument || media instanceof tl_1.Api.Document) { - return _downloadDocument(client2, media, outputFile, date, thumb, progressCallback, msgData); - } else if (media instanceof tl_1.Api.MessageMediaContact) { - return _downloadContact(client2, media, {}); - } else if (media instanceof tl_1.Api.WebDocument || media instanceof tl_1.Api.WebDocumentNoProxy) { - return _downloadWebDocument(client2, media, {}); - } else { - return Buffer.alloc(0); + /** + * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). + * @returns {boolean} + */ + isDocumentation() { + return DOCUMENTATION_SUBNETS.some((subnet) => this.isHostInSubnet(subnet)); } - } - async function _downloadDocument(client2, doc, outputFile, date, thumb, progressCallback, msgData) { - if (doc instanceof tl_1.Api.MessageMediaDocument) { - if (!doc.document) { - return Buffer.alloc(0); + /** + * Returns true if the address is in the benchmarking range `2001:2::/48` + * ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an + * IPv4-mapped / NAT64 address whose embedded IPv4 address is in + * `198.18.0.0/15`, false otherwise. + * @returns {boolean} + */ + isBenchmarking() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isBenchmarking(); } - doc = doc.document; + return this.isHostInSubnet(BENCHMARKING_SUBNET); } - if (!(doc instanceof tl_1.Api.Document)) { - return Buffer.alloc(0); + /** + * Returns true if the address is globally reachable: inside the global + * unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space + * Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns + * for global unicast; everything else is reserved, ULA, link-local, or + * multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/) + * marks as not globally reachable. An IPv4-mapped or NAT64 well-known + * address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and + * `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4 + * (`2002::/16`) are not global either: the registry lists them as N/A and a + * packet to one needs a relay. + * + * This covers everything the individual classifiers name and the blocks they + * do not: the discard-only prefix `100::/64`, the IETF protocol assignments + * in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible + * `::/96` ranges, and unallocated space such as `4000::/3`. It is the single + * predicate to use where a request must not reach an internal or + * special-purpose destination; see SECURITY.md. + * @returns {boolean} + */ + isGlobal() { + const embedded = this.embeddedIPv4(); + if (embedded) { + return embedded.isGlobal(); + } + return this.isHostInSubnet(GLOBAL_UNICAST_SUBNET) && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V6); } - let size; - if (thumb == void 0) { - outputFile = getProperFilename(outputFile, "document", "." + (__1.utils.getExtension(doc) || "bin"), date); - } else { - outputFile = getProperFilename(outputFile, "photo", ".jpg", date); - size = getThumb(doc.thumbs || [], thumb); - if (size instanceof tl_1.Api.PhotoCachedSize || size instanceof tl_1.Api.PhotoStrippedSize) { - return _downloadCachedPhotoSize(size, outputFile); + // #endregion + // #region HTML + /** + * Returns the address as an HTTP URL with the host bracketed, e.g. + * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, + * e.g. `http://[2001:db8::1]:8080/`. + */ + href(optionalPort) { + if (optionalPort === void 0) { + optionalPort = ""; + } else { + optionalPort = `:${optionalPort}`; } + return `http://[${this.correctForm()}]${optionalPort}/`; } - return await downloadFileV2(client2, new tl_1.Api.InputDocumentFileLocation({ - id: doc.id, - accessHash: doc.accessHash, - fileReference: doc.fileReference, - thumbSize: size && "type" in size ? size.type : "" - }), { - outputFile, - fileSize: size && "size" in size ? (0, big_integer_1.default)(size.size) : doc.size, - progressCallback, - msgData - }); - } - async function _downloadContact(client2, media, args) { - throw new Error("not implemented"); - } - async function _downloadWebDocument(client2, media, args) { - throw new Error("not implemented"); - } - function getThumb(thumbs, thumb) { - function sortThumb(thumb2) { - if (thumb2 instanceof tl_1.Api.PhotoStrippedSize) { - return thumb2.bytes.length; + /** + * Returns an HTML `<a>` element whose `href` encodes the address in a URL + * hash fragment (default prefix `/#address=`). Useful for linking between + * pages of an address-inspector UI. + * @param options.className - CSS class for the rendered `<a>` element + * @param options.prefix - hash prefix prepended to the address (default `/#address=`) + * @param options.v4 - when true, render the address in v4-in-v6 form + */ + link(options) { + if (!options) { + options = {}; } - if (thumb2 instanceof tl_1.Api.PhotoCachedSize) { - return thumb2.bytes.length; + if (options.className === void 0) { + options.className = ""; } - if (thumb2 instanceof tl_1.Api.PhotoSize) { - return thumb2.size; + if (options.prefix === void 0) { + options.prefix = "/#address="; } - if (thumb2 instanceof tl_1.Api.PhotoSizeProgressive) { - return Math.max(...thumb2.sizes); + if (options.v4 === void 0) { + options.v4 = false; } - if (thumb2 instanceof tl_1.Api.VideoSize) { - return thumb2.size; + let formFunction = this.correctForm; + if (options.v4) { + formFunction = this.to4in6; } - return 0; + const form = formFunction.call(this); + const safeHref = helpers.escapeHtml(`${options.prefix}${form}`); + const safeForm = helpers.escapeHtml(form); + if (options.className) { + const safeClass = helpers.escapeHtml(options.className); + return `<a href="${safeHref}" class="${safeClass}">${safeForm}</a>`; + } + return `<a href="${safeHref}">${safeForm}</a>`; } - thumbs = thumbs.sort((a, b) => sortThumb(a) - sortThumb(b)); - const correctThumbs = []; - for (const t of thumbs) { - if (!(t instanceof tl_1.Api.PhotoPathSize)) { - correctThumbs.push(t); + /** + * Groups an address. + * + * Returns an HTML fragment: each group is wrapped in a `<span>` carrying + * the group classes an address-inspector UI hovers on. The address content + * is HTML-escaped; anything you concatenate around it is your + * responsibility. + * @returns {String} + */ + group() { + if (this.elidedGroups === 0) { + return helpers.simpleGroup(this.addressMinusSuffix).join(":"); + } + assert(typeof this.elidedGroups === "number"); + assert(typeof this.elisionBegin === "number"); + const output = []; + const [left, right] = this.addressMinusSuffix.split("::"); + if (left.length) { + output.push(...helpers.simpleGroup(left)); + } else { + output.push(""); + } + const classes = ["hover-group"]; + for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) { + classes.push(`group-${i}`); + } + output.push(`<span class="${classes.join(" ")}"></span>`); + if (right.length) { + output.push(...helpers.simpleGroup(right, this.elisionEnd)); + } else { + output.push(""); } + if (this.is4()) { + assert(this.address4 instanceof ipv4_1.Address4); + output.pop(); + output.push(this.address4.groupForV6()); + } + return output.join(":"); } - if (thumb == void 0) { - return correctThumbs.pop(); - } else if (typeof thumb == "number") { - return correctThumbs[thumb]; - } else if (typeof thumb == "string") { - for (const t of correctThumbs) { - if ("type" in t && t.type == thumb) { - return t; + // #endregion + // #region Regular expressions + /** + * Generate a regular expression string that can be used to find or validate + * all variations of this address + * @param {boolean} substringSearch + * @returns {string} + */ + regularExpressionString(substringSearch = false) { + let output = []; + const address6 = new _Address6(this.correctForm()); + if (address6.elidedGroups === 0) { + output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress)); + } else if (address6.elidedGroups === constants6.GROUPS) { + output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS)); + } else { + const halves = address6.address.split("::"); + if (halves[0].length) { + output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(":"))); + } + assert(typeof address6.elidedGroups === "number"); + output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0)); + if (halves[1].length) { + output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(":"))); } + output = [output.join(":")]; } - } else if (thumb instanceof tl_1.Api.PhotoSize || thumb instanceof tl_1.Api.PhotoCachedSize || thumb instanceof tl_1.Api.PhotoStrippedSize || thumb instanceof tl_1.Api.VideoSize) { - return thumb; + if (!substringSearch) { + output = [ + "(?=^|", + regular_expressions_1.ADDRESS_BOUNDARY, + "|[^\\w\\:])(", + ...output, + ")(?=[^\\w\\:]|", + regular_expressions_1.ADDRESS_BOUNDARY, + "|$)" + ]; + } + return output.join(""); + } + /** + * Generate a regular expression that can be used to find or validate all + * variations of this address. + * @param {boolean} substringSearch + * @returns {RegExp} + */ + regularExpression(substringSearch = false) { + return new RegExp(this.regularExpressionString(substringSearch), "i"); + } + }; + exports2.Address6 = Address6; + var TYPE_SUBNETS = Object.keys(constants6.TYPES).map((subnet) => [ + new Address6(subnet), + constants6.TYPES[subnet] + ]); + var TEREDO_SUBNET = new Address6("2001::/32"); + var SIX_TO_FOUR_SUBNET = new Address6("2002::/16"); + var ULA_SUBNET = new Address6("fc00::/7"); + var LINK_LOCAL_SUBNET = new Address6("fe80::/10"); + var DOCUMENTATION_SUBNETS = [new Address6("2001:db8::/32"), new Address6("3fff::/20")]; + var BENCHMARKING_SUBNET = new Address6("2001:2::/48"); + var GLOBAL_UNICAST_SUBNET = new Address6("2000::/3"); + var SPECIAL_PURPOSE_V6 = constants6.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({ + subnet: new Address6(cidr), + reachable + })); + var IPV4_MAPPED_SUBNET = new Address6("::ffff:0:0/96"); + var NAT64_WELL_KNOWN_SUBNET = new Address6("64:ff9b::/96"); + var NAT64_LOCAL_USE_SUBNET = new Address6("64:ff9b:1::/48"); + } +}); + +// node_modules/ip-address/dist/ip-address.js +var require_ip_address = __commonJS({ + "node_modules/ip-address/dist/ip-address.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - } - async function _downloadCachedPhotoSize(size, outputFile) { - let data; - if (size instanceof tl_1.Api.PhotoStrippedSize) { - data = (0, Utils_1.strippedPhotoToJpg)(size.bytes); - } else { - data = size.bytes; + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - const writer = getWriter(outputFile); - try { - await writer.write(data); - } finally { - closeWriter(writer); + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.v6 = exports2.AddressError = exports2.Address6 = exports2.Address4 = void 0; + var ipv4_1 = require_ipv4(); + Object.defineProperty(exports2, "Address4", { enumerable: true, get: function() { + return ipv4_1.Address4; + } }); + var ipv6_1 = require_ipv6(); + Object.defineProperty(exports2, "Address6", { enumerable: true, get: function() { + return ipv6_1.Address6; + } }); + var address_error_1 = require_address_error(); + Object.defineProperty(exports2, "AddressError", { enumerable: true, get: function() { + return address_error_1.AddressError; + } }); + var helpers = __importStar2(require_helpers3()); + exports2.v6 = { helpers }; + } +}); + +// node_modules/socks/build/common/helpers.js +var require_helpers4 = __commonJS({ + "node_modules/socks/build/common/helpers.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateSocksClientOptions = validateSocksClientOptions; + exports2.validateSocksClientChainOptions = validateSocksClientChainOptions; + exports2.ipv4ToInt32 = ipv4ToInt32; + exports2.int32ToIpv4 = int32ToIpv4; + exports2.ipToBuffer = ipToBuffer; + var util_1 = require_util(); + var constants_1 = require_constants3(); + var stream = require("stream"); + var ip_address_1 = require_ip_address(); + var net = require("net"); + function validateSocksClientOptions(options, acceptedCommands = ["connect", "bind", "associate"]) { + if (!constants_1.SocksCommand[options.command]) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommand, options); } - return returnWriterValue(writer); - } - function getProperFilename(file, fileType, extension, date) { - if (!file || typeof file != "string") { - return file; + if (acceptedCommands.indexOf(options.command) === -1) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandForOperation, options); } - if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) { - let fullName = fileType + date + extension; - return path_1.default.join(file, fullName); + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); } - return file; - } - async function _downloadPhoto(client2, photo, file, date, thumb, progressCallback) { - if (photo instanceof tl_1.Api.MessageMediaPhoto) { - if (photo.photo instanceof tl_1.Api.PhotoEmpty || !photo.photo) { - return Buffer.alloc(0); - } - photo = photo.photo; + if (!isValidSocksProxy(options.proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); } - if (!(photo instanceof tl_1.Api.Photo)) { - return Buffer.alloc(0); + validateCustomProxyAuth(options.proxy, options); + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); } - const photoSizes = [...photo.sizes || [], ...photo.videoSizes || []]; - const size = getThumb(photoSizes, thumb); - if (!size || size instanceof tl_1.Api.PhotoSizeEmpty) { - return Buffer.alloc(0); + if (options.existing_socket && !(options.existing_socket instanceof stream.Duplex)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsExistingSocket, options); } - if (!date) { - date = Date.now(); + } + function validateSocksClientChainOptions(options) { + if (options.command !== "connect") { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandChain, options); } - file = getProperFilename(file, "photo", ".jpg", date); - if (size instanceof tl_1.Api.PhotoCachedSize || size instanceof tl_1.Api.PhotoStrippedSize) { - return _downloadCachedPhotoSize(size, file); + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); } - let fileSize; - if (size instanceof tl_1.Api.PhotoSizeProgressive) { - fileSize = Math.max(...size.sizes); - } else { - fileSize = "size" in size ? size.size : 512; + if (!(options.proxies && Array.isArray(options.proxies) && options.proxies.length >= 2)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxiesLength, options); } - return downloadFileV2(client2, new tl_1.Api.InputPhotoFileLocation({ - id: photo.id, - accessHash: photo.accessHash, - fileReference: photo.fileReference, - thumbSize: "type" in size ? size.type : "" - }), { - outputFile: file, - fileSize: (0, big_integer_1.default)(fileSize), - progressCallback, - dcId: photo.dcId + options.proxies.forEach((proxy) => { + if (!isValidSocksProxy(proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + } + validateCustomProxyAuth(proxy, options); }); + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + } } - async function downloadProfilePhoto(client2, entity, fileParams) { - let photo; - if (typeof entity == "object" && "photo" in entity) { - photo = entity.photo; - } else { - entity = await client2.getEntity(entity); - if ("photo" in entity) { - photo = entity.photo; - } else { - throw new Error(`Could not get photo from ${entity ? entity.className : void 0}`); + function validateCustomProxyAuth(proxy, options) { + if (proxy.custom_auth_method !== void 0) { + if (proxy.custom_auth_method < constants_1.SOCKS5_CUSTOM_AUTH_START || proxy.custom_auth_method > constants_1.SOCKS5_CUSTOM_AUTH_END) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthRange, options); + } + if (proxy.custom_auth_request_handler === void 0 || typeof proxy.custom_auth_request_handler !== "function") { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + if (proxy.custom_auth_response_size === void 0) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + if (proxy.custom_auth_response_handler === void 0 || typeof proxy.custom_auth_response_handler !== "function") { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); } } - let dcId; - let loc; - if (photo instanceof tl_1.Api.UserProfilePhoto || photo instanceof tl_1.Api.ChatPhoto) { - dcId = photo.dcId; - loc = new tl_1.Api.InputPeerPhotoFileLocation({ - peer: __1.utils.getInputPeer(entity), - photoId: photo.photoId, - big: fileParams.isBig - }); + } + function isValidSocksRemoteHost(remoteHost) { + return remoteHost && typeof remoteHost.host === "string" && Buffer.byteLength(remoteHost.host) < 256 && typeof remoteHost.port === "number" && remoteHost.port >= 0 && remoteHost.port <= 65535; + } + function isValidSocksProxy(proxy) { + return proxy && (typeof proxy.host === "string" || typeof proxy.ipaddress === "string") && typeof proxy.port === "number" && proxy.port >= 0 && proxy.port <= 65535 && (proxy.type === 4 || proxy.type === 5); + } + function isValidTimeoutValue(value) { + return typeof value === "number" && value > 0; + } + function ipv4ToInt32(ip) { + const address = new ip_address_1.Address4(ip); + return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0; + } + function int32ToIpv4(int32) { + const octet1 = int32 >>> 24 & 255; + const octet2 = int32 >>> 16 & 255; + const octet3 = int32 >>> 8 & 255; + const octet4 = int32 & 255; + return [octet1, octet2, octet3, octet4].join("."); + } + function ipToBuffer(ip) { + if (net.isIPv4(ip)) { + const address = new ip_address_1.Address4(ip); + return Buffer.from(address.toArray()); + } else if (net.isIPv6(ip)) { + const address = new ip_address_1.Address6(ip); + return Buffer.from(address.canonicalForm().split(":").map((segment) => segment.padStart(4, "0")).join(""), "hex"); } else { - return Buffer.alloc(0); + throw new Error("Invalid IP address format"); } - return client2.downloadFile(loc, { - outputFile: fileParams.outputFile, - dcId - }); } } }); -// node_modules/telegram/client/uploads.js -var require_uploads = __commonJS({ - "node_modules/telegram/client/uploads.js"(exports2) { +// node_modules/socks/build/common/receivebuffer.js +var require_receivebuffer = __commonJS({ + "node_modules/socks/build/common/receivebuffer.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CustomFile = void 0; - exports2.uploadFile = uploadFile; - exports2._fileToMedia = _fileToMedia; - exports2._sendAlbum = _sendAlbum; - exports2.sendFile = sendFile; - var tl_1 = require_tl(); - var Helpers_1 = require_Helpers(); - var Utils_1 = require_Utils(); - var path_1 = __importDefault2(require_path()); - var fs_1 = require_fs(); - var index_1 = require_telegram(); - var messageParse_1 = require_messageParse(); - var messages_1 = require_messages2(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var CustomFile = class { - constructor(name, size, path2, buffer) { - this.name = name; - this.size = size; - this.path = path2; - this.buffer = buffer; + exports2.ReceiveBuffer = void 0; + var ReceiveBuffer = class { + constructor(size = 4096) { + this.buffer = Buffer.allocUnsafe(size); + this.offset = 0; + this.originalSize = size; } - }; - exports2.CustomFile = CustomFile; - var CustomBuffer = class { - constructor(options) { - this.options = options; - if (!options.buffer && !options.filePath) { - throw new Error("Either one of `buffer` or `filePath` should be specified"); + get length() { + return this.offset; + } + append(data) { + if (!Buffer.isBuffer(data)) { + throw new Error("Attempted to append a non-buffer instance to ReceiveBuffer."); + } + if (this.offset + data.length >= this.buffer.length) { + const tmp = this.buffer; + this.buffer = Buffer.allocUnsafe(Math.max(this.buffer.length + this.originalSize, this.buffer.length + data.length)); + tmp.copy(this.buffer); + } + data.copy(this.buffer, this.offset); + return this.offset += data.length; + } + peek(length) { + if (length > this.offset) { + throw new Error("Attempted to read beyond the bounds of the managed internal data."); } + return this.buffer.slice(0, length); } - async slice(begin, end) { - const { buffer, filePath } = this.options; - if (buffer) { - return buffer.slice(begin, end); - } else if (filePath) { - const buffSize = end - begin; - const buff = Buffer.alloc(buffSize); - const fHandle = await fs_1.promises.open(filePath, "r"); - await fHandle.read(buff, 0, buffSize, begin); - await fHandle.close(); - return Buffer.from(buff); + get(length) { + if (length > this.offset) { + throw new Error("Attempted to read beyond the bounds of the managed internal data."); } - return Buffer.alloc(0); + const value = Buffer.allocUnsafe(length); + this.buffer.slice(0, length).copy(value); + this.buffer.copyWithin(0, length, length + this.offset - length); + this.offset -= length; + return value; } }; - var KB_TO_BYTES = 1024; - var LARGE_FILE_THRESHOLD = 10 * 1024 * 1024; - var UPLOAD_TIMEOUT = 15 * 1e3; - var DISCONNECT_SLEEP = 1e3; - var BUFFER_SIZE_2GB = 2 ** 31; - var BUFFER_SIZE_20MB = 20 * 1024 * 1024; - async function getFileBuffer(file, fileSize, maxBufferSize) { - const options = {}; - if (fileSize > maxBufferSize && file instanceof CustomFile) { - options.filePath = file.path; - } else { - options.buffer = Buffer.from(await fileToBuffer(file)); - } - return new CustomBuffer(options); - } - async function uploadFile(client2, fileParams) { - const { file, onProgress } = fileParams; - let { workers } = fileParams; - const { name, size } = file; - const fileId = (0, Helpers_1.readBigIntFromBuffer)((0, Helpers_1.generateRandomBytes)(8), true, true); - const isLarge = size > LARGE_FILE_THRESHOLD; - const partSize = (0, Utils_1.getAppropriatedPartSize)((0, big_integer_1.default)(size)) * KB_TO_BYTES; - const partCount = Math.floor((size + partSize - 1) / partSize); - const buffer = await getFileBuffer(file, size, fileParams.maxBufferSize || BUFFER_SIZE_20MB - 1); - await client2.getSender(client2.session.dcId); - if (!workers || !size) { - workers = 1; + exports2.ReceiveBuffer = ReceiveBuffer; + } +}); + +// node_modules/socks/build/client/socksclient.js +var require_socksclient = __commonJS({ + "node_modules/socks/build/client/socksclient.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); } - if (workers >= partCount) { - workers = partCount; + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SocksClientError = exports2.SocksClient = void 0; + var events_1 = require("events"); + var net = require("net"); + var smart_buffer_1 = require_smartbuffer(); + var constants_1 = require_constants3(); + var helpers_1 = require_helpers4(); + var receivebuffer_1 = require_receivebuffer(); + var util_1 = require_util(); + Object.defineProperty(exports2, "SocksClientError", { enumerable: true, get: function() { + return util_1.SocksClientError; + } }); + var ip_address_1 = require_ip_address(); + var SocksClient = class _SocksClient extends events_1.EventEmitter { + constructor(options) { + super(); + this.options = Object.assign({}, options); + (0, helpers_1.validateSocksClientOptions)(options); + this.setState(constants_1.SocksClientState.Created); } - let progress = 0; - if (onProgress) { - onProgress(progress); + /** + * Creates a new SOCKS connection. + * + * Note: Supports callbacks and promises. Only supports the connect command. + * @param options { SocksClientOptions } Options. + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnection(options, callback) { + return new Promise((resolve, reject) => { + try { + (0, helpers_1.validateSocksClientOptions)(options, ["connect"]); + } catch (err) { + if (typeof callback === "function") { + callback(err); + return resolve(err); + } else { + return reject(err); + } + } + const client2 = new _SocksClient(options); + client2.connect(options.existing_socket); + client2.once("established", (info) => { + client2.removeAllListeners(); + if (typeof callback === "function") { + callback(null, info); + resolve(info); + } else { + resolve(info); + } + }); + client2.once("error", (err) => { + client2.removeAllListeners(); + if (typeof callback === "function") { + callback(err); + resolve(err); + } else { + reject(err); + } + }); + }); } - for (let i = 0; i < partCount; i += workers) { - const sendingParts = []; - let end = i + workers; - if (end > partCount) { - end = partCount; - } - for (let j = i; j < end; j++) { - let endPart = (j + 1) * partSize; - if (endPart > size) { - endPart = size; + /** + * Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies. + * + * Note: Supports callbacks and promises. Only supports the connect method. + * Note: Implemented via createConnection() factory function. + * @param options { SocksClientChainOptions } Options + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnectionChain(options, callback) { + return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { + try { + (0, helpers_1.validateSocksClientChainOptions)(options); + } catch (err) { + if (typeof callback === "function") { + callback(err); + return resolve(err); + } else { + return reject(err); + } } - if (endPart == j * partSize) { - break; + if (options.randomizeChain) { + (0, util_1.shuffleArray)(options.proxies); } - const bytes = await buffer.slice(j * partSize, endPart); - sendingParts.push((async (jMemo, bytesMemo) => { - while (true) { - let sender; - try { - sender = await client2.getSender(client2.session.dcId); - await sender.send(isLarge ? new tl_1.Api.upload.SaveBigFilePart({ - fileId, - filePart: jMemo, - fileTotalParts: partCount, - bytes: bytesMemo - }) : new tl_1.Api.upload.SaveFilePart({ - fileId, - filePart: jMemo, - bytes: bytesMemo - })); - } catch (err) { - if (sender && !sender.isConnected()) { - await (0, Helpers_1.sleep)(DISCONNECT_SLEEP); - continue; - } else if (err instanceof index_1.errors.FloodWaitError) { - await (0, Helpers_1.sleep)(err.seconds * 1e3); - continue; - } - throw err; - } - if (onProgress) { - if (onProgress.isCanceled) { - throw new Error("USER_CANCELED"); - } - progress += 1 / partCount; - onProgress(progress); - } - break; + try { + let sock; + for (let i = 0; i < options.proxies.length; i++) { + const nextProxy = options.proxies[i]; + const nextDestination = i === options.proxies.length - 1 ? options.destination : { + host: options.proxies[i + 1].host || options.proxies[i + 1].ipaddress, + port: options.proxies[i + 1].port + }; + const result = yield _SocksClient.createConnection({ + command: "connect", + proxy: nextProxy, + destination: nextDestination, + existing_socket: sock + }); + sock = sock || result.socket; } - })(j, bytes)); + if (typeof callback === "function") { + callback(null, { socket: sock }); + resolve({ socket: sock }); + } else { + resolve({ socket: sock }); + } + } catch (err) { + if (typeof callback === "function") { + callback(err); + resolve(err); + } else { + reject(err); + } + } + })); + } + /** + * Creates a SOCKS UDP Frame. + * @param options + */ + static createUDPFrame(options) { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt16BE(0); + buff.writeUInt8(options.frameNumber || 0); + if (net.isIPv4(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeUInt32BE((0, helpers_1.ipv4ToInt32)(options.remoteHost.host)); + } else if (net.isIPv6(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer((0, helpers_1.ipToBuffer)(options.remoteHost.host)); + } else { + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(Buffer.byteLength(options.remoteHost.host)); + buff.writeString(options.remoteHost.host); } - await Promise.all(sendingParts); - } - return isLarge ? new tl_1.Api.InputFileBig({ - id: fileId, - parts: partCount, - name - }) : new tl_1.Api.InputFile({ - id: fileId, - parts: partCount, - name, - md5Checksum: "" - // This is not a "flag", so not sure if we can make it optional. - }); - } - async function _fileToMedia(client2, { file, forceDocument, fileSize, progressCallback, attributes, thumb, voiceNote = false, videoNote = false, supportsStreaming = false, mimeType, asImage, workers = 1 }) { - if (!file) { - return { fileHandle: void 0, media: void 0, image: void 0 }; + buff.writeUInt16BE(options.remoteHost.port); + buff.writeBuffer(options.data); + return buff.toBuffer(); } - const isImage = index_1.utils.isImage(file); - if (asImage == void 0) { - asImage = isImage && !forceDocument; + /** + * Parses a SOCKS UDP frame. + * @param data + */ + static parseUDPFrame(data) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const frameNumber = buff.readUInt8(); + const hostType = buff.readUInt8(); + let remoteHost; + if (hostType === constants_1.Socks5HostType.IPv4) { + remoteHost = (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()); + } else if (hostType === constants_1.Socks5HostType.IPv6) { + remoteHost = ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(); + } else { + remoteHost = buff.readString(buff.readUInt8()); + } + const remotePort = buff.readUInt16BE(); + return { + frameNumber, + remoteHost: { + host: remoteHost, + port: remotePort + }, + data: buff.readBuffer() + }; } - if (typeof file == "object" && !Buffer.isBuffer(file) && !(file instanceof tl_1.Api.InputFile) && !(file instanceof tl_1.Api.InputFileBig) && !(file instanceof CustomFile) && !("read" in file)) { - try { - return { - fileHandle: void 0, - media: index_1.utils.getInputMedia(file, { - isPhoto: asImage, - attributes, - forceDocument, - voiceNote, - videoNote, - supportsStreaming - }), - image: asImage - }; - } catch (e) { - return { - fileHandle: void 0, - media: void 0, - image: isImage - }; + /** + * Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state. + */ + setState(newState) { + if (this.state !== constants_1.SocksClientState.Error) { + this.state = newState; } } - let media; - let fileHandle; - let createdFile; - if (file instanceof tl_1.Api.InputFile || file instanceof tl_1.Api.InputFileBig) { - fileHandle = file; - } else if (typeof file == "string" && (file.startsWith("https://") || file.startsWith("http://"))) { - if (asImage) { - media = new tl_1.Api.InputMediaPhotoExternal({ url: file }); + /** + * Starts the connection establishment to the proxy and destination. + * @param existingSocket Connected socket to use instead of creating a new one (internal use). + */ + connect(existingSocket) { + this.onDataReceived = (data) => this.onDataReceivedHandler(data); + this.onClose = () => this.onCloseHandler(); + this.onError = (err) => this.onErrorHandler(err); + this.onConnect = () => this.onConnectHandler(); + const timer = setTimeout(() => this.onEstablishedTimeout(), this.options.timeout || constants_1.DEFAULT_TIMEOUT); + if (timer.unref && typeof timer.unref === "function") { + timer.unref(); + } + if (existingSocket) { + this.socket = existingSocket; } else { - media = new tl_1.Api.InputMediaDocumentExternal({ url: file }); + this.socket = new net.Socket(); } - } else if (!(typeof file == "string") || (await fs_1.promises.lstat(file)).isFile()) { - if (typeof file == "string") { - createdFile = new CustomFile(path_1.default.basename(file), (await fs_1.promises.stat(file)).size, file); - } else if (typeof File !== "undefined" && file instanceof File || file instanceof CustomFile) { - createdFile = file; + this.socket.once("close", this.onClose); + this.socket.once("error", this.onError); + this.socket.once("connect", this.onConnect); + this.socket.on("data", this.onDataReceived); + this.setState(constants_1.SocksClientState.Connecting); + this.receiveBuffer = new receivebuffer_1.ReceiveBuffer(); + if (existingSocket) { + this.socket.emit("connect"); } else { - let name; - if ("name" in file) { - name = file.name; - } else { - name = "unnamed"; - } - if (Buffer.isBuffer(file)) { - createdFile = new CustomFile(name, file.length, "", file); + this.socket.connect(this.getSocketOptions()); + if (this.options.set_tcp_nodelay !== void 0 && this.options.set_tcp_nodelay !== null) { + this.socket.setNoDelay(!!this.options.set_tcp_nodelay); } } - if (!createdFile) { - throw new Error(`Could not create file from ${JSON.stringify(file)}`); - } - fileHandle = await uploadFile(client2, { - file: createdFile, - onProgress: progressCallback, - workers + this.prependOnceListener("established", (info) => { + setImmediate(() => { + if (this.receiveBuffer.length > 0) { + const excessData = this.receiveBuffer.get(this.receiveBuffer.length); + info.socket.emit("data", excessData); + } + info.socket.resume(); + }); }); - } else { - throw new Error(`"Not a valid path nor a url ${file}`); } - if (media != void 0) { - } else if (fileHandle == void 0) { - throw new Error(`Failed to convert ${file} to media. Not an existing file or an HTTP URL`); - } else if (asImage) { - media = new tl_1.Api.InputMediaUploadedPhoto({ - file: fileHandle - }); - } else { - let res = index_1.utils.getAttributes(file, { - mimeType, - attributes, - forceDocument: forceDocument && !isImage, - voiceNote, - videoNote, - supportsStreaming, - thumb - }); - attributes = res.attrs; - mimeType = res.mimeType; - let uploadedThumb; - if (!thumb) { - uploadedThumb = void 0; + // Socket options (defaults host/port to options.proxy.host/options.proxy.port) + getSocketOptions() { + return Object.assign(Object.assign({}, this.options.socket_options), { host: this.options.proxy.host || this.options.proxy.ipaddress, port: this.options.proxy.port }); + } + /** + * Handles internal Socks timeout callback. + * Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed. + */ + onEstablishedTimeout() { + if (this.state !== constants_1.SocksClientState.Established && this.state !== constants_1.SocksClientState.BoundWaitingForConnection) { + this.closeSocket(constants_1.ERRORS.ProxyConnectionTimedOut); + } + } + /** + * Handles Socket connect event. + */ + onConnectHandler() { + this.setState(constants_1.SocksClientState.Connected); + if (this.options.proxy.type === 4) { + this.sendSocks4InitialHandshake(); } else { - if (typeof thumb == "string") { - uploadedThumb = new CustomFile(path_1.default.basename(thumb), (await fs_1.promises.stat(thumb)).size, thumb); - } else if (typeof File !== "undefined" && thumb instanceof File) { - uploadedThumb = thumb; - } else { - let name; - if ("name" in thumb) { - name = thumb.name; + this.sendSocks5InitialHandshake(); + } + this.setState(constants_1.SocksClientState.SentInitialHandshake); + } + /** + * Handles Socket data event. + * @param data + */ + onDataReceivedHandler(data) { + this.receiveBuffer.append(data); + this.processData(); + } + /** + * Handles processing of the data we have received. + */ + processData() { + while (this.state !== constants_1.SocksClientState.Established && this.state !== constants_1.SocksClientState.Error && this.receiveBuffer.length >= this.nextRequiredPacketBufferSize) { + if (this.state === constants_1.SocksClientState.SentInitialHandshake) { + if (this.options.proxy.type === 4) { + this.handleSocks4FinalHandshakeResponse(); } else { - name = "unnamed"; + this.handleInitialSocks5HandshakeResponse(); } - if (Buffer.isBuffer(thumb)) { - uploadedThumb = new CustomFile(name, thumb.length, "", thumb); + } else if (this.state === constants_1.SocksClientState.SentAuthentication) { + this.handleInitialSocks5AuthenticationHandshakeResponse(); + } else if (this.state === constants_1.SocksClientState.SentFinalHandshake) { + this.handleSocks5FinalHandshakeResponse(); + } else if (this.state === constants_1.SocksClientState.BoundWaitingForConnection) { + if (this.options.proxy.type === 4) { + this.handleSocks4IncomingConnectionResponse(); + } else { + this.handleSocks5IncomingConnectionResponse(); } + } else { + this.closeSocket(constants_1.ERRORS.InternalError); + break; } - if (!uploadedThumb) { - throw new Error(`Could not create file from ${file}`); - } - uploadedThumb = await uploadFile(client2, { - file: uploadedThumb, - workers: 1 - }); } - media = new tl_1.Api.InputMediaUploadedDocument({ - file: fileHandle, - mimeType, - attributes, - thumb: uploadedThumb, - forceFile: forceDocument && !isImage - }); } - return { - fileHandle, - media, - image: asImage - }; - } - async function _sendAlbum(client2, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, voiceNote = false, videoNote = false, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId }) { - entity = await client2.getInputEntity(entity); - let files = []; - if (!Array.isArray(file)) { - files = [file]; - } else { - files = file; + /** + * Handles Socket close event. + * @param had_error + */ + onCloseHandler() { + this.closeSocket(constants_1.ERRORS.SocketClosed); } - if (!Array.isArray(caption)) { - if (!caption) { - caption = ""; - } - caption = [caption]; + /** + * Handles Socket error event. + * @param err + */ + onErrorHandler(err) { + this.closeSocket(err.message); } - const captions = []; - for (const c of caption) { - captions.push(await (0, messageParse_1._parseMessageText)(client2, c, parseMode)); + /** + * Removes internal event listeners on the underlying Socket. + */ + removeInternalSocketHandlers() { + this.socket.pause(); + this.socket.removeListener("data", this.onDataReceived); + this.socket.removeListener("close", this.onClose); + this.socket.removeListener("error", this.onError); + this.socket.removeListener("connect", this.onConnect); } - if (commentTo != void 0) { - const discussionData = await (0, messages_1.getCommentData)(client2, entity, commentTo); - entity = discussionData.entity; - replyTo = discussionData.replyTo; - } else { - replyTo = index_1.utils.getMessageId(replyTo); + /** + * Closes and destroys the underlying Socket. Emits an error event. + * @param err { String } An error string to include in error event. + */ + closeSocket(err) { + if (this.state !== constants_1.SocksClientState.Error) { + this.setState(constants_1.SocksClientState.Error); + this.socket.destroy(); + this.removeInternalSocketHandlers(); + this.emit("error", new util_1.SocksClientError(err, this.options)); + } } - if (!attributes) { - attributes = []; + /** + * Sends initial Socks v4 handshake request. + */ + sendSocks4InitialHandshake() { + const userId = this.options.proxy.userId || ""; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(4); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt16BE(this.options.destination.port); + if (net.isIPv4(this.options.destination.host)) { + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); + buff.writeStringNT(userId); + } else { + buff.writeUInt8(0); + buff.writeUInt8(0); + buff.writeUInt8(0); + buff.writeUInt8(1); + buff.writeStringNT(userId); + buff.writeStringNT(this.options.destination.host); + } + this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks4Response; + this.socket.write(buff.toBuffer()); } - let index2 = 0; - const albumFiles = []; - for (const file2 of files) { - let { fileHandle, media, image } = await _fileToMedia(client2, { - file: file2, - forceDocument, - fileSize, - progressCallback, - // @ts-ignore - attributes: attributes[index2], - thumb, - voiceNote, - videoNote, - supportsStreaming, - workers - }); - index2++; - if (media instanceof tl_1.Api.InputMediaUploadedPhoto || media instanceof tl_1.Api.InputMediaPhotoExternal) { - const r = await client2.invoke(new tl_1.Api.messages.UploadMedia({ - peer: entity, - media - })); - if (r instanceof tl_1.Api.MessageMediaPhoto) { - media = (0, Utils_1.getInputMedia)(r.photo); - } - } else if (media instanceof tl_1.Api.InputMediaUploadedDocument) { - const r = await client2.invoke(new tl_1.Api.messages.UploadMedia({ - peer: entity, - media - })); - if (r instanceof tl_1.Api.MessageMediaDocument) { - media = (0, Utils_1.getInputMedia)(r.document); + /** + * Handles Socks v4 handshake response. + * @param data + */ + handleSocks4FinalHandshakeResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedConnection} - (${constants_1.Socks4Response[data[1]]})`); + } else { + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()) + }; + if (remoteHost.host === "0.0.0.0") { + remoteHost.host = this.options.proxy.ipaddress; + } + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.emit("bound", { remoteHost, socket: this.socket }); + } else { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit("established", { socket: this.socket }); } } - let text = ""; - let msgEntities = []; - if (captions.length) { - [text, msgEntities] = captions.shift(); - } - albumFiles.push(new tl_1.Api.InputSingleMedia({ - media, - message: text, - entities: msgEntities - })); } - let replyObject = void 0; - if (replyTo != void 0) { - replyObject = new tl_1.Api.InputReplyToMessage({ - replyToMsgId: (0, Utils_1.getMessageId)(replyTo), - topMsgId: (0, Utils_1.getMessageId)(topMsgId) - }); + /** + * Handles Socks v4 incoming connection request (BIND) + * @param data + */ + handleSocks4IncomingConnectionResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${constants_1.Socks4Response[data[1]]})`); + } else { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()) + }; + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit("established", { remoteHost, socket: this.socket }); + } } - const result = await client2.invoke(new tl_1.Api.messages.SendMultiMedia({ - peer: entity, - replyTo: replyObject, - multiMedia: albumFiles, - silent, - scheduleDate, - clearDraft, - noforwards - })); - const randomIds = albumFiles.map((m) => m.randomId); - return client2._getResponseMessage(randomIds, result, entity); - } - async function sendFile(client2, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, formattingEntities, voiceNote = false, videoNote = false, buttons, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId }) { - if (!file) { - throw new Error("You need to specify a file"); + /** + * Sends initial Socks v5 handshake request. + */ + sendSocks5InitialHandshake() { + const buff = new smart_buffer_1.SmartBuffer(); + const supportedAuthMethods = [constants_1.Socks5Auth.NoAuth]; + if (this.options.proxy.userId || this.options.proxy.password) { + supportedAuthMethods.push(constants_1.Socks5Auth.UserPass); + } + if (this.options.proxy.custom_auth_method !== void 0) { + supportedAuthMethods.push(this.options.proxy.custom_auth_method); + } + buff.writeUInt8(5); + buff.writeUInt8(supportedAuthMethods.length); + for (const authMethod of supportedAuthMethods) { + buff.writeUInt8(authMethod); + } + this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentInitialHandshake); } - if (!caption) { - caption = ""; + /** + * Handles initial Socks v5 handshake response. + * @param data + */ + handleInitialSocks5HandshakeResponse() { + const data = this.receiveBuffer.get(2); + if (data[0] !== 5) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion); + } else if (data[1] === constants_1.SOCKS5_NO_ACCEPTABLE_AUTH) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType); + } else { + if (data[1] === constants_1.Socks5Auth.NoAuth) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.NoAuth; + this.sendSocks5CommandRequest(); + } else if (data[1] === constants_1.Socks5Auth.UserPass) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.UserPass; + this.sendSocks5UserPassAuthentication(); + } else if (data[1] === this.options.proxy.custom_auth_method) { + this.socks5ChosenAuthType = this.options.proxy.custom_auth_method; + this.sendSocks5CustomAuthentication(); + } else { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType); + } + } } - entity = await client2.getInputEntity(entity); - if (commentTo != void 0) { - const discussionData = await (0, messages_1.getCommentData)(client2, entity, commentTo); - entity = discussionData.entity; - replyTo = discussionData.replyTo; - } else { - replyTo = index_1.utils.getMessageId(replyTo); + /** + * Sends Socks v5 user & password auth handshake. + * + * Note: No auth and user/pass are currently supported. + */ + sendSocks5UserPassAuthentication() { + const userId = this.options.proxy.userId || ""; + const password = this.options.proxy.password || ""; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(1); + buff.writeUInt8(Buffer.byteLength(userId)); + buff.writeString(userId); + buff.writeUInt8(Buffer.byteLength(password)); + buff.writeString(password); + this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentAuthentication); } - if (Array.isArray(file)) { - return await _sendAlbum(client2, entity, { - file, - caption, - replyTo, - parseMode, - attributes, - silent, - scheduleDate, - supportsStreaming, - clearDraft, - forceDocument, - noforwards, - topMsgId + sendSocks5CustomAuthentication() { + return __awaiter2(this, void 0, void 0, function* () { + this.nextRequiredPacketBufferSize = this.options.proxy.custom_auth_response_size; + this.socket.write(yield this.options.proxy.custom_auth_request_handler()); + this.setState(constants_1.SocksClientState.SentAuthentication); }); } - if (Array.isArray(caption)) { - caption = caption[0] || ""; + handleSocks5CustomAuthHandshakeResponse(data) { + return __awaiter2(this, void 0, void 0, function* () { + return yield this.options.proxy.custom_auth_response_handler(data); + }); } - let msgEntities; - if (formattingEntities != void 0) { - msgEntities = formattingEntities; - } else { - [caption, msgEntities] = await (0, messageParse_1._parseMessageText)(client2, caption, parseMode); + handleSocks5AuthenticationNoAuthHandshakeResponse(data) { + return __awaiter2(this, void 0, void 0, function* () { + return data[1] === 0; + }); } - const { fileHandle, media, image } = await _fileToMedia(client2, { - file, - forceDocument, - fileSize, - progressCallback, - // @ts-ignore - attributes, - thumb, - voiceNote, - videoNote, - supportsStreaming, - workers - }); - if (media == void 0) { - throw new Error(`Cannot use ${file} as file.`); + handleSocks5AuthenticationUserPassHandshakeResponse(data) { + return __awaiter2(this, void 0, void 0, function* () { + return data[1] === 0; + }); } - const markup = client2.buildReplyMarkup(buttons); - let replyObject = void 0; - if (replyTo != void 0) { - replyObject = new tl_1.Api.InputReplyToMessage({ - replyToMsgId: (0, Utils_1.getMessageId)(replyTo), - topMsgId: (0, Utils_1.getMessageId)(topMsgId) + /** + * Handles Socks v5 auth handshake response. + * @param data + */ + handleInitialSocks5AuthenticationHandshakeResponse() { + return __awaiter2(this, void 0, void 0, function* () { + this.setState(constants_1.SocksClientState.ReceivedAuthenticationResponse); + let authResult = false; + if (this.socks5ChosenAuthType === constants_1.Socks5Auth.NoAuth) { + authResult = yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)); + } else if (this.socks5ChosenAuthType === constants_1.Socks5Auth.UserPass) { + authResult = yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)); + } else if (this.socks5ChosenAuthType === this.options.proxy.custom_auth_method) { + authResult = yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size)); + } + if (!authResult) { + this.closeSocket(constants_1.ERRORS.Socks5AuthenticationFailed); + } else { + this.sendSocks5CommandRequest(); + } }); } - const request = new tl_1.Api.messages.SendMedia({ - peer: entity, - media, - replyTo: replyObject, - message: caption, - entities: msgEntities, - replyMarkup: markup, - silent, - scheduleDate, - clearDraft, - noforwards - }); - const result = await client2.invoke(request); - return client2._getResponseMessage(request, result, entity); - } - function fileToBuffer(file) { - if (typeof File !== "undefined" && file instanceof File) { - return new Response(file).arrayBuffer(); - } else if (file instanceof CustomFile) { - if (file.buffer != void 0) { - return file.buffer; + /** + * Sends Socks v5 final handshake request. + */ + sendSocks5CommandRequest() { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(5); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt8(0); + if (net.isIPv4(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); + } else if (net.isIPv6(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); } else { - return fs_1.promises.readFile(file.path); + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(this.options.destination.host.length); + buff.writeString(this.options.destination.host); } - } else { - throw new Error("Could not create buffer from file " + file); + buff.writeUInt16BE(this.options.destination.port); + this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentFinalHandshake); } - } + /** + * Handles Socks v5 final handshake response. + * @param data + */ + handleSocks5FinalHandshakeResponse() { + const header = this.receiveBuffer.peek(5); + if (header[0] !== 5 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${constants_1.Socks5Response[header[1]]}`); + } else { + const addressType = header[3]; + let remoteHost; + let buff; + if (addressType === constants_1.Socks5HostType.IPv4) { + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + port: buff.readUInt16BE() + }; + if (remoteHost.host === "0.0.0.0") { + remoteHost.host = this.options.proxy.ipaddress; + } + } else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE() + }; + } else if (addressType === constants_1.Socks5HostType.IPv6) { + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), + port: buff.readUInt16BE() + }; + } + this.setState(constants_1.SocksClientState.ReceivedFinalResponse); + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.connect) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit("established", { remoteHost, socket: this.socket }); + } else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.nextRequiredPacketBufferSize = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.emit("bound", { remoteHost, socket: this.socket }); + } else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.associate) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit("established", { + remoteHost, + socket: this.socket + }); + } + } + } + /** + * Handles Socks v5 incoming connection request (BIND). + */ + handleSocks5IncomingConnectionResponse() { + const header = this.receiveBuffer.peek(5); + if (header[0] !== 5 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${constants_1.Socks5Response[header[1]]}`); + } else { + const addressType = header[3]; + let remoteHost; + let buff; + if (addressType === constants_1.Socks5HostType.IPv4) { + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + port: buff.readUInt16BE() + }; + if (remoteHost.host === "0.0.0.0") { + remoteHost.host = this.options.proxy.ipaddress; + } + } else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE() + }; + } else if (addressType === constants_1.Socks5HostType.IPv6) { + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), + port: buff.readUInt16BE() + }; + } + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit("established", { remoteHost, socket: this.socket }); + } + } + get socksClientOptions() { + return Object.assign({}, this.options); + } + }; + exports2.SocksClient = SocksClient; } }); -// node_modules/telegram/client/messages.js -var require_messages2 = __commonJS({ - "node_modules/telegram/client/messages.js"(exports2) { +// node_modules/socks/build/index.js +var require_build = __commonJS({ + "node_modules/socks/build/index.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + __exportStar2(require_socksclient(), exports2); + } +}); + +// node_modules/telegram/extensions/socks.js +var require_socks = __commonJS({ + "node_modules/telegram/extensions/socks.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; + Object.defineProperty(exports2, "__esModule", { value: true }); + __exportStar2(require_build(), exports2); + } +}); + +// node_modules/telegram/extensions/PromisedNetSockets.js +var require_PromisedNetSockets = __commonJS({ + "node_modules/telegram/extensions/PromisedNetSockets.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._IDsIter = exports2._MessagesIter = void 0; - exports2.iterMessages = iterMessages; - exports2.getMessages = getMessages; - exports2.sendMessage = sendMessage; - exports2.forwardMessages = forwardMessages; - exports2.editMessage = editMessage; - exports2.deleteMessages = deleteMessages; - exports2.pinMessage = pinMessage; - exports2.unpinMessage = unpinMessage; - exports2._pin = _pin; - exports2.markAsRead = markAsRead; - exports2.getCommentData = getCommentData; - var tl_1 = require_tl(); - var requestIter_1 = require_requestIter(); - var Helpers_1 = require_Helpers(); - var Utils_1 = require_Utils(); - var __1 = require_telegram(); - var messageParse_1 = require_messageParse(); - var users_1 = require_users(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var uploads_1 = require_uploads(); - var _MAX_CHUNK_SIZE = 100; - var _MessagesIter = class extends requestIter_1.RequestIter { - async _init({ entity, offsetId, minId, maxId, fromUser, offsetDate, addOffset, filter: filter3, search, replyTo }) { - var _a3, e_1, _b, _c; - if (entity) { - this.entity = await this.client.getInputEntity(entity); - } else { - this.entity = void 0; - if (this.reverse) { - throw new Error("Cannot reverse global search"); - } - } - if (this.reverse) { - offsetId = Math.max(offsetId, minId); - if (offsetId && maxId) { - if (maxId - offsetId <= 1) { - return false; - } - } - if (!maxId) { - maxId = Number.MAX_SAFE_INTEGER; - } - } else { - offsetId = Math.max(offsetId, maxId); - if (offsetId && minId) { - if (offsetId - minId <= 1) { - return false; - } - } - } - if (this.reverse) { - if (offsetId) { - offsetId += 1; - } else if (!offsetDate) { - offsetId = 1; - } - } - if (fromUser) { - fromUser = await this.client.getInputEntity(fromUser); - } - if (!this.entity && fromUser) { - this.entity = new tl_1.Api.InputPeerEmpty(); - } - if (!filter3) { - filter3 = new tl_1.Api.InputMessagesFilterEmpty(); - } - if (!this.entity) { - this.request = new tl_1.Api.messages.SearchGlobal({ - q: search || "", - filter: filter3, - minDate: void 0, - // TODO fix this smh - maxDate: offsetDate, - offsetRate: void 0, - offsetPeer: new tl_1.Api.InputPeerEmpty(), - offsetId, - limit: 1 - }); - } else if (replyTo !== void 0) { - this.request = new tl_1.Api.messages.GetReplies({ - peer: this.entity, - msgId: replyTo, - offsetId, - offsetDate, - addOffset, - limit: 0, - maxId: 0, - minId: 0, - hash: big_integer_1.default.zero - }); - } else if (search !== void 0 || !(filter3 instanceof tl_1.Api.InputMessagesFilterEmpty) || fromUser !== void 0) { - this.request = new tl_1.Api.messages.Search({ - peer: this.entity, - q: search || "", - filter: typeof filter3 === "function" ? new filter3() : filter3, - minDate: void 0, - maxDate: offsetDate, - offsetId, - addOffset, - limit: 0, - maxId: 0, - minId: 0, - hash: (0, Helpers_1.generateRandomBigInt)(), - fromId: fromUser - }); - if (!(filter3 instanceof tl_1.Api.InputMessagesFilterEmpty) && offsetDate && !search && !offsetId) { - try { - for (var _d = true, _e = __asyncValues2(this.client.iterMessages(this.entity, { - limit: 1, - offsetDate - })), _f; _f = await _e.next(), _a3 = _f.done, !_a3; _d = true) { - _c = _f.value; - _d = false; - const m = _c; - this.request.offsetId = m.id + 1; - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a3 && (_b = _e.return)) await _b.call(_e); - } finally { - if (e_1) throw e_1.error; - } - } - } - } else { - this.request = new tl_1.Api.messages.GetHistory({ - peer: this.entity, - limit: 1, - offsetDate, - offsetId, - minId: 0, - maxId: 0, - addOffset, - hash: big_integer_1.default.zero - }); - } - if (this.limit <= 0) { - const result = await this.client.invoke(this.request); - if (result instanceof tl_1.Api.messages.MessagesNotModified) { - this.total = result.count; - } else { - if ("count" in result) { - this.total = result.count; - } else { - this.total = result.messages.length; + exports2.PromisedNetSockets = void 0; + var net = __importStar2(require_net()); + var socks_1 = require_socks(); + var async_mutex_1 = require_lib16(); + var mutex = new async_mutex_1.Mutex(); + var closeError = new Error("NetSocket was closed"); + var PromisedNetSockets = class { + constructor(proxy) { + this.client = void 0; + this.closed = true; + this.stream = Buffer.alloc(0); + if (proxy) { + if (!("MTProxy" in proxy)) { + if (!proxy.ip || !proxy.port || !proxy.socksType) { + throw new Error(`Invalid sockets params: ip=${proxy.ip}, port=${proxy.port}, socksType=${proxy.socksType}`); } + this.proxy = proxy; } - return false; - } - if (!this.waitTime) { - this.waitTime = this.limit > 3e3 ? 1 : 0; } - if (this.reverse && !(this.request instanceof tl_1.Api.messages.SearchGlobal)) { - this.request.addOffset -= _MAX_CHUNK_SIZE; + } + async readExactly(number) { + let readData = Buffer.alloc(0); + while (true) { + const thisTime = await this.read(number); + readData = Buffer.concat([readData, thisTime]); + number = number - thisTime.length; + if (!number || number === -437) { + return readData; + } } - this.addOffset = addOffset; - this.maxId = maxId; - this.minId = minId; - this.lastId = this.reverse ? 0 : Number.MAX_SAFE_INTEGER; } - async _loadNextChunk() { - var _a3; - if (!this.request) { - throw new Error("Request not set yet"); + async read(number) { + if (this.closed) { + throw closeError; } - this.request.limit = Math.min(this.left, _MAX_CHUNK_SIZE); - if (this.reverse && this.request.limit != _MAX_CHUNK_SIZE) { - if (!(this.request instanceof tl_1.Api.messages.SearchGlobal)) { - this.request.addOffset = this.addOffset - this.request.limit; - } + await this.canRead; + if (this.closed) { + throw closeError; } - const r = await this.client.invoke(this.request); - if (r instanceof tl_1.Api.messages.MessagesNotModified) { - return true; + const toReturn = this.stream.slice(0, number); + this.stream = this.stream.slice(number); + if (this.stream.length === 0) { + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); } - if ("count" in r) { - this.total = r.count; - } else { - this.total = r.messages.length; + return toReturn; + } + async readAll() { + if (this.closed || !await this.canRead) { + throw closeError; } - const entities2 = /* @__PURE__ */ new Map(); - for (const x of [...r.users, ...r.chats]) { - entities2.set((0, Utils_1.getPeerId)(x), x); + const toReturn = this.stream; + this.stream = Buffer.alloc(0); + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); + return toReturn; + } + /** + * Creates a new connection + * @param port + * @param ip + * @returns {Promise<void>} + */ + async connect(port, ip) { + this.stream = Buffer.alloc(0); + let connected = false; + if (this.proxy) { + const info = await socks_1.SocksClient.createConnection({ + proxy: { + host: this.proxy.ip, + port: this.proxy.port, + type: this.proxy.socksType, + userId: this.proxy.username, + password: this.proxy.password + }, + command: "connect", + timeout: (this.proxy.timeout || 5) * 1e3, + destination: { + host: ip, + port + } + }); + this.client = info.socket; + connected = true; + } else { + this.client = new net.Socket(); } - const messages = this.reverse ? r.messages.reverse() : r.messages; - for (const message of messages) { - if (!this._messageInRange(message)) { - return true; - } - this.lastId = message.id; - try { - message._finishInit(this.client, entities2, this.entity); - } catch (e) { + this.canRead = new Promise((resolve) => { + this.resolveRead = resolve; + }); + this.closed = false; + return new Promise((resolve, reject) => { + if (this.client) { + if (connected) { + this.receive(); + resolve(this); + } else { + this.client.connect(port, ip, () => { + this.receive(); + resolve(this); + }); + } + this.client.on("error", reject); + this.client.on("close", () => { + if (this.client && this.client.destroyed) { + if (this.resolveRead) { + this.resolveRead(false); + } + this.closed = true; + } + }); } - message._entities = entities2; - (_a3 = this.buffer) === null || _a3 === void 0 ? void 0 : _a3.push(message); + }); + } + write(data) { + if (this.closed) { + throw closeError; } - if (r.messages.length < this.request.limit) { - return true; + if (this.client) { + this.client.write(data); } - if (this.buffer) { - this._updateOffset(this.buffer[this.buffer.length - 1], r); - } else { - return true; + } + async close() { + if (this.client) { + await this.client.destroy(); + this.client.unref(); } + this.closed = true; } - _messageInRange(message) { - if (this.entity) { - if (this.reverse) { - if (message.id <= this.lastId || message.id >= this.maxId) { - return false; + async receive() { + if (this.client) { + this.client.on("data", async (message) => { + const release = await mutex.acquire(); + try { + let data; + this.stream = Buffer.concat([this.stream, message]); + if (this.resolveRead) { + this.resolveRead(true); + } + } finally { + release(); + } + }); + } + } + toString() { + return "PromisedNetSocket"; + } + }; + exports2.PromisedNetSockets = PromisedNetSockets; + } +}); + +// node_modules/telegram/extensions/MessagePacker.js +var require_MessagePacker = __commonJS({ + "node_modules/telegram/extensions/MessagePacker.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MessagePacker = void 0; + var core_1 = require_core(); + var core_2 = require_core(); + var BinaryWriter_1 = require_BinaryWriter(); + var USE_INVOKE_AFTER_WITH = /* @__PURE__ */ new Set([ + "messages.SendMessage", + "messages.SendMedia", + "messages.SendMultiMedia", + "messages.ForwardMessages", + "messages.SendInlineBotResult" + ]); + var MessagePacker = class { + constructor(state2, logger) { + this._state = state2; + this._queue = []; + this._pendingStates = []; + this._ready = new Promise((resolve) => { + this.setReady = resolve; + }); + this._log = logger; + } + values() { + return this._queue; + } + append(state2, setReady = true, atStart = false) { + var _a, _b; + if (state2 && USE_INVOKE_AFTER_WITH.has(state2.request.className)) { + if (atStart) { + for (let i = 0; i < this._queue.length; i++) { + if (USE_INVOKE_AFTER_WITH.has((_a = this._queue[i]) === null || _a === void 0 ? void 0 : _a.request.className)) { + this._queue[i].after = state2; + break; + } } } else { - if (message.id >= this.lastId || message.id <= this.minId) { - return false; + for (let i = this._queue.length - 1; i >= 0; i--) { + if (USE_INVOKE_AFTER_WITH.has((_b = this._queue[i]) === null || _b === void 0 ? void 0 : _b.request.className)) { + state2.after = this._queue[i]; + break; + } } } } - return true; - } - [Symbol.asyncIterator]() { - return super[Symbol.asyncIterator](); - } - _updateOffset(lastMessage, response) { - if (!this.request) { - throw new Error("Request not set yet"); + if (atStart) { + this._queue.unshift(state2); + } else { + this._queue.push(state2); } - this.request.offsetId = Number(lastMessage.id); - if (this.reverse) { - this.request.offsetId += 1; + if (setReady && this.setReady) { + this.setReady(true); } - if (this.request instanceof tl_1.Api.messages.Search) { - this.request.maxDate = -1; - } else { - if (!(this.request instanceof tl_1.Api.messages.SearchGlobal)) { - this.request.offsetDate = lastMessage.date; - } + if (state2 && state2.request.CONSTRUCTOR_ID !== 1658238041) { + this._pendingStates.push(state2); + state2.promise.catch((err) => { + }).finally(() => { + this._pendingStates = this._pendingStates.filter((s) => s !== state2); + }); } - if (this.request instanceof tl_1.Api.messages.SearchGlobal) { - if (lastMessage.inputChat) { - this.request.offsetPeer = lastMessage.inputChat; - } else { - this.request.offsetPeer = new tl_1.Api.InputPeerEmpty(); - } - this.request.offsetRate = response.nextRate; + } + prepend(states) { + states.reverse().forEach((state2) => { + this.append(state2, false, true); + }); + if (this.setReady) { + this.setReady(true); } } - }; - exports2._MessagesIter = _MessagesIter; - var _IDsIter = class extends requestIter_1.RequestIter { - async _init({ entity, ids }) { - this.total = ids.length; - this._ids = this.reverse ? ids.reverse() : ids; - this._offset = 0; - this._entity = entity ? await this.client.getInputEntity(entity) : void 0; - this._ty = this._entity ? (0, Helpers_1._entityType)(this._entity) : void 0; - if (!this.waitTime) { - this.waitTime = this.limit > 300 ? 10 : 0; + extend(states) { + states.forEach((state2) => { + this.append(state2, false); + }); + if (this.setReady) { + this.setReady(true); } } - [Symbol.asyncIterator]() { - return super[Symbol.asyncIterator](); + clear() { + this._queue = []; + this.append(void 0); } - async _loadNextChunk() { - var _a3, _b, _c; - const ids = this._ids.slice(this._offset, this._offset + _MAX_CHUNK_SIZE); - if (!ids.length) { - return false; + async wait() { + if (!this._queue.length) { + this._ready = new Promise((resolve) => { + this.setReady = resolve; + }); + await this._ready; } - this._offset += _MAX_CHUNK_SIZE; - let fromId; - let r; - if (this._ty == Helpers_1._EntityType.CHANNEL) { - try { - r = await this.client.invoke(new tl_1.Api.channels.GetMessages({ - channel: this._entity, - id: ids - })); - } catch (e) { - if (e.errorMessage == "MESSAGE_IDS_EMPTY") { - r = new tl_1.Api.messages.MessagesNotModified({ - count: ids.length - }); - } else { - throw e; + } + async get() { + if (!this._queue[this._queue.length - 1]) { + this._queue = this._queue.filter(Boolean); + return void 0; + } + let data; + let buffer = new BinaryWriter_1.BinaryWriter(Buffer.alloc(0)); + const batch = []; + let size = 0; + while (this._queue.length && batch.length <= core_1.MessageContainer.MAXIMUM_LENGTH) { + const state2 = this._queue.shift(); + if (!state2) { + continue; + } + size += state2.data.length + core_2.TLMessage.SIZE_OVERHEAD; + if (size <= core_1.MessageContainer.MAXIMUM_SIZE) { + let afterId; + if (state2.after) { + afterId = state2.after.msgId; + } + if (state2.after) { + afterId = state2.after.msgId; } + state2.msgId = await this._state.writeDataAsMessage(buffer, state2.data, state2.request.classType === "request", afterId); + this._log.debug(`Assigned msgId = ${state2.msgId} to ${state2.request.className || state2.request.constructor.name}`); + batch.push(state2); + continue; } - } else { - r = await this.client.invoke(new tl_1.Api.messages.GetMessages({ - id: ids - })); - if (this._entity) { - fromId = await (0, users_1._getPeer)(this.client, this._entity); + if (batch.length) { + this._queue.unshift(state2); + break; } + this._log.warn(`Message payload for ${state2.request.className || state2.request.constructor.name} is too long ${state2.data.length} and cannot be sent`); + state2.promise.reject("Request Payload is too big"); + size = 0; } - if (r instanceof tl_1.Api.messages.MessagesNotModified) { - (_a3 = this.buffer) === null || _a3 === void 0 ? void 0 : _a3.push(...Array(ids.length)); - return; - } - const entities2 = /* @__PURE__ */ new Map(); - for (const entity of [...r.users, ...r.chats]) { - entities2.set(__1.utils.getPeerId(entity), entity); + if (!batch.length) { + return null; } - let message; - for (message of r.messages) { - if (message instanceof tl_1.Api.MessageEmpty || fromId && __1.utils.getPeerId(message.peerId) != __1.utils.getPeerId(fromId)) { - (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(void 0); - } else { - const temp = message; - temp._finishInit(this.client, entities2, this._entity); - temp._entities = entities2; - (_c = this.buffer) === null || _c === void 0 ? void 0 : _c.push(temp); + if (batch.length > 1) { + const b = Buffer.alloc(8); + b.writeUInt32LE(core_1.MessageContainer.CONSTRUCTOR_ID, 0); + b.writeInt32LE(batch.length, 4); + data = Buffer.concat([b, buffer.getValue()]); + buffer = new BinaryWriter_1.BinaryWriter(Buffer.alloc(0)); + const containerId = await this._state.writeDataAsMessage(buffer, data, false); + for (const s of batch) { + s.containerId = containerId; } } + data = buffer.getValue(); + return { batch, data }; } }; - exports2._IDsIter = _IDsIter; - var IterMessagesDefaults = { - limit: void 0, - offsetDate: void 0, - offsetId: 0, - maxId: 0, - minId: 0, - addOffset: 0, - search: void 0, - filter: void 0, - fromUser: void 0, - waitTime: void 0, - ids: void 0, - reverse: false, - replyTo: void 0, - scheduled: false - }; - function iterMessages(client2, entity, options) { - const { limit, offsetDate, offsetId, maxId, minId, addOffset, search, filter: filter3, fromUser, waitTime, ids, reverse, replyTo } = Object.assign(Object.assign({}, IterMessagesDefaults), options); - if (ids) { - let idsArray; - if (!(0, Helpers_1.isArrayLike)(ids)) { - idsArray = [ids]; - } else { - idsArray = ids; - } - return new _IDsIter(client2, idsArray.length, { - reverse, - waitTime - }, { - entity, - ids: idsArray + exports2.MessagePacker = MessagePacker; + } +}); + +// node_modules/telegram/extensions/AsyncQueue.js +var require_AsyncQueue = __commonJS({ + "node_modules/telegram/extensions/AsyncQueue.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AsyncQueue = void 0; + var AsyncQueue = class { + constructor() { + this._queue = []; + this.canPush = true; + this.resolvePush = (value) => { + }; + this.resolveGet = (value) => { + }; + this.canGet = new Promise((resolve) => { + this.resolveGet = resolve; }); } - return new _MessagesIter(client2, limit, { - waitTime, - reverse - }, { - entity, - offsetId, - minId, - maxId, - fromUser, - offsetDate, - addOffset, - filter: filter3, - search, - replyTo - }); - } - async function getMessages(client2, entity, params) { - var _a3, e_2, _b, _c; - if (Object.keys(params).length == 1 && params.limit === void 0) { - if (params.minId === void 0 && params.maxId === void 0) { - params.limit = void 0; - } else { - params.limit = 1; + async push(value) { + await this.canPush; + this._queue.push(value); + this.resolveGet(true); + this.canPush = new Promise((resolve) => { + this.resolvePush = resolve; + }); + } + async pop() { + await this.canGet; + const returned = this._queue.pop(); + this.resolvePush(true); + this.canGet = new Promise((resolve) => { + this.resolveGet = resolve; + }); + return returned; + } + }; + exports2.AsyncQueue = AsyncQueue; + } +}); + +// node_modules/telegram/extensions/index.js +var require_extensions = __commonJS({ + "node_modules/telegram/extensions/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AsyncQueue = exports2.MessagePacker = exports2.PromisedNetSockets = exports2.PromisedWebSockets = exports2.BinaryReader = exports2.BinaryWriter = exports2.Logger = void 0; + var Logger_1 = require_Logger(); + Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { + return Logger_1.Logger; + } }); + var BinaryWriter_1 = require_BinaryWriter(); + Object.defineProperty(exports2, "BinaryWriter", { enumerable: true, get: function() { + return BinaryWriter_1.BinaryWriter; + } }); + var BinaryReader_1 = require_BinaryReader(); + Object.defineProperty(exports2, "BinaryReader", { enumerable: true, get: function() { + return BinaryReader_1.BinaryReader; + } }); + var PromisedWebSockets_1 = require_PromisedWebSockets(); + Object.defineProperty(exports2, "PromisedWebSockets", { enumerable: true, get: function() { + return PromisedWebSockets_1.PromisedWebSockets; + } }); + var PromisedNetSockets_1 = require_PromisedNetSockets(); + Object.defineProperty(exports2, "PromisedNetSockets", { enumerable: true, get: function() { + return PromisedNetSockets_1.PromisedNetSockets; + } }); + var MessagePacker_1 = require_MessagePacker(); + Object.defineProperty(exports2, "MessagePacker", { enumerable: true, get: function() { + return MessagePacker_1.MessagePacker; + } }); + var AsyncQueue_1 = require_AsyncQueue(); + Object.defineProperty(exports2, "AsyncQueue", { enumerable: true, get: function() { + return AsyncQueue_1.AsyncQueue; + } }); + } +}); + +// node_modules/telegram/network/connection/Connection.js +var require_Connection = __commonJS({ + "node_modules/telegram/network/connection/Connection.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ObfuscatedConnection = exports2.PacketCodec = exports2.Connection = void 0; + var extensions_1 = require_extensions(); + var Connection = class { + constructor({ ip, port, dcId, loggers, proxy, socket, testServers }) { + this._ip = ip; + this._port = port; + this._dcId = dcId; + this._log = loggers; + this._proxy = proxy; + this._connected = false; + this._sendTask = void 0; + this._recvTask = void 0; + this._codec = void 0; + this._obfuscation = void 0; + this._sendArray = new extensions_1.AsyncQueue(); + this._recvArray = new extensions_1.AsyncQueue(); + this.socket = new socket(proxy); + this._testServers = testServers; + } + async _connect() { + this._log.debug("Connecting"); + this._codec = new this.PacketCodecClass(this); + await this.socket.connect(this._port, this._ip, this._testServers); + this._log.debug("Finished connecting"); + await this._initConn(); + } + async connect() { + await this._connect(); + this._connected = true; + if (!this._sendTask) { + this._sendTask = this._sendLoop(); } + this._recvTask = this._recvLoop(); } - const it = client2.iterMessages(entity, params); - const ids = params.ids; - if (ids && !(0, Helpers_1.isArrayLike)(ids)) { + async disconnect() { + if (!this._connected) { + return; + } + this._connected = false; + void this._recvArray.push(void 0); + await this.socket.close(); + } + async send(data) { + if (!this._connected) { + throw new Error("Not connected"); + } + await this._sendArray.push(data); + } + async recv() { + while (this._connected) { + const result = await this._recvArray.pop(); + if (result) { + return result; + } + } + throw new Error("Not connected"); + } + async _sendLoop() { try { - for (var _d = true, it_1 = __asyncValues2(it), it_1_1; it_1_1 = await it_1.next(), _a3 = it_1_1.done, !_a3; _d = true) { - _c = it_1_1.value; - _d = false; - const message = _c; - return [message]; + while (this._connected) { + const data = await this._sendArray.pop(); + if (!data) { + this._sendTask = void 0; + return; + } + await this._send(data); } - } catch (e_2_1) { - e_2 = { error: e_2_1 }; - } finally { + } catch (e) { + this._log.info("The server closed the connection while sending"); + } + } + isConnected() { + return this._connected; + } + async _recvLoop() { + let data; + while (this._connected) { try { - if (!_d && !_a3 && (_b = it_1.return)) await _b.call(it_1); - } finally { - if (e_2) throw e_2.error; + data = await this._recv(); + if (!data) { + throw new Error("no data received"); + } + } catch (e) { + this._log.info("connection closed"); + this.disconnect(); + return; } + await this._recvArray.push(data); } - return []; } - return await it.collect(); - } - async function sendMessage(client2, entity, { message, replyTo, attributes, parseMode, formattingEntities, linkPreview = true, file, thumb, forceDocument, clearDraft, buttons, silent, supportStreaming, schedule, noforwards, commentTo, topMsgId } = {}) { - if (file) { - return client2.sendFile(entity, { - file, - caption: message ? typeof message == "string" ? message : message.message : "", - forceDocument, - clearDraft, - replyTo, - attributes, - thumb, - supportsStreaming: supportStreaming, - parseMode, - formattingEntities, - silent, - scheduleDate: schedule, - buttons, - noforwards, - commentTo, - topMsgId - }); + async _initConn() { + if (this._codec.tag) { + await this.socket.write(this._codec.tag); + } } - entity = await client2.getInputEntity(entity); - if (commentTo != void 0) { - const discussionData = await getCommentData(client2, entity, commentTo); - entity = discussionData.entity; - replyTo = discussionData.replyTo; + async _send(data) { + const encodedPacket = this._codec.encodePacket(data); + this.socket.write(encodedPacket); } - let markup, request; - let replyObject = void 0; - if (replyTo != void 0) { - replyObject = new tl_1.Api.InputReplyToMessage({ - replyToMsgId: (0, Utils_1.getMessageId)(replyTo), - topMsgId: (0, Utils_1.getMessageId)(topMsgId) - }); + async _recv() { + return await this._codec.readPacket(this.socket); } - if (message && message instanceof tl_1.Api.Message) { - if (buttons == void 0) { - markup = message.replyMarkup; - } else { - markup = client2.buildReplyMarkup(buttons); - } - if (silent == void 0) { - silent = message.silent; - } - if (message.media && !(message.media instanceof tl_1.Api.MessageMediaWebPage)) { - return client2.sendFile(entity, { - file: message.media, - caption: message.message, - silent, - replyTo, - buttons: markup, - formattingEntities: message.entities, - scheduleDate: schedule - }); - } - request = new tl_1.Api.messages.SendMessage({ - peer: entity, - message: message.message || "", - silent, - replyTo: replyObject, - replyMarkup: markup, - entities: message.entities, - clearDraft, - noWebpage: !(message.media instanceof tl_1.Api.MessageMediaWebPage), - scheduleDate: schedule, - noforwards - }); - message = message.message; - } else { - if (formattingEntities == void 0) { - [message, formattingEntities] = await (0, messageParse_1._parseMessageText)(client2, message || "", parseMode); - } - if (!message) { - throw new Error("The message cannot be empty unless a file is provided"); - } - request = new tl_1.Api.messages.SendMessage({ - peer: entity, - message: message.toString(), - entities: formattingEntities, - noWebpage: !linkPreview, - replyTo: replyObject, - clearDraft, - silent, - replyMarkup: client2.buildReplyMarkup(buttons), - scheduleDate: schedule, - noforwards - }); + toString() { + return `${this._ip}:${this._port}/${this.constructor.name.replace("Connection", "")}`; } - const result = await client2.invoke(request); - if (result instanceof tl_1.Api.UpdateShortSentMessage) { - const msg = new tl_1.Api.Message({ - id: result.id, - peerId: await (0, users_1._getPeer)(client2, entity), - message, - date: result.date, - out: result.out, - media: result.media, - entities: result.entities, - replyMarkup: request.replyMarkup, - ttlPeriod: result.ttlPeriod - }); - msg._finishInit(client2, /* @__PURE__ */ new Map(), entity); - return msg; + }; + exports2.Connection = Connection; + var ObfuscatedConnection = class extends Connection { + constructor() { + super(...arguments); + this.ObfuscatedIO = void 0; } - return client2._getResponseMessage(request, result, entity); - } - async function forwardMessages(client2, entity, { messages, fromPeer, silent, schedule, noforwards, dropAuthor }) { - if (!(0, Helpers_1.isArrayLike)(messages)) { - messages = [messages]; + async _initConn() { + this._obfuscation = new this.ObfuscatedIO(this); + await this._obfuscation.initHeader(); + this.socket.write(this._obfuscation.header); } - entity = await client2.getInputEntity(entity); - let fromPeerId; - if (fromPeer) { - fromPeer = await client2.getInputEntity(fromPeer); - fromPeerId = await client2.getPeerId(fromPeer); + async _send(data) { + this._obfuscation.write(this._codec.encodePacket(data)); } - const getKey = (m) => { - if (m instanceof tl_1.Api.Message) { - return m.chatId; - } - let msgId = (0, Utils_1.parseID)(m); - if (msgId) { - if (fromPeerId !== void 0) { - return fromPeerId; - } - throw new Error("fromPeer must be given if integer IDs are used"); - } else { - throw new Error(`Cannot forward ${m}`); - } - }; - const sent = []; - for (let [chatId, chunk] of (0, Helpers_1.groupBy)(messages, getKey)) { - let chat; - let numbers = []; - if (typeof chunk[0] == "number") { - chat = fromPeer; - numbers = chunk; - } else { - chat = await chunk[0].getInputChat(); - numbers = chunk.map((m) => m.id); - } - chunk.push(); - const request = new tl_1.Api.messages.ForwardMessages({ - fromPeer: chat, - id: numbers, - toPeer: entity, - silent, - scheduleDate: schedule, - noforwards, - dropAuthor - }); - const result = await client2.invoke(request); - sent.push(client2._getResponseMessage(request, result, entity)); + async _recv() { + return await this._codec.readPacket(this._obfuscation); } - return sent; - } - async function editMessage(client2, entity, { message, text, parseMode, formattingEntities, linkPreview = true, file, forceDocument, buttons, schedule }) { - if (typeof message === "number" && typeof text === "undefined" && !file && !schedule) { - throw Error("You have to provide either file or text or schedule property."); + }; + exports2.ObfuscatedConnection = ObfuscatedConnection; + var PacketCodec = class { + constructor(connection) { + this._conn = connection; } - entity = await client2.getInputEntity(entity); - let id; - let markup; - let entities2; - let inputMedia; - if (file) { - const { fileHandle, media, image } = await (0, uploads_1._fileToMedia)(client2, { - file, - forceDocument - }); - inputMedia = media; + encodePacket(data) { + throw new Error("Not Implemented"); } - if (message instanceof tl_1.Api.Message) { - id = (0, Utils_1.getMessageId)(message); - text = message.message; - entities2 = message.entities; - if (buttons == void 0) { - markup = message.replyMarkup; - } else { - markup = client2.buildReplyMarkup(buttons); - } - if (message.media) { - inputMedia = (0, Utils_1.getInputMedia)(message.media, { forceDocument }); + async readPacket(reader) { + throw new Error("Not Implemented"); + } + }; + exports2.PacketCodec = PacketCodec; + } +}); + +// node_modules/telegram/network/connection/TCPFull.js +var require_TCPFull = __commonJS({ + "node_modules/telegram/network/connection/TCPFull.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConnectionTCPFull = exports2.FullPacketCodec = void 0; + var Connection_1 = require_Connection(); + var Helpers_1 = require_Helpers(); + var errors_1 = require_errors(); + var FullPacketCodec = class extends Connection_1.PacketCodec { + constructor(connection) { + super(connection); + this._sendCounter = 0; + } + encodePacket(data) { + const length = data.length + 12; + const e = Buffer.alloc(8); + e.writeInt32LE(length, 0); + e.writeInt32LE(this._sendCounter, 4); + data = Buffer.concat([e, data]); + const crc = Buffer.alloc(4); + crc.writeUInt32LE((0, Helpers_1.crc32)(data), 0); + this._sendCounter += 1; + return Buffer.concat([data, crc]); + } + /** + * + * @param reader {PromisedWebSockets} + * @returns {Promise<*>} + */ + async readPacket(reader) { + const packetLenSeq = await reader.readExactly(8); + if (packetLenSeq === void 0) { + return Buffer.alloc(0); } - } else { - if (typeof message !== "number") { - throw Error("editMessageParams.message must be either a number or a Api.Message type"); + const packetLen = packetLenSeq.readInt32LE(0); + if (packetLen < 0) { + const body2 = await reader.readExactly(4); + throw new errors_1.InvalidBufferError(body2); } - id = message; - if (formattingEntities == void 0) { - [text, entities2] = await (0, messageParse_1._parseMessageText)(client2, text || "", parseMode); - } else { - entities2 = formattingEntities; + let body = await reader.readExactly(packetLen - 8); + const checksum = body.slice(-4).readUInt32LE(0); + body = body.slice(0, -4); + const validChecksum = (0, Helpers_1.crc32)(Buffer.concat([packetLenSeq, body])); + if (!(validChecksum === checksum)) { + throw new errors_1.InvalidChecksumError(checksum, validChecksum); } - markup = client2.buildReplyMarkup(buttons); + return body; } - const request = new tl_1.Api.messages.EditMessage({ - peer: entity, - id, - message: text, - noWebpage: !linkPreview, - entities: entities2, - media: inputMedia, - replyMarkup: markup, - scheduleDate: schedule - }); - const result = await client2.invoke(request); - return client2._getResponseMessage(request, result, entity); - } - async function deleteMessages(client2, entity, messageIds, { revoke = false }) { - let ty = Helpers_1._EntityType.USER; - if (entity) { - entity = await client2.getInputEntity(entity); - ty = (0, Helpers_1._entityType)(entity); + }; + exports2.FullPacketCodec = FullPacketCodec; + var ConnectionTCPFull = class extends Connection_1.Connection { + constructor() { + super(...arguments); + this.PacketCodecClass = FullPacketCodec; } - const ids = []; - for (const messageId of messageIds) { - if (messageId instanceof tl_1.Api.Message || messageId instanceof tl_1.Api.MessageService || messageId instanceof tl_1.Api.MessageEmpty) { - ids.push(messageId.id); - } else if (typeof messageId === "number") { - ids.push(messageId); + }; + exports2.ConnectionTCPFull = ConnectionTCPFull; + } +}); + +// node_modules/telegram/network/connection/TCPAbridged.js +var require_TCPAbridged = __commonJS({ + "node_modules/telegram/network/connection/TCPAbridged.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConnectionTCPAbridged = exports2.AbridgedPacketCodec = void 0; + var Helpers_1 = require_Helpers(); + var Connection_1 = require_Connection(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var AbridgedPacketCodec = class _AbridgedPacketCodec extends Connection_1.PacketCodec { + constructor(props) { + super(props); + this.tag = _AbridgedPacketCodec.tag; + this.obfuscateTag = _AbridgedPacketCodec.obfuscateTag; + } + encodePacket(data) { + let length = data.length >> 2; + let temp; + if (length < 127) { + const b = Buffer.alloc(1); + b.writeUInt8(length, 0); + temp = b; } else { - throw new Error(`Cannot convert ${messageId} to an integer`); + temp = Buffer.concat([ + Buffer.from("7f", "hex"), + (0, Helpers_1.readBufferFromBigInt)((0, big_integer_1.default)(length), 3) + ]); } + return Buffer.concat([temp, data]); } - const results = []; - if (ty == Helpers_1._EntityType.CHANNEL) { - for (const chunk of __1.utils.chunks(ids)) { - results.push(client2.invoke(new tl_1.Api.channels.DeleteMessages({ - channel: entity, - id: chunk - }))); - } - } else { - for (const chunk of __1.utils.chunks(ids)) { - results.push(client2.invoke(new tl_1.Api.messages.DeleteMessages({ - id: chunk, - revoke - }))); + async readPacket(reader) { + const readData = await reader.read(1); + let length = readData[0]; + if (length >= 127) { + length = Buffer.concat([ + await reader.read(3), + Buffer.alloc(1) + ]).readInt32LE(0); } + return reader.read(length << 2); } - return Promise.all(results); - } - async function pinMessage(client2, entity, message, pinMessageParams) { - return await _pin(client2, entity, message, false, pinMessageParams === null || pinMessageParams === void 0 ? void 0 : pinMessageParams.notify, pinMessageParams === null || pinMessageParams === void 0 ? void 0 : pinMessageParams.pmOneSide); + }; + exports2.AbridgedPacketCodec = AbridgedPacketCodec; + AbridgedPacketCodec.tag = Buffer.from("ef", "hex"); + AbridgedPacketCodec.obfuscateTag = Buffer.from("efefefef", "hex"); + var ConnectionTCPAbridged = class extends Connection_1.Connection { + constructor() { + super(...arguments); + this.PacketCodecClass = AbridgedPacketCodec; + } + }; + exports2.ConnectionTCPAbridged = ConnectionTCPAbridged; + } +}); + +// node_modules/@cryptography/aes/dist/cjs/aes.min.js +var require_aes_min = __commonJS({ + "node_modules/@cryptography/aes/dist/cjs/aes.min.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + var t = new Uint8Array(256); + var e = new Uint8Array(256); + var r = new Uint32Array(256); + var n = new Uint32Array(256); + var i = new Uint32Array(256); + var h = new Uint32Array(256); + var o = new Uint32Array(256); + var s = new Uint32Array(256); + var c = new Uint32Array(256); + var y = new Uint32Array(256); + function a(t2) { + if (t2 instanceof Uint32Array) return t2; + if ("string" == typeof t2) { + if (t2.length % 4 != 0) for (var e2 = t2.length % 4; e2 <= 4; e2++) t2 += "\0x00"; + var r3 = new Uint32Array(t2.length / 4); + for (e2 = 0; e2 < t2.length; e2 += 4) r3[e2 / 4] = (i2 = e2, (n2 = t2).charCodeAt(i2) << 24 ^ n2.charCodeAt(i2 + 1) << 16 ^ n2.charCodeAt(i2 + 2) << 8 ^ n2.charCodeAt(i2 + 3)); + return r3; + } + var n2, i2; + if (t2 instanceof Uint8Array) { + for (r3 = new Uint32Array(t2.length / 4), e2 = 0; e2 < t2.length; e2 += 4) r3[e2 / 4] = t2[e2] << 24 ^ t2[e2 + 1] << 16 ^ t2[e2 + 2] << 8 ^ t2[e2 + 3]; + return r3; + } + throw new Error("Unable to create 32-bit words"); } - async function unpinMessage(client2, entity, message, unpinMessageParams) { - return await _pin(client2, entity, message, true, unpinMessageParams === null || unpinMessageParams === void 0 ? void 0 : unpinMessageParams.notify, unpinMessageParams === null || unpinMessageParams === void 0 ? void 0 : unpinMessageParams.pmOneSide); + function l(t2, e2, r3) { + void 0 === r3 && (r3 = t2); + for (var n2 = 0; n2 < t2.length; n2++) r3[n2] = t2[n2] ^ e2[n2]; } - async function _pin(client2, entity, message, unpin, notify = false, pmOneSide = false) { - message = __1.utils.getMessageId(message) || 0; - if (message === 0) { - return await client2.invoke(new tl_1.Api.messages.UnpinAllMessages({ - peer: entity - })); + !(function() { + for (var a2, l2, f2, u2, g2, p = new Uint8Array(256), v = new Uint8Array(256), w = 0, A = 0, d = 0; d < 256; d++) p[d] = d << 1 ^ 283 * (d >> 7), v[p[d] ^ d] = d; + for (; !t[w]; w ^= a2 || 1) f2 = (f2 = A ^ A << 1 ^ A << 2 ^ A << 3 ^ A << 4) >> 8 ^ 255 & f2 ^ 99, t[w] = f2, e[f2] = w, g2 = 16843009 * p[l2 = p[a2 = p[w]]] ^ 65537 * l2 ^ 257 * a2 ^ 16843008 * w, u2 = 257 * p[f2] ^ 16843008 * f2, r[w] = u2 = u2 << 24 ^ u2 >>> 8, n[w] = u2 = u2 << 24 ^ u2 >>> 8, i[w] = u2 = u2 << 24 ^ u2 >>> 8, h[w] = u2 = u2 << 24 ^ u2 >>> 8, o[f2] = g2 = g2 << 24 ^ g2 >>> 8, s[f2] = g2 = g2 << 24 ^ g2 >>> 8, c[f2] = g2 = g2 << 24 ^ g2 >>> 8, y[f2] = g2 = g2 << 24 ^ g2 >>> 8, A = v[A] || 1; + })(); + var f = (function() { + function l2(e2) { + var r3 = a(e2); + if (4 !== r3.length && 6 !== r3.length && 8 !== r3.length) throw new Error("Invalid key size"); + this.encKey = new Uint32Array(4 * r3.length + 28), this.decKey = new Uint32Array(4 * r3.length + 28), this.encKey.set(r3); + for (var n2, i2 = 1, h2 = r3.length; h2 < 4 * r3.length + 28; h2++) n2 = this.encKey[h2 - 1], (h2 % r3.length == 0 || 8 === r3.length && h2 % r3.length == 4) && (n2 = t[n2 >>> 24] << 24 ^ t[n2 >> 16 & 255] << 16 ^ t[n2 >> 8 & 255] << 8 ^ t[255 & n2], h2 % r3.length == 0 && (n2 = n2 << 8 ^ n2 >>> 24 ^ i2 << 24, i2 = i2 << 1 ^ 283 * (i2 >> 7))), this.encKey[h2] = this.encKey[h2 - r3.length] ^ n2; + for (var l3 = 0; h2; l3++, h2--) n2 = this.encKey[3 & l3 ? h2 : h2 - 4], this.decKey[l3] = h2 <= 4 || l3 < 4 ? n2 : o[t[n2 >>> 24]] ^ s[t[n2 >> 16 & 255]] ^ c[t[n2 >> 8 & 255]] ^ y[t[255 & n2]]; } - entity = await client2.getInputEntity(entity); - const request = new tl_1.Api.messages.UpdatePinnedMessage({ - silent: !notify, - unpin, - pmOneside: pmOneSide, - peer: entity, - id: message - }); - const result = await client2.invoke(request); - if (unpin || !("updates" in result) || "updates" in result && !result.updates) { - return; + return l2.prototype.encrypt = function(e2) { + for (var o2, s2, c2, y2 = a(e2), l3 = new Uint32Array(4), f2 = y2[0] ^ this.encKey[0], u2 = y2[1] ^ this.encKey[1], g2 = y2[2] ^ this.encKey[2], p = y2[3] ^ this.encKey[3], v = this.encKey.length / 4 - 2, w = 4, A = 0; A < v; A++) o2 = r[f2 >>> 24] ^ n[u2 >> 16 & 255] ^ i[g2 >> 8 & 255] ^ h[255 & p] ^ this.encKey[w], s2 = r[u2 >>> 24] ^ n[g2 >> 16 & 255] ^ i[p >> 8 & 255] ^ h[255 & f2] ^ this.encKey[w + 1], c2 = r[g2 >>> 24] ^ n[p >> 16 & 255] ^ i[f2 >> 8 & 255] ^ h[255 & u2] ^ this.encKey[w + 2], p = r[p >>> 24] ^ n[f2 >> 16 & 255] ^ i[u2 >> 8 & 255] ^ h[255 & g2] ^ this.encKey[w + 3], f2 = o2, u2 = s2, g2 = c2, w += 4; + for (A = 0; A < 4; A++) l3[A] = t[f2 >>> 24] << 24 ^ t[u2 >> 16 & 255] << 16 ^ t[g2 >> 8 & 255] << 8 ^ t[255 & p] ^ this.encKey[w++], o2 = f2, f2 = u2, u2 = g2, g2 = p, p = o2; + return l3; + }, l2.prototype.decrypt = function(t2) { + for (var r3, n2, i2, h2 = a(t2), l3 = new Uint32Array(4), f2 = h2[0] ^ this.decKey[0], u2 = h2[3] ^ this.decKey[1], g2 = h2[2] ^ this.decKey[2], p = h2[1] ^ this.decKey[3], v = this.decKey.length / 4 - 2, w = 4, A = 0; A < v; A++) r3 = o[f2 >>> 24] ^ s[u2 >> 16 & 255] ^ c[g2 >> 8 & 255] ^ y[255 & p] ^ this.decKey[w], n2 = o[u2 >>> 24] ^ s[g2 >> 16 & 255] ^ c[p >> 8 & 255] ^ y[255 & f2] ^ this.decKey[w + 1], i2 = o[g2 >>> 24] ^ s[p >> 16 & 255] ^ c[f2 >> 8 & 255] ^ y[255 & u2] ^ this.decKey[w + 2], p = o[p >>> 24] ^ s[f2 >> 16 & 255] ^ c[u2 >> 8 & 255] ^ y[255 & g2] ^ this.decKey[w + 3], f2 = r3, u2 = n2, g2 = i2, w += 4; + for (A = 0; A < 4; A++) l3[3 & -A] = e[f2 >>> 24] << 24 ^ e[u2 >> 16 & 255] << 16 ^ e[g2 >> 8 & 255] << 8 ^ e[255 & p] ^ this.decKey[w++], r3 = f2, f2 = u2, u2 = g2, g2 = p, p = r3; + return l3; + }, l2; + })(); + var u = (function() { + function t2(t3, e2, r3) { + void 0 === r3 && (r3 = 16), this.key = a(t3), this.iv = a(e2), this.cipher = new f(t3), this.blockSize = r3 / 4; } - return client2._getResponseMessage(request, result, entity); - } - async function markAsRead(client2, entity, message, markAsReadParams) { - let maxId = (markAsReadParams === null || markAsReadParams === void 0 ? void 0 : markAsReadParams.maxId) || 0; - const maxIdIsUndefined = (markAsReadParams === null || markAsReadParams === void 0 ? void 0 : markAsReadParams.maxId) === void 0; - if (maxIdIsUndefined) { - if (message) { - if (Array.isArray(message)) { - maxId = Math.max(...message.map((v) => __1.utils.getMessageId(v))); - } else { - maxId = __1.utils.getMessageId(message); - } + return t2.prototype.encrypt = function(t3, e2) { + for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.iv.subarray(this.blockSize, this.iv.length), h2 = this.iv.subarray(0, this.blockSize), o2 = new Uint32Array(this.blockSize), s2 = 0; s2 < r3.length; s2 += this.blockSize) { + var c2 = r3.subarray(s2, s2 + this.blockSize); + l(c2, h2, o2); + var y2 = this.cipher.encrypt(o2); + l(y2, i2), i2 = c2, h2 = y2; + for (var f2 = s2, u2 = 0; f2 < r3.length && u2 < 4; f2++, u2++) n2[f2] = y2[u2]; } - } - entity = await client2.getInputEntity(entity); - if (markAsReadParams && !markAsReadParams.clearMentions) { - await client2.invoke(new tl_1.Api.messages.ReadMentions({ peer: entity })); - if (maxIdIsUndefined && message === void 0) { - return true; + return n2; + }, t2.prototype.decrypt = function(t3, e2) { + for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.iv.subarray(this.blockSize, this.iv.length), h2 = this.iv.subarray(0, this.blockSize), o2 = new Uint32Array(this.blockSize), s2 = 0; s2 < n2.length; s2 += this.blockSize) { + var c2 = r3.subarray(s2, s2 + this.blockSize); + l(c2, i2, o2); + var y2 = this.cipher.decrypt(o2); + l(y2, h2), h2 = c2, i2 = y2; + for (var f2 = s2, u2 = 0; f2 < n2.length && u2 < 4; f2++, u2++) n2[f2] = y2[u2]; } + return n2; + }, t2; + })(); + var g = (function() { + function t2(t3, e2, r3) { + if (void 0 === r3 && (r3 = 16), this.offset = 0, this.key = a(t3), this.counter = a(e2), this.cipher = new f(t3), this.blockSize = r3 / 4, 4 !== this.counter.length) throw new Error("AES-CTR mode counter must be 16 bytes length"); } - if ((0, Helpers_1._entityType)(entity) === Helpers_1._EntityType.CHANNEL) { - return await client2.invoke(new tl_1.Api.channels.ReadHistory({ channel: entity, maxId })); - } else { - await client2.invoke(new tl_1.Api.messages.ReadHistory({ peer: entity, maxId })); - return true; + return t2.prototype.encrypt = function(t3, e2) { + for (var r3 = a(t3), n2 = e2 || new Uint32Array(r3.length), i2 = this.offset, h2 = 0; h2 < r3.length; h2 += this.blockSize) { + for (var o2 = this.cipher.encrypt(this.counter), s2 = h2, c2 = i2; s2 < r3.length && c2 < this.blockSize; s2++, c2++) n2[s2] = o2[c2] ^ r3[s2]; + r3.length - h2 >= this.blockSize && this.incrementCounter(), i2 && (h2 -= i2, i2 = 0); + } + return this.offset = (this.offset + r3.length % 4) % 4, n2; + }, t2.prototype.decrypt = function(t3, e2) { + return this.encrypt(t3, e2); + }, t2.prototype.incrementCounter = function() { + for (var t3 = this.counter.length - 1; t3 >= 0 && !(++this.counter[t3] < 4294967295); t3--) ; + }, t2; + })(); + exports2.CTR = g, exports2.IGE = u, exports2.default = f; + } +}); + +// node_modules/telegram/crypto/converters.js +var require_converters = __commonJS({ + "node_modules/telegram/crypto/converters.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ab2i = exports2.i2ab = exports2.isBigEndian = void 0; + exports2.i2abLow = i2abLow; + exports2.i2abBig = i2abBig; + exports2.ab2iLow = ab2iLow; + exports2.ab2iBig = ab2iBig; + function i2abLow(buf) { + const uint8 = new Uint8Array(buf.length * 4); + let i = 0; + for (let j = 0; j < buf.length; j++) { + const int = buf[j]; + uint8[i++] = int >>> 24; + uint8[i++] = int >> 16 & 255; + uint8[i++] = int >> 8 & 255; + uint8[i++] = int & 255; } + return uint8.buffer; } - async function getCommentData(client2, entity, message) { - const result = await client2.invoke(new tl_1.Api.messages.GetDiscussionMessage({ - peer: entity, - msgId: __1.utils.getMessageId(message) - })); - const relevantMessage = result.messages.reduce((p, c) => p && p.id < c.id ? p : c); - let chat; - for (const c of result.chats) { - if (relevantMessage.peerId instanceof tl_1.Api.PeerChannel && c.id.eq(relevantMessage.peerId.channelId)) { - chat = c; - break; - } + function i2abBig(buf) { + return buf.buffer; + } + function ab2iLow(ab) { + const uint8 = new Uint8Array(ab); + const buf = new Uint32Array(uint8.length / 4); + for (let i = 0; i < uint8.length; i += 4) { + buf[i / 4] = uint8[i] << 24 ^ uint8[i + 1] << 16 ^ uint8[i + 2] << 8 ^ uint8[i + 3]; } - return { - entity: __1.utils.getInputPeer(chat), - replyTo: relevantMessage.id - }; + return buf; } + function ab2iBig(ab) { + return new Uint32Array(ab); + } + exports2.isBigEndian = new Uint8Array(new Uint32Array([16909060]))[0] === 1; + exports2.i2ab = exports2.isBigEndian ? i2abBig : i2abLow; + exports2.ab2i = exports2.isBigEndian ? ab2iBig : ab2iLow; } }); -// node_modules/telegram/tl/custom/index.js -var require_custom = __commonJS({ - "node_modules/telegram/tl/custom/index.js"(exports2) { +// node_modules/telegram/crypto/words.js +var require_words = __commonJS({ + "node_modules/telegram/crypto/words.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ChatGetter = void 0; - var chatGetter_1 = require_chatGetter(); - Object.defineProperty(exports2, "ChatGetter", { enumerable: true, get: function() { - return chatGetter_1.ChatGetter; - } }); + exports2.s2i = s2i; + exports2.getWords = getWords; + exports2.xor = xor; + function s2i(str, pos) { + return str.charCodeAt(pos) << 24 ^ str.charCodeAt(pos + 1) << 16 ^ str.charCodeAt(pos + 2) << 8 ^ str.charCodeAt(pos + 3); + } + function getWords(key) { + if (key instanceof Uint32Array) { + return key; + } + if (typeof key === "string") { + if (key.length % 4 !== 0) + for (let i = key.length % 4; i <= 4; i++) + key += "\0x00"; + const buf = new Uint32Array(key.length / 4); + for (let i = 0; i < key.length; i += 4) + buf[i / 4] = s2i(key, i); + return buf; + } + if (key instanceof Uint8Array) { + const buf = new Uint32Array(key.length / 4); + for (let i = 0; i < key.length; i += 4) { + buf[i / 4] = key[i] << 24 ^ key[i + 1] << 16 ^ key[i + 2] << 8 ^ key[i + 3]; + } + return buf; + } + throw new Error("Unable to create 32-bit words"); + } + function xor(left, right, to = left) { + for (let i = 0; i < left.length; i++) + to[i] = left[i] ^ right[i]; + } } }); -// node_modules/telegram/events/common.js -var require_common3 = __commonJS({ - "node_modules/telegram/events/common.js"(exports2) { +// node_modules/telegram/crypto/crypto.js +var require_crypto = __commonJS({ + "node_modules/telegram/crypto/crypto.js"(exports2) { "use strict"; init_define_import_meta_env(); var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EventCommonSender = exports2.EventCommon = exports2.EventBuilder = void 0; - exports2._intoIdSet = _intoIdSet; - var tl_1 = require_tl(); - var custom_1 = require_custom(); - var Helpers_1 = require_Helpers(); - var __1 = require_telegram(); - var senderGetter_1 = require_senderGetter(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var Utils_1 = require_Utils(); - async function _intoIdSet(client2, chats) { - if (chats == void 0) { - return void 0; - } - if (!(0, Helpers_1.isArrayLike)(chats)) { - chats = [chats]; + exports2.Hash = exports2.CTR = exports2.Counter = void 0; + exports2.createDecipheriv = createDecipheriv; + exports2.createCipheriv = createCipheriv; + exports2.randomBytes = randomBytes; + exports2.pbkdf2Sync = pbkdf2Sync; + exports2.createHash = createHash; + var aes_1 = __importDefault2(require_aes_min()); + var converters_1 = require_converters(); + var words_1 = require_words(); + var Counter = class { + constructor(initialValue) { + this._counter = Buffer.from(initialValue); } - const result = /* @__PURE__ */ new Set(); - for (let chat of chats) { - if (typeof chat == "number" || typeof chat == "bigint" || typeof chat == "string" && (0, Utils_1.parseID)(chat) || big_integer_1.default.isInstance(chat)) { - chat = (0, Helpers_1.returnBigInt)(chat); - if (chat.lesser(0)) { - result.add(chat.toString()); + increment() { + for (let i = 15; i >= 0; i--) { + if (this._counter[i] === 255) { + this._counter[i] = 0; } else { - result.add(__1.utils.getPeerId(new tl_1.Api.PeerUser({ - userId: chat - }))); - result.add(__1.utils.getPeerId(new tl_1.Api.PeerChat({ - chatId: chat - }))); - result.add(__1.utils.getPeerId(new tl_1.Api.PeerChannel({ - channelId: chat - }))); - } - } else if (typeof chat == "object" && chat.SUBCLASS_OF_ID == 47470215) { - result.add(__1.utils.getPeerId(chat)); - } else { - chat = await client2.getInputEntity(chat); - if (chat instanceof tl_1.Api.InputPeerSelf) { - chat = await client2.getMe(true); + this._counter[i]++; + break; } - result.add(__1.utils.getPeerId(chat)); } } - return Array.from(result); - } - var EventBuilder = class { - constructor(eventParams) { - var _a3; - this.chats = (_a3 = eventParams.chats) === null || _a3 === void 0 ? void 0 : _a3.map((x) => x.toString()); - this.blacklistChats = eventParams.blacklistChats || false; - this.resolved = false; - this.func = eventParams.func; - } - build(update2, callback, selfId) { - if (update2) - return update2; - } - async resolve(client2) { - if (this.resolved) { - return; + }; + exports2.Counter = Counter; + var CTR = class { + constructor(key, counter) { + if (!(counter instanceof Counter)) { + counter = new Counter(counter); } - await this._resolve(client2); - this.resolved = true; + this._counter = counter; + this._remainingCounter = void 0; + this._remainingCounterIndex = 16; + this._aes = new aes_1.default((0, words_1.getWords)(key)); } - async _resolve(client2) { - this.chats = await _intoIdSet(client2, this.chats); + update(plainText) { + return this.encrypt(plainText); } - filter(event) { - if (!this.resolved) { - return; - } - if (this.chats != void 0) { - if (event.chatId == void 0) { - return; + encrypt(plainText) { + const encrypted = Buffer.from(plainText); + for (let i = 0; i < encrypted.length; i++) { + if (this._remainingCounterIndex === 16) { + this._remainingCounter = Buffer.from((0, converters_1.i2ab)(this._aes.encrypt((0, converters_1.ab2i)(this._counter._counter)))); + this._remainingCounterIndex = 0; + this._counter.increment(); } - const inside = this.chats.includes(event.chatId.toString()); - if (inside == this.blacklistChats) { - return; + if (this._remainingCounter) { + encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; } } - if (this.func && !this.func(event)) { - return; - } - return event; + return encrypted; } }; - exports2.EventBuilder = EventBuilder; - var EventCommon = class extends custom_1.ChatGetter { - constructor({ chatPeer = void 0, msgId = void 0, broadcast = void 0 }) { - super(); - this._eventName = "Event"; - custom_1.ChatGetter.initChatClass(this, { chatPeer, broadcast }); - this._entities = /* @__PURE__ */ new Map(); - this._client = void 0; - this._messageId = msgId; - } - _setClient(client2) { - this._client = client2; + exports2.CTR = CTR; + function createDecipheriv(algorithm, key, iv) { + if (algorithm.includes("ECB")) { + throw new Error("Not supported"); + } else { + return new CTR(key, iv); } - get client() { - return this._client; + } + function createCipheriv(algorithm, key, iv) { + if (algorithm.includes("ECB")) { + throw new Error("Not supported"); + } else { + return new CTR(key, iv); } - }; - exports2.EventCommon = EventCommon; - var EventCommonSender = class extends senderGetter_1.SenderGetter { - constructor({ chatPeer = void 0, msgId = void 0, broadcast = void 0 }) { - super(); - this._eventName = "Event"; - custom_1.ChatGetter.initChatClass(this, { chatPeer, broadcast }); - senderGetter_1.SenderGetter.initChatClass(this, { chatPeer, broadcast }); - this._entities = /* @__PURE__ */ new Map(); - this._client = void 0; - this._messageId = msgId; + } + function randomBytes(count) { + const bytes = new Uint8Array(count); + crypto.getRandomValues(bytes); + return bytes; + } + var Hash = class { + constructor(algorithm) { + this.algorithm = algorithm; } - _setClient(client2) { - this._client = client2; + update(data) { + this.data = new Uint8Array(data); } - get client() { - return this._client; + async digest() { + if (this.data) { + if (this.algorithm === "sha1") { + return Buffer.from(await self.crypto.subtle.digest("SHA-1", this.data)); + } else if (this.algorithm === "sha256") { + return Buffer.from(await self.crypto.subtle.digest("SHA-256", this.data)); + } + } + return Buffer.alloc(0); } }; - exports2.EventCommonSender = EventCommonSender; + exports2.Hash = Hash; + async function pbkdf2Sync(password, salt, iterations, ...args) { + const passwordKey = await crypto.subtle.importKey("raw", password, { name: "PBKDF2" }, false, ["deriveBits"]); + return Buffer.from(await crypto.subtle.deriveBits({ + name: "PBKDF2", + hash: "SHA-512", + salt, + iterations + }, passwordKey, 512)); + } + function createHash(algorithm) { + return new Hash(algorithm); + } } }); -// node_modules/telegram/events/Raw.js -var require_Raw = __commonJS({ - "node_modules/telegram/events/Raw.js"(exports2) { +// node_modules/telegram/crypto/CTR.js +var require_CTR = __commonJS({ + "node_modules/telegram/crypto/CTR.js"(exports2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Raw = void 0; - var common_1 = require_common3(); - var Raw = class extends common_1.EventBuilder { - constructor(params) { - super({ func: params.func }); - this.types = params.types; - } - async resolve(client2) { - this.resolved = true; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - build(update2) { - return update2; + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - filter(event) { - if (this.types) { - let correct = false; - for (const type of this.types) { - if (event instanceof type) { - correct = true; - break; - } - } - if (!correct) { - return; - } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CTR = void 0; + var crypto4 = __importStar2(require_crypto()); + var CTR = class { + constructor(key, iv) { + if (!Buffer.isBuffer(key) || !Buffer.isBuffer(iv) || iv.length !== 16) { + throw new Error("Key and iv need to be a buffer"); } - return super.filter(event); + this.cipher = crypto4.createCipheriv("AES-256-CTR", key, iv); + } + encrypt(data) { + return Buffer.from(this.cipher.update(data)); } }; - exports2.Raw = Raw; + exports2.CTR = CTR; } }); -// node_modules/telegram/client/updates.js -var require_updates = __commonJS({ - "node_modules/telegram/client/updates.js"(exports2) { +// node_modules/telegram/network/connection/TCPObfuscated.js +var require_TCPObfuscated = __commonJS({ + "node_modules/telegram/network/connection/TCPObfuscated.js"(exports2) { "use strict"; init_define_import_meta_env(); Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StopPropagation = void 0; - exports2.on = on; - exports2.addEventHandler = addEventHandler; - exports2.removeEventHandler = removeEventHandler; - exports2.listEventHandlers = listEventHandlers; - exports2.catchUp = catchUp; - exports2._handleUpdate = _handleUpdate; - exports2._processUpdate = _processUpdate; - exports2._dispatchUpdate = _dispatchUpdate; - exports2._updateLoop = _updateLoop; - var tl_1 = require_tl(); - var network_1 = require_network(); - var index_1 = require_telegram(); + exports2.ConnectionTCPObfuscated = void 0; var Helpers_1 = require_Helpers(); - var Logger_1 = require_Logger(); - var PING_INTERVAL = 9e3; - var PING_TIMEOUT = 1e4; - var PING_FAIL_ATTEMPTS = 3; - var PING_FAIL_INTERVAL = 100; - var PING_DISCONNECT_DELAY = 6e4; - var PING_INTERVAL_TO_WAKE_UP = 5e3; - var PING_WAKE_UP_TIMEOUT = 3e3; - var PING_WAKE_UP_WARNING_TIMEOUT = 1e3; - var StopPropagation = class extends Error { - }; - exports2.StopPropagation = StopPropagation; - function on(client2, event) { - return (f) => { - client2.addEventHandler(f, event); - return f; - }; - } - function addEventHandler(client2, callback, event) { - if (event == void 0) { - const raw = require_Raw().Raw; - event = new raw({}); - } - event.client = client2; - client2._eventBuilders.push([event, callback]); - } - function removeEventHandler(client2, callback, event) { - client2._eventBuilders = client2._eventBuilders.filter(function(item) { - return item[0] !== event && item[1] !== callback; - }); - } - function listEventHandlers(client2) { - return client2._eventBuilders; - } - function catchUp() { - } - function _handleUpdate(client2, update2) { - if (typeof update2 === "number") { - if ([-1, 0, 1].includes(update2)) { - _dispatchUpdate(client2, { - update: new network_1.UpdateConnectionState(update2) - }); - return; - } - } - client2._entityCache.add(update2); - client2.session.processEntities(update2); - if (update2 instanceof tl_1.Api.Updates || update2 instanceof tl_1.Api.UpdatesCombined) { - const entities2 = /* @__PURE__ */ new Map(); - for (const x of [...update2.users, ...update2.chats]) { - entities2.set(index_1.utils.getPeerId(x), x); - } - for (const u of update2.updates) { - _processUpdate(client2, u, update2.updates, entities2); - } - } else if (update2 instanceof tl_1.Api.UpdateShort) { - _processUpdate(client2, update2.update, null); - } else { - _processUpdate(client2, update2, null); + var Connection_1 = require_Connection(); + var TCPAbridged_1 = require_TCPAbridged(); + var CTR_1 = require_CTR(); + var ObfuscatedIO = class { + constructor(connection) { + this.header = void 0; + this.connection = connection.socket; + this._packetClass = connection.PacketCodecClass; } - } - function _processUpdate(client2, update2, others, entities2) { - update2._entities = entities2 || /* @__PURE__ */ new Map(); - const args = { - update: update2, - others - }; - _dispatchUpdate(client2, args); - } - async function _dispatchUpdate(client2, args) { - for (const [builder, callback] of client2._eventBuilders) { - if (!builder || !callback) { - continue; - } - if (!builder.resolved) { - await builder.resolve(client2); - } - let event = args.update; - if (event) { - if (!client2._selfInputPeer) { - try { - await client2.getMe(true); - } catch (e) { - } - } - if (!(event instanceof network_1.UpdateConnectionState)) { - } - event = builder.build(event, callback, client2._selfInputPeer ? (0, Helpers_1.returnBigInt)(client2._selfInputPeer.userId) : void 0); - if (event) { - event._client = client2; - if ("_eventName" in event) { - event._setClient(client2); - event.originalUpdate = args.update; - event._entities = args.update._entities; - } - const filter3 = await builder.filter(event); - if (!filter3) { - continue; - } - try { - await callback(event); - } catch (e) { - if (e instanceof StopPropagation) { + async initHeader() { + const keywords = [ + Buffer.from("50567247", "hex"), + Buffer.from("474554", "hex"), + Buffer.from("504f5354", "hex"), + Buffer.from("eeeeeeee", "hex") + ]; + let random; + while (true) { + random = (0, Helpers_1.generateRandomBytes)(64); + if (random[0] !== 239 && !random.slice(4, 8).equals(Buffer.alloc(4))) { + let ok = true; + for (const key of keywords) { + if (key.equals(random.slice(0, 4))) { + ok = false; break; } - if (client2._errorHandler) { - await client2._errorHandler(e); - } - if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); - } } - } - } - } - } - async function _updateLoop(client2) { - let lastPongAt; - while (!client2._destroyed) { - await (0, Helpers_1.sleep)(PING_INTERVAL, true); - if (client2._destroyed) - break; - if (client2._sender.isReconnecting || client2._isSwitchingDc) { - lastPongAt = void 0; - continue; - } - try { - const ping = () => { - return client2._sender.send(new tl_1.Api.PingDelayDisconnect({ - pingId: (0, Helpers_1.returnBigInt)((0, Helpers_1.getRandomInt)(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)), - disconnectDelay: PING_DISCONNECT_DELAY - })); - }; - const pingAt = Date.now(); - const lastInterval = lastPongAt ? pingAt - lastPongAt : void 0; - if (!lastInterval || lastInterval < PING_INTERVAL_TO_WAKE_UP) { - await attempts(() => timeout(ping, PING_TIMEOUT), PING_FAIL_ATTEMPTS, PING_FAIL_INTERVAL); - } else { - let wakeUpWarningTimeout = setTimeout(() => { - _handleUpdate(client2, network_1.UpdateConnectionState.disconnected); - wakeUpWarningTimeout = void 0; - }, PING_WAKE_UP_WARNING_TIMEOUT); - await timeout(ping, PING_WAKE_UP_TIMEOUT); - if (wakeUpWarningTimeout) { - clearTimeout(wakeUpWarningTimeout); - wakeUpWarningTimeout = void 0; + if (ok) { + break; } - _handleUpdate(client2, network_1.UpdateConnectionState.connected); - } - lastPongAt = Date.now(); - } catch (err) { - if (client2._errorHandler) { - await client2._errorHandler(err); - } - if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(err); - } - lastPongAt = void 0; - if (client2._sender.isReconnecting || client2._isSwitchingDc) { - continue; - } - client2._sender.reconnect(); - } - if (Date.now() - (client2._lastRequest || 0) > 30 * 60 * 1e3) { - try { - await client2.invoke(new tl_1.Api.updates.GetState()); - } catch (e) { } - lastPongAt = void 0; } + random = random.toJSON().data; + const randomReversed = Buffer.from(random.slice(8, 56)).reverse(); + const encryptKey = Buffer.from(random.slice(8, 40)); + const encryptIv = Buffer.from(random.slice(40, 56)); + const decryptKey = Buffer.from(randomReversed.slice(0, 32)); + const decryptIv = Buffer.from(randomReversed.slice(32, 48)); + const encryptor = new CTR_1.CTR(encryptKey, encryptIv); + const decryptor = new CTR_1.CTR(decryptKey, decryptIv); + random = Buffer.concat([ + Buffer.from(random.slice(0, 56)), + this._packetClass.obfuscateTag, + Buffer.from(random.slice(60)) + ]); + random = Buffer.concat([ + Buffer.from(random.slice(0, 56)), + Buffer.from(encryptor.encrypt(random).slice(56, 64)), + Buffer.from(random.slice(64)) + ]); + this.header = random; + this._encrypt = encryptor; + this._decrypt = decryptor; } - await client2.disconnect(); - } - async function attempts(cb, times, pause) { - for (let i = 0; i < times; i++) { - try { - return await cb(); - } catch (err) { - if (i === times - 1) { - throw err; - } - await (0, Helpers_1.sleep)(pause); - } + async read(n) { + const data = await this.connection.readExactly(n); + return this._decrypt.encrypt(data); } - return void 0; - } - function timeout(cb, ms) { - let isResolved = false; - return Promise.race([ - cb(), - (0, Helpers_1.sleep)(ms).then(() => isResolved ? void 0 : Promise.reject(new Error("TIMEOUT"))) - ]).finally(() => { - isResolved = true; - }); - } + write(data) { + this.connection.write(this._encrypt.encrypt(data)); + } + }; + var ConnectionTCPObfuscated = class extends Connection_1.ObfuscatedConnection { + constructor() { + super(...arguments); + this.ObfuscatedIO = ObfuscatedIO; + this.PacketCodecClass = TCPAbridged_1.AbridgedPacketCodec; + } + }; + exports2.ConnectionTCPObfuscated = ConnectionTCPObfuscated; } }); -// node_modules/telegram/client/chats.js -var require_chats = __commonJS({ - "node_modules/telegram/client/chats.js"(exports2) { +// node_modules/telegram/network/connection/index.js +var require_connection = __commonJS({ + "node_modules/telegram/network/connection/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConnectionTCPObfuscated = exports2.ConnectionTCPAbridged = exports2.ConnectionTCPFull = exports2.Connection = void 0; + var Connection_1 = require_Connection(); + Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { + return Connection_1.Connection; + } }); + var TCPFull_1 = require_TCPFull(); + Object.defineProperty(exports2, "ConnectionTCPFull", { enumerable: true, get: function() { + return TCPFull_1.ConnectionTCPFull; + } }); + var TCPAbridged_1 = require_TCPAbridged(); + Object.defineProperty(exports2, "ConnectionTCPAbridged", { enumerable: true, get: function() { + return TCPAbridged_1.ConnectionTCPAbridged; + } }); + var TCPObfuscated_1 = require_TCPObfuscated(); + Object.defineProperty(exports2, "ConnectionTCPObfuscated", { enumerable: true, get: function() { + return TCPObfuscated_1.ConnectionTCPObfuscated; + } }); + } +}); + +// node_modules/telegram/sessions/Abstract.js +var require_Abstract = __commonJS({ + "node_modules/telegram/sessions/Abstract.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Session = void 0; + var Session = class { + }; + exports2.Session = Session; + } +}); + +// node_modules/telegram/sessions/Memory.js +var require_Memory = __commonJS({ + "node_modules/telegram/sessions/Memory.js"(exports2) { "use strict"; init_define_import_meta_env(); var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._ParticipantsIter = void 0; - exports2.iterParticipants = iterParticipants; - exports2.getParticipants = getParticipants; - exports2.kickParticipant = kickParticipant; - var Helpers_1 = require_Helpers(); - var requestIter_1 = require_requestIter(); - var __1 = require_telegram(); + exports2.MemorySession = void 0; + var Abstract_1 = require_Abstract(); var tl_1 = require_tl(); var big_integer_1 = __importDefault2(require_BigInteger()); - var inspect_1 = require_inspect(); var Utils_1 = require_Utils(); - var _MAX_PARTICIPANTS_CHUNK_SIZE = 200; - var _MAX_ADMIN_LOG_CHUNK_SIZE = 100; - var _ChatAction = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + var Helpers_1 = require_Helpers(); + var __1 = require_telegram(); + var MemorySession = class extends Abstract_1.Session { + constructor() { + super(); + this._serverAddress = void 0; + this._dcId = 0; + this._port = void 0; + this._takeoutId = void 0; + this._entities = /* @__PURE__ */ new Set(); + this._updateStates = {}; } - constructor(client2, chat, action, params = { - delay: 4, - autoCancel: true - }) { - this._client = client2; - this._chat = chat; - this._action = action; - this._delay = params.delay; - this.autoCancel = params.autoCancel; - this._request = void 0; - this._task = null; - this._running = false; + setDC(dcId, serverAddress, port) { + this._dcId = dcId | 0; + this._serverAddress = serverAddress; + this._port = port; } - async start() { - this._request = new tl_1.Api.messages.SetTyping({ - peer: this._chat, - action: this._action - }); - this._running = true; - this._update(); + get dcId() { + return this._dcId; } - async stop() { - this._running = false; - if (this.autoCancel) { - await this._client.invoke(new tl_1.Api.messages.SetTyping({ - peer: this._chat, - action: new tl_1.Api.SendMessageCancelAction() - })); - } + get serverAddress() { + return this._serverAddress; } - async _update() { - while (this._running) { - if (this._request != void 0) { - await this._client.invoke(this._request); - } - await (0, Helpers_1.sleep)(this._delay * 1e3); + get port() { + return this._port; + } + get authKey() { + return this._authKey; + } + set authKey(value) { + this._authKey = value; + } + get takeoutId() { + return this._takeoutId; + } + set takeoutId(value) { + this._takeoutId = value; + } + getAuthKey(dcId) { + if (dcId && dcId !== this.dcId) { + return void 0; } + return this.authKey; } - progress(current, total) { - if ("progress" in this._action) { - this._action.progress = 100 * Math.round(current / total); + setAuthKey(authKey, dcId) { + if (dcId && dcId !== this.dcId) { + return void 0; } + this.authKey = authKey; } - }; - _ChatAction._str_mapping = { - typing: new tl_1.Api.SendMessageTypingAction(), - contact: new tl_1.Api.SendMessageChooseContactAction(), - game: new tl_1.Api.SendMessageGamePlayAction(), - location: new tl_1.Api.SendMessageGeoLocationAction(), - "record-audio": new tl_1.Api.SendMessageRecordAudioAction(), - "record-voice": new tl_1.Api.SendMessageRecordAudioAction(), - //alias - "record-round": new tl_1.Api.SendMessageRecordRoundAction(), - "record-video": new tl_1.Api.SendMessageRecordVideoAction(), - audio: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), - voice: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), - // alias - song: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), - // alias - round: new tl_1.Api.SendMessageUploadRoundAction({ progress: 1 }), - video: new tl_1.Api.SendMessageUploadVideoAction({ progress: 1 }), - photo: new tl_1.Api.SendMessageUploadPhotoAction({ progress: 1 }), - document: new tl_1.Api.SendMessageUploadDocumentAction({ progress: 1 }), - file: new tl_1.Api.SendMessageUploadDocumentAction({ progress: 1 }), - // alias - cancel: new tl_1.Api.SendMessageCancelAction() - }; - var _ParticipantsIter = class extends requestIter_1.RequestIter { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + close() { } - async _init({ entity, filter: filter3, offset, search, showTotal }) { - var _a3, _b; - if (!offset) { - offset = 0; + save() { + } + async load() { + } + delete() { + } + _entityValuesToRow(id, hash2, username, phone, name) { + return [id, hash2, username, phone, name]; + } + _entityToRow(e) { + if (!(e.classType === "constructor")) { + return; } - if (filter3 && filter3.constructor === Function) { - if ([ - tl_1.Api.ChannelParticipantsBanned, - tl_1.Api.ChannelParticipantsKicked, - tl_1.Api.ChannelParticipantsSearch, - tl_1.Api.ChannelParticipantsContacts - ].includes(filter3)) { - filter3 = new filter3({ - q: "" - }); - } else { - filter3 = new filter3(); - } + let p; + let markedId; + try { + p = (0, Utils_1.getInputPeer)(e, false); + markedId = (0, Utils_1.getPeerId)(p); + } catch (e2) { + return; } - entity = await this.client.getInputEntity(entity); - const ty = __1.helpers._entityType(entity); - if (search && (filter3 || ty != __1.helpers._EntityType.CHANNEL)) { - search = search.toLowerCase(); - this.filterEntity = (entity2) => { - return __1.utils.getDisplayName(entity2).toLowerCase().includes(search) || ("username" in entity2 ? entity2.username || "" : "").toLowerCase().includes(search); - }; + let pHash; + if (p instanceof tl_1.Api.InputPeerUser || p instanceof tl_1.Api.InputPeerChannel) { + pHash = p.accessHash; + } else if (p instanceof tl_1.Api.InputPeerChat) { + pHash = big_integer_1.default.zero; } else { - this.filterEntity = (entity2) => true; + return; } - this.requests = []; - if (ty == __1.helpers._EntityType.CHANNEL) { - if (showTotal) { - const channel = await this.client.invoke(new tl_1.Api.channels.GetFullChannel({ - channel: entity - })); - if (!(channel.fullChat instanceof tl_1.Api.ChatFull)) { - this.total = channel.fullChat.participantsCount; + let username = e.username; + if (username) { + username = username.toLowerCase(); + } + const phone = e.phone; + const name = (0, Utils_1.getDisplayName)(e); + return this._entityValuesToRow(markedId, pHash, username, phone, name); + } + _entitiesToRows(tlo) { + let entities2 = []; + if (!(tlo.classType === "constructor") && (0, Helpers_1.isArrayLike)(tlo)) { + entities2 = tlo; + } else { + if (typeof tlo === "object") { + if ("user" in tlo) { + entities2.push(tlo.user); + } + if ("chat" in tlo) { + entities2.push(tlo.chat); + } + if ("channel" in tlo) { + entities2.push(tlo.channel); + } + if ("chats" in tlo && (0, Helpers_1.isArrayLike)(tlo.chats)) { + entities2 = entities2.concat(tlo.chats); + } + if ("users" in tlo && (0, Helpers_1.isArrayLike)(tlo.users)) { + entities2 = entities2.concat(tlo.users); } } - if (this.total && this.total <= 0) { - return false; + } + const rows = []; + for (const e of entities2) { + const row = this._entityToRow(e); + if (row) { + rows.push(row); } - this.requests.push(new tl_1.Api.channels.GetParticipants({ - channel: entity, - filter: filter3 || new tl_1.Api.ChannelParticipantsSearch({ - q: search || "" - }), - offset, - limit: _MAX_PARTICIPANTS_CHUNK_SIZE, - hash: big_integer_1.default.zero - })); - } else if (ty == __1.helpers._EntityType.CHAT) { - if (!("chatId" in entity)) { - throw new Error("Found chat without id " + JSON.stringify(entity)); + } + return rows; + } + processEntities(tlo) { + const entitiesSet = this._entitiesToRows(tlo); + for (const e of entitiesSet) { + this._entities.add(e); + } + } + getEntityRowsByPhone(phone) { + for (const e of this._entities) { + if (e[3] === phone) { + return [e[0], e[1]]; } - const full = await this.client.invoke(new tl_1.Api.messages.GetFullChat({ - chatId: entity.chatId - })); - if (full.fullChat instanceof tl_1.Api.ChatFull) { - if (!(full.fullChat.participants instanceof tl_1.Api.ChatParticipantsForbidden)) { - this.total = full.fullChat.participants.participants.length; - } else { - this.total = 0; - return false; - } - const users = /* @__PURE__ */ new Map(); - for (const user of full.users) { - users.set(user.id.toString(), user); + } + } + getEntityRowsByUsername(username) { + for (const e of this._entities) { + if (e[2] === username) { + return [e[0], e[1]]; + } + } + } + getEntityRowsByName(name) { + for (const e of this._entities) { + if (e[4] === name) { + return [e[0], e[1]]; + } + } + } + getEntityRowsById(id, exact = true) { + if (exact) { + for (const e of this._entities) { + if (e[0] === id) { + return [e[0], e[1]]; } - for (const participant of full.fullChat.participants.participants) { - const user = users.get(participant.userId.toString()); - if (!this.filterEntity(user)) { - continue; - } - user.participant = participant; - (_a3 = this.buffer) === null || _a3 === void 0 ? void 0 : _a3.push(user); + } + } else { + const ids = [ + __1.utils.getPeerId(new tl_1.Api.PeerUser({ userId: (0, Helpers_1.returnBigInt)(id) })), + __1.utils.getPeerId(new tl_1.Api.PeerChat({ chatId: (0, Helpers_1.returnBigInt)(id) })), + __1.utils.getPeerId(new tl_1.Api.PeerChannel({ channelId: (0, Helpers_1.returnBigInt)(id) })) + ]; + for (const e of this._entities) { + if (ids.includes(e[0])) { + return [e[0], e[1]]; } - return true; } + } + } + getInputEntity(key) { + let exact; + if (typeof key === "object" && !big_integer_1.default.isInstance(key) && key.SUBCLASS_OF_ID) { + if (key.SUBCLASS_OF_ID == 3374092470 || key.SUBCLASS_OF_ID == 3865689926 || key.SUBCLASS_OF_ID == 1089602301) { + return key; + } + return __1.utils.getInputPeer(key); } else { - this.total = 1; - if (this.limit != 0) { - const user = await this.client.getEntity(entity); - if (this.filterEntity(user)) { - user.participant = void 0; - (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(user); + if (typeof key === "object") { + key = __1.utils.getPeerId(key); + exact = true; + } else { + exact = false; + } + } + if (big_integer_1.default.isInstance(key) || typeof key == "bigint" || typeof key == "number") { + key = key.toString(); + } + let result = void 0; + if (typeof key === "string") { + const phone = __1.utils.parsePhone(key); + if (phone) { + result = this.getEntityRowsByPhone(phone); + } else { + const { username, isInvite } = __1.utils.parseUsername(key); + if (username && !isInvite) { + result = this.getEntityRowsByUsername(username); } } - return true; + if (!result) { + const id = __1.utils.parseID(key); + if (id) { + result = this.getEntityRowsById(id, exact); + } + } + if (!result) { + result = this.getEntityRowsByName(key); + } + } + if (result) { + let entityId = result[0]; + const entityHash = (0, big_integer_1.default)(result[1]); + const resolved = __1.utils.resolveId((0, Helpers_1.returnBigInt)(entityId)); + entityId = resolved[0]; + const kind = resolved[1]; + if (kind === tl_1.Api.PeerUser) { + return new tl_1.Api.InputPeerUser({ + userId: entityId, + accessHash: entityHash + }); + } else if (kind === tl_1.Api.PeerChat) { + return new tl_1.Api.InputPeerChat({ chatId: entityId }); + } else if (kind === tl_1.Api.PeerChannel) { + return new tl_1.Api.InputPeerChannel({ + channelId: entityId, + accessHash: entityHash + }); + } + } else { + throw new Error("Could not find input entity with key " + key); + } + throw new Error("Could not find input entity with key " + key); + } + }; + exports2.MemorySession = MemorySession; + } +}); + +// node_modules/telegram/crypto/AuthKey.js +var require_AuthKey = __commonJS({ + "node_modules/telegram/crypto/AuthKey.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AuthKey = void 0; + var Helpers_1 = require_Helpers(); + var extensions_1 = require_extensions(); + var Helpers_2 = require_Helpers(); + var AuthKey = class _AuthKey { + constructor(value, hash2) { + if (!hash2 || !value) { + return; } + this._key = value; + this._hash = hash2; + const reader = new extensions_1.BinaryReader(hash2); + this.auxHash = reader.readLong(false); + reader.read(4); + this.keyId = reader.readLong(false); } - async _loadNextChunk() { - var _a3, _b; - if (!((_a3 = this.requests) === null || _a3 === void 0 ? void 0 : _a3.length)) { - return true; + async setKey(value) { + if (!value) { + this._key = this.auxHash = this.keyId = this._hash = void 0; + return; } - this.requests[0].limit = Math.min(this.limit - this.requests[0].offset, _MAX_PARTICIPANTS_CHUNK_SIZE); - const results = []; - for (const request of this.requests) { - results.push(await this.client.invoke(request)); + if (value instanceof _AuthKey) { + this._key = value._key; + this.auxHash = value.auxHash; + this.keyId = value.keyId; + this._hash = value._hash; + return; } - for (let i = this.requests.length - 1; i >= 0; i--) { - const participants = results[i]; - if (participants instanceof tl_1.Api.channels.ChannelParticipantsNotModified || !participants.users.length) { - this.requests.splice(i, 1); - continue; - } - this.requests[i].offset += participants.participants.length; - const users = /* @__PURE__ */ new Map(); - for (const user of participants.users) { - users.set(user.id.toString(), user); + this._key = value; + this._hash = await (0, Helpers_1.sha1)(this._key); + const reader = new extensions_1.BinaryReader(this._hash); + this.auxHash = reader.readLong(false); + reader.read(4); + this.keyId = reader.readLong(false); + } + async waitForKey() { + while (!this.keyId) { + await (0, Helpers_2.sleep)(20); + } + } + getKey() { + return this._key; + } + // TODO : This doesn't really fit here, it's only used in authentication + /** + * Calculates the new nonce hash based on the current class fields' values + * @param newNonce + * @param number + * @returns {bigInt.BigInteger} + */ + async calcNewNonceHash(newNonce, number) { + if (this.auxHash) { + const nonce = (0, Helpers_1.toSignedLittleBuffer)(newNonce, 32); + const n = Buffer.alloc(1); + n.writeUInt8(number, 0); + const data = Buffer.concat([ + nonce, + Buffer.concat([n, (0, Helpers_1.readBufferFromBigInt)(this.auxHash, 8, true)]) + ]); + const shaData = (await (0, Helpers_1.sha1)(data)).slice(4, 20); + return (0, Helpers_1.readBigIntFromBuffer)(shaData, true, true); + } + throw new Error("Auth key not set"); + } + equals(other) { + var _a; + return other instanceof this.constructor && this._key && Buffer.isBuffer(other.getKey()) && ((_a = other.getKey()) === null || _a === void 0 ? void 0 : _a.equals(this._key)); + } + }; + exports2.AuthKey = AuthKey; + } +}); + +// node_modules/telegram/sessions/StringSession.js +var require_StringSession = __commonJS({ + "node_modules/telegram/sessions/StringSession.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StringSession = void 0; + var Memory_1 = require_Memory(); + var extensions_1 = require_extensions(); + var AuthKey_1 = require_AuthKey(); + var CURRENT_VERSION = "1"; + var StringSession2 = class _StringSession extends Memory_1.MemorySession { + /** + * This session file can be easily saved and loaded as a string. According + * to the initial design, it contains only the data that is necessary for + * successful connection and authentication, so takeout ID is not stored. + + * It is thought to be used where you don't want to create any on-disk + * files but would still like to be able to save and load existing sessions + * by other means. + + * You can use custom `encode` and `decode` functions, if present: + + * `encode` definition must be ``function encode(value: Buffer) -> string:``. + * `decode` definition must be ``function decode(value: string) -> Buffer:``. + * @param session {string|null} + */ + constructor(session2) { + super(); + if (session2) { + if (session2[0] !== CURRENT_VERSION) { + throw new Error("Not a valid string"); } - for (const participant of participants.participants) { - if (!("userId" in participant)) { - continue; - } - const user = users.get(participant.userId.toString()); - if (this.filterEntity && !this.filterEntity(user)) { - continue; + session2 = session2.slice(1); + const r = _StringSession.decode(session2); + const reader = new extensions_1.BinaryReader(r); + this._dcId = reader.read(1).readUInt8(0); + if (session2.length == 352) { + const ip_v4 = reader.read(4); + this._serverAddress = ip_v4[0].toString() + "." + ip_v4[1].toString() + "." + ip_v4[2].toString() + "." + ip_v4[3].toString(); + } else { + const serverAddressLen = reader.read(2).readInt16BE(0); + if (serverAddressLen > 100) { + reader.offset -= 2; + this._serverAddress = reader.read(16).toString("hex").match(/.{1,4}/g).map((val) => val.replace(/^0+/, "")).join(":").replace(/0000\:/g, ":").replace(/:{2,}/g, "::"); + } else { + this._serverAddress = reader.read(serverAddressLen).toString(); } - user.participant = participant; - (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(user); } + this._port = reader.read(2).readInt16BE(0); + this._key = reader.read(-1); } - return void 0; } - [Symbol.asyncIterator]() { - return super[Symbol.asyncIterator](); + /** + * @param x {Buffer} + * @returns {string} + */ + static encode(x) { + return x.toString("base64"); } - }; - exports2._ParticipantsIter = _ParticipantsIter; - var _AdminLogIter = class extends requestIter_1.RequestIter { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + /** + * @param x {string} + * @returns {Buffer} + */ + static decode(x) { + return Buffer.from(x, "base64"); } - async _init(entity, searchArgs, filterArgs) { - let eventsFilter = void 0; - if (filterArgs && Object.values(filterArgs).find((element) => element === true)) { - eventsFilter = new tl_1.Api.ChannelAdminLogEventsFilter(Object.assign({}, filterArgs)); - } - this.entity = await this.client.getInputEntity(entity); - const adminList = []; - if (searchArgs && searchArgs.admins) { - for (const admin of searchArgs.admins) { - adminList.push(await this.client.getInputEntity(admin)); - } + async load() { + if (this._key) { + this._authKey = new AuthKey_1.AuthKey(); + await this._authKey.setKey(this._key); } - this.request = new tl_1.Api.channels.GetAdminLog({ - channel: this.entity, - q: (searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.search) || "", - minId: searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.minId, - maxId: searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.maxId, - limit: 0, - eventsFilter, - admins: adminList || void 0 - }); } - async _loadNextChunk() { - if (!this.request) { - return true; - } - this.request.limit = Math.min(this.left, _MAX_ADMIN_LOG_CHUNK_SIZE); - const r = await this.client.invoke(this.request); - const entities2 = /* @__PURE__ */ new Map(); - for (const entity of [...r.users, ...r.chats]) { - entities2.set(__1.utils.getPeerId(entity), entity); - } - const eventIds = []; - for (const e of r.events) { - eventIds.push(e.id); + save() { + if (!this.authKey || !this.serverAddress || !this.port) { + return ""; } - this.request.maxId = (0, Helpers_1.getMinBigInt)([big_integer_1.default.zero, ...eventIds]); - for (const ev of r.events) { - if (ev.action instanceof tl_1.Api.ChannelAdminLogEventActionEditMessage) { - } + const key = this.authKey.getKey(); + if (!key) { + return ""; } + const dcBuffer = Buffer.from([this.dcId]); + const addressBuffer = Buffer.from(this.serverAddress); + const addressLengthBuffer = Buffer.alloc(2); + addressLengthBuffer.writeInt16BE(addressBuffer.length, 0); + const portBuffer = Buffer.alloc(2); + portBuffer.writeInt16BE(this.port, 0); + return CURRENT_VERSION + _StringSession.encode(Buffer.concat([ + dcBuffer, + addressLengthBuffer, + addressBuffer, + portBuffer, + key + ])); } }; - function iterParticipants(client2, entity, { limit, offset, search, filter: filter3, showTotal = true }) { - return new _ParticipantsIter(client2, limit !== null && limit !== void 0 ? limit : Number.MAX_SAFE_INTEGER, {}, { - entity, - filter: filter3, - offset: offset !== null && offset !== void 0 ? offset : 0, - search, - showTotal - }); - } - async function getParticipants(client2, entity, params) { - const it = client2.iterParticipants(entity, params); - return await it.collect(); - } - async function kickParticipant(client2, entity, participant) { - const peer = await client2.getInputEntity(entity); - const user = await client2.getInputEntity(participant); - let resp; - let request; - const type = __1.helpers._entityType(peer); - if (type === __1.helpers._EntityType.CHAT) { - request = new tl_1.Api.messages.DeleteChatUser({ - chatId: (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(entity)), - userId: (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(participant)) - }); - resp = await client2.invoke(request); - } else if (type === __1.helpers._EntityType.CHANNEL) { - if (user instanceof tl_1.Api.InputPeerSelf) { - request = new tl_1.Api.channels.LeaveChannel({ - channel: peer - }); - resp = await client2.invoke(request); - } else { - request = new tl_1.Api.channels.EditBanned({ - channel: peer, - participant: user, - bannedRights: new tl_1.Api.ChatBannedRights({ - untilDate: 0, - viewMessages: true - }) - }); - resp = await client2.invoke(request); - await (0, Helpers_1.sleep)(500); - await client2.invoke(new tl_1.Api.channels.EditBanned({ - channel: peer, - participant: user, - bannedRights: new tl_1.Api.ChatBannedRights({ untilDate: 0 }) - })); - } - } else { - throw new Error("You must pass either a channel or a chat"); - } - return client2._getResponseMessage(request, resp, entity); - } + exports2.StringSession = StringSession2; } }); -// node_modules/telegram/tl/custom/draft.js -var require_draft = __commonJS({ - "node_modules/telegram/tl/custom/draft.js"(exports2) { - "use strict"; +// node_modules/store2/dist/store2.js +var require_store2 = __commonJS({ + "node_modules/store2/dist/store2.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Draft = void 0; - var Utils_1 = require_Utils(); - var api_1 = require_api(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var Draft = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(client2, entity, draft) { - this._client = client2; - this._peer = (0, Utils_1.getPeer)(entity); - this._entity = entity; - this._inputEntity = entity ? (0, Utils_1.getInputPeer)(entity) : void 0; - if (!draft || !(draft instanceof api_1.Api.DraftMessage)) { - draft = new api_1.Api.DraftMessage({ - message: "", - date: -1 + (function(window2, define2) { + var _ = { + version: "2.14.4", + areas: {}, + apis: {}, + nsdelim: ".", + // utilities + inherit: function(api, o) { + for (var p in api) { + if (!o.hasOwnProperty(p)) { + Object.defineProperty(o, p, Object.getOwnPropertyDescriptor(api, p)); + } + } + return o; + }, + stringify: function(d, fn) { + return d === void 0 || typeof d === "function" ? d + "" : JSON.stringify(d, fn || _.replace); + }, + parse: function(s, fn) { + try { + return JSON.parse(s, fn || _.revive); + } catch (e) { + return s; + } + }, + // extension hooks + fn: function(name, fn) { + _.storeAPI[name] = fn; + for (var api in _.apis) { + _.apis[api][name] = fn; + } + }, + get: function(area, key) { + return area.getItem(key); + }, + set: function(area, key, string) { + area.setItem(key, string); + }, + remove: function(area, key) { + area.removeItem(key); + }, + key: function(area, i) { + return area.key(i); + }, + length: function(area) { + return area.length; + }, + clear: function(area) { + area.clear(); + }, + // core functions + Store: function(id, area, namespace) { + var store2 = _.inherit(_.storeAPI, function(key, data, overwrite) { + if (arguments.length === 0) { + return store2.getAll(); + } + if (typeof data === "function") { + return store2.transact(key, data, overwrite); + } + if (data !== void 0) { + return store2.set(key, data, overwrite); + } + if (typeof key === "string" || typeof key === "number") { + return store2.get(key); + } + if (typeof key === "function") { + return store2.each(key); + } + if (!key) { + return store2.clear(); + } + return store2.setAll(key, data); }); - } - if (!(draft instanceof api_1.Api.DraftMessageEmpty)) { - this.linkPreview = !draft.noWebpage; - this._text = client2.parseMode ? client2.parseMode.unparse(draft.message, draft.entities || []) : draft.message; - this._rawText = draft.message; - this.date = draft.date; - const replyTo = draft.replyTo; - if (replyTo != void 0) { - if ("replyToMsgId" in replyTo) { - this.replyToMsgId = replyTo.replyToMsgId; + store2._id = id; + try { + var testKey = "__store2_test"; + area.setItem(testKey, "ok"); + store2._area = area; + area.removeItem(testKey); + } catch (e) { + store2._area = _.storage("fake"); + } + store2._ns = namespace || ""; + if (!_.areas[id]) { + _.areas[id] = store2._area; + } + if (!_.apis[store2._ns + store2._id]) { + _.apis[store2._ns + store2._id] = store2; + } + return store2; + }, + storeAPI: { + // admin functions + area: function(id, area) { + var store2 = this[id]; + if (!store2 || !store2.area) { + store2 = _.Store(id, area, this._ns); + if (!this[id]) { + this[id] = store2; + } + } + return store2; + }, + namespace: function(namespace, singleArea, delim) { + delim = delim || this._delim || _.nsdelim; + if (!namespace) { + return this._ns ? this._ns.substring(0, this._ns.length - delim.length) : ""; + } + var ns = namespace, store2 = this[ns]; + if (!store2 || !store2.namespace) { + store2 = _.Store(this._id, this._area, this._ns + ns + delim); + store2._delim = delim; + if (!this[ns]) { + this[ns] = store2; + } + if (!singleArea) { + for (var name in _.areas) { + store2.area(name, _.areas[name]); + } + } + } + return store2; + }, + isFake: function(force) { + if (force) { + this._real = this._area; + this._area = _.storage("fake"); + } else if (force === false) { + this._area = this._real || this._area; + } + return this._area.name === "fake"; + }, + toString: function() { + return "store" + (this._ns ? "." + this.namespace() : "") + "[" + this._id + "]"; + }, + // storage functions + has: function(key) { + if (this._area.has) { + return this._area.has(this._in(key)); + } + return !!(this._in(key) in this._area); + }, + size: function() { + return this.keys().length; + }, + each: function(fn, fill) { + for (var i = 0, m = _.length(this._area); i < m; i++) { + var key = this._out(_.key(this._area, i)); + if (key !== void 0) { + if (fn.call(this, key, this.get(key), fill) === false) { + break; + } + } + if (m > _.length(this._area)) { + m--; + i--; + } + } + return fill || this; + }, + keys: function(fillList) { + return this.each(function(k, v, list) { + list.push(k); + }, fillList || []); + }, + get: function(key, alt) { + var s = _.get(this._area, this._in(key)), fn; + if (typeof alt === "function") { + fn = alt; + alt = null; + } + return s !== null ? _.parse(s, fn) : alt != null ? alt : s; + }, + getAll: function(fillObj) { + return this.each(function(k, v, all) { + all[k] = v; + }, fillObj || {}); + }, + transact: function(key, fn, alt) { + var val = this.get(key, alt), ret = fn(val); + this.set(key, ret === void 0 ? val : ret); + return this; + }, + set: function(key, data, overwrite) { + var d = this.get(key), replacer; + if (d != null && overwrite === false) { + return data; + } + if (typeof overwrite === "function") { + replacer = overwrite; + overwrite = void 0; + } + return _.set(this._area, this._in(key), _.stringify(data, replacer), overwrite) || d; + }, + setAll: function(data, overwrite) { + var changed, val; + for (var key in data) { + val = data[key]; + if (this.set(key, val, overwrite) !== val) { + changed = true; + } + } + return changed; + }, + add: function(key, data, replacer) { + var d = this.get(key); + if (d instanceof Array) { + data = d.concat(data); + } else if (d !== null) { + var type = typeof d; + if (type === typeof data && type === "object") { + for (var k in data) { + d[k] = data[k]; + } + data = d; + } else { + data = d + data; + } + } + _.set(this._area, this._in(key), _.stringify(data, replacer)); + return data; + }, + remove: function(key, alt) { + var d = this.get(key, alt); + _.remove(this._area, this._in(key)); + return d; + }, + clear: function() { + if (!this._ns) { + _.clear(this._area); + } else { + this.each(function(k) { + _.remove(this._area, this._in(k)); + }, 1); + } + return this; + }, + clearAll: function() { + var area = this._area; + for (var id in _.areas) { + if (_.areas.hasOwnProperty(id)) { + this._area = _.areas[id]; + this.clear(); + } + } + this._area = area; + return this; + }, + // internal use functions + _in: function(k) { + if (typeof k !== "string") { + k = _.stringify(k); + } + return this._ns ? this._ns + k : k; + }, + _out: function(k) { + return this._ns ? k && k.indexOf(this._ns) === 0 ? k.substring(this._ns.length) : void 0 : ( + // so each() knows to skip it + k + ); + } + }, + // end _.storeAPI + storage: function(name) { + return _.inherit(_.storageAPI, { items: {}, name }); + }, + storageAPI: { + length: 0, + has: function(k) { + return this.items.hasOwnProperty(k); + }, + key: function(i) { + var c = 0; + for (var k in this.items) { + if (this.has(k) && i === c++) { + return k; + } + } + }, + setItem: function(k, v) { + if (!this.has(k)) { + this.length++; + } + this.items[k] = v; + }, + removeItem: function(k) { + if (this.has(k)) { + delete this.items[k]; + this.length--; + } + }, + getItem: function(k) { + return this.has(k) ? this.items[k] : null; + }, + clear: function() { + for (var k in this.items) { + this.removeItem(k); } } } - } - get entity() { - return this._entity; - } - get inputEntity() { - if (!this._inputEntity) { - this._inputEntity = this._client._entityCache.get(this._peer); - } - return this._inputEntity; - } - }; - exports2.Draft = Draft; - } -}); - -// node_modules/telegram/tl/custom/dialog.js -var require_dialog = __commonJS({ - "node_modules/telegram/tl/custom/dialog.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Dialog = void 0; - var api_1 = require_api(); - var Utils_1 = require_Utils(); - var draft_1 = require_draft(); - var Helpers_1 = require_Helpers(); - var inspect_1 = require_inspect(); - var Dialog = class { - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); - } - constructor(client2, dialog, entities2, message) { - this._client = client2; - this.dialog = dialog; - this.pinned = !!dialog.pinned; - this.folderId = dialog.folderId; - this.archived = dialog.folderId != void 0; - this.message = message; - this.date = this.message.date; - this.entity = entities2.get((0, Utils_1.getPeerId)(dialog.peer)); - this.inputEntity = (0, Utils_1.getInputPeer)(this.entity); - if (this.entity) { - this.id = (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(this.entity)); - this.name = this.title = (0, Utils_1.getDisplayName)(this.entity); + // end _.storageAPI + }; + var store = ( + // safely set this up (throws error in IE10/32bit mode for local files) + _.Store("local", (function() { + try { + return localStorage; + } catch (e) { + } + })()) + ); + store.local = store; + store._ = _; + store.area("session", (function() { + try { + return sessionStorage; + } catch (e) { } - this.unreadCount = dialog.unreadCount; - this.unreadMentionsCount = dialog.unreadMentionsCount; - if (!this.entity) { - throw new Error("Entity not found for dialog"); + })()); + store.area("page", _.storage("page")); + if (typeof define2 === "function" && define2.amd !== void 0) { + define2("store2", [], function() { + return store; + }); + } else if (typeof module2 !== "undefined" && module2.exports) { + module2.exports = store; + } else { + if (window2.store) { + _.conflict = window2.store; } - this.draft = new draft_1.Draft(client2, this.entity, this.dialog.draft); - this.isUser = this.entity instanceof api_1.Api.User; - this.isGroup = !!(this.entity instanceof api_1.Api.Chat || this.entity instanceof api_1.Api.ChatForbidden || this.entity instanceof api_1.Api.Channel && this.entity.megagroup); - this.isChannel = this.entity instanceof api_1.Api.Channel; + window2.store = store; } - }; - exports2.Dialog = Dialog; + })(exports2, exports2 && exports2.define); } }); -// node_modules/telegram/client/dialogs.js -var require_dialogs = __commonJS({ - "node_modules/telegram/client/dialogs.js"(exports2) { - "use strict"; +// node_modules/graceful-fs/polyfills.js +var require_polyfills = __commonJS({ + "node_modules/graceful-fs/polyfills.js"(exports2, module2) { init_define_import_meta_env(); - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; + var constants = require("constants"); + var origCwd = process.cwd; + var cwd = null; + var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; + process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process); + return cwd; }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2._DialogsIter = void 0; - exports2.iterDialogs = iterDialogs; - exports2.getDialogs = getDialogs; - var tl_1 = require_tl(); - var requestIter_1 = require_requestIter(); - var index_1 = require_telegram(); - var dialog_1 = require_dialog(); - var big_integer_1 = __importDefault2(require_BigInteger()); - var Logger_1 = require_Logger(); - var _MAX_CHUNK_SIZE = 100; - function _dialogMessageKey(peer, messageId) { - return "" + [ - peer instanceof tl_1.Api.PeerChannel ? peer.channelId : void 0, - messageId - ]; + try { + process.cwd(); + } catch (er) { } - var _DialogsIter = class extends requestIter_1.RequestIter { - async _init({ offsetDate, offsetId, offsetPeer, ignorePinned, ignoreMigrated, folder }) { - this.request = new tl_1.Api.messages.GetDialogs({ - offsetDate, - offsetId, - offsetPeer, - limit: 1, - hash: big_integer_1.default.zero, - excludePinned: ignorePinned, - folderId: folder - }); - if (this.limit <= 0) { - const dialogs = await this.client.invoke(this.request); - if ("count" in dialogs) { - this.total = dialogs.count; - } else { - this.total = dialogs.dialogs.length; - } - return true; - } - this.seen = /* @__PURE__ */ new Set(); - this.offsetDate = offsetDate; - this.ignoreMigrated = ignoreMigrated; + if (typeof process.chdir === "function") { + chdir = process.chdir; + process.chdir = function(d) { + cwd = null; + chdir.call(process, d); + }; + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir); + } + var chdir; + module2.exports = patch; + function patch(fs) { + if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs); } - [Symbol.asyncIterator]() { - return super[Symbol.asyncIterator](); + if (!fs.lutimes) { + patchLutimes(fs); } - async _loadNextChunk() { - var _a3; - if (!this.request || !this.seen || !this.buffer) { - return; - } - this.request.limit = Math.min(this.left, _MAX_CHUNK_SIZE); - const r = await this.client.invoke(this.request); - if (r instanceof tl_1.Api.messages.DialogsNotModified) { - return; - } - if ("count" in r) { - this.total = r.count; - } else { - this.total = r.dialogs.length; - } - const entities2 = /* @__PURE__ */ new Map(); - const messages = /* @__PURE__ */ new Map(); - for (const entity of [...r.users, ...r.chats]) { - if (entity instanceof tl_1.Api.UserEmpty || entity instanceof tl_1.Api.ChatEmpty) { - continue; + fs.chown = chownFix(fs.chown); + fs.fchown = chownFix(fs.fchown); + fs.lchown = chownFix(fs.lchown); + fs.chmod = chmodFix(fs.chmod); + fs.fchmod = chmodFix(fs.fchmod); + fs.lchmod = chmodFix(fs.lchmod); + fs.chownSync = chownFixSync(fs.chownSync); + fs.fchownSync = chownFixSync(fs.fchownSync); + fs.lchownSync = chownFixSync(fs.lchownSync); + fs.chmodSync = chmodFixSync(fs.chmodSync); + fs.fchmodSync = chmodFixSync(fs.fchmodSync); + fs.lchmodSync = chmodFixSync(fs.lchmodSync); + fs.stat = statFix(fs.stat); + fs.fstat = statFix(fs.fstat); + fs.lstat = statFix(fs.lstat); + fs.statSync = statFixSync(fs.statSync); + fs.fstatSync = statFixSync(fs.fstatSync); + fs.lstatSync = statFixSync(fs.lstatSync); + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function(path2, mode, cb) { + if (cb) process.nextTick(cb); + }; + fs.lchmodSync = function() { + }; + } + if (fs.chown && !fs.lchown) { + fs.lchown = function(path2, uid, gid, cb) { + if (cb) process.nextTick(cb); + }; + fs.lchownSync = function() { + }; + } + if (platform === "win32") { + fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) { + function rename(from, to, cb) { + var start = Date.now(); + var backoff = 0; + fs$rename(from, to, function CB(er) { + if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { + setTimeout(function() { + fs.stat(to, function(stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er); + }); + }, backoff); + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er); + }); } - entities2.set(index_1.utils.getPeerId(entity), entity); - } - for (const m of r.messages) { - let message = m; - try { - if (message && "_finishInit" in message) { - message._finishInit(this.client, entities2, void 0); - } - } catch (e) { - console.log("msg", message); - this.client._log.error("Got error while trying to finish init message with id " + m.id); - if (this.client._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); - } - if (this.client._errorHandler) { - await this.client._errorHandler(e); - } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); + return rename; + })(fs.rename); + } + fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) { + function read(fd, buffer, offset, length, position, callback_) { + var callback; + if (callback_ && typeof callback_ === "function") { + var eagCounter = 0; + callback = function(er, _, __) { + if (er && er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + return fs$read.call(fs, fd, buffer, offset, length, position, callback); + } + callback_.apply(this, arguments); + }; } - messages.set(_dialogMessageKey(message.peerId, message.id), message); + return fs$read.call(fs, fd, buffer, offset, length, position, callback); } - for (const d of r.dialogs) { - if (d instanceof tl_1.Api.DialogFolder) { - continue; - } - const message = messages.get(_dialogMessageKey(d.peer, d.topMessage)); - if (this.offsetDate != void 0) { - const date = message === null || message === void 0 ? void 0 : message.date; - if (date == void 0 || date > this.offsetDate) { - continue; + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); + return read; + })(fs.read); + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) { + return function(fd, buffer, offset, length, position) { + var eagCounter = 0; + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position); + } catch (er) { + if (er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + continue; + } + throw er; } } - const peerId = index_1.utils.getPeerId(d.peer); - if (!this.seen.has(peerId)) { - this.seen.add(peerId); - if (!entities2.has(peerId)) { - continue; + }; + })(fs.readSync); + function patchLchmod(fs2) { + fs2.lchmod = function(path2, mode, callback) { + fs2.open( + path2, + constants.O_WRONLY | constants.O_SYMLINK, + mode, + function(err, fd) { + if (err) { + if (callback) callback(err); + return; + } + fs2.fchmod(fd, mode, function(err2) { + fs2.close(fd, function(err22) { + if (callback) callback(err2 || err22); + }); + }); } - const cd = new dialog_1.Dialog(this.client, d, entities2, message); - if (!this.ignoreMigrated || cd.entity != void 0 && "migratedTo" in cd.entity) { - this.buffer.push(cd); + ); + }; + fs2.lchmodSync = function(path2, mode) { + var fd = fs2.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode); + var threw = true; + var ret; + try { + ret = fs2.fchmodSync(fd, mode); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); } } - } - if (r.dialogs.length < this.request.limit || !(r instanceof tl_1.Api.messages.DialogsSlice)) { - return true; - } - let lastMessage; - for (let dialog of r.dialogs.reverse()) { - lastMessage = messages.get(_dialogMessageKey(dialog.peer, dialog.topMessage)); - if (lastMessage) { - break; - } - } - this.request.excludePinned = true; - this.request.offsetId = lastMessage ? lastMessage.id : 0; - this.request.offsetDate = lastMessage ? lastMessage.date : 0; - this.request.offsetPeer = (_a3 = this.buffer[this.buffer.length - 1]) === null || _a3 === void 0 ? void 0 : _a3.inputEntity; - } - }; - exports2._DialogsIter = _DialogsIter; - function iterDialogs(client2, { limit = void 0, offsetDate = void 0, offsetId = 0, offsetPeer = new tl_1.Api.InputPeerEmpty(), ignorePinned = false, ignoreMigrated = false, folder = void 0, archived = void 0 }) { - if (archived != void 0) { - folder = archived ? 1 : 0; - } - return new _DialogsIter(client2, limit, {}, { - offsetDate, - offsetId, - offsetPeer, - ignorePinned, - ignoreMigrated, - folder - }); - } - async function getDialogs(client2, params) { - return await client2.iterDialogs(params).collect(); - } - } -}); - -// node_modules/telegram/client/2fa.js -var require_fa = __commonJS({ - "node_modules/telegram/client/2fa.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.updateTwoFaSettings = updateTwoFaSettings; - var Helpers_1 = require_Helpers(); - var Password_1 = require_Password(); - var tl_1 = require_tl(); - var index_1 = require_telegram(); - async function updateTwoFaSettings(client2, { isCheckPassword, currentPassword, newPassword, hint = "", email, emailCodeCallback, onEmailCodeError }) { - if (!newPassword && !currentPassword) { - throw new Error("Neither `currentPassword` nor `newPassword` is present"); - } - if (email && !(emailCodeCallback && onEmailCodeError)) { - throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`"); + return ret; + }; } - const pwd = await client2.invoke(new tl_1.Api.account.GetPassword()); - if (!(pwd.newAlgo instanceof tl_1.Api.PasswordKdfAlgoUnknown)) { - pwd.newAlgo.salt1 = Buffer.concat([ - pwd.newAlgo.salt1, - (0, Helpers_1.generateRandomBytes)(32) - ]); + function patchLutimes(fs2) { + if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) { + fs2.lutimes = function(path2, at, mt, cb) { + fs2.open(path2, constants.O_SYMLINK, function(er, fd) { + if (er) { + if (cb) cb(er); + return; + } + fs2.futimes(fd, at, mt, function(er2) { + fs2.close(fd, function(er22) { + if (cb) cb(er2 || er22); + }); + }); + }); + }; + fs2.lutimesSync = function(path2, at, mt) { + var fd = fs2.openSync(path2, constants.O_SYMLINK); + var ret; + var threw = true; + try { + ret = fs2.futimesSync(fd, at, mt); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret; + }; + } else if (fs2.futimes) { + fs2.lutimes = function(_a, _b, _c, cb) { + if (cb) process.nextTick(cb); + }; + fs2.lutimesSync = function() { + }; + } } - if (!pwd.hasPassword && currentPassword) { - currentPassword = void 0; + function chmodFix(orig) { + if (!orig) return orig; + return function(target, mode, cb) { + return orig.call(fs, target, mode, function(er) { + if (chownErOk(er)) er = null; + if (cb) cb.apply(this, arguments); + }); + }; } - const password = currentPassword ? await (0, Password_1.computeCheck)(pwd, currentPassword) : new tl_1.Api.InputCheckPasswordEmpty(); - if (isCheckPassword) { - await client2.invoke(new tl_1.Api.auth.CheckPassword({ password })); - return; + function chmodFixSync(orig) { + if (!orig) return orig; + return function(target, mode) { + try { + return orig.call(fs, target, mode); + } catch (er) { + if (!chownErOk(er)) throw er; + } + }; } - if (pwd.newAlgo instanceof tl_1.Api.PasswordKdfAlgoUnknown) { - throw new Error("Unknown password encryption method"); + function chownFix(orig) { + if (!orig) return orig; + return function(target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function(er) { + if (chownErOk(er)) er = null; + if (cb) cb.apply(this, arguments); + }); + }; } - try { - await client2.invoke(new tl_1.Api.account.UpdatePasswordSettings({ - password, - newSettings: new tl_1.Api.account.PasswordInputSettings({ - newAlgo: pwd.newAlgo, - newPasswordHash: newPassword ? await (0, Password_1.computeDigest)(pwd.newAlgo, newPassword) : Buffer.alloc(0), - hint, - email, - // not explained what it does and it seems to always be set to empty in tdesktop - newSecureSettings: void 0 - }) - })); - } catch (e) { - if (e instanceof index_1.errors.EmailUnconfirmedError) { - while (true) { - try { - const code = await emailCodeCallback(e.codeLength); - if (!code) { - throw new Error("Code is empty"); - } - await client2.invoke(new tl_1.Api.account.ConfirmPasswordEmail({ code })); - break; - } catch (err) { - onEmailCodeError(err); + function chownFixSync(orig) { + if (!orig) return orig; + return function(target, uid, gid) { + try { + return orig.call(fs, target, uid, gid); + } catch (er) { + if (!chownErOk(er)) throw er; + } + }; + } + function statFix(orig) { + if (!orig) return orig; + return function(target, options, cb) { + if (typeof options === "function") { + cb = options; + options = null; + } + function callback(er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 4294967296; + if (stats.gid < 0) stats.gid += 4294967296; } + if (cb) cb.apply(this, arguments); } - } else { - throw e; + return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback); + }; + } + function statFixSync(orig) { + if (!orig) return orig; + return function(target, options) { + var stats = options ? orig.call(fs, target, options) : orig.call(fs, target); + if (stats) { + if (stats.uid < 0) stats.uid += 4294967296; + if (stats.gid < 0) stats.gid += 4294967296; + } + return stats; + }; + } + function chownErOk(er) { + if (!er) + return true; + if (er.code === "ENOSYS") + return true; + var nonroot = !process.getuid || process.getuid() !== 0; + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true; } + return false; } } } }); -// node_modules/telegram/events/NewMessage.js -var require_NewMessage = __commonJS({ - "node_modules/telegram/events/NewMessage.js"(exports2) { - "use strict"; +// node_modules/graceful-fs/legacy-streams.js +var require_legacy_streams = __commonJS({ + "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.NewMessageEvent = exports2.NewMessage = void 0; - var common_1 = require_common3(); - var tl_1 = require_tl(); - var Logger_1 = require_Logger(); - var NewMessage = class extends common_1.EventBuilder { - constructor(newMessageParams = {}) { - let { chats, func, incoming, outgoing, fromUsers, forwards, pattern, blacklistChats = false } = newMessageParams; - if (incoming && outgoing) { - incoming = outgoing = void 0; - } else if (incoming != void 0 && outgoing == void 0) { - outgoing = !incoming; - } else if (outgoing != void 0 && incoming == void 0) { - incoming = !outgoing; - } else if (outgoing == false && incoming == false) { - throw new Error("Don't create an event handler if you don't want neither incoming nor outgoing!"); + var Stream = require("stream").Stream; + module2.exports = legacy; + function legacy(fs) { + return { + ReadStream, + WriteStream + }; + function ReadStream(path2, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path2, options); + Stream.call(this); + var self2 = this; + this.path = path2; + this.fd = null; + this.readable = true; + this.paused = false; + this.flags = "r"; + this.mode = 438; + this.bufferSize = 64 * 1024; + options = options || {}; + var keys = Object.keys(options); + for (var index2 = 0, length = keys.length; index2 < length; index2++) { + var key = keys[index2]; + this[key] = options[key]; } - super({ chats, blacklistChats, func }); - this.incoming = incoming; - this.outgoing = outgoing; - this.fromUsers = fromUsers; - this.forwards = forwards; - this.pattern = pattern; - this._noCheck = [ - incoming, - outgoing, - chats, - pattern, - fromUsers, - forwards, - func - ].every((v) => v == void 0); - } - async _resolve(client2) { - await super._resolve(client2); - this.fromUsers = await (0, common_1._intoIdSet)(client2, this.fromUsers); - } - build(update2, callback, selfId) { - if (update2 instanceof tl_1.Api.UpdateNewMessage || update2 instanceof tl_1.Api.UpdateNewChannelMessage) { - if (!(update2.message instanceof tl_1.Api.Message)) { - return void 0; + if (this.encoding) this.setEncoding(this.encoding); + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); } - const event = new NewMessageEvent(update2.message, update2); - this.addAttributes(event); - return event; - } else if (update2 instanceof tl_1.Api.UpdateShortMessage) { - return new NewMessageEvent(new tl_1.Api.Message({ - out: update2.out, - mentioned: update2.mentioned, - mediaUnread: update2.mediaUnread, - silent: update2.silent, - id: update2.id, - peerId: new tl_1.Api.PeerUser({ userId: update2.userId }), - fromId: new tl_1.Api.PeerUser({ - userId: update2.out ? selfId : update2.userId - }), - message: update2.message, - date: update2.date, - fwdFrom: update2.fwdFrom, - viaBotId: update2.viaBotId, - replyTo: update2.replyTo, - entities: update2.entities, - ttlPeriod: update2.ttlPeriod - }), update2); - } else if (update2 instanceof tl_1.Api.UpdateShortChatMessage) { - return new NewMessageEvent(new tl_1.Api.Message({ - out: update2.out, - mentioned: update2.mentioned, - mediaUnread: update2.mediaUnread, - silent: update2.silent, - id: update2.id, - peerId: new tl_1.Api.PeerChat({ chatId: update2.chatId }), - fromId: new tl_1.Api.PeerUser({ - userId: update2.out ? selfId : update2.fromId - }), - message: update2.message, - date: update2.date, - fwdFrom: update2.fwdFrom, - viaBotId: update2.viaBotId, - replyTo: update2.replyTo, - entities: update2.entities, - ttlPeriod: update2.ttlPeriod - }), update2); - } - } - filter(event) { - var _a3; - if (this._noCheck) { - return event; - } - if (this.incoming && event.message.out) { - return; - } - if (this.outgoing && !event.message.out) { - return; - } - if (this.forwards != void 0) { - if (this.forwards != !!event.message.fwdFrom) { - return; + if (this.end === void 0) { + this.end = Infinity; + } else if ("number" !== typeof this.end) { + throw TypeError("end must be a Number"); } - } - if (this.fromUsers != void 0) { - if (!event.message.senderId || !this.fromUsers.includes(event.message.senderId.toString())) { - return; + if (this.start > this.end) { + throw new Error("start must be <= end"); } + this.pos = this.start; } - if (this.pattern) { - const match = (_a3 = event.message.message) === null || _a3 === void 0 ? void 0 : _a3.match(this.pattern); - if (!match) { + if (this.fd !== null) { + process.nextTick(function() { + self2._read(); + }); + return; + } + fs.open(this.path, this.flags, this.mode, function(err, fd) { + if (err) { + self2.emit("error", err); + self2.readable = false; return; } - event.message.patternMatch = match; - } - return super.filter(event); - } - addAttributes(update2) { - } - }; - exports2.NewMessage = NewMessage; - var NewMessageEvent = class extends common_1.EventCommon { - constructor(message, originalUpdate) { - super({ - msgId: message.id, - chatPeer: message.peerId, - broadcast: message.post + self2.fd = fd; + self2.emit("open", fd); + self2._read(); }); - this.originalUpdate = originalUpdate; - this.message = message; } - _setClient(client2) { - super._setClient(client2); - const m = this.message; - try { - m._finishInit(client2, this.originalUpdate._entities || /* @__PURE__ */ new Map(), void 0); - } catch (e) { - client2._log.error("Got error while trying to finish init message with id " + m.id); - if (client2._errorHandler) { - client2._errorHandler(e); + function WriteStream(path2, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path2, options); + Stream.call(this); + this.path = path2; + this.fd = null; + this.writable = true; + this.flags = "w"; + this.encoding = "binary"; + this.mode = 438; + this.bytesWritten = 0; + options = options || {}; + var keys = Object.keys(options); + for (var index2 = 0, length = keys.length; index2 < length; index2++) { + var key = keys[index2]; + this[key] = options[key]; + } + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); } - if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); + if (this.start < 0) { + throw new Error("start must be >= zero"); } + this.pos = this.start; + } + this.busy = false; + this._queue = []; + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); + this.flush(); } } - }; - exports2.NewMessageEvent = NewMessageEvent; + } } }); -// node_modules/telegram/events/index.js -var require_events = __commonJS({ - "node_modules/telegram/events/index.js"(exports2) { +// node_modules/graceful-fs/clone.js +var require_clone2 = __commonJS({ + "node_modules/graceful-fs/clone.js"(exports2, module2) { "use strict"; init_define_import_meta_env(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.NewMessageEvent = exports2.NewMessage = exports2.Raw = void 0; - var Raw_1 = require_Raw(); - Object.defineProperty(exports2, "Raw", { enumerable: true, get: function() { - return Raw_1.Raw; - } }); - var NewMessage_1 = require_NewMessage(); - Object.defineProperty(exports2, "NewMessage", { enumerable: true, get: function() { - return NewMessage_1.NewMessage; - } }); - Object.defineProperty(exports2, "NewMessageEvent", { enumerable: true, get: function() { - return NewMessage_1.NewMessageEvent; - } }); + module2.exports = clone; + var getPrototypeOf = Object.getPrototypeOf || function(obj) { + return obj.__proto__; + }; + function clone(obj) { + if (obj === null || typeof obj !== "object") + return obj; + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) }; + else + var copy = /* @__PURE__ */ Object.create(null); + Object.getOwnPropertyNames(obj).forEach(function(key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); + }); + return copy; + } } }); -// node_modules/telegram/client/TelegramClient.js -var require_TelegramClient = __commonJS({ - "node_modules/telegram/client/TelegramClient.js"(exports2) { - "use strict"; +// node_modules/graceful-fs/graceful-fs.js +var require_graceful_fs = __commonJS({ + "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + var fs = require("fs"); + var polyfills = require_polyfills(); + var legacy = require_legacy_streams(); + var clone = require_clone2(); + var util = require("util"); + var gracefulQueue; + var previousSymbol; + if (typeof Symbol === "function" && typeof Symbol.for === "function") { + gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue"); + previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous"); + } else { + gracefulQueue = "___graceful-fs.queue"; + previousSymbol = "___graceful-fs.previous"; + } + function noop() { + } + function publishQueue(context2, queue2) { + Object.defineProperty(context2, gracefulQueue, { + get: function() { + return queue2; + } + }); + } + var debug = noop; + if (util.debuglog) + debug = util.debuglog("gfs4"); + else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) + debug = function() { + var m = util.format.apply(util, arguments); + m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); + console.error(m); + }; + if (!fs[gracefulQueue]) { + queue = global[gracefulQueue] || []; + publishQueue(fs, queue); + fs.close = (function(fs$close) { + function close(fd, cb) { + return fs$close.call(fs, fd, function(err) { + if (!err) { + resetQueue(); + } + if (typeof cb === "function") + cb.apply(this, arguments); + }); + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }); + return close; + })(fs.close); + fs.closeSync = (function(fs$closeSync) { + function closeSync(fd) { + fs$closeSync.apply(fs, arguments); + resetQueue(); + } + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }); + return closeSync; + })(fs.closeSync); + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { + process.on("exit", function() { + debug(fs[gracefulQueue]); + require("assert").equal(fs[gracefulQueue].length, 0); + }); } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + var queue; + if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); + } + module2.exports = patch(clone(fs)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module2.exports = patch(fs); + fs.__patched = true; + } + function patch(fs2) { + polyfills(fs2); + fs2.gracefulify = patch; + fs2.createReadStream = createReadStream; + fs2.createWriteStream = createWriteStream; + var fs$readFile = fs2.readFile; + fs2.readFile = readFile; + function readFile(path2, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$readFile(path2, options, cb); + function go$readFile(path3, options2, cb2, startTime) { + return fs$readFile(path3, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } } - __setModuleDefault2(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TelegramClient = void 0; - var telegramBaseClient_1 = require_telegramBaseClient(); - var authMethods = __importStar2(require_auth()); - var botMethods = __importStar2(require_bots()); - var buttonsMethods = __importStar2(require_buttons()); - var downloadMethods = __importStar2(require_downloads()); - var parseMethods = __importStar2(require_messageParse()); - var messageMethods = __importStar2(require_messages2()); - var updateMethods = __importStar2(require_updates()); - var uploadMethods = __importStar2(require_uploads()); - var userMethods = __importStar2(require_users()); - var chatMethods = __importStar2(require_chats()); - var dialogMethods = __importStar2(require_dialogs()); - var twoFA = __importStar2(require_fa()); - var tl_1 = require_tl(); - var Utils_1 = require_Utils(); - var network_1 = require_network(); - var AllTLObjects_1 = require_AllTLObjects(); - var Helpers_1 = require_Helpers(); - var updates_1 = require_updates(); - var Logger_1 = require_Logger(); - var inspect_1 = require_inspect(); - var platform_1 = require_platform(); - var TelegramClient2 = class extends telegramBaseClient_1.TelegramBaseClient { - /** - * @param session - a session to be used to save the connection and auth key to. This can be a custom session that inherits MemorySession. - * @param apiId - The API ID you obtained from https://my.telegram.org. - * @param apiHash - The API hash you obtained from https://my.telegram.org. - * @param clientParams - see {@link TelegramClientParams} - */ - constructor(session2, apiId, apiHash, clientParams) { - super(session2, apiId, apiHash, clientParams); + var fs$writeFile = fs2.writeFile; + fs2.writeFile = writeFile; + function writeFile(path2, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$writeFile(path2, data, options, cb); + function go$writeFile(path3, data2, options2, cb2, startTime) { + return fs$writeFile(path3, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } } - // region auth - /** - * Used to handle all aspects of connecting to telegram.<br/> - * This method will connect to the telegram servers and check if the user is already logged in.<br/> - * in the case of a new connection this will sign in if the phone already exists or sign up otherwise<br/> - * By using this method you are **agreeing to Telegram's Terms of Service** https://core.telegram.org/api/terms.<br/> - * this method also calls {@link getMe} to tell telegram that we want to receive updates.<br/> - * @param authParams - see UserAuthParams and BotAuthParams - * @return nothing - * @example - * ```ts - * // this example assumes you've installed and imported the input package. npm i input. - * // This package uses CLI to receive input from the user. you can use your own callback function. - * import { TelegramClient } from "telegram"; - * import { StringSession } from "telegram/sessions"; - * - * const client = new TelegramClient(new StringSession(''), apiId, apiHash, {}); - * // logging in as a bot account - * await client.start(botToken="123456:abcdfgh123456789); - * // logging in as a user account - * await client.start({ - * phoneNumber: async () => await input.text("number ?"), - * password: async () => await input.text("password?"), - * phoneCode: async () => await input.text("Code ?"), - * onError: (err) => console.log(err), - * }); - * >Number ? +1234567897 - * >Code ? 12345 - * >password ? 111111 - * Logged in as user... - * - * You can now use the client instance to call other api requests. - */ - start(authParams) { - return authMethods.start(this, authParams); + var fs$appendFile = fs2.appendFile; + if (fs$appendFile) + fs2.appendFile = appendFile; + function appendFile(path2, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$appendFile(path2, data, options, cb); + function go$appendFile(path3, data2, options2, cb2, startTime) { + return fs$appendFile(path3, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } } - /** - * Checks whether the current client is authorized or not. (logged in as a user) - * @example - * ```ts - * await client.connect(); - * if (await client.checkAuthorization()){ - * console.log("I am logged in!"); - * }else{ - * console.log("I am connected to telegram servers but not logged in with any account/bot"); - * } - * ``` - * @return boolean (true of authorized else false) - */ - checkAuthorization() { - return authMethods.checkAuthorization(this); + var fs$copyFile = fs2.copyFile; + if (fs$copyFile) + fs2.copyFile = copyFile; + function copyFile(src, dest, flags, cb) { + if (typeof flags === "function") { + cb = flags; + flags = 0; + } + return go$copyFile(src, dest, flags, cb); + function go$copyFile(src2, dest2, flags2, cb2, startTime) { + return fs$copyFile(src2, dest2, flags2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } } - /** - * Logs in as a user. Should only be used when not already logged in.<br/> - * This method will send a code when needed.<br/> - * This will also sign up if needed. - * @example - * ```ts - * await client.connect(); - * // we should only use this when we are not already authorized. - * // This function is very similar to `client.start` - * // The minor difference that start checks if already authorized and supports bots as well. - * if (!await client.checkAuthorization()){ - * const phoneNumber = "+123456789"; - * await client.signIn({ - * apiId:132456, - * apiHash:"132456", - * },{ - * phoneNumber: async () => await input.text("number ?"), - * password: async () => await input.text("password?"), - * phoneCode: async () => await input.text("Code ?"), - * onError: (err) => console.log(err), - * }) - * } - * ``` - * @param apiCredentials - credentials to be used. - * @param authParams - user auth params. - */ - signInUser(apiCredentials, authParams) { - return authMethods.signInUser(this, apiCredentials, authParams); + var fs$readdir = fs2.readdir; + fs2.readdir = readdir; + var noReaddirOptionVersions = /^v[0-5]\./; + function readdir(path2, options, cb) { + if (typeof options === "function") + cb = options, options = null; + var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) { + return fs$readdir(path3, fs$readdirCallback( + path3, + options2, + cb2, + startTime + )); + } : function go$readdir2(path3, options2, cb2, startTime) { + return fs$readdir(path3, options2, fs$readdirCallback( + path3, + options2, + cb2, + startTime + )); + }; + return go$readdir(path2, options, cb); + function fs$readdirCallback(path3, options2, cb2, startTime) { + return function(err, files) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([ + go$readdir, + [path3, options2, cb2], + err, + startTime || Date.now(), + Date.now() + ]); + else { + if (files && files.sort) + files.sort(); + if (typeof cb2 === "function") + cb2.call(this, err, files); + } + }; + } } - /** - * logs the user using a QR code to be scanned.<br/> - * this function generates the QR code that needs to be scanned by mobile. - * @example - * '''ts - * await client.connect(); - * const user = await client.signInUserWithQrCode({ apiId, apiHash }, - * { - * onError: async function(p1: Error) { - * console.log("error", p1); - * // true = stop the authentication processes - * return true; - * }, - * qrCode: async (code) => { - * console.log("Convert the next string to a QR code and scan it"); - * console.log( - * `tg://login?token=${code.token.toString("base64url")}` - * ); - * }, - * password: async (hint) => { - * // password if needed - * return "1111"; - * } - * } - * ); - * console.log("user is", user); - * - * ''' - * @param apiCredentials - credentials to be used. - * @param authParams - user auth params. - */ - signInUserWithQrCode(apiCredentials, authParams) { - return authMethods.signInUserWithQrCode(this, apiCredentials, authParams); + if (process.version.substr(0, 4) === "v0.8") { + var legStreams = legacy(fs2); + ReadStream = legStreams.ReadStream; + WriteStream = legStreams.WriteStream; } - /** - * Sends a telegram authentication code to the phone number. - * @example - * ```ts - * await client.connect(); - * const {phoneCodeHash,isCodeViaApp} = await client.sendCode({ - * apiId:1234, - * apiHash:"123456789abcfghj", - * },"+123456798"}); - * ``` - * @param apiCredentials - credentials to be used. - * @param phoneNumber - the phone number to send the code to - * @param forceSMS - whether to send it as an SMS or a normal in app message - * @return the phone code hash and whether it was sent via app - */ - sendCode(apiCredentials, phoneNumber, forceSMS = false) { - return authMethods.sendCode(this, apiCredentials, phoneNumber, forceSMS); + var fs$ReadStream = fs2.ReadStream; + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype); + ReadStream.prototype.open = ReadStream$open; } - /** - * Uses the 2FA password to sign in the account.<br/> - * This function should be used after the user has signed in with the code they received. - * @param apiCredentials - credentials to be used. - * @param authParams - user auth params. - * @returns the logged in user. - */ - signInWithPassword(apiCredentials, authParams) { - return authMethods.signInWithPassword(this, apiCredentials, authParams); + var fs$WriteStream = fs2.WriteStream; + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype); + WriteStream.prototype.open = WriteStream$open; } - /** - * Used to sign in as a bot. - * @example - * ```ts - * await client.connect(); - * const bot = await client.signInBot({ - * apiId:1234, - * apiHash:"12345", - * },{ - * botToken:"123456:abcdfghae4fg654", - * }); - * // we are now logged in as a bot - * console.log("Logged in",bot); - * ``` - * @param apiCredentials - credentials to be used. - * @param authParams - user auth params. - * @return instance User of the logged in bot. - */ - signInBot(apiCredentials, authParams) { - return authMethods.signInBot(this, apiCredentials, authParams); + Object.defineProperty(fs2, "ReadStream", { + get: function() { + return ReadStream; + }, + set: function(val) { + ReadStream = val; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(fs2, "WriteStream", { + get: function() { + return WriteStream; + }, + set: function(val) { + WriteStream = val; + }, + enumerable: true, + configurable: true + }); + var FileReadStream = ReadStream; + Object.defineProperty(fs2, "FileReadStream", { + get: function() { + return FileReadStream; + }, + set: function(val) { + FileReadStream = val; + }, + enumerable: true, + configurable: true + }); + var FileWriteStream = WriteStream; + Object.defineProperty(fs2, "FileWriteStream", { + get: function() { + return FileWriteStream; + }, + set: function(val) { + FileWriteStream = val; + }, + enumerable: true, + configurable: true + }); + function ReadStream(path2, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this; + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments); } - /** - * Changes the 2FA settings of the logged in user. - Note that this method may be *incredibly* slow depending on the - prime numbers that must be used during the process to make sure - that everything is safe. - - Has no effect if both current and new password are omitted. - - * @param client: The telegram client instance - * @param isCheckPassword: Must be ``true`` if you want to check the current password - * @param currentPassword: The current password, to authorize changing to ``new_password``. - Must be set if changing existing 2FA settings. - Must **not** be set if 2FA is currently disabled. - Passing this by itself will remove 2FA (if correct). - * @param newPassword: The password to set as 2FA. - If 2FA was already enabled, ``currentPassword`` **must** be set. - Leaving this blank or `undefined` will remove the password. - * @param hint: Hint to be displayed by Telegram when it asks for 2FA. - Must be set when changing or creating a new password. - Has no effect if ``newPassword`` is not set. - * @param email: Recovery and verification email. If present, you must also - set `emailCodeCallback`, else it raises an Error. - * @param emailCodeCallback: If an email is provided, a callback that returns the code sent - to it must also be set. This callback may be asynchronous. - It should return a string with the code. The length of the - code will be passed to the callback as an input parameter. - * @param onEmailCodeError: Called when an error happens while sending an email. - - If the callback returns an invalid code, it will raise an rpc error with the message - ``CODE_INVALID`` - - * @returns Promise<void> - * @throws this method can throw: - "PASSWORD_HASH_INVALID" if you entered a wrong password (or set it to undefined). - "EMAIL_INVALID" if the entered email is wrong - "EMAIL_HASH_EXPIRED" if the user took too long to verify their email - */ - async updateTwoFaSettings({ isCheckPassword, currentPassword, newPassword, hint = "", email, emailCodeCallback, onEmailCodeError }) { - return twoFA.updateTwoFaSettings(this, { - isCheckPassword, - currentPassword, - newPassword, - hint, - email, - emailCodeCallback, - onEmailCodeError + function ReadStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + if (that.autoClose) + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + that.read(); + } }); } - //endregion auth - //region bot - /** - * Makes an inline query to the specified bot and gets the result list.<br/> - * This is equivalent to writing `@pic something` in clients - * @param bot - the bot entity to which the inline query should be made - * @param query - the query string that should be made for that bot (up to 512 characters). can be empty - * @param entity - The entity where the inline query is being made from.<br/> - * Certain bots use this to display different results depending on where it's used, such as private chats, groups or channels.<br/> - * If specified, it will also be the default entity where the message will be sent after clicked.<br/> - * Otherwise, the “empty peer” will be used, which some bots may not handle correctly. - * @param offset - String offset of the results to be returned. can be empty - * @param geoPoint - The geo point location information to send to the bot for localised results. Available under some bots. - * @return a list of InlineResults - * @example - * ```ts - * // Makes the query to @pic - * const results = await client.inlineQuery("pic", "something"); - * // clicks on the first result - * await results[0].click(); - * ``` - */ - inlineQuery(bot, query2, entity, offset, geoPoint) { - return botMethods.inlineQuery(this, bot, query2, entity, offset, geoPoint); - } - //endregion - //region buttons - /** - * Builds a ReplyInlineMarkup or ReplyKeyboardMarkup for the given buttons.<br/><br/> - * Does nothing if either no buttons are provided or the provided argument is already a reply markup.<br/><br/> - * this function is called internally when passing an array of buttons. - - * @param buttons - The button, array of buttons, array of array of buttons or markup to convert into a markup. - * @param inlineOnly - Whether the buttons **must** be inline buttons only or not. - * @example - * ```ts - * import {Button} from "telegram/tl/custom/button"; - * // PS this function is not async - * const markup = client.buildReplyMarkup(Button.inline("Hello!")); - * - * await client.sendMessage(chat, { - * message: "click me!", - * buttons: markup, - * } - * - * // The following example can also be used in a simpler way like so - * - * await client.sendMessage(chat, { - * message: "click me!", - * buttons: [Button.inline("Hello!")], - * } - * ``` - */ - buildReplyMarkup(buttons, inlineOnly = false) { - return buttonsMethods.buildReplyMarkup(buttons, inlineOnly); + function WriteStream(path2, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this; + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments); } - //endregion - //region download - /** - * Low-level method to download files from their input location. - * downloadMedia should generally be used over this. - * @param inputLocation - The file location from which the file will be downloaded. See getInputLocation source for a complete list of supported types. - * @param fileParams - {@link DownloadFileParams} - * @return a Buffer downloaded from the inputFile. - * @example - * ```ts - * const photo = message.photo; - * const buffer = await client.downloadFile( - * new Api.InputPhotoFileLocation({ - * id: photo.id, - * accessHash: photo.accessHash, - * fileReference: photo.fileReference, - * thumbSize: size.type - * }), - * { - * dcId: photo.dcId, - * fileSize: "m", - * } - * ); - * ``` - */ - downloadFile(inputLocation, fileParams = {}) { - return downloadMethods.downloadFileV2(this, inputLocation, fileParams); + function WriteStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + } + }); } - /** - * Iterates over a file download, yielding chunks of the file. - * This method can be used to stream files in a more convenient way, since it offers more control (pausing, resuming, etc.) - * @param iterFileParams - {@link IterDownloadFunction} - * @return a Buffer downloaded from the inputFile. - * @example - * ```ts - * const photo = message.photo; - * for await (const chunk of client.iterDownload({ - * file: new Api.InputPhotoFileLocation({ - * id: photo.id, - * accessHash: photo.accessHash, - * fileReference: photo.fileReference, - * thumbSize: size.type - * }), - * offset: start, - * limit: end, - * requestSize:2048*1024 - * )){ - * console.log("Downloaded chunk of size",chunk.length); - * }; - * ``` - */ - iterDownload(iterFileParams) { - return downloadMethods.iterDownload(this, iterFileParams); + function createReadStream(path2, options) { + return new fs2.ReadStream(path2, options); } - //region download - /** - * Downloads the profile photo from the given user,chat or channel.<br/> - * This method will return an empty buffer in case of no profile photo. - * @param entity - where to download the photo from. - * @param downloadProfilePhotoParams - {@link DownloadProfilePhotoParams} - * @return buffer containing the profile photo. can be empty in case of no profile photo. - * @example - * ```ts - * // Download your own profile photo - * const buffer = await client.downloadProfilePhoto('me') - * console.log("Downloaded image is",buffer); - * // if you want to save it as a file you can use the fs module on node for that. - * import { promises as fs } from 'fs'; - * await fs.writeFile("picture.jpg",buffer); - * ``` - */ - downloadProfilePhoto(entity, downloadProfilePhotoParams = { - isBig: false - }) { - return downloadMethods.downloadProfilePhoto(this, entity, downloadProfilePhotoParams); + function createWriteStream(path2, options) { + return new fs2.WriteStream(path2, options); } - /** - * Downloads the given media from a message or a media object.<br/> - * this will return an empty Buffer in case of wrong or empty media. - * @param messageOrMedia - instance of a message or a media. - * @param downloadParams {@link DownloadMediaInterface} - * @return a buffer containing the downloaded data if outputFile is undefined else nothing. - * @example ```ts - * const buffer = await client.downloadMedia(message, {}) - * // to save it to a file later on using fs. - * import { promises as fs } from 'fs'; - * await fs.writeFile("file",buffer); - * // to use a progress callback you can pass it like so. - * const buffer = await client.downloadMedia(message, { - * progressCallback : console.log - * }) - * ``` - */ - downloadMedia(messageOrMedia, downloadParams) { - return downloadMethods.downloadMedia(this, messageOrMedia, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.outputFile, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.thumb, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.progressCallback); + var fs$open = fs2.open; + fs2.open = open; + function open(path2, flags, mode, cb) { + if (typeof mode === "function") + cb = mode, mode = null; + return go$open(path2, flags, mode, cb); + function go$open(path3, flags2, mode2, cb2, startTime) { + return fs$open(path3, flags2, mode2, function(err, fd) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } } - //endregion - //region message parse - /** - * This property is the default parse mode used when sending messages. Defaults to {@link MarkdownParser}.<br/> - * It will always be either undefined or an object with parse and unparse methods.<br/> - * When setting a different value it should be one of:<br/> - *<br/> - * - Object with parse and unparse methods.<br/> - * - A str indicating the parse_mode. For Markdown 'md' or 'markdown' may be used. For HTML, 'html' may be used.<br/> - * The parse method should be a function accepting a single parameter, the text to parse, and returning a tuple consisting of (parsed message str, [MessageEntity instances]).<br/> - * <br/> - * The unparse method should be the inverse of parse such that text == unparse(parse(text)).<br/> - * <br/> - * See {@link Api.TypeMessageEntity} for allowed message entities. - * @example - * ```ts - * // gets the current parse mode. - * console.log("parse mode is :", client.parseMode) - * ``` - */ - get parseMode() { - return this._parseMode; + return fs2; + } + function enqueue(elem) { + debug("ENQUEUE", elem[0].name, elem[1]); + fs[gracefulQueue].push(elem); + retry(); + } + var retryTimer; + function resetQueue() { + var now = Date.now(); + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now; + fs[gracefulQueue][i][4] = now; + } } - /** Setter for parseMode. - * {@link parseMode} - * @param mode can be md,markdown for Markdown or html for html. can also pass a custom mode. - * pass undefined for no parsing. - * @example - * // sets the mode to HTML - * client.setParseMode("html"); - * await client.sendMessage("me",{message:"<u>This is an underline text</u>"}); - * // disable formatting - * client.setParseMode(undefined); - * await client.sendMessage("me",{message:"<u> this will be sent as it is</u> ** with no formatting **}); - */ - setParseMode(mode) { - if (mode) { - this._parseMode = (0, Utils_1.sanitizeParseMode)(mode); + retry(); + } + function retry() { + clearTimeout(retryTimer); + retryTimer = void 0; + if (fs[gracefulQueue].length === 0) + return; + var elem = fs[gracefulQueue].shift(); + var fn = elem[0]; + var args = elem[1]; + var err = elem[2]; + var startTime = elem[3]; + var lastTime = elem[4]; + if (startTime === void 0) { + debug("RETRY", fn.name, args); + fn.apply(null, args); + } else if (Date.now() - startTime >= 6e4) { + debug("TIMEOUT", fn.name, args); + var cb = args.pop(); + if (typeof cb === "function") + cb.call(null, err); + } else { + var sinceAttempt = Date.now() - lastTime; + var sinceStart = Math.max(lastTime - startTime, 1); + var desiredDelay = Math.min(sinceStart * 1.2, 100); + if (sinceAttempt >= desiredDelay) { + debug("RETRY", fn.name, args); + fn.apply(null, args.concat([startTime])); } else { - this._parseMode = void 0; + fs[gracefulQueue].push(elem); } } - //endregion - // region messages - /** - * Iterates over the messages for a given chat. - * <br/> - * The default order is from newest to oldest but can be changed with the reverse param.<br/> - * If either `search`, `filter` or `fromUser` are provided this will use {@link Api.messages.Search} instead of {@link Api.messages.GetHistory}. - * @remarks - * Telegram limits GetHistory requests every 10 requests (1 000 messages) therefore a sleep of 1 seconds will be the default for this limit. - * @param entity - The entity from whom to retrieve the message history.<br/> - * It may be undefined to perform a global search, or to get messages by their ID from no particular chat<br/> - * **Note** that some of the offsets will not work if this is the case.<br/> - * **Note** that if you want to perform a global search, you must set a non-empty search string, a filter. or fromUser. - * @param iterParams - {@link IterMessagesParams} - * @yield Instances of custom {@link Message} - * @example - * ```ts - * // From most-recent to oldest - * for await (const message of client.iterMessages(chat,{}){ - * console.log(message.id, message.text) - * } - * - * // From oldest to most-recent - * for await (const message of client.iterMessages(chat,{reverse:true}){ - * console.log(message.id, message.text) - * } - * - * // Filter by sender - * for await (const message of client.iterMessages(chat,{fromUser:"me"}){ - * console.log(message.id, message.text) - * } - * - * // Server-side search with fuzzy text - * for await (const message of client.iterMessages(chat,{search:"hello"}){ - * console.log(message.id, message.text) - * } - * - * // Filter by message type: - * import { Api } from "telegram"; - * for await (const message of client.iterMessages(chat,{filter: Api.InputMessagesFilterPhotos}){ - * console.log(message.id, message.photo) - * } - * - * // Getting comments from a post in a channel: - * * for await (const message of client.iterMessages(chat,{replyTo: 123}){ - * console.log(message.chat.title,, message.text) - * } - * ``` - */ - iterMessages(entity, iterParams = {}) { - return messageMethods.iterMessages(this, entity, iterParams); + if (retryTimer === void 0) { + retryTimer = setTimeout(retry, 0); } - /** - * Same as iterMessages() but returns a TotalList instead.<br/> - * if the `limit` is not set, it will be 1 by default unless both `minId` **and** `maxId` are set. in which case the entire range will be returned.<br/> - * @param entity - The entity from whom to retrieve the message history. see {@link iterMessages}.<br/> - * @param getMessagesParams - see {@link IterMessagesParams}. - * @return {@link TotalList} of messages. - * @example - * ```ts - * // The totalList has a .total attribute which will show the complete number of messages even if none are fetched. - * // Get 0 photos and print the total to show how many photos there are - * import { Api } from "telegram"; - * const photos = await client.getMessages(chat, {limit: 0, filter:Api.InputMessagesFilterPhotos}) - * console.log(photos.total) - * - * // Get all the photos - * const photos = await client.getMessages(chat, {limit: undefined, filter:Api.InputMessagesFilterPhotos}) - * - // Get messages by ID: - * const messages = await client.getMessages(chat, {ids:1337}) - * const message_1337 = messages[0]; - * ``` - */ - getMessages(entity, getMessagesParams = {}) { - return messageMethods.getMessages(this, entity, getMessagesParams); + } + } +}); + +// node_modules/slide/lib/async-map.js +var require_async_map = __commonJS({ + "node_modules/slide/lib/async-map.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = asyncMap; + function asyncMap() { + var steps = Array.prototype.slice.call(arguments), list = steps.shift() || [], cb_ = steps.pop(); + if (typeof cb_ !== "function") throw new Error( + "No callback provided to asyncMap" + ); + if (!list) return cb_(null, []); + if (!Array.isArray(list)) list = [list]; + var n = steps.length, data = [], errState = null, l = list.length, a = l * n; + if (!a) return cb_(null, []); + function cb(er) { + if (er && !errState) errState = er; + var argLen = arguments.length; + for (var i = 1; i < argLen; i++) if (arguments[i] !== void 0) { + data[i - 1] = (data[i - 1] || []).concat(arguments[i]); + } + if (list.length > l) { + var newList = list.slice(l); + a += (list.length - l) * n; + l = list.length; + process.nextTick(function() { + newList.forEach(function(ar) { + steps.forEach(function(fn) { + fn(ar, cb); + }); + }); + }); + } + if (--a === 0) cb_.apply(null, [errState].concat(data)); } - /** - * Sends a message to the specified user, chat or channel.<br/> - * The default parse mode is the same as the official applications (a custom flavour of markdown). **bold**, `code` or __italic__ are available.<br/> - * In addition you can send [links](https://example.com) and [mentions](@username) (or using IDs like in the Bot API: [mention](tg://user?id=123456789)) and pre blocks with three backticks.<br/> - * <br/> - * Sending a /start command with a parameter (like ?start=data) is also done through this method. Simply send '/start data' to the bot.<br/> - * <br/> - * See also Message.respond() and Message.reply(). - * - * @param entity - Who to sent the message to. - * @param sendMessageParams - see {@link SendMessageParams} - * @return - * The sent custom Message. - * @example - * ```ts - * // Markdown is the default. - * await client.sendMessage("me",{message:"Hello **world!**}); - * - * // Defaults to another parse mode. - * client.setParseMode("HTML"); - * - * await client.sendMessage('me', {message:'Some <b>bold</b> and <i>italic</i> text'}) - * await client.sendMessage('me', {message:'An <a href="https://example.com">URL</a>'}) - * await client.sendMessage('me', {message:'<a href="tg://user?id=me">Mentions</a>'}) - * - * // Explicit parse mode. - * // No parse mode by default - * client.setParseMode(undefined); - * //...but here I want markdown - * await client.sendMessage('me', {message:'Hello, **world**!', {parseMode:"md"}}) - * - * // ...and here I need HTML - * await client.sendMessage('me', {message:'Hello, <i>world</i>!', {parseMode='html'}}) - * - * - * // Scheduling a message to be sent after 5 minutes - * - * await client.sendMessage(chat, {message:'Hi, future!', schedule:(60 * 5) + (Date.now() / 1000)}) - * - * ``` - */ - sendMessage(entity, sendMessageParams = {}) { - return messageMethods.sendMessage(this, entity, sendMessageParams); + list.forEach(function(ar) { + steps.forEach(function(fn) { + fn(ar, cb); + }); + }); + } + } +}); + +// node_modules/slide/lib/bind-actor.js +var require_bind_actor = __commonJS({ + "node_modules/slide/lib/bind-actor.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = bindActor; + function bindActor() { + var args = Array.prototype.slice.call(arguments), obj = null, fn; + if (typeof args[0] === "object") { + obj = args.shift(); + fn = args.shift(); + if (typeof fn === "string") + fn = obj[fn]; + } else fn = args.shift(); + return function(cb) { + fn.apply(obj, args.concat(cb)); + }; + } + } +}); + +// node_modules/slide/lib/chain.js +var require_chain = __commonJS({ + "node_modules/slide/lib/chain.js"(exports2, module2) { + init_define_import_meta_env(); + module2.exports = chain; + var bindActor = require_bind_actor(); + chain.first = {}; + chain.last = {}; + function chain(things, cb) { + var res = []; + (function LOOP(i, len) { + if (i >= len) return cb(null, res); + if (Array.isArray(things[i])) + things[i] = bindActor.apply( + null, + things[i].map(function(i2) { + return i2 === chain.first ? res[0] : i2 === chain.last ? res[res.length - 1] : i2; + }) + ); + if (!things[i]) return LOOP(i + 1, len); + things[i](function(er, data) { + if (er) return cb(er, res); + if (data !== void 0) res = res.concat(data); + LOOP(i + 1, len); + }); + })(0, things.length); + } + } +}); + +// node_modules/slide/lib/slide.js +var require_slide = __commonJS({ + "node_modules/slide/lib/slide.js"(exports2) { + init_define_import_meta_env(); + exports2.asyncMap = require_async_map(); + exports2.bindActor = require_bind_actor(); + exports2.chain = require_chain(); + } +}); + +// node_modules/imurmurhash/imurmurhash.js +var require_imurmurhash = __commonJS({ + "node_modules/imurmurhash/imurmurhash.js"(exports2, module2) { + init_define_import_meta_env(); + (function() { + var cache; + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed); + if (typeof key === "string" && key.length > 0) { + m.hash(key); + } + if (m !== this) { + return m; + } } - /** - * Forwards the given messages to the specified entity.<br/> - *<br/> - * If you want to "forward" a message without the forward header - * (the "forwarded from" text), you should use `sendMessage` with - * the original message instead. This will send a copy of it. - *<br/> - * See also {@link Message.forwardTo}`. - * @param entity - To which entity the message(s) will be forwarded. - * @param forwardMessagesParams - see {@link ForwardMessagesParams} - * @return The list of forwarded Message, Note.<br/> - * if some messages failed to be forwarded the returned list will have them as undefined. - * @example ```ts - * // a single one - * await client.forwardMessages(chat, {messages: message}); - * // or - * await client.forwardMessages(chat, {messages:messageId,fromPeer:fromChat}); - * // or - * await message.forwardTo(chat) - * - * // multiple - * await client.forwardMessages(chat, {messages:messages}); - * // or - * await client.forwardMessages(chat, {messages:messageIds,fromPeer:fromChat}); - * - * // Forwarding as a copy - * await client.sendMessage(chat, {message:message}); - * ``` - */ - forwardMessages(entity, forwardMessagesParams) { - return messageMethods.forwardMessages(this, entity, forwardMessagesParams); + ; + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; + len = key.length; + this.len += len; + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: + k1 ^= len > i ? key.charCodeAt(i++) & 65535 : 0; + case 1: + k1 ^= len > i ? (key.charCodeAt(i++) & 65535) << 8 : 0; + case 2: + k1 ^= len > i ? (key.charCodeAt(i++) & 65535) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 255) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 65280) >> 8 : 0; + } + this.rem = len + this.rem & 3; + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295; + k1 = k1 << 15 | k1 >>> 17; + k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295; + h1 ^= k1; + h1 = h1 << 13 | h1 >>> 19; + h1 = h1 * 5 + 3864292196 & 4294967295; + if (i >= len) { + break; + } + k1 = key.charCodeAt(i++) & 65535 ^ (key.charCodeAt(i++) & 65535) << 8 ^ (key.charCodeAt(i++) & 65535) << 16; + top = key.charCodeAt(i++); + k1 ^= (top & 255) << 24 ^ (top & 65280) >> 8; + } + k1 = 0; + switch (this.rem) { + case 3: + k1 ^= (key.charCodeAt(i + 2) & 65535) << 16; + case 2: + k1 ^= (key.charCodeAt(i + 1) & 65535) << 8; + case 1: + k1 ^= key.charCodeAt(i) & 65535; + } + this.h1 = h1; + } + this.k1 = k1; + return this; + }; + MurmurHash3.prototype.result = function() { + var k1, h1; + k1 = this.k1; + h1 = this.h1; + if (k1 > 0) { + k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295; + k1 = k1 << 15 | k1 >>> 17; + k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295; + h1 ^= k1; + } + h1 ^= this.len; + h1 ^= h1 >>> 16; + h1 = h1 * 51819 + (h1 & 65535) * 2246770688 & 4294967295; + h1 ^= h1 >>> 13; + h1 = h1 * 44597 + (h1 & 65535) * 3266445312 & 4294967295; + h1 ^= h1 >>> 16; + return h1 >>> 0; + }; + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === "number" ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; + cache = new MurmurHash3(); + if (typeof module2 != "undefined") { + module2.exports = MurmurHash3; + } else { + this.MurmurHash3 = MurmurHash3; } - /** - * Used to edit a message by changing it's text or media - * message refers to the message to be edited not what to edit - * text refers to the new text - * See also Message.edit()<br/> - * Notes: It is not possible to edit the media of a message that doesn't contain media. - * @param entity - From which chat to edit the message.<br/> - * This can also be the message to be edited, and the entity will be inferred from it, so the next parameter will be assumed to be the message text.<br/> - * You may also pass a InputBotInlineMessageID, which is the only way to edit messages that were sent after the user selects an inline query result. Not supported yet! - * @param editMessageParams - see {@link EditMessageParams}. - * @return The edited Message. - * @throws - * `MESSAGE_AUTHOR_REQUIRED` if you're not the author of the message but tried editing it anyway. - * `MESSAGE_NOT_MODIFIED` if the contents of the message were not modified at all. - * `MESSAGE_ID_INVALID` if the ID of the message is invalid (the ID itself may be correct, but the message with that ID cannot be edited).<br/> - * For example, when trying to edit messages with a reply markup (or clear markup) this error will be raised. - * @example - * ```ts - * const message = await client.sendMessage(chat,{message:"Hi!"}); - * - * await client.editMessage(chat,{message:message,text:"Hello!"} - * // or - * await client.editMessage(chat,{message:message.id,text:"Hello!"} - * ``` - */ - editMessage(entity, editMessageParams) { - return messageMethods.editMessage(this, entity, editMessageParams); + })(); + } +}); + +// node_modules/write-file-atomic/index.js +var require_write_file_atomic = __commonJS({ + "node_modules/write-file-atomic/index.js"(exports2, module2) { + "use strict"; + init_define_import_meta_env(); + module2.exports = writeFile; + module2.exports.sync = writeFileSync; + module2.exports._getTmpname = getTmpname; + var fs = require_graceful_fs(); + var chain = require_slide().chain; + var MurmurHash3 = require_imurmurhash(); + var extend = Object.assign || require("util")._extend; + var invocations = 0; + function getTmpname(filename) { + return filename + "." + MurmurHash3(__filename).hash(String(process.pid)).hash(String(++invocations)).result(); + } + function writeFile(filename, data, options, callback) { + if (options instanceof Function) { + callback = options; + options = null; } - /** - * Deletes the given messages, optionally "for everyone". - * - * See also {@link Message.delete}`. - * - * @remarks This method does **not** validate that the message IDs belong to the chat that you passed! It's possible for the method to delete messages from different private chats and small group chats at once, so make sure to pass the right IDs. - * @param entity - From who the message will be deleted. This can actually be `undefined` for normal chats, but **must** be present for channels and megagroups. - * @param messageIds - The IDs (or ID) or messages to be deleted. - * @param revoke - Whether the message should be deleted for everyone or not. - * By default it has the opposite behaviour of official clients, - * and it will delete the message for everyone. - * Disabling this has no effect on channels or megagroups, - * since it will unconditionally delete the message for everyone. - * @return - * A list of {@link AffectedMessages}, each item being the result for the delete calls of the messages in chunks of 100 each. - * @example - * ```ts - * await client.deleteMessages(chat, messages); - * - * await client.deleteMessages(chat, messages, {revoke:false}); - * ``` - */ - deleteMessages(entity, messageIds, { revoke = true }) { - return messageMethods.deleteMessages(this, entity, messageIds, { - revoke + if (!options) options = {}; + fs.realpath(filename, function(_, realname) { + _writeFile(realname || filename, data, options, callback); + }); + } + function _writeFile(filename, data, options, callback) { + var tmpfile = getTmpname(filename); + if (options.mode && options.chown) { + return thenWriteFile(); + } else { + return fs.stat(filename, function(err, stats) { + if (err || !stats) return thenWriteFile(); + options = extend({}, options); + if (!options.mode) { + options.mode = stats.mode; + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid }; + } + return thenWriteFile(); + }); + } + function thenWriteFile() { + chain([ + [writeFileAsync, tmpfile, data, options.mode, options.encoding || "utf8"], + options.chown && [fs, fs.chown, tmpfile, options.chown.uid, options.chown.gid], + options.mode && [fs, fs.chmod, tmpfile, options.mode], + [fs, fs.rename, tmpfile, filename] + ], function(err) { + err ? fs.unlink(tmpfile, function() { + callback(err); + }) : callback(); + }); + } + function writeFileAsync(file, data2, mode, encoding, cb) { + fs.open(file, "w", options.mode, function(err, fd) { + if (err) return cb(err); + if (Buffer.isBuffer(data2)) { + return fs.write(fd, data2, 0, data2.length, 0, syncAndClose); + } else if (data2 != null) { + return fs.write(fd, String(data2), 0, String(encoding), syncAndClose); + } else { + return syncAndClose(); + } + function syncAndClose(err2) { + if (err2) return cb(err2); + fs.fsync(fd, function(err3) { + if (err3) return cb(err3); + fs.close(fd, cb); + }); + } }); } - pinMessage(entity, message, pinMessageParams) { - return messageMethods.pinMessage(this, entity, message, pinMessageParams); - } - unpinMessage(entity, message, unpinMessageParams) { - return messageMethods.unpinMessage(this, entity, message, unpinMessageParams); - } - /** - * Marks messages as read and optionally clears mentions. <br/> - * This effectively marks a message as read (or more than one) in the given conversation. <br /> - * If a message or maximum ID is provided, all the messages up to and - * including such ID will be marked as read (for all messages whose ID ≤ max_id). - * - * See also {@link Message.markRead}`. - * - * @remarks If neither message nor maximum ID are provided, all messages will be marked as read by assuming that `max_id = 0`. - * @param entity - The chat where the message should be pinned. - * @param message - The message or the message ID to pin. If it's `undefined`, all messages will be unpinned instead. - * @param markAsReadParams - see {@link MarkAsReadParams}. - * @return boolean - * @example - * ```ts - * // using a Message object - * const message = await client.sendMessage(chat, 'GramJS is awesome!'); - * await client.markAsRead(chat, message) - * // ...or using the int ID of a Message - * await client.markAsRead(chat, message.id); - * - * // ...or passing a list of messages to mark as read - * await client.markAsRead(chat, messages) - * ``` - */ - markAsRead(entity, message, markAsReadParams) { - return messageMethods.markAsRead(this, entity, message, markAsReadParams); + } + function writeFileSync(filename, data, options) { + if (!options) options = {}; + try { + filename = fs.realpathSync(filename); + } catch (ex) { } - //endregion - //region dialogs - /** - * Iterator over the dialogs (open conversations/subscribed channels) sequentially.<br/> - * The order is the same as the one seen in official applications. (dialogs that had recent messages come first) - * @param iterDialogsParams - see {@link IterDialogsParams} - * @yield instances of custom {@link Dialog}. - * @example - * ```ts - * // logs all dialog IDs and their title. - * for await (const dialog of client.iterDialogs({})){ - * console.log(`${dialog.id}: ${dialog.title}`); - * } - * ``` - */ - iterDialogs(iterDialogsParams = {}) { - return dialogMethods.iterDialogs(this, iterDialogsParams); + var tmpfile = getTmpname(filename); + try { + if (!options.mode || !options.chown) { + try { + var stats = fs.statSync(filename); + options = extend({}, options); + if (!options.mode) { + options.mode = stats.mode; + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid }; + } + } catch (ex) { + } + } + var fd = fs.openSync(tmpfile, "w", options.mode); + if (Buffer.isBuffer(data)) { + fs.writeSync(fd, data, 0, data.length, 0); + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || "utf8")); + } + fs.fsyncSync(fd); + fs.closeSync(fd); + if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid); + if (options.mode) fs.chmodSync(tmpfile, options.mode); + fs.renameSync(tmpfile, filename); + } catch (err) { + try { + fs.unlinkSync(tmpfile); + } catch (e) { + } + throw err; } - /** - * Same as iterDialogs but returns a TotalList instead of an iterator. - * @param params - {@link IterDialogsParams} - * @example - * ```ts - * // Get all open conversation, print the title of the first - * const dialogs = await client.getDialogs({}); - * const first = dialogs[0]; - * console.log(first.title); - * <br/> - * // Use the dialog somewhere else - * await client.sendMessage(first, {message: "hi"}); - * <br/> - * // Getting only non-archived dialogs (both equivalent) - * non_archived = await client.get_dialogs({folder:0}) - * non_archived = await client.get_dialogs({archived:false}) - * <br/> - * // Getting only archived dialogs (both equivalent) - * archived = await client.get_dialogs({folder:1}) - * archived = await client.get_dialogs({archived:true}) - * ``` - */ - getDialogs(params = {}) { - return dialogMethods.getDialogs(this, params); + } + } +}); + +// node_modules/node-localstorage/LocalStorage.js +var require_LocalStorage = __commonJS({ + "node_modules/node-localstorage/LocalStorage.js"(exports2) { + init_define_import_meta_env(); + (function() { + var JSONStorage, KEY_FOR_EMPTY_STRING, LocalStorage, MetaKey, QUOTA_EXCEEDED_ERR, StorageEvent, _emptyDirectory, _escapeKey, _rm, createMap, events, fs, path2, writeSync, extend = function(child, parent) { + for (var key in parent) { + if (hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + child.__super__ = parent.prototype; + return child; + }, hasProp = {}.hasOwnProperty; + path2 = require("path"); + fs = require("fs"); + events = require("events"); + writeSync = require_write_file_atomic().sync; + KEY_FOR_EMPTY_STRING = "---.EMPTY_STRING.---"; + _emptyDirectory = function(target) { + var i, len, p, ref, results; + ref = fs.readdirSync(target); + results = []; + for (i = 0, len = ref.length; i < len; i++) { + p = ref[i]; + results.push(_rm(path2.join(target, p))); + } + return results; + }; + _rm = function(target) { + if (fs.statSync(target).isDirectory()) { + _emptyDirectory(target); + return fs.rmdirSync(target); + } else { + return fs.unlinkSync(target); + } + }; + _escapeKey = function(key) { + var newKey; + if (key === "") { + newKey = KEY_FOR_EMPTY_STRING; + } else { + newKey = "" + key; + } + return newKey; + }; + QUOTA_EXCEEDED_ERR = (function(superClass) { + extend(QUOTA_EXCEEDED_ERR2, superClass); + function QUOTA_EXCEEDED_ERR2(message) { + this.message = message != null ? message : "Unknown error."; + QUOTA_EXCEEDED_ERR2.__super__.constructor.call(this); + if (Error.captureStackTrace != null) { + Error.captureStackTrace(this, this.constructor); + } + this.name = this.constructor.name; + } + QUOTA_EXCEEDED_ERR2.prototype.toString = function() { + return this.name + ": " + this.message; + }; + return QUOTA_EXCEEDED_ERR2; + })(Error); + StorageEvent = /* @__PURE__ */ (function() { + function StorageEvent2(key1, oldValue1, newValue1, url, storageArea) { + this.key = key1; + this.oldValue = oldValue1; + this.newValue = newValue1; + this.url = url; + this.storageArea = storageArea != null ? storageArea : "localStorage"; + } + return StorageEvent2; + })(); + MetaKey = /* @__PURE__ */ (function() { + function MetaKey2(key1, index1) { + this.key = key1; + this.index = index1; + if (!(this instanceof MetaKey2)) { + return new MetaKey2(this.key, this.index); + } + } + return MetaKey2; + })(); + createMap = function() { + var Map2; + Map2 = function() { + }; + Map2.prototype = /* @__PURE__ */ Object.create(null); + return new Map2(); + }; + LocalStorage = (function(superClass) { + var instanceMap; + extend(LocalStorage2, superClass); + instanceMap = {}; + function LocalStorage2(_location, quota) { + var handler; + this._location = _location; + this.quota = quota != null ? quota : 5 * 1024 * 1024; + LocalStorage2.__super__.constructor.call(this); + if (!(this instanceof LocalStorage2)) { + return new LocalStorage2(this._location, this.quota); + } + this._location = path2.resolve(this._location); + if (instanceMap[this._location] != null) { + return instanceMap[this._location]; + } + this.length = 0; + this._bytesInUse = 0; + this._keys = []; + this._metaKeyMap = createMap(); + this._eventUrl = "pid:" + process.pid; + this._init(); + this._QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR; + if (typeof Proxy !== "undefined" && Proxy !== null) { + handler = { + set: /* @__PURE__ */ (function(_this) { + return function(receiver, key, value) { + if (_this[key] != null) { + return _this[key] = value; + } else { + return _this.setItem(key, value); + } + }; + })(this), + get: /* @__PURE__ */ (function(_this) { + return function(receiver, key) { + if (_this[key] != null) { + return _this[key]; + } else { + return _this.getItem(key); + } + }; + })(this) + }; + instanceMap[this._location] = new Proxy(this, handler); + return instanceMap[this._location]; + } + instanceMap[this._location] = this; + return instanceMap[this._location]; + } + LocalStorage2.prototype._init = function() { + var _MetaKey, _decodedKey, _keys, e, i, index2, k, len, stat; + try { + stat = fs.statSync(this._location); + if (stat != null && !stat.isDirectory()) { + throw new Error("A file exists at the location '" + this._location + "' when trying to create/open localStorage"); + } + this._bytesInUse = 0; + this.length = 0; + _keys = fs.readdirSync(this._location); + for (index2 = i = 0, len = _keys.length; i < len; index2 = ++i) { + k = _keys[index2]; + _decodedKey = decodeURIComponent(k); + this._keys.push(_decodedKey); + _MetaKey = new MetaKey(k, index2); + this._metaKeyMap[_decodedKey] = _MetaKey; + stat = this._getStat(k); + if ((stat != null ? stat.size : void 0) != null) { + _MetaKey.size = stat.size; + this._bytesInUse += stat.size; + } + } + this.length = _keys.length; + } catch (error) { + e = error; + if (e.code !== "ENOENT") { + throw e; + } + try { + fs.mkdirSync(this._location, { + recursive: true + }); + } catch (error2) { + e = error2; + if (e.code !== "EEXIST") { + throw e; + } + } + } + }; + LocalStorage2.prototype.setItem = function(key, value) { + var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; + hasListeners = this.listenerCount("storage"); + oldValue = null; + if (hasListeners) { + oldValue = this.getItem(key); + } + key = _escapeKey(key); + encodedKey = encodeURIComponent(key).replace(/[!'()]/g, escape).replace(/\*/g, "%2A"); + filename = path2.join(this._location, encodedKey); + valueString = "" + value; + valueStringLength = valueString.length; + metaKey = this._metaKeyMap[key]; + existsBeforeSet = !!metaKey; + if (existsBeforeSet) { + oldLength = metaKey.size; + } else { + oldLength = 0; + } + if (this._bytesInUse - oldLength + valueStringLength > this.quota) { + throw new QUOTA_EXCEEDED_ERR(); + } + writeSync(filename, valueString, { + encoding: "utf8" + }); + if (!existsBeforeSet) { + metaKey = new MetaKey(encodedKey, this._keys.push(key) - 1); + metaKey.size = valueStringLength; + this._metaKeyMap[key] = metaKey; + this.length += 1; + this._bytesInUse += valueStringLength; + } + if (hasListeners) { + evnt = new StorageEvent(key, oldValue, value, this._eventUrl); + return this.emit("storage", evnt); + } + }; + LocalStorage2.prototype.getItem = function(key) { + var filename, metaKey; + key = _escapeKey(key); + metaKey = this._metaKeyMap[key]; + if (!!metaKey) { + filename = path2.join(this._location, metaKey.key); + return fs.readFileSync(filename, "utf8"); + } else { + return null; + } + }; + LocalStorage2.prototype._getStat = function(key) { + var filename; + key = _escapeKey(key); + filename = path2.join(this._location, encodeURIComponent(key)); + try { + return fs.statSync(filename); + } catch (error) { + return null; + } + }; + LocalStorage2.prototype.removeItem = function(key) { + var evnt, filename, hasListeners, k, meta, metaKey, oldValue, ref, v; + key = _escapeKey(key); + metaKey = this._metaKeyMap[key]; + if (!!metaKey) { + hasListeners = this.listenerCount("storage"); + oldValue = null; + if (hasListeners) { + oldValue = this.getItem(key); + } + delete this._metaKeyMap[key]; + this.length -= 1; + this._bytesInUse -= metaKey.size; + filename = path2.join(this._location, metaKey.key); + this._keys.splice(metaKey.index, 1); + ref = this._metaKeyMap; + for (k in ref) { + v = ref[k]; + meta = this._metaKeyMap[k]; + if (meta.index > metaKey.index) { + meta.index -= 1; + } + } + _rm(filename); + if (hasListeners) { + evnt = new StorageEvent(key, oldValue, null, this._eventUrl); + return this.emit("storage", evnt); + } + } + }; + LocalStorage2.prototype.key = function(n) { + var rawKey; + rawKey = this._keys[n]; + if (rawKey === KEY_FOR_EMPTY_STRING) { + return ""; + } else { + return rawKey; + } + }; + LocalStorage2.prototype.clear = function() { + var evnt; + _emptyDirectory(this._location); + this._metaKeyMap = createMap(); + this._keys = []; + this.length = 0; + this._bytesInUse = 0; + if (this.listenerCount("storage")) { + evnt = new StorageEvent(null, null, null, this._eventUrl); + return this.emit("storage", evnt); + } + }; + LocalStorage2.prototype._getBytesInUse = function() { + return this._bytesInUse; + }; + LocalStorage2.prototype._deleteLocation = function() { + delete instanceMap[this._location]; + _rm(this._location); + this._metaKeyMap = {}; + this._keys = []; + this.length = 0; + return this._bytesInUse = 0; + }; + return LocalStorage2; + })(events.EventEmitter); + JSONStorage = (function(superClass) { + extend(JSONStorage2, superClass); + function JSONStorage2() { + return JSONStorage2.__super__.constructor.apply(this, arguments); + } + JSONStorage2.prototype.setItem = function(key, value) { + var newValue; + newValue = JSON.stringify(value); + return JSONStorage2.__super__.setItem.call(this, key, newValue); + }; + JSONStorage2.prototype.getItem = function(key) { + return JSON.parse(JSONStorage2.__super__.getItem.call(this, key)); + }; + return JSONStorage2; + })(LocalStorage); + exports2.LocalStorage = LocalStorage; + exports2.JSONStorage = JSONStorage; + exports2.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR; + }).call(exports2); + } +}); + +// node_modules/telegram/sessions/localStorage.js +var require_localStorage = __commonJS({ + "node_modules/telegram/sessions/localStorage.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.LocalStorage = void 0; + exports2.LocalStorage = require_LocalStorage().LocalStorage; + } +}); + +// node_modules/telegram/sessions/StoreSession.js +var require_StoreSession = __commonJS({ + "node_modules/telegram/sessions/StoreSession.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StoreSession = void 0; + var Memory_1 = require_Memory(); + var store2_1 = __importDefault2(require_store2()); + var AuthKey_1 = require_AuthKey(); + var StoreSession = class extends Memory_1.MemorySession { + constructor(sessionName, divider = ":") { + super(); + if (sessionName === "session") { + throw new Error("Session name can't be 'session'. Please use a different name."); + } + if (typeof localStorage === "undefined" || localStorage === null) { + const LocalStorage = require_localStorage().LocalStorage; + this.store = store2_1.default.area(sessionName, new LocalStorage("./" + sessionName)); + } else { + this.store = store2_1.default.area(sessionName, localStorage); + } + if (divider == void 0) { + divider = ":"; + } + this.sessionName = sessionName + divider; } - //endregion - //region chats - /** - * Iterates over the participants belonging to a specified chat , channel or supergroup.<br/> - * <br/> - * Channels can return a maximum of 200 users while supergroups can return up to 10 000.<br/> - * You must be an admin to retrieve users from a channel.<br/> - * @param entity - The entity from which to retrieve the participants list. - * @param params - {@link IterParticipantsParams} - * @remarks - * The filter ChannelParticipantsBanned will return restricted users. If you want banned users you should use ChannelParticipantsKicked instead. - * @yield The User objects returned by GetParticipants with an additional .participant attribute<br/> - * which is the matched ChannelParticipant type for channels/supergroup or ChatParticipants for normal chats. - * @example - * ```ts - * // logs all user IDs in a chat. - * for await (const user of client.iterParticipants(chat)){ - * console.log("User id",user.id); - * } - * - * // Searches by name. - * for await (const user of client.iterParticipants(chat, {search: "name"})){ - * console.log("Username is ",user.username); // Some users don't have a username so this can be undefined. - * } - * - * // Filter by admins. - * import { Api } from "telegram"; - * - * for await (const user of client.iterParticipants(chat, {filter: Api.ChannelParticipantsAdmins})){ - * console.log("admin first name is ",user.firstName); - * } - * ``` - */ - iterParticipants(entity, params = {}) { - return chatMethods.iterParticipants(this, entity, params); + async load() { + let authKey = this.store.get(this.sessionName + "authKey"); + if (authKey && typeof authKey === "object") { + this._authKey = new AuthKey_1.AuthKey(); + if ("data" in authKey) { + authKey = Buffer.from(authKey.data); + } + await this._authKey.setKey(authKey); + } + const dcId = this.store.get(this.sessionName + "dcId"); + if (dcId) { + this._dcId = dcId; + } + const port = this.store.get(this.sessionName + "port"); + if (port) { + this._port = port; + } + const serverAddress = this.store.get(this.sessionName + "serverAddress"); + if (serverAddress) { + this._serverAddress = serverAddress; + } } - /** - * Exact same as iterParticipants but returns a TotalList instead.<br/> - * This can be used if you want to retrieve a list instead of iterating over the users. - * @param entity - entity to get users from. - * @param params - {@link IterParticipantsParams}. - * @return - */ - getParticipants(entity, params = {}) { - return chatMethods.getParticipants(this, entity, params); + setDC(dcId, serverAddress, port) { + this.store.set(this.sessionName + "dcId", dcId); + this.store.set(this.sessionName + "port", port); + this.store.set(this.sessionName + "serverAddress", serverAddress); + super.setDC(dcId, serverAddress, port); } - /** - * Kicks a user from a chat. - * - * Kicking yourself (`'me'`) will result in leaving the chat. - * - * @note - * Attempting to kick someone who was banned will remove their - * restrictions (and thus unbanning them), since kicking is just - * ban + unban. - * - * @example - * // Kick some user from some chat, and deleting the service message - * const msg = await client.kickParticipant(chat, user); - * await msg.delete(); - * - * // Leaving chat - * await client.kickParticipant(chat, 'me'); - */ - kickParticipant(entity, participant) { - return chatMethods.kickParticipant(this, entity, participant); + set authKey(value) { + this._authKey = value; + this.store.set(this.sessionName + "authKey", value === null || value === void 0 ? void 0 : value.getKey()); } - //endregion - //region updates - /** TODO */ - on(event) { - return updateMethods.on(this, event); + get authKey() { + return this._authKey; } - addEventHandler(callback, event) { - return updateMethods.addEventHandler(this, callback, event); + processEntities(tlo) { + const rows = this._entitiesToRows(tlo); + if (!rows) { + return; + } + for (const row of rows) { + row.push((/* @__PURE__ */ new Date()).getTime().toString()); + this.store.set(this.sessionName + row[0], row); + } } - /** - * Inverse operation of addEventHandler().<br> - * - * @param callback - the callback function to be removed. - * @param event - the type of the event. - */ - removeEventHandler(callback, event) { - return updateMethods.removeEventHandler(this, callback, event); + getEntityRowsById(id, exact = true) { + return this.store.get(this.sessionName + id.toString()); } - /** - * Lists all registered event handlers. - * @return pair of [eventBuilder,CallableFunction] - */ - listEventHandlers() { - return updateMethods.listEventHandlers(this); + }; + exports2.StoreSession = StoreSession; + } +}); + +// node_modules/telegram/sessions/index.js +var require_sessions = __commonJS({ + "node_modules/telegram/sessions/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Session = exports2.StoreSession = exports2.StringSession = exports2.MemorySession = void 0; + var Memory_1 = require_Memory(); + Object.defineProperty(exports2, "MemorySession", { enumerable: true, get: function() { + return Memory_1.MemorySession; + } }); + var StringSession_1 = require_StringSession(); + Object.defineProperty(exports2, "StringSession", { enumerable: true, get: function() { + return StringSession_1.StringSession; + } }); + var StoreSession_1 = require_StoreSession(); + Object.defineProperty(exports2, "StoreSession", { enumerable: true, get: function() { + return StoreSession_1.StoreSession; + } }); + var Abstract_1 = require_Abstract(); + Object.defineProperty(exports2, "Session", { enumerable: true, get: function() { + return Abstract_1.Session; + } }); + } +}); + +// node_modules/telegram/client/os.js +var require_os = __commonJS({ + "node_modules/telegram/client/os.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - // region uploads - /** - * Uploads a file to Telegram's servers, without sending it. - * @remarks generally it's better to use {@link sendFile} instead. - * This method returns a handle (an instance of InputFile or InputFileBig, as required) which can be later used before it expires (they are usable during less than a day).<br/> - * Uploading a file will simply return a "handle" to the file stored remotely in the Telegram servers, - * which can be later used on. This will not upload the file to your own chat or any chat at all. - * This also can be used to update profile pictures - * @param fileParams see {@link UploadFileParams} - * @return {@link Api.InputFileBig} if the file size is larger than 10mb otherwise {@link Api.InputFile} - * @example - * ```ts - * import { CustomFile } from "telegram/client/uploads"; - * const toUpload = new CustomFile("photo.jpg", fs.statSync("../photo.jpg").size, "../photo.jpg"); - * const file = await client.uploadFile({ - * file: toUpload, - * workers: 1, - * }); - * await client.invoke(new Api.photos.UploadProfilePhoto({ - * file: file, - * })); - * ``` - */ - uploadFile(fileParams) { - return uploadMethods.uploadFile(this, fileParams); + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - /** - * Sends message with the given file to the specified entity. - * This uses {@link uploadFile} internally so if you want more control over uploads you can use that. - * @param entity - who will receive the file. - * @param sendFileParams - see {@link SendFileInterface} - * @example - * ``` - * // Normal files like photos - * await client.sendFile(chat, {file:'/my/photos/me.jpg', caption:"It's me!"}) - * // or - * await client.sendMessage(chat, {message:"It's me!", file:'/my/photos/me.jpg'}) - * - * Voice notes or round videos - * await client.sendFile(chat, {file: '/my/songs/song.mp3', voiceNote:True}) - * await client.sendFile(chat, {file: '/my/videos/video.mp4', videoNote:True}) - * - * // Custom thumbnails - * await client.sendFile(chat, {file:'/my/documents/doc.txt', thumb:'photo.jpg'}) - * - * // Only documents - * await client.sendFile(chat, {file:'/my/photos/photo.png', forceDocument:True}) - * - * //logging progress - * await client.sendFile(chat, {file: file, progressCallback=console.log}) - * - * // Dices, including dart and other future emoji - * await client.sendFile(chat, {file:new Api.InputMediaDice("")}) - * await client.sendFile(chat, {file:new Api.InputMediaDice("🎯")}) - * - * // Contacts - * await client.sendFile(chat, {file: new Api.InputMediaContact({ - * phoneNumber:'+1 123 456 789', - * firstName:'Example', - * lastName:'', - * vcard:'' - * })) - * ``` - */ - sendFile(entity, sendFileParams) { - return uploadMethods.sendFile(this, entity, sendFileParams); + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + var os = __importStar2(require("os")); + exports2.default = os; + } +}); + +// node_modules/telegram/entityCache.js +var require_entityCache = __commonJS({ + "node_modules/telegram/entityCache.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EntityCache = void 0; + var Utils_1 = require_Utils(); + var Helpers_1 = require_Helpers(); + var tl_1 = require_tl(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var EntityCache = class { + constructor() { + this.cacheMap = /* @__PURE__ */ new Map(); } - // endregion - //region user methods - /** - * invokes raw Telegram requests.<br/> - * This is a low level method that can be used to call manually any Telegram API method.<br/> - * Generally this should only be used when there isn't a friendly method that does what you need.<br/> - * All available requests and types are found under the `Api.` namespace. - * @param request - The request to send. this should be of type request. - * @param dcId - Optional dc id to use when sending. - * @return The response from Telegram. - * @example - * ```ts - * // - * const result = await client.invoke(new Api.account.CheckUsername({ - * username: 'some string here' - * })); - * console.log("does this username exist?",result); - * - * ``` - */ - invoke(request, dcId) { - return userMethods.invoke(this, request, dcId); + add(entities2) { + const temp = []; + if (!(0, Helpers_1.isArrayLike)(entities2)) { + if (entities2 != void 0) { + if (typeof entities2 == "object") { + if ("chats" in entities2) { + temp.push(...entities2.chats); + } + if ("users" in entities2) { + temp.push(...entities2.users); + } + if ("user" in entities2) { + temp.push(entities2.user); + } + } + } + if (temp.length) { + entities2 = temp; + } else { + return; + } + } + for (const entity of entities2) { + try { + const pid = (0, Utils_1.getPeerId)(entity); + if (!this.cacheMap.has(pid.toString())) { + this.cacheMap.set(pid.toString(), (0, Utils_1.getInputPeer)(entity)); + } + } catch (e) { + } + } } - invokeWithSender(request, sender) { - return userMethods.invoke(this, request, void 0, sender); + get(item) { + if (item == void 0) { + throw new Error("No cached entity for the given key"); + } + item = (0, Helpers_1.returnBigInt)(item); + if (item.lesser(big_integer_1.default.zero)) { + let res; + try { + res = this.cacheMap.get((0, Utils_1.getPeerId)(item).toString()); + if (res) { + return res; + } + } catch (e) { + throw new Error("Invalid key will not have entity"); + } + } + for (const cls of [tl_1.Api.PeerUser, tl_1.Api.PeerChat, tl_1.Api.PeerChannel]) { + const result = this.cacheMap.get((0, Utils_1.getPeerId)(new cls({ + userId: item, + chatId: item, + channelId: item + })).toString()); + if (result) { + return result; + } + } + throw new Error("No cached entity for the given key"); } - getMe(inputPeer = false) { - return userMethods.getMe(this, inputPeer); + }; + exports2.EntityCache = EntityCache; + } +}); + +// node_modules/telegram/crypto/IGE.js +var require_IGE = __commonJS({ + "node_modules/telegram/crypto/IGE.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.IGE = void 0; + var Helpers = require_Helpers(); + var { IGE: aes_ige } = require_aes_min(); + var IGENEW = class { + constructor(key, iv) { + this.ige = new aes_ige(key, iv); } /** - * Return true if the signed-in user is a bot, false otherwise. - * @example - * ```ts - * if (await client.isBot()){ - * console.log("I am a bot. PI is 3.14159265359); - * } else { - * console.log("I am a human. Pies are delicious); - * } - * ``` + * Decrypts the given text in 16-bytes blocks by using the given key and 32-bytes initialization vector + * @param cipherText {Buffer} + * @returns {Buffer} */ - isBot() { - return userMethods.isBot(this); + decryptIge(cipherText) { + return Helpers.convertToLittle(this.ige.decrypt(cipherText)); } /** - * Returns true if the user is authorized (logged in). - * @example - * if (await client.isUserAuthorized()){ - * console.log("I am authorized. I can call functions and use requests"); - * }else{ - * console.log("I am not logged in. I need to sign in first before being able to call methods"); - * } + * Encrypts the given text in 16-bytes blocks by using the given key and 32-bytes initialization vector + * @param plainText {Buffer} + * @returns {Buffer} */ - isUserAuthorized() { - return userMethods.isUserAuthorized(this); + encryptIge(plainText) { + const padding = plainText.length % 16; + if (padding) { + plainText = Buffer.concat([ + plainText, + Helpers.generateRandomBytes(16 - padding) + ]); + } + return Helpers.convertToLittle(this.ige.encrypt(plainText)); } - getEntity(entity) { - return userMethods.getEntity(this, entity); + }; + exports2.IGE = IGENEW; + } +}); + +// node_modules/telegram/network/MTProtoState.js +var require_MTProtoState = __commonJS({ + "node_modules/telegram/network/MTProtoState.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MTProtoState = void 0; + var big_integer_1 = __importDefault2(require_BigInteger()); + var __1 = require_telegram(); + var tl_1 = require_tl(); + var Helpers_1 = require_Helpers(); + var core_1 = require_core(); + var extensions_1 = require_extensions(); + var IGE_1 = require_IGE(); + var errors_1 = require_errors(); + var MTProtoState = class { + /** + * + `telethon.network.mtprotosender.MTProtoSender` needs to hold a state + in order to be able to encrypt and decrypt incoming/outgoing messages, + as well as generating the message IDs. Instances of this class hold + together all the required information. + + It doesn't make sense to use `telethon.sessions.abstract.Session` for + the sender because the sender should *not* be concerned about storing + this information to disk, as one may create as many senders as they + desire to any other data center, or some CDN. Using the same session + for all these is not a good idea as each need their own authkey, and + the concept of "copying" sessions with the unnecessary entities or + updates state for these connections doesn't make sense. + + While it would be possible to have a `MTProtoPlainState` that does no + encryption so that it was usable through the `MTProtoLayer` and thus + avoid the need for a `MTProtoPlainSender`, the `MTProtoLayer` is more + focused to efficiency and this state is also more advanced (since it + supports gzipping and invoking after other message IDs). There are too + many methods that would be needed to make it convenient to use for the + authentication process, at which point the `MTProtoPlainSender` is better + * @param authKey + * @param loggers + * @param securityChecks + */ + constructor(authKey, loggers, securityChecks = true) { + this.authKey = authKey; + this._log = loggers; + this.timeOffset = 0; + this.salt = big_integer_1.default.zero; + this._sequence = 0; + this.id = this._lastMsgId = big_integer_1.default.zero; + this.msgIds = []; + this.securityChecks = securityChecks; + this.reset(); } /** - * Turns the given entity into its input entity version.<br/> - * Almost all requests use this kind of InputPeer, so this is the most suitable call to make for those cases.<br/> - * **Generally you should let the library do its job** and don't worry about getting the input entity first, but if you're going to use an entity often, consider making the call. - * @param entity - If a username or invite link is given, the library will use the cache.<br/> - * This means that it's possible to be using a username that changed or an old invite link (this only happens if an invite link for a small group chat is used after it was upgraded to a mega-group). - *<br/> - * - If the username or ID from the invite link is not found in the cache, it will be fetched. The same rules apply to phone numbers ('+34 123456789') from people in your contact list. - *<br/> - * - If an exact name is given, it must be in the cache too. This is not reliable as different people can share the same name and which entity is returned is arbitrary,<br/> - * and should be used only for quick tests. - *<br/> - * - If a positive integer ID is given, the entity will be searched in cached users, chats or channels, without making any call. - *<br/> - * - If a negative integer ID is given, the entity will be searched exactly as either a chat (prefixed with -) or as a channel (prefixed with -100). - *<br/> - * - If a Peer is given, it will be searched exactly in the cache as either a user, chat or channel. - *<br/> - * - If the given object can be turned into an input entity directly, said operation will be done. - *<br/> - * -If the entity can't be found, this will throw an error. - * @return - * {@link Api.InputPeerUser} , {@link Api.InputPeerChat} , {@link Api.InputPeerChannel} or {@link Api.InputPeerSelf} if the parameter is "me" or "self" - * @example - * ```ts - * // If you're going to use "username" often in your code - * // (make a lot of calls), consider getting its input entity - * // once, and then using the "user" everywhere instead. - * user = await client.getInputEntity('username') - * - * // The same applies to IDs, chats or channels. - * chat = await client.getInputEntity(-123456789) - * ``` + * Resets the state */ - getInputEntity(entity) { - return userMethods.getInputEntity(this, entity); + reset() { + this.id = __1.helpers.generateRandomLong(true); + this._sequence = 0; + this._lastMsgId = big_integer_1.default.zero; + this.msgIds = []; } /** - * Gets the ID for the given entity.<br/> - * This method needs to be async because peer supports usernames, invite-links, phone numbers (from people in your contact list), etc.<br/> - * <br/> - * If addMark is false, then a positive ID will be returned instead. By default, bot-API style IDs (signed) are returned. - * @param peer - * @param addMark - whether to return a bot api style id. - * @return the ID of the entity. - * @example - * ```ts - * console.log(await client.getPeerId("me")); - * ``` + * Updates the message ID to a new one, + * used when the time offset changed. + * @param message */ - getPeerId(peer, addMark = true) { - return userMethods.getPeerId(this, peer, addMark); - } - /** @hidden */ - _getInputDialog(peer) { - return userMethods._getInputDialog(this, peer); + updateMessageId(message) { + message.msgId = this._getNewMsgId(); } - /** @hidden */ - _getInputNotify(notify) { - return userMethods._getInputNotify(this, notify); + /** + * Calculate the key based on Telegram guidelines, specifying whether it's the client or not + * @param authKey + * @param msgKey + * @param client + * @returns {{iv: Buffer, key: Buffer}} + */ + async _calcKey(authKey, msgKey, client2) { + const x = client2 ? 0 : 8; + const [sha256a, sha256b] = await Promise.all([ + (0, Helpers_1.sha256)(Buffer.concat([msgKey, authKey.slice(x, x + 36)])), + (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(x + 40, x + 76), msgKey])) + ]); + const key = Buffer.concat([ + sha256a.slice(0, 8), + sha256b.slice(8, 24), + sha256a.slice(24, 32) + ]); + const iv = Buffer.concat([ + sha256b.slice(0, 8), + sha256a.slice(8, 24), + sha256b.slice(24, 32) + ]); + return { key, iv }; } - //endregion - /** @hidden */ - async _handleReconnect() { - this._log.info("Handling reconnect!"); - try { - const res = await this.getMe(); - } catch (e) { - this._log.error(`Error while trying to reconnect`); - if (this._errorHandler) { - await this._errorHandler(e); - } - if (this._log.canSend(Logger_1.LogLevel.ERROR)) { - console.error(e); - } + /** + * Writes a message containing the given data into buffer. + * Returns the message id. + * @param buffer + * @param data + * @param contentRelated + * @param afterId + */ + async writeDataAsMessage(buffer, data, contentRelated, afterId) { + const msgId = this._getNewMsgId(); + const seqNo = this._getSeqNo(contentRelated); + let body; + if (!afterId) { + body = await core_1.GZIPPacked.gzipIfSmaller(contentRelated, data); + } else { + body = await core_1.GZIPPacked.gzipIfSmaller(contentRelated, new tl_1.Api.InvokeAfterMsg({ + msgId: afterId, + query: { + getBytes() { + return data; + } + } + }).getBytes()); } + const s = Buffer.alloc(4); + s.writeInt32LE(seqNo, 0); + const b = Buffer.alloc(4); + b.writeInt32LE(body.length, 0); + const m = (0, Helpers_1.toSignedLittleBuffer)(msgId, 8); + buffer.write(Buffer.concat([m, s, b])); + buffer.write(body); + return msgId; } - //region base methods - async connect() { - await this._initSession(); - if (this._sender === void 0) { - this._sender = new network_1.MTProtoSender(this.session.getAuthKey(), { - logger: this._log, - dcId: this.session.dcId || 4, - retries: this._connectionRetries, - delay: this._retryDelay, - autoReconnect: this._autoReconnect, - connectTimeout: this._timeout, - authKeyCallback: this._authKeyCallback.bind(this), - updateCallback: updates_1._handleUpdate.bind(this), - isMainSender: true, - client: this, - securityChecks: this._securityChecks, - autoReconnectCallback: this._handleReconnect.bind(this), - _exportedSenderPromises: this._exportedSenderPromises, - reconnectRetries: this._reconnectRetries - }); + /** + * Encrypts the given message data using the current authorization key + * following MTProto 2.0 guidelines core.telegram.org/mtproto/description. + * @param data + */ + async encryptMessageData(data) { + if (!this.authKey) { + throw new Error("Auth key unset"); } - const connection = new this._connection({ - ip: this.session.serverAddress, - port: this.useWSS ? 443 : 80, - dcId: this.session.dcId, - loggers: this._log, - proxy: this._proxy, - socket: this.networkSocket, - testServers: this.testServers - }); - if (!await this._sender.connect(connection, false)) { - if (!this._loopStarted) { - (0, updates_1._updateLoop)(this); - this._loopStarted = true; - } - return false; + await this.authKey.waitForKey(); + const authKey = this.authKey.getKey(); + if (!authKey) { + throw new Error("Auth key unset"); } - this.session.setAuthKey(this._sender.authKey); - this.session.save(); - this._initRequest.query = new tl_1.Api.help.GetConfig(); - this._log.info(`Using LAYER ${AllTLObjects_1.LAYER} for initial connect`); - await this._sender.send(new tl_1.Api.InvokeWithLayer({ - layer: AllTLObjects_1.LAYER, - query: this._initRequest - })); - if (!this._loopStarted) { - (0, updates_1._updateLoop)(this); - this._loopStarted = true; + if (!this.salt || !this.id || !authKey || !this.authKey.keyId) { + throw new Error("Unset params"); } - this._connectedDeferred.resolve(); - this._isSwitchingDc = false; - return true; - } - //endregion - // region Working with different connections/Data Centers - /** @hidden */ - async _switchDC(newDc) { - this._log.info(`Reconnecting to new data center ${newDc}`); - const DC = await this.getDC(newDc); - this.session.setDC(newDc, DC.ipAddress, DC.port); - await this._sender.authKey.setKey(void 0); - this.session.setAuthKey(void 0); - this.session.save(); - this._isSwitchingDc = true; - await this._disconnect(); - this._sender = void 0; - return await this.connect(); + const s = (0, Helpers_1.toSignedLittleBuffer)(this.salt, 8); + const i = (0, Helpers_1.toSignedLittleBuffer)(this.id, 8); + data = Buffer.concat([Buffer.concat([s, i]), data]); + const padding = __1.helpers.generateRandomBytes(__1.helpers.mod(-(data.length + 12), 16) + 12); + const msgKeyLarge = await (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(88, 88 + 32), data, padding])); + const msgKey = msgKeyLarge.slice(8, 24); + const { iv, key } = await this._calcKey(authKey, msgKey, true); + const keyId = __1.helpers.readBufferFromBigInt(this.authKey.keyId, 8); + return Buffer.concat([ + keyId, + msgKey, + new IGE_1.IGE(key, iv).encryptIge(Buffer.concat([data, padding])) + ]); } /** - * Returns the DC ip in case of node or the DC web address in case of browser.<br/> - * This will do an API request to fill the cache if it's the first time it's called. - * @param dcId The DC ID. - * @param downloadDC whether to use -1 DCs or not - * @param web if true this will get the web DCs. - * TODO, hardcode IPs. - * (These only support downloading/uploading and not creating a new AUTH key) + * Inverse of `encrypt_message_data` for incoming server messages. + * @param body */ - async getDC(dcId, downloadDC = false, web = false) { - this._log.debug(`Getting DC ${dcId}`); - if (!platform_1.isNode || web) { - switch (dcId) { - case 1: - return { - id: 1, - ipAddress: `pluto${downloadDC ? "-1" : ""}.web.telegram.org`, - port: 443 - }; - case 2: - return { - id: 2, - ipAddress: `venus${downloadDC ? "-1" : ""}.web.telegram.org`, - port: 443 - }; - case 3: - return { - id: 3, - ipAddress: `aurora${downloadDC ? "-1" : ""}.web.telegram.org`, - port: 443 - }; - case 4: - return { - id: 4, - ipAddress: `vesta${downloadDC ? "-1" : ""}.web.telegram.org`, - port: 443 - }; - case 5: - return { - id: 5, - ipAddress: `flora${downloadDC ? "-1" : ""}.web.telegram.org`, - port: 443 - }; - default: - throw new Error(`Cannot find the DC with the ID of ${dcId}`); - } + async decryptMessageData(body) { + if (!this.authKey) { + throw new Error("Auth key unset"); } - if (!this._config) { - this._config = await this.invoke(new tl_1.Api.help.GetConfig()); + if (body.length < 8) { + throw new errors_1.InvalidBufferError(body); } - for (const DC of this._config.dcOptions) { - if (DC.id === dcId && !!DC.ipv6 === this._useIPV6) { - return { - id: DC.id, - ipAddress: DC.ipAddress, - port: 443 - }; - } + const keyId = __1.helpers.readBigIntFromBuffer(body.slice(0, 8)); + if (!this.authKey.keyId || keyId.neq(this.authKey.keyId)) { + throw new errors_1.SecurityError("Server replied with an invalid auth key"); } - throw new Error(`Cannot find the DC with the ID of ${dcId}`); - } - /** @hidden */ - _removeSender(dcId) { - delete this._borrowedSenderPromises[dcId]; + const authKey = this.authKey.getKey(); + if (!authKey) { + throw new errors_1.SecurityError("Unset AuthKey"); + } + const msgKey = body.slice(8, 24); + const { iv, key } = await this._calcKey(authKey, msgKey, false); + body = new IGE_1.IGE(key, iv).decryptIge(body.slice(24)); + const ourKey = await (0, Helpers_1.sha256)(Buffer.concat([authKey.slice(96, 96 + 32), body])); + if (!msgKey.equals(ourKey.slice(8, 24))) { + throw new errors_1.SecurityError("Received msg_key doesn't match with expected one"); + } + const reader = new extensions_1.BinaryReader(body); + reader.readLong(); + const serverId = reader.readLong(); + if (serverId.neq(this.id)) { + } + const remoteMsgId = reader.readLong(); + if (this.msgIds.includes(remoteMsgId.toString()) && this.securityChecks) { + throw new errors_1.SecurityError("Duplicate msgIds"); + } + if (this.msgIds.length > 500) { + this.msgIds.shift(); + } + this.msgIds.push(remoteMsgId.toString()); + const remoteSequence = reader.readInt(); + reader.readInt(); + const obj = reader.tgReadObject(); + return new core_1.TLMessage(remoteMsgId, remoteSequence, obj); } - /** @hidden */ - _getResponseMessage(req, result, inputChat) { - return parseMethods._getResponseMessage(this, req, result, inputChat); + /** + * Generates a new unique message ID based on the current + * time (in ms) since epoch, applying a known time offset. + * @private + */ + _getNewMsgId() { + const now = (/* @__PURE__ */ new Date()).getTime() / 1e3 + this.timeOffset; + const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9); + let newMsgId = (0, big_integer_1.default)(Math.floor(now)).shiftLeft((0, big_integer_1.default)(32)).or((0, big_integer_1.default)(nanoseconds).shiftLeft((0, big_integer_1.default)(2))); + if (this._lastMsgId.greaterOrEquals(newMsgId)) { + newMsgId = this._lastMsgId.add((0, big_integer_1.default)(4)); + } + this._lastMsgId = newMsgId; + return newMsgId; } - /** @hidden */ - [inspect_1.inspect.custom]() { - return (0, Helpers_1.betterConsoleLog)(this); + /** + * Updates the time offset to the correct + * one given a known valid message ID. + * @param correctMsgId {BigInteger} + */ + updateTimeOffset(correctMsgId) { + const bad = this._getNewMsgId(); + const old = this.timeOffset; + const now = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3); + const correct = correctMsgId.shiftRight((0, big_integer_1.default)(32)).toJSNumber(); + this.timeOffset = correct - now; + if (this.timeOffset !== old) { + this._lastMsgId = big_integer_1.default.zero; + this._log.debug(`Updated time offset (old offset ${old}, bad ${bad}, good ${correctMsgId}, new ${this.timeOffset})`); + } + return this.timeOffset; } /** - * Small hack for using it in browsers + * Generates the next sequence number depending on whether + * it should be for a content-related query or not. + * @param contentRelated + * @private */ - static get events() { - return require_events(); + _getSeqNo(contentRelated) { + if (contentRelated) { + const result = this._sequence * 2 + 1; + this._sequence += 1; + return result; + } else { + return this._sequence * 2; + } } }; - exports2.TelegramClient = TelegramClient2; + exports2.MTProtoState = MTProtoState; } }); -// node_modules/telegram/Version.js -var require_Version = __commonJS({ - "node_modules/telegram/Version.js"(exports2) { +// node_modules/telegram/network/MTProtoPlainSender.js +var require_MTProtoPlainSender = __commonJS({ + "node_modules/telegram/network/MTProtoPlainSender.js"(exports2) { "use strict"; init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.version = void 0; - exports2.version = "2.26.21"; - } -}); - -// node_modules/telegram/client/index.js -var require_client = __commonJS({ - "node_modules/telegram/client/index.js"(exports2) { - "use strict"; - init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + exports2.MTProtoPlainSender = void 0; + var big_integer_1 = __importDefault2(require_BigInteger()); + var MTProtoState_1 = require_MTProtoState(); + var Helpers_1 = require_Helpers(); + var errors_1 = require_errors(); + var extensions_1 = require_extensions(); + var MTProtoPlainSender = class { + /** + * Initializes the MTProto plain sender. + * @param connection connection: the Connection to be used. + * @param loggers + */ + constructor(connection, loggers) { + this._state = new MTProtoState_1.MTProtoState(void 0, loggers); + this._connection = connection; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + /** + * Sends and receives the result for the given request. + * @param request + */ + async send(request) { + let body = request.getBytes(); + let msgId = this._state._getNewMsgId(); + const m = (0, Helpers_1.toSignedLittleBuffer)(msgId, 8); + const b = Buffer.alloc(4); + b.writeInt32LE(body.length, 0); + const res = Buffer.concat([ + Buffer.concat([Buffer.alloc(8), m, b]), + body + ]); + await this._connection.send(res); + body = await this._connection.recv(); + if (body.length < 8) { + throw new errors_1.InvalidBufferError(body); + } + const reader = new extensions_1.BinaryReader(body); + const authKeyId = reader.readLong(); + if (authKeyId.neq((0, big_integer_1.default)(0))) { + throw new Error("Bad authKeyId"); + } + msgId = reader.readLong(); + if (msgId.eq((0, big_integer_1.default)(0))) { + throw new Error("Bad msgId"); + } + const length = reader.readInt(); + if (length <= 0) { + throw new Error("Bad length"); + } + return reader.tgReadObject(); } - __setModuleDefault2(result, mod); - return result; }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.users = exports2.uploads = exports2.updates = exports2.tgClient = exports2.telegramBaseClient = exports2.message = exports2.messageParse = exports2.downloads = exports2.dialogs = exports2.chats = exports2.buttons = exports2.bots = exports2.auth = exports2.twoFA = void 0; - var twoFA = __importStar2(require_fa()); - exports2.twoFA = twoFA; - var auth = __importStar2(require_auth()); - exports2.auth = auth; - var bots = __importStar2(require_bots()); - exports2.bots = bots; - var buttons = __importStar2(require_buttons()); - exports2.buttons = buttons; - var chats = __importStar2(require_chats()); - exports2.chats = chats; - var dialogs = __importStar2(require_dialogs()); - exports2.dialogs = dialogs; - var downloads = __importStar2(require_downloads()); - exports2.downloads = downloads; - var messageParse = __importStar2(require_messageParse()); - exports2.messageParse = messageParse; - var message = __importStar2(require_messages2()); - exports2.message = message; - var telegramBaseClient = __importStar2(require_telegramBaseClient()); - exports2.telegramBaseClient = telegramBaseClient; - var tgClient = __importStar2(require_TelegramClient()); - exports2.tgClient = tgClient; - var updates = __importStar2(require_updates()); - exports2.updates = updates; - var uploads = __importStar2(require_uploads()); - exports2.uploads = uploads; - var users = __importStar2(require_users()); - exports2.users = users; + exports2.MTProtoPlainSender = MTProtoPlainSender; } }); -// node_modules/telegram/index.js -var require_telegram = __commonJS({ - "node_modules/telegram/index.js"(exports2) { +// node_modules/telegram/crypto/Factorizator.js +var require_Factorizator = __commonJS({ + "node_modules/telegram/crypto/Factorizator.js"(exports2) { "use strict"; init_define_import_meta_env(); - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.client = exports2.password = exports2.tl = exports2.helpers = exports2.extensions = exports2.sessions = exports2.errors = exports2.utils = exports2.Logger = exports2.version = exports2.Connection = exports2.TelegramClient = exports2.Api = void 0; - var tl_1 = require_tl(); - Object.defineProperty(exports2, "Api", { enumerable: true, get: function() { - return tl_1.Api; - } }); - var tl = __importStar2(require_tl()); - exports2.tl = tl; - var TelegramClient_1 = require_TelegramClient(); - Object.defineProperty(exports2, "TelegramClient", { enumerable: true, get: function() { - return TelegramClient_1.TelegramClient; - } }); - var network_1 = require_network(); - Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { - return network_1.Connection; - } }); - var Version_1 = require_Version(); - Object.defineProperty(exports2, "version", { enumerable: true, get: function() { - return Version_1.version; - } }); - var Logger_1 = require_Logger(); - Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { - return Logger_1.Logger; - } }); - var utils = __importStar2(require_Utils()); - exports2.utils = utils; - var errors = __importStar2(require_errors()); - exports2.errors = errors; - var sessions = __importStar2(require_sessions()); - exports2.sessions = sessions; - var extensions = __importStar2(require_extensions()); - exports2.extensions = extensions; - var helpers = __importStar2(require_Helpers()); - exports2.helpers = helpers; - var client2 = __importStar2(require_client()); - exports2.client = client2; - var password = __importStar2(require_Password()); - exports2.password = password; + exports2.Factorizator = void 0; + var big_integer_1 = __importDefault2(require_BigInteger()); + var Helpers_1 = require_Helpers(); + var Factorizator = class _Factorizator { + /** + * Calculates the greatest common divisor + * @param a {BigInteger} + * @param b {BigInteger} + * @returns {BigInteger} + */ + static gcd(a, b) { + while (b.neq(big_integer_1.default.zero)) { + const temp = b; + b = a.remainder(b); + a = temp; + } + return a; + } + /** + * Factorizes the given number and returns both the divisor and the number divided by the divisor + * @param pq {BigInteger} + * @returns {{p: *, q: *}} + */ + static factorize(pq) { + if (pq.remainder(2).equals(big_integer_1.default.zero)) { + return { p: (0, big_integer_1.default)(2), q: pq.divide((0, big_integer_1.default)(2)) }; + } + let y = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); + const c = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); + const m = big_integer_1.default.randBetween((0, big_integer_1.default)(1), pq.minus(1)); + let g = big_integer_1.default.one; + let r = big_integer_1.default.one; + let q = big_integer_1.default.one; + let x = big_integer_1.default.zero; + let ys = big_integer_1.default.zero; + let k; + while (g.eq(big_integer_1.default.one)) { + x = y; + for (let i = 0; (0, big_integer_1.default)(i).lesser(r); i++) { + y = (0, Helpers_1.modExp)(y, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); + } + k = big_integer_1.default.zero; + while (k.lesser(r) && g.eq(big_integer_1.default.one)) { + ys = y; + const condition = big_integer_1.default.min(m, r.minus(k)); + for (let i = 0; (0, big_integer_1.default)(i).lesser(condition); i++) { + y = (0, Helpers_1.modExp)(y, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); + q = q.multiply(x.minus(y).abs()).remainder(pq); + } + g = _Factorizator.gcd(q, pq); + k = k.add(m); + } + r = r.multiply(2); + } + if (g.eq(pq)) { + while (true) { + ys = (0, Helpers_1.modExp)(ys, (0, big_integer_1.default)(2), pq).add(c).remainder(pq); + g = _Factorizator.gcd(x.minus(ys).abs(), pq); + if (g.greater(1)) { + break; + } + } + } + const p = g; + q = pq.divide(g); + return p < q ? { p, q } : { p: q, q: p }; + } + }; + exports2.Factorizator = Factorizator; } }); -// server.ts -init_define_import_meta_env(); -var import_express = __toESM(require_express2()); -var import_path = __toESM(require("path")); -var import_crypto2 = __toESM(require("crypto")); - -// node_modules/linkedom/esm/index.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/dom/parser.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/symbols.js -init_define_import_meta_env(); -var CHANGED = /* @__PURE__ */ Symbol("changed"); -var CLASS_LIST = /* @__PURE__ */ Symbol("classList"); -var CUSTOM_ELEMENTS = /* @__PURE__ */ Symbol("CustomElements"); -var CONTENT = /* @__PURE__ */ Symbol("content"); -var DATASET = /* @__PURE__ */ Symbol("dataset"); -var DOCTYPE = /* @__PURE__ */ Symbol("doctype"); -var DOM_PARSER = /* @__PURE__ */ Symbol("DOMParser"); -var END = /* @__PURE__ */ Symbol("end"); -var EVENT_TARGET = /* @__PURE__ */ Symbol("EventTarget"); -var GLOBALS = /* @__PURE__ */ Symbol("globals"); -var IMAGE = /* @__PURE__ */ Symbol("image"); -var MIME = /* @__PURE__ */ Symbol("mime"); -var MUTATION_OBSERVER = /* @__PURE__ */ Symbol("MutationObserver"); -var NEXT = /* @__PURE__ */ Symbol("next"); -var OWNER_ELEMENT = /* @__PURE__ */ Symbol("ownerElement"); -var PREV = /* @__PURE__ */ Symbol("prev"); -var PRIVATE = /* @__PURE__ */ Symbol("private"); -var SHEET = /* @__PURE__ */ Symbol("sheet"); -var START = /* @__PURE__ */ Symbol("start"); -var STYLE = /* @__PURE__ */ Symbol("style"); -var UPGRADE = /* @__PURE__ */ Symbol("upgrade"); -var VALUE = /* @__PURE__ */ Symbol("value"); - -// node_modules/linkedom/esm/shared/parse-from-string.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/dist/esm/index.js -var esm_exports3 = {}; -__export(esm_exports3, { - DefaultHandler: () => DomHandler, - DomHandler: () => DomHandler, - DomUtils: () => esm_exports2, - ElementType: () => esm_exports, - Parser: () => Parser, - QuoteType: () => QuoteType, - Tokenizer: () => Tokenizer, - createDocumentStream: () => createDocumentStream, - createDomStream: () => createDomStream, - getFeed: () => getFeed, - parseDOM: () => parseDOM, - parseDocument: () => parseDocument, - parseFeed: () => parseFeed -}); -init_define_import_meta_env(); - -// node_modules/htmlparser2/dist/esm/Parser.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/dist/esm/Tokenizer.js -init_define_import_meta_env(); - -// node_modules/entities/dist/esm/decode.js -init_define_import_meta_env(); - -// node_modules/entities/dist/esm/decode-codepoint.js -init_define_import_meta_env(); -var _a; -var decodeMap = /* @__PURE__ */ new Map([ - [0, 65533], - // C1 Unicode control character reference replacements - [128, 8364], - [130, 8218], - [131, 402], - [132, 8222], - [133, 8230], - [134, 8224], - [135, 8225], - [136, 710], - [137, 8240], - [138, 352], - [139, 8249], - [140, 338], - [142, 381], - [145, 8216], - [146, 8217], - [147, 8220], - [148, 8221], - [149, 8226], - [150, 8211], - [151, 8212], - [152, 732], - [153, 8482], - [154, 353], - [155, 8250], - [156, 339], - [158, 382], - [159, 376] -]); -var fromCodePoint = ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins - (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => { - let output = ""; - if (codePoint > 65535) { - codePoint -= 65536; - output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - output += String.fromCharCode(codePoint); - return output; - }) -); -function replaceCodePoint(codePoint) { - var _a3; - if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { - return 65533; - } - return (_a3 = decodeMap.get(codePoint)) !== null && _a3 !== void 0 ? _a3 : codePoint; -} - -// node_modules/entities/dist/esm/generated/decode-data-html.js -init_define_import_meta_env(); - -// node_modules/entities/dist/esm/internal/decode-shared.js -init_define_import_meta_env(); -function decodeBase64(input) { - const binary = ( - // eslint-disable-next-line n/no-unsupported-features/node-builtins - typeof atob === "function" ? ( - // Browser (and Node >=16) - // eslint-disable-next-line n/no-unsupported-features/node-builtins - atob(input) - ) : ( - // Older Node versions (<16) - // eslint-disable-next-line n/no-unsupported-features/node-builtins - typeof Buffer.from === "function" ? ( - // eslint-disable-next-line n/no-unsupported-features/node-builtins - Buffer.from(input, "base64").toString("binary") - ) : ( - // eslint-disable-next-line unicorn/no-new-buffer, n/no-deprecated-api - new Buffer(input, "base64").toString("binary") - ) - ) - ); - const evenLength = binary.length & ~1; - const out = new Uint16Array(evenLength / 2); - for (let index2 = 0, outIndex = 0; index2 < evenLength; index2 += 2) { - const lo = binary.charCodeAt(index2); - const hi = binary.charCodeAt(index2 + 1); - out[outIndex++] = lo | hi << 8; - } - return out; -} - -// node_modules/entities/dist/esm/generated/decode-data-html.js -var htmlDecodeTree = /* @__PURE__ */ decodeBase64("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg"); - -// node_modules/entities/dist/esm/generated/decode-data-xml.js -init_define_import_meta_env(); -var xmlDecodeTree = /* @__PURE__ */ decodeBase64("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg"); - -// node_modules/entities/dist/esm/internal/bin-trie-flags.js -init_define_import_meta_env(); -var BinTrieFlags; -(function(BinTrieFlags3) { - BinTrieFlags3[BinTrieFlags3["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH"; - BinTrieFlags3[BinTrieFlags3["FLAG13"] = 8192] = "FLAG13"; - BinTrieFlags3[BinTrieFlags3["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH"; - BinTrieFlags3[BinTrieFlags3["JUMP_TABLE"] = 127] = "JUMP_TABLE"; -})(BinTrieFlags || (BinTrieFlags = {})); - -// node_modules/entities/dist/esm/decode.js -var CharCodes; -(function(CharCodes4) { - CharCodes4[CharCodes4["NUM"] = 35] = "NUM"; - CharCodes4[CharCodes4["SEMI"] = 59] = "SEMI"; - CharCodes4[CharCodes4["EQUALS"] = 61] = "EQUALS"; - CharCodes4[CharCodes4["ZERO"] = 48] = "ZERO"; - CharCodes4[CharCodes4["NINE"] = 57] = "NINE"; - CharCodes4[CharCodes4["LOWER_A"] = 97] = "LOWER_A"; - CharCodes4[CharCodes4["LOWER_F"] = 102] = "LOWER_F"; - CharCodes4[CharCodes4["LOWER_X"] = 120] = "LOWER_X"; - CharCodes4[CharCodes4["LOWER_Z"] = 122] = "LOWER_Z"; - CharCodes4[CharCodes4["UPPER_A"] = 65] = "UPPER_A"; - CharCodes4[CharCodes4["UPPER_F"] = 70] = "UPPER_F"; - CharCodes4[CharCodes4["UPPER_Z"] = 90] = "UPPER_Z"; -})(CharCodes || (CharCodes = {})); -var TO_LOWER_BIT = 32; -function isNumber(code) { - return code >= CharCodes.ZERO && code <= CharCodes.NINE; -} -function isHexadecimalCharacter(code) { - return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F; -} -function isAsciiAlphaNumeric(code) { - return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code); -} -function isEntityInAttributeInvalidEnd(code) { - return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code); -} -var EntityDecoderState; -(function(EntityDecoderState3) { - EntityDecoderState3[EntityDecoderState3["EntityStart"] = 0] = "EntityStart"; - EntityDecoderState3[EntityDecoderState3["NumericStart"] = 1] = "NumericStart"; - EntityDecoderState3[EntityDecoderState3["NumericDecimal"] = 2] = "NumericDecimal"; - EntityDecoderState3[EntityDecoderState3["NumericHex"] = 3] = "NumericHex"; - EntityDecoderState3[EntityDecoderState3["NamedEntity"] = 4] = "NamedEntity"; -})(EntityDecoderState || (EntityDecoderState = {})); -var DecodingMode; -(function(DecodingMode3) { - DecodingMode3[DecodingMode3["Legacy"] = 0] = "Legacy"; - DecodingMode3[DecodingMode3["Strict"] = 1] = "Strict"; - DecodingMode3[DecodingMode3["Attribute"] = 2] = "Attribute"; -})(DecodingMode || (DecodingMode = {})); -var EntityDecoder = class { - constructor(decodeTree, emitCodePoint, errors) { - this.decodeTree = decodeTree; - this.emitCodePoint = emitCodePoint; - this.errors = errors; - this.state = EntityDecoderState.EntityStart; - this.consumed = 1; - this.result = 0; - this.treeIndex = 0; - this.excess = 1; - this.decodeMode = DecodingMode.Strict; - this.runConsumed = 0; - } - /** Resets the instance to make it reusable. */ - startEntity(decodeMode) { - this.decodeMode = decodeMode; - this.state = EntityDecoderState.EntityStart; - this.result = 0; - this.treeIndex = 0; - this.excess = 1; - this.consumed = 1; - this.runConsumed = 0; - } - /** - * Write an entity to the decoder. This can be called multiple times with partial entities. - * If the entity is incomplete, the decoder will return -1. - * - * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the - * entity is incomplete, and resume when the next string is written. - * - * @param input The string containing the entity (or a continuation of the entity). - * @param offset The offset at which the entity begins. Should be 0 if this is not the first call. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - write(input, offset) { - switch (this.state) { - case EntityDecoderState.EntityStart: { - if (input.charCodeAt(offset) === CharCodes.NUM) { - this.state = EntityDecoderState.NumericStart; - this.consumed += 1; - return this.stateNumericStart(input, offset + 1); +// node_modules/telegram/crypto/RSA.js +var require_RSA = __commonJS({ + "node_modules/telegram/crypto/RSA.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __rest2 = exports2 && exports2.__rest || function(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; } - this.state = EntityDecoderState.NamedEntity; - return this.stateNamedEntity(input, offset); - } - case EntityDecoderState.NumericStart: { - return this.stateNumericStart(input, offset); - } - case EntityDecoderState.NumericDecimal: { - return this.stateNumericDecimal(input, offset); - } - case EntityDecoderState.NumericHex: { - return this.stateNumericHex(input, offset); + return t; + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._serverKeys = void 0; + exports2.encrypt = encrypt2; + var big_integer_1 = __importDefault2(require_BigInteger()); + var Helpers_1 = require_Helpers(); + var PUBLIC_KEYS = [ + { + fingerprint: (0, big_integer_1.default)("-3414540481677951611"), + n: (0, big_integer_1.default)("29379598170669337022986177149456128565388431120058863768162556424047512191330847455146576344487764408661701890505066208632169112269581063774293102577308490531282748465986139880977280302242772832972539403531316010870401287642763009136156734339538042419388722777357134487746169093539093850251243897188928735903389451772730245253062963384108812842079887538976360465290946139638691491496062099570836476454855996319192747663615955633778034897140982517446405334423701359108810182097749467210509584293428076654573384828809574217079944388301239431309115013843331317877374435868468779972014486325557807783825502498215169806323"), + e: 65537 + }, + { + fingerprint: (0, big_integer_1.default)("-5595554452916591101"), + n: (0, big_integer_1.default)("25342889448840415564971689590713473206898847759084779052582026594546022463853940585885215951168491965708222649399180603818074200620463776135424884632162512403163793083921641631564740959529419359595852941166848940585952337613333022396096584117954892216031229237302943701877588456738335398602461675225081791820393153757504952636234951323237820036543581047826906120927972487366805292115792231423684261262330394324750785450942589751755390156647751460719351439969059949569615302809050721500330239005077889855323917509948255722081644689442127297605422579707142646660768825302832201908302295573257427896031830742328565032949"), + e: 65537 } - case EntityDecoderState.NamedEntity: { - return this.stateNamedEntity(input, offset); + ]; + exports2._serverKeys = /* @__PURE__ */ new Map(); + PUBLIC_KEYS.forEach((_a) => { + var { fingerprint } = _a, keyInfo = __rest2(_a, ["fingerprint"]); + exports2._serverKeys.set(fingerprint.toString(), keyInfo); + }); + async function encrypt2(fingerprint, data) { + const key = exports2._serverKeys.get(fingerprint.toString()); + if (!key) { + return void 0; } + const rand = (0, Helpers_1.generateRandomBytes)(235 - data.length); + const toEncrypt = Buffer.concat([await (0, Helpers_1.sha1)(data), data, rand]); + const payload = (0, Helpers_1.readBigIntFromBuffer)(toEncrypt, false); + const encrypted = (0, Helpers_1.modExp)(payload, (0, big_integer_1.default)(key.e), key.n); + return (0, Helpers_1.readBufferFromBigInt)(encrypted, 256, false); } } - /** - * Switches between the numeric decimal and hexadecimal states. - * - * Equivalent to the `Numeric character reference state` in the HTML spec. - * - * @param input The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericStart(input, offset) { - if (offset >= input.length) { - return -1; - } - if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) { - this.state = EntityDecoderState.NumericHex; - this.consumed += 1; - return this.stateNumericHex(input, offset + 1); - } - this.state = EntityDecoderState.NumericDecimal; - return this.stateNumericDecimal(input, offset); - } - /** - * Parses a hexadecimal numeric entity. - * - * Equivalent to the `Hexademical character reference state` in the HTML spec. - * - * @param input The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericHex(input, offset) { - while (offset < input.length) { - const char = input.charCodeAt(offset); - if (isNumber(char) || isHexadecimalCharacter(char)) { - const digit = char <= CharCodes.NINE ? char - CharCodes.ZERO : (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10; - this.result = this.result * 16 + digit; - this.consumed++; - offset++; - } else { - return this.emitNumericEntity(char, 3); +}); + +// node_modules/telegram/network/Authenticator.js +var require_Authenticator = __commonJS({ + "node_modules/telegram/network/Authenticator.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.doAuthentication = doAuthentication; + var Helpers_1 = require_Helpers(); + var tl_1 = require_tl(); + var errors_1 = require_errors(); + var Factorizator_1 = require_Factorizator(); + var RSA_1 = require_RSA(); + var IGE_1 = require_IGE(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var extensions_1 = require_extensions(); + var AuthKey_1 = require_AuthKey(); + var RETRIES = 20; + async function doAuthentication(sender, log) { + let bytes = (0, Helpers_1.generateRandomBytes)(16); + const nonce = (0, Helpers_1.readBigIntFromBuffer)(bytes, false, true); + const resPQ = await sender.send(new tl_1.Api.ReqPqMulti({ nonce })); + log.debug("Starting authKey generation step 1"); + if (!(resPQ instanceof tl_1.Api.ResPQ)) { + throw new errors_1.SecurityError(`Step 1 answer was ${resPQ}`); } - } - return -1; - } - /** - * Parses a decimal numeric entity. - * - * Equivalent to the `Decimal character reference state` in the HTML spec. - * - * @param input The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericDecimal(input, offset) { - while (offset < input.length) { - const char = input.charCodeAt(offset); - if (isNumber(char)) { - this.result = this.result * 10 + (char - CharCodes.ZERO); - this.consumed++; - offset++; - } else { - return this.emitNumericEntity(char, 2); + if (resPQ.nonce.neq(nonce)) { + throw new errors_1.SecurityError("Step 1 invalid nonce from server"); } - } - return -1; - } - /** - * Validate and emit a numeric entity. - * - * Implements the logic from the `Hexademical character reference start - * state` and `Numeric character reference end state` in the HTML spec. - * - * @param lastCp The last code point of the entity. Used to see if the - * entity was terminated with a semicolon. - * @param expectedLength The minimum number of characters that should be - * consumed. Used to validate that at least one digit - * was consumed. - * @returns The number of characters that were consumed. - */ - emitNumericEntity(lastCp, expectedLength) { - var _a3; - if (this.consumed <= expectedLength) { - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.absenceOfDigitsInNumericCharacterReference(this.consumed); - return 0; - } - if (lastCp === CharCodes.SEMI) { - this.consumed += 1; - } else if (this.decodeMode === DecodingMode.Strict) { - return 0; - } - this.emitCodePoint(replaceCodePoint(this.result), this.consumed); - if (this.errors) { - if (lastCp !== CharCodes.SEMI) { - this.errors.missingSemicolonAfterCharacterReference(); + const pq = (0, Helpers_1.readBigIntFromBuffer)(resPQ.pq, false, true); + log.debug("Finished authKey generation step 1"); + const { p, q } = Factorizator_1.Factorizator.factorize(pq); + const pBuffer = (0, Helpers_1.getByteArray)(p); + const qBuffer = (0, Helpers_1.getByteArray)(q); + bytes = (0, Helpers_1.generateRandomBytes)(32); + const newNonce = (0, Helpers_1.readBigIntFromBuffer)(bytes, true, true); + const pqInnerData = new tl_1.Api.PQInnerData({ + pq: (0, Helpers_1.getByteArray)(pq), + // unsigned + p: pBuffer, + q: qBuffer, + nonce: resPQ.nonce, + serverNonce: resPQ.serverNonce, + newNonce + }).getBytes(); + if (pqInnerData.length > 144) { + throw new errors_1.SecurityError("Step 1 invalid nonce from server"); } - this.errors.validateNumericCharacterReference(this.result); - } - return this.consumed; - } - /** - * Parses a named entity. - * - * Equivalent to the `Named character reference state` in the HTML spec. - * - * @param input The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNamedEntity(input, offset) { - const { decodeTree } = this; - let current = decodeTree[this.treeIndex]; - let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14; - while (offset < input.length) { - if (valueLength === 0 && (current & BinTrieFlags.FLAG13) !== 0) { - const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; - if (this.runConsumed === 0) { - const firstChar = current & BinTrieFlags.JUMP_TABLE; - if (input.charCodeAt(offset) !== firstChar) { - return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity(); - } - offset++; - this.excess++; - this.runConsumed++; - } - while (this.runConsumed < runLength) { - if (offset >= input.length) { - return -1; - } - const charIndexInPacked = this.runConsumed - 1; - const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)]; - const expectedChar = charIndexInPacked % 2 === 0 ? packedWord & 255 : packedWord >> 8 & 255; - if (input.charCodeAt(offset) !== expectedChar) { - this.runConsumed = 0; - return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity(); - } - offset++; - this.excess++; - this.runConsumed++; + let targetFingerprint; + let targetKey; + for (const fingerprint of resPQ.serverPublicKeyFingerprints) { + targetKey = RSA_1._serverKeys.get(fingerprint.toString()); + if (targetKey !== void 0) { + targetFingerprint = fingerprint; + break; } - this.runConsumed = 0; - this.treeIndex += 1 + (runLength >> 1); - current = decodeTree[this.treeIndex]; - valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14; } - if (offset >= input.length) + if (targetFingerprint === void 0 || targetKey === void 0) { + throw new errors_1.SecurityError("Step 2 could not find a valid key for fingerprints"); + } + const padding = (0, Helpers_1.generateRandomBytes)(192 - pqInnerData.length); + const dataWithPadding = Buffer.concat([pqInnerData, padding]); + const dataPadReversed = Buffer.from(dataWithPadding).reverse(); + let encryptedData; + for (let i = 0; i < RETRIES; i++) { + const tempKey = (0, Helpers_1.generateRandomBytes)(32); + const shaDigestKeyWithData = await (0, Helpers_1.sha256)(Buffer.concat([tempKey, dataWithPadding])); + const dataWithHash = Buffer.concat([ + dataPadReversed, + shaDigestKeyWithData + ]); + const ige2 = new IGE_1.IGE(tempKey, Buffer.alloc(32)); + const aesEncrypted = ige2.encryptIge(dataWithHash); + const tempKeyXor = (0, Helpers_1.bufferXor)(tempKey, await (0, Helpers_1.sha256)(aesEncrypted)); + const keyAesEncrypted = Buffer.concat([tempKeyXor, aesEncrypted]); + const keyAesEncryptedInt = (0, Helpers_1.readBigIntFromBuffer)(keyAesEncrypted, false, false); + if (keyAesEncryptedInt.greaterOrEquals(targetKey.n)) { + log.debug("Aes key greater than RSA. retrying"); + continue; + } + const encryptedDataBuffer = (0, Helpers_1.modExp)(keyAesEncryptedInt, (0, big_integer_1.default)(targetKey.e), targetKey.n); + encryptedData = (0, Helpers_1.readBufferFromBigInt)(encryptedDataBuffer, 256, false, false); break; - const char = input.charCodeAt(offset); - if (char === CharCodes.SEMI && valueLength !== 0 && (current & BinTrieFlags.FLAG13) !== 0) { - return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); } - this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char); - if (this.treeIndex < 0) { - return this.result === 0 || // If we are parsing an attribute - this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity, - (valueLength === 0 || // And there should be no invalid characters. - isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity(); + if (encryptedData === void 0) { + throw new errors_1.SecurityError("Step 2 could create a secure encrypted key"); } - current = decodeTree[this.treeIndex]; - valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14; - if (valueLength !== 0) { - if (char === CharCodes.SEMI) { - return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); - } - if (this.decodeMode !== DecodingMode.Strict && (current & BinTrieFlags.FLAG13) === 0) { - this.result = this.treeIndex; - this.consumed += this.excess; - this.excess = 0; + log.debug("Step 2 : Generated a secure aes encrypted data"); + const serverDhParams = await sender.send(new tl_1.Api.ReqDHParams({ + nonce: resPQ.nonce, + serverNonce: resPQ.serverNonce, + p: pBuffer, + q: qBuffer, + publicKeyFingerprint: targetFingerprint, + encryptedData + })); + if (!(serverDhParams instanceof tl_1.Api.ServerDHParamsOk || serverDhParams instanceof tl_1.Api.ServerDHParamsFail)) { + throw new Error(`Step 2.1 answer was ${serverDhParams}`); + } + if (serverDhParams.nonce.neq(resPQ.nonce)) { + throw new errors_1.SecurityError("Step 2 invalid nonce from server"); + } + if (serverDhParams.serverNonce.neq(resPQ.serverNonce)) { + throw new errors_1.SecurityError("Step 2 invalid server nonce from server"); + } + if (serverDhParams instanceof tl_1.Api.ServerDHParamsFail) { + const sh = await (0, Helpers_1.sha1)((0, Helpers_1.toSignedLittleBuffer)(newNonce, 32).slice(4, 20)); + const nnh = (0, Helpers_1.readBigIntFromBuffer)(sh, true, true); + if (serverDhParams.newNonceHash.neq(nnh)) { + throw new errors_1.SecurityError("Step 2 invalid DH fail nonce from server"); } } - offset++; - this.excess++; - } - return -1; - } - /** - * Emit a named entity that was not terminated with a semicolon. - * - * @returns The number of characters consumed. - */ - emitNotTerminatedNamedEntity() { - var _a3; - const { result, decodeTree } = this; - const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14; - this.emitNamedEntityData(result, valueLength, this.consumed); - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.missingSemicolonAfterCharacterReference(); - return this.consumed; - } - /** - * Emit a named entity. - * - * @param result The index of the entity in the decode tree. - * @param valueLength The number of bytes in the entity. - * @param consumed The number of characters consumed. - * - * @returns The number of characters consumed. - */ - emitNamedEntityData(result, valueLength, consumed) { - const { decodeTree } = this; - this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~(BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13) : decodeTree[result + 1], consumed); - if (valueLength === 3) { - this.emitCodePoint(decodeTree[result + 2], consumed); - } - return consumed; - } - /** - * Signal to the parser that the end of the input was reached. - * - * Remaining data will be emitted and relevant errors will be produced. - * - * @returns The number of characters consumed. - */ - end() { - var _a3; - switch (this.state) { - case EntityDecoderState.NamedEntity: { - return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0; - } - // Otherwise, emit a numeric entity if we have one. - case EntityDecoderState.NumericDecimal: { - return this.emitNumericEntity(0, 2); - } - case EntityDecoderState.NumericHex: { - return this.emitNumericEntity(0, 3); - } - case EntityDecoderState.NumericStart: { - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.absenceOfDigitsInNumericCharacterReference(this.consumed); - return 0; + if (!(serverDhParams instanceof tl_1.Api.ServerDHParamsOk)) { + throw new Error(`Step 2.2 answer was ${serverDhParams}`); } - case EntityDecoderState.EntityStart: { - return 0; + log.debug("Finished authKey generation step 2"); + log.debug("Starting authKey generation step 3"); + const { key, iv } = await (0, Helpers_1.generateKeyDataFromNonce)(resPQ.serverNonce, newNonce); + if (serverDhParams.encryptedAnswer.length % 16 !== 0) { + throw new errors_1.SecurityError("Step 3 AES block size mismatch"); } + const ige = new IGE_1.IGE(key, iv); + const plainTextAnswer = ige.decryptIge(serverDhParams.encryptedAnswer); + const reader = new extensions_1.BinaryReader(plainTextAnswer); + reader.read(20); + const serverDhInner = reader.tgReadObject(); + if (!(serverDhInner instanceof tl_1.Api.ServerDHInnerData)) { + throw new Error(`Step 3 answer was ${serverDhInner}`); + } + if (serverDhInner.nonce.neq(resPQ.nonce)) { + throw new errors_1.SecurityError("Step 3 Invalid nonce in encrypted answer"); + } + if (serverDhInner.serverNonce.neq(resPQ.serverNonce)) { + throw new errors_1.SecurityError("Step 3 Invalid server nonce in encrypted answer"); + } + const dhPrime = (0, Helpers_1.readBigIntFromBuffer)(serverDhInner.dhPrime, false, false); + const ga = (0, Helpers_1.readBigIntFromBuffer)(serverDhInner.gA, false, false); + const timeOffset = serverDhInner.serverTime - Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3); + const b = (0, Helpers_1.readBigIntFromBuffer)((0, Helpers_1.generateRandomBytes)(256), false, false); + const gb = (0, Helpers_1.modExp)((0, big_integer_1.default)(serverDhInner.g), b, dhPrime); + const gab = (0, Helpers_1.modExp)(ga, b, dhPrime); + const clientDhInner = new tl_1.Api.ClientDHInnerData({ + nonce: resPQ.nonce, + serverNonce: resPQ.serverNonce, + retryId: big_integer_1.default.zero, + // TODO Actual retry ID + gB: (0, Helpers_1.getByteArray)(gb, false) + }).getBytes(); + const clientDdhInnerHashed = Buffer.concat([ + await (0, Helpers_1.sha1)(clientDhInner), + clientDhInner + ]); + const clientDhEncrypted = ige.encryptIge(clientDdhInnerHashed); + const dhGen = await sender.send(new tl_1.Api.SetClientDHParams({ + nonce: resPQ.nonce, + serverNonce: resPQ.serverNonce, + encryptedData: clientDhEncrypted + })); + const nonceTypes = [tl_1.Api.DhGenOk, tl_1.Api.DhGenRetry, tl_1.Api.DhGenFail]; + const nonceTypesString = ["DhGenOk", "DhGenRetry", "DhGenFail"]; + if (!(dhGen instanceof nonceTypes[0] || dhGen instanceof nonceTypes[1] || dhGen instanceof nonceTypes[2])) { + throw new Error(`Step 3.1 answer was ${dhGen}`); + } + const { name } = dhGen.constructor; + if (dhGen.nonce.neq(resPQ.nonce)) { + throw new errors_1.SecurityError(`Step 3 invalid ${name} nonce from server`); + } + if (dhGen.serverNonce.neq(resPQ.serverNonce)) { + throw new errors_1.SecurityError(`Step 3 invalid ${name} server nonce from server`); + } + const authKey = new AuthKey_1.AuthKey(); + await authKey.setKey((0, Helpers_1.getByteArray)(gab)); + const nonceNumber = 1 + nonceTypesString.indexOf(dhGen.className); + const newNonceHash = await authKey.calcNewNonceHash(newNonce, nonceNumber); + const dhHash = dhGen[`newNonceHash${nonceNumber}`]; + if (dhHash.neq(newNonceHash)) { + throw new errors_1.SecurityError("Step 3 invalid new nonce hash"); + } + if (!(dhGen instanceof tl_1.Api.DhGenOk)) { + throw new Error(`Step 3.2 answer was ${dhGen}`); + } + log.debug("Finished authKey generation step 3"); + return { authKey, timeOffset }; } } -}; -function determineBranch(decodeTree, current, nodeIndex, char) { - const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; - const jumpOffset = current & BinTrieFlags.JUMP_TABLE; - if (branchCount === 0) { - return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1; - } - if (jumpOffset) { - const value = char - jumpOffset; - return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIndex + value] - 1; - } - const packedKeySlots = branchCount + 1 >> 1; - let lo = 0; - let hi = branchCount - 1; - while (lo <= hi) { - const mid = lo + hi >>> 1; - const slot = mid >> 1; - const packed = decodeTree[nodeIndex + slot]; - const midKey = packed >> (mid & 1) * 8 & 255; - if (midKey < char) { - lo = mid + 1; - } else if (midKey > char) { - hi = mid - 1; - } else { - return decodeTree[nodeIndex + packedKeySlots + mid]; - } - } - return -1; -} +}); -// node_modules/htmlparser2/dist/esm/Tokenizer.js -var CharCodes2; -(function(CharCodes4) { - CharCodes4[CharCodes4["Tab"] = 9] = "Tab"; - CharCodes4[CharCodes4["NewLine"] = 10] = "NewLine"; - CharCodes4[CharCodes4["FormFeed"] = 12] = "FormFeed"; - CharCodes4[CharCodes4["CarriageReturn"] = 13] = "CarriageReturn"; - CharCodes4[CharCodes4["Space"] = 32] = "Space"; - CharCodes4[CharCodes4["ExclamationMark"] = 33] = "ExclamationMark"; - CharCodes4[CharCodes4["Number"] = 35] = "Number"; - CharCodes4[CharCodes4["Amp"] = 38] = "Amp"; - CharCodes4[CharCodes4["SingleQuote"] = 39] = "SingleQuote"; - CharCodes4[CharCodes4["DoubleQuote"] = 34] = "DoubleQuote"; - CharCodes4[CharCodes4["Dash"] = 45] = "Dash"; - CharCodes4[CharCodes4["Slash"] = 47] = "Slash"; - CharCodes4[CharCodes4["Zero"] = 48] = "Zero"; - CharCodes4[CharCodes4["Nine"] = 57] = "Nine"; - CharCodes4[CharCodes4["Semi"] = 59] = "Semi"; - CharCodes4[CharCodes4["Lt"] = 60] = "Lt"; - CharCodes4[CharCodes4["Eq"] = 61] = "Eq"; - CharCodes4[CharCodes4["Gt"] = 62] = "Gt"; - CharCodes4[CharCodes4["Questionmark"] = 63] = "Questionmark"; - CharCodes4[CharCodes4["UpperA"] = 65] = "UpperA"; - CharCodes4[CharCodes4["LowerA"] = 97] = "LowerA"; - CharCodes4[CharCodes4["UpperF"] = 70] = "UpperF"; - CharCodes4[CharCodes4["LowerF"] = 102] = "LowerF"; - CharCodes4[CharCodes4["UpperZ"] = 90] = "UpperZ"; - CharCodes4[CharCodes4["LowerZ"] = 122] = "LowerZ"; - CharCodes4[CharCodes4["LowerX"] = 120] = "LowerX"; - CharCodes4[CharCodes4["OpeningSquareBracket"] = 91] = "OpeningSquareBracket"; -})(CharCodes2 || (CharCodes2 = {})); -var State; -(function(State2) { - State2[State2["Text"] = 1] = "Text"; - State2[State2["BeforeTagName"] = 2] = "BeforeTagName"; - State2[State2["InTagName"] = 3] = "InTagName"; - State2[State2["InSelfClosingTag"] = 4] = "InSelfClosingTag"; - State2[State2["BeforeClosingTagName"] = 5] = "BeforeClosingTagName"; - State2[State2["InClosingTagName"] = 6] = "InClosingTagName"; - State2[State2["AfterClosingTagName"] = 7] = "AfterClosingTagName"; - State2[State2["BeforeAttributeName"] = 8] = "BeforeAttributeName"; - State2[State2["InAttributeName"] = 9] = "InAttributeName"; - State2[State2["AfterAttributeName"] = 10] = "AfterAttributeName"; - State2[State2["BeforeAttributeValue"] = 11] = "BeforeAttributeValue"; - State2[State2["InAttributeValueDq"] = 12] = "InAttributeValueDq"; - State2[State2["InAttributeValueSq"] = 13] = "InAttributeValueSq"; - State2[State2["InAttributeValueNq"] = 14] = "InAttributeValueNq"; - State2[State2["BeforeDeclaration"] = 15] = "BeforeDeclaration"; - State2[State2["InDeclaration"] = 16] = "InDeclaration"; - State2[State2["InProcessingInstruction"] = 17] = "InProcessingInstruction"; - State2[State2["BeforeComment"] = 18] = "BeforeComment"; - State2[State2["CDATASequence"] = 19] = "CDATASequence"; - State2[State2["InSpecialComment"] = 20] = "InSpecialComment"; - State2[State2["InCommentLike"] = 21] = "InCommentLike"; - State2[State2["BeforeSpecialS"] = 22] = "BeforeSpecialS"; - State2[State2["BeforeSpecialT"] = 23] = "BeforeSpecialT"; - State2[State2["SpecialStartSequence"] = 24] = "SpecialStartSequence"; - State2[State2["InSpecialTag"] = 25] = "InSpecialTag"; - State2[State2["InEntity"] = 26] = "InEntity"; -})(State || (State = {})); -function isWhitespace(c) { - return c === CharCodes2.Space || c === CharCodes2.NewLine || c === CharCodes2.Tab || c === CharCodes2.FormFeed || c === CharCodes2.CarriageReturn; -} -function isEndOfTagSection(c) { - return c === CharCodes2.Slash || c === CharCodes2.Gt || isWhitespace(c); -} -function isASCIIAlpha(c) { - return c >= CharCodes2.LowerA && c <= CharCodes2.LowerZ || c >= CharCodes2.UpperA && c <= CharCodes2.UpperZ; -} -var QuoteType; -(function(QuoteType2) { - QuoteType2[QuoteType2["NoValue"] = 0] = "NoValue"; - QuoteType2[QuoteType2["Unquoted"] = 1] = "Unquoted"; - QuoteType2[QuoteType2["Single"] = 2] = "Single"; - QuoteType2[QuoteType2["Double"] = 3] = "Double"; -})(QuoteType || (QuoteType = {})); -var Sequences = { - Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), - // CDATA[ - CdataEnd: new Uint8Array([93, 93, 62]), - // ]]> - CommentEnd: new Uint8Array([45, 45, 62]), - // `-->` - ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), - // `</script` - StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), - // `</style` - TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), - // `</title` - TextareaEnd: new Uint8Array([ - 60, - 47, - 116, - 101, - 120, - 116, - 97, - 114, - 101, - 97 - ]), - // `</textarea` - XmpEnd: new Uint8Array([60, 47, 120, 109, 112]) - // `</xmp` -}; -var Tokenizer = class { - constructor({ xmlMode = false, decodeEntities = true }, cbs) { - this.cbs = cbs; - this.state = State.Text; - this.buffer = ""; - this.sectionStart = 0; - this.index = 0; - this.entityStart = 0; - this.baseState = State.Text; - this.isSpecial = false; - this.running = true; - this.offset = 0; - this.currentSequence = void 0; - this.sequenceIndex = 0; - this.xmlMode = xmlMode; - this.decodeEntities = decodeEntities; - this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed)); - } - reset() { - this.state = State.Text; - this.buffer = ""; - this.sectionStart = 0; - this.index = 0; - this.baseState = State.Text; - this.currentSequence = void 0; - this.running = true; - this.offset = 0; - } - write(chunk) { - this.offset += this.buffer.length; - this.buffer = chunk; - this.parse(); - } - end() { - if (this.running) - this.finish(); - } - pause() { - this.running = false; - } - resume() { - this.running = true; - if (this.index < this.buffer.length + this.offset) { - this.parse(); - } - } - stateText(c) { - if (c === CharCodes2.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes2.Lt)) { - if (this.index > this.sectionStart) { - this.cbs.ontext(this.sectionStart, this.index); - } - this.state = State.BeforeTagName; - this.sectionStart = this.index; - } else if (this.decodeEntities && c === CharCodes2.Amp) { - this.startEntity(); - } - } - stateSpecialStartSequence(c) { - const isEnd = this.sequenceIndex === this.currentSequence.length; - const isMatch = isEnd ? ( - // If we are at the end of the sequence, make sure the tag name has ended - isEndOfTagSection(c) - ) : ( - // Otherwise, do a case-insensitive comparison - (c | 32) === this.currentSequence[this.sequenceIndex] - ); - if (!isMatch) { - this.isSpecial = false; - } else if (!isEnd) { - this.sequenceIndex++; - return; - } - this.sequenceIndex = 0; - this.state = State.InTagName; - this.stateInTagName(c); - } - /** Look for an end tag. For <title> tags, also decode entities. */ - stateInSpecialTag(c) { - if (this.sequenceIndex === this.currentSequence.length) { - if (c === CharCodes2.Gt || isWhitespace(c)) { - const endOfText = this.index - this.currentSequence.length; - if (this.sectionStart < endOfText) { - const actualIndex = this.index; - this.index = endOfText; - this.cbs.ontext(this.sectionStart, endOfText); - this.index = actualIndex; - } - this.isSpecial = false; - this.sectionStart = endOfText + 2; - this.stateInClosingTagName(c); - return; +// node_modules/telegram/extensions/PendingState.js +var require_PendingState = __commonJS({ + "node_modules/telegram/extensions/PendingState.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PendingState = void 0; + var PendingState = class { + constructor() { + this._pending = /* @__PURE__ */ new Map(); } - this.sequenceIndex = 0; - } - if ((c | 32) === this.currentSequence[this.sequenceIndex]) { - this.sequenceIndex += 1; - } else if (this.sequenceIndex === 0) { - if (this.currentSequence === Sequences.TitleEnd) { - if (this.decodeEntities && c === CharCodes2.Amp) { - this.startEntity(); - } - } else if (this.fastForwardTo(CharCodes2.Lt)) { - this.sequenceIndex = 1; + set(msgId, state2) { + this._pending.set(msgId.toString(), state2); } - } else { - this.sequenceIndex = Number(c === CharCodes2.Lt); - } - } - stateCDATASequence(c) { - if (c === Sequences.Cdata[this.sequenceIndex]) { - if (++this.sequenceIndex === Sequences.Cdata.length) { - this.state = State.InCommentLike; - this.currentSequence = Sequences.CdataEnd; - this.sequenceIndex = 0; - this.sectionStart = this.index + 1; + get(msgId) { + return this._pending.get(msgId.toString()); } - } else { - this.sequenceIndex = 0; - this.state = State.InDeclaration; - this.stateInDeclaration(c); - } - } - /** - * When we wait for one specific character, we can speed things up - * by skipping through the buffer until we find it. - * - * @returns Whether the character was found. - */ - fastForwardTo(c) { - while (++this.index < this.buffer.length + this.offset) { - if (this.buffer.charCodeAt(this.index - this.offset) === c) { - return true; + getAndDelete(msgId) { + const state2 = this.get(msgId); + this.delete(msgId); + return state2; } - } - this.index = this.buffer.length + this.offset - 1; - return false; - } - /** - * Comments and CDATA end with `-->` and `]]>`. - * - * Their common qualities are: - * - Their end sequences have a distinct character they start with. - * - That character is then repeated, so we have to check multiple repeats. - * - All characters but the start character of the sequence can be skipped. - */ - stateInCommentLike(c) { - if (c === this.currentSequence[this.sequenceIndex]) { - if (++this.sequenceIndex === this.currentSequence.length) { - if (this.currentSequence === Sequences.CdataEnd) { - this.cbs.oncdata(this.sectionStart, this.index, 2); - } else { - this.cbs.oncomment(this.sectionStart, this.index, 2); - } - this.sequenceIndex = 0; - this.sectionStart = this.index + 1; - this.state = State.Text; + values() { + return Array.from(this._pending.values()); } - } else if (this.sequenceIndex === 0) { - if (this.fastForwardTo(this.currentSequence[0])) { - this.sequenceIndex = 1; + delete(msgId) { + this._pending.delete(msgId.toString()); } - } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { - this.sequenceIndex = 0; - } - } - /** - * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name. - * - * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar). - * We allow anything that wouldn't end the tag. - */ - isTagStartChar(c) { - return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c); - } - startSpecial(sequence, offset) { - this.isSpecial = true; - this.currentSequence = sequence; - this.sequenceIndex = offset; - this.state = State.SpecialStartSequence; - } - stateBeforeTagName(c) { - if (c === CharCodes2.ExclamationMark) { - this.state = State.BeforeDeclaration; - this.sectionStart = this.index + 1; - } else if (c === CharCodes2.Questionmark) { - this.state = State.InProcessingInstruction; - this.sectionStart = this.index + 1; - } else if (this.isTagStartChar(c)) { - const lower = c | 32; - this.sectionStart = this.index; - if (this.xmlMode) { - this.state = State.InTagName; - } else if (lower === Sequences.ScriptEnd[2]) { - this.state = State.BeforeSpecialS; - } else if (lower === Sequences.TitleEnd[2] || lower === Sequences.XmpEnd[2]) { - this.state = State.BeforeSpecialT; - } else { - this.state = State.InTagName; + clear() { + this._pending.clear(); } - } else if (c === CharCodes2.Slash) { - this.state = State.BeforeClosingTagName; - } else { - this.state = State.Text; - this.stateText(c); - } - } - stateInTagName(c) { - if (isEndOfTagSection(c)) { - this.cbs.onopentagname(this.sectionStart, this.index); - this.sectionStart = -1; - this.state = State.BeforeAttributeName; - this.stateBeforeAttributeName(c); - } - } - stateBeforeClosingTagName(c) { - if (isWhitespace(c)) { - } else if (c === CharCodes2.Gt) { - this.state = State.Text; - } else { - this.state = this.isTagStartChar(c) ? State.InClosingTagName : State.InSpecialComment; - this.sectionStart = this.index; - } - } - stateInClosingTagName(c) { - if (c === CharCodes2.Gt || isWhitespace(c)) { - this.cbs.onclosetag(this.sectionStart, this.index); - this.sectionStart = -1; - this.state = State.AfterClosingTagName; - this.stateAfterClosingTagName(c); - } - } - stateAfterClosingTagName(c) { - if (c === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) { - this.state = State.Text; - this.sectionStart = this.index + 1; - } + }; + exports2.PendingState = PendingState; } - stateBeforeAttributeName(c) { - if (c === CharCodes2.Gt) { - this.cbs.onopentagend(this.index); - if (this.isSpecial) { - this.state = State.InSpecialTag; - this.sequenceIndex = 0; - } else { - this.state = State.Text; +}); + +// node_modules/telegram/network/MTProtoSender.js +var require_MTProtoSender = __commonJS({ + "node_modules/telegram/network/MTProtoSender.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MTProtoSender = void 0; + var AuthKey_1 = require_AuthKey(); + var MTProtoState_1 = require_MTProtoState(); + var extensions_1 = require_extensions(); + var core_1 = require_core(); + var tl_1 = require_tl(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var Helpers_1 = require_Helpers(); + var RequestState_1 = require_RequestState(); + var Authenticator_1 = require_Authenticator(); + var MTProtoPlainSender_1 = require_MTProtoPlainSender(); + var errors_1 = require_errors(); + var _1 = require_network(); + var Logger_1 = require_Logger(); + var async_mutex_1 = require_lib16(); + var PendingState_1 = require_PendingState(); + var MsgsAck = tl_1.Api.MsgsAck; + var MTProtoSender = class _MTProtoSender { + /** + * @param authKey + * @param opts + */ + constructor(authKey, opts) { + this._exportedSenderPromises = /* @__PURE__ */ new Map(); + const args = Object.assign(Object.assign({}, _MTProtoSender.DEFAULT_OPTIONS), opts); + this._finishedConnecting = false; + this._cancelSend = false; + this._connection = void 0; + this._log = args.logger; + this._dcId = args.dcId; + this._retries = args.retries; + this._currentRetries = 0; + this._reconnectRetries = args.reconnectRetries; + this._delay = args.delay; + this._autoReconnect = args.autoReconnect; + this._connectTimeout = args.connectTimeout; + this._authKeyCallback = args.authKeyCallback; + this._updateCallback = args.updateCallback; + this._autoReconnectCallback = args.autoReconnectCallback; + this._isMainSender = args.isMainSender; + this._senderCallback = args.senderCallback; + this._client = args.client; + this._onConnectionBreak = args.onConnectionBreak; + this._securityChecks = args.securityChecks; + this._connectMutex = new async_mutex_1.Mutex(); + this._exportedSenderPromises = args._exportedSenderPromises; + this.userDisconnected = false; + this.isConnecting = false; + this._authenticated = false; + this._userConnected = false; + this.isReconnecting = false; + this._reconnecting = false; + this._disconnected = true; + this._sendLoopHandle = null; + this._recvLoopHandle = null; + this.authKey = authKey || new AuthKey_1.AuthKey(); + this._state = new MTProtoState_1.MTProtoState(this.authKey, this._log, this._securityChecks); + this._sendQueue = new extensions_1.MessagePacker(this._state, this._log); + this._pendingState = new PendingState_1.PendingState(); + this._pendingAck = /* @__PURE__ */ new Set(); + this._lastAcks = []; + this._handlers = { + [core_1.RPCResult.CONSTRUCTOR_ID.toString()]: this._handleRPCResult.bind(this), + [core_1.MessageContainer.CONSTRUCTOR_ID.toString()]: this._handleContainer.bind(this), + [core_1.GZIPPacked.CONSTRUCTOR_ID.toString()]: this._handleGzipPacked.bind(this), + [tl_1.Api.Pong.CONSTRUCTOR_ID.toString()]: this._handlePong.bind(this), + [tl_1.Api.BadServerSalt.CONSTRUCTOR_ID.toString()]: this._handleBadServerSalt.bind(this), + [tl_1.Api.BadMsgNotification.CONSTRUCTOR_ID.toString()]: this._handleBadNotification.bind(this), + [tl_1.Api.MsgDetailedInfo.CONSTRUCTOR_ID.toString()]: this._handleDetailedInfo.bind(this), + [tl_1.Api.MsgNewDetailedInfo.CONSTRUCTOR_ID.toString()]: this._handleNewDetailedInfo.bind(this), + [tl_1.Api.NewSessionCreated.CONSTRUCTOR_ID.toString()]: this._handleNewSessionCreated.bind(this), + [tl_1.Api.MsgsAck.CONSTRUCTOR_ID.toString()]: this._handleAck.bind(this), + [tl_1.Api.FutureSalts.CONSTRUCTOR_ID.toString()]: this._handleFutureSalts.bind(this), + [tl_1.Api.MsgsStateReq.CONSTRUCTOR_ID.toString()]: this._handleStateForgotten.bind(this), + [tl_1.Api.MsgResendReq.CONSTRUCTOR_ID.toString()]: this._handleStateForgotten.bind(this), + [tl_1.Api.MsgsAllInfo.CONSTRUCTOR_ID.toString()]: this._handleMsgAll.bind(this) + }; } - this.sectionStart = this.index + 1; - } else if (c === CharCodes2.Slash) { - this.state = State.InSelfClosingTag; - } else if (!isWhitespace(c)) { - this.state = State.InAttributeName; - this.sectionStart = this.index; - } - } - stateInSelfClosingTag(c) { - if (c === CharCodes2.Gt) { - this.cbs.onselfclosingtag(this.index); - this.state = State.Text; - this.sectionStart = this.index + 1; - this.isSpecial = false; - } else if (!isWhitespace(c)) { - this.state = State.BeforeAttributeName; - this.stateBeforeAttributeName(c); - } - } - stateInAttributeName(c) { - if (c === CharCodes2.Eq || isEndOfTagSection(c)) { - this.cbs.onattribname(this.sectionStart, this.index); - this.sectionStart = this.index; - this.state = State.AfterAttributeName; - this.stateAfterAttributeName(c); - } - } - stateAfterAttributeName(c) { - if (c === CharCodes2.Eq) { - this.state = State.BeforeAttributeValue; - } else if (c === CharCodes2.Slash || c === CharCodes2.Gt) { - this.cbs.onattribend(QuoteType.NoValue, this.sectionStart); - this.sectionStart = -1; - this.state = State.BeforeAttributeName; - this.stateBeforeAttributeName(c); - } else if (!isWhitespace(c)) { - this.cbs.onattribend(QuoteType.NoValue, this.sectionStart); - this.state = State.InAttributeName; - this.sectionStart = this.index; - } - } - stateBeforeAttributeValue(c) { - if (c === CharCodes2.DoubleQuote) { - this.state = State.InAttributeValueDq; - this.sectionStart = this.index + 1; - } else if (c === CharCodes2.SingleQuote) { - this.state = State.InAttributeValueSq; - this.sectionStart = this.index + 1; - } else if (!isWhitespace(c)) { - this.sectionStart = this.index; - this.state = State.InAttributeValueNq; - this.stateInAttributeValueNoQuotes(c); - } - } - handleInAttributeValue(c, quote) { - if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) { - this.cbs.onattribdata(this.sectionStart, this.index); - this.sectionStart = -1; - this.cbs.onattribend(quote === CharCodes2.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1); - this.state = State.BeforeAttributeName; - } else if (this.decodeEntities && c === CharCodes2.Amp) { - this.startEntity(); - } - } - stateInAttributeValueDoubleQuotes(c) { - this.handleInAttributeValue(c, CharCodes2.DoubleQuote); - } - stateInAttributeValueSingleQuotes(c) { - this.handleInAttributeValue(c, CharCodes2.SingleQuote); - } - stateInAttributeValueNoQuotes(c) { - if (isWhitespace(c) || c === CharCodes2.Gt) { - this.cbs.onattribdata(this.sectionStart, this.index); - this.sectionStart = -1; - this.cbs.onattribend(QuoteType.Unquoted, this.index); - this.state = State.BeforeAttributeName; - this.stateBeforeAttributeName(c); - } else if (this.decodeEntities && c === CharCodes2.Amp) { - this.startEntity(); - } - } - stateBeforeDeclaration(c) { - if (c === CharCodes2.OpeningSquareBracket) { - this.state = State.CDATASequence; - this.sequenceIndex = 0; - } else { - this.state = c === CharCodes2.Dash ? State.BeforeComment : State.InDeclaration; - } - } - stateInDeclaration(c) { - if (c === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) { - this.cbs.ondeclaration(this.sectionStart, this.index); - this.state = State.Text; - this.sectionStart = this.index + 1; - } - } - stateInProcessingInstruction(c) { - if (c === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) { - this.cbs.onprocessinginstruction(this.sectionStart, this.index); - this.state = State.Text; - this.sectionStart = this.index + 1; - } - } - stateBeforeComment(c) { - if (c === CharCodes2.Dash) { - this.state = State.InCommentLike; - this.currentSequence = Sequences.CommentEnd; - this.sequenceIndex = 2; - this.sectionStart = this.index + 1; - } else { - this.state = State.InDeclaration; - } - } - stateInSpecialComment(c) { - if (c === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) { - this.cbs.oncomment(this.sectionStart, this.index, 0); - this.state = State.Text; - this.sectionStart = this.index + 1; - } - } - stateBeforeSpecialS(c) { - const lower = c | 32; - if (lower === Sequences.ScriptEnd[3]) { - this.startSpecial(Sequences.ScriptEnd, 4); - } else if (lower === Sequences.StyleEnd[3]) { - this.startSpecial(Sequences.StyleEnd, 4); - } else { - this.state = State.InTagName; - this.stateInTagName(c); - } - } - stateBeforeSpecialT(c) { - const lower = c | 32; - switch (lower) { - case Sequences.TitleEnd[3]: { - this.startSpecial(Sequences.TitleEnd, 4); - break; + set dcId(dcId) { + this._dcId = dcId; } - case Sequences.TextareaEnd[3]: { - this.startSpecial(Sequences.TextareaEnd, 4); - break; + get dcId() { + return this._dcId; } - case Sequences.XmpEnd[3]: { - this.startSpecial(Sequences.XmpEnd, 4); - break; + // Public API + /** + * Connects to the specified given connection using the given auth key. + */ + async connect(connection, force) { + this.userDisconnected = false; + if (this._userConnected && !force) { + this._log.info("User is already connected!"); + return false; + } + this.isConnecting = true; + this._connection = connection; + this._finishedConnecting = false; + for (let attempt = 0; attempt < this._retries; attempt++) { + try { + await this._connect(); + if (this._updateCallback) { + this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.connected)); + } + this._finishedConnecting = true; + break; + } catch (err) { + if (this._updateCallback && attempt === 0) { + this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.disconnected)); + } + this._log.error(`WebSocket connection failed attempt: ${attempt + 1}`); + if (this._client._errorHandler) { + await this._client._errorHandler(err); + } + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(err); + } + await (0, Helpers_1.sleep)(this._delay); + } + } + this.isConnecting = false; + return this._finishedConnecting; } - default: { - this.state = State.InTagName; - this.stateInTagName(c); + isConnected() { + return this._userConnected; } - } - } - startEntity() { - this.baseState = this.state; - this.state = State.InEntity; - this.entityStart = this.index; - this.entityDecoder.startEntity(this.xmlMode ? DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? DecodingMode.Legacy : DecodingMode.Attribute); - } - stateInEntity() { - const indexInBuffer = this.index - this.offset; - const length = this.entityDecoder.write(this.buffer, indexInBuffer); - if (length >= 0) { - this.state = this.baseState; - if (length === 0) { - this.index -= 1; + _transportConnected() { + return !this._reconnecting && this._connection && this._connection._connected; } - } else { - if (indexInBuffer < this.buffer.length && this.buffer.charCodeAt(indexInBuffer) === CharCodes2.Amp) { - this.state = this.baseState; - this.index -= 1; - return; + /** + * Cleanly disconnects the instance from the network, cancels + * all pending requests, and closes the send and receive loops. + */ + async disconnect() { + this.userDisconnected = true; + this._log.warn("Disconnecting..."); + await this._disconnect(); } - this.index = this.offset + this.buffer.length - 1; - } - } - /** - * Remove data that has already been consumed from the buffer. - */ - cleanup() { - if (this.running && this.sectionStart !== this.index) { - if (this.state === State.Text || this.state === State.InSpecialTag && this.sequenceIndex === 0) { - this.cbs.ontext(this.sectionStart, this.index); - this.sectionStart = this.index; - } else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) { - this.cbs.onattribdata(this.sectionStart, this.index); - this.sectionStart = this.index; + /** + * + This method enqueues the given request to be sent. Its send + state will be saved until a response arrives, and a ``Future`` + that will be resolved when the response arrives will be returned: + + .. code-block:: javascript + + async def method(): + # Sending (enqueued for the send loop) + future = sender.send(request) + # Receiving (waits for the receive loop to read the result) + result = await future + + Designed like this because Telegram may send the response at + any point, and it can send other items while one waits for it. + Once the response for this future arrives, it is set with the + received result, quite similar to how a ``receive()`` call + would otherwise work. + + Since the receiving part is "built in" the future, it's + impossible to await receive a result that was never sent. + * @param request + * @returns {RequestState} + */ + send(request) { + const state2 = new RequestState_1.RequestState(request); + this._log.debug(`Send ${request.className}`); + this._sendQueue.append(state2); + return state2.promise; } - } - } - shouldContinue() { - return this.index < this.buffer.length + this.offset && this.running; - } - /** - * Iterates through the buffer, calling the function corresponding to the current state. - * - * States that are more likely to be hit are higher up, as a performance improvement. - */ - parse() { - while (this.shouldContinue()) { - const c = this.buffer.charCodeAt(this.index - this.offset); - switch (this.state) { - case State.Text: { - this.stateText(c); - break; - } - case State.SpecialStartSequence: { - this.stateSpecialStartSequence(c); - break; - } - case State.InSpecialTag: { - this.stateInSpecialTag(c); - break; - } - case State.CDATASequence: { - this.stateCDATASequence(c); - break; - } - case State.InAttributeValueDq: { - this.stateInAttributeValueDoubleQuotes(c); - break; - } - case State.InAttributeName: { - this.stateInAttributeName(c); - break; - } - case State.InCommentLike: { - this.stateInCommentLike(c); - break; - } - case State.InSpecialComment: { - this.stateInSpecialComment(c); - break; - } - case State.BeforeAttributeName: { - this.stateBeforeAttributeName(c); - break; - } - case State.InTagName: { - this.stateInTagName(c); - break; + addStateToQueue(state2) { + this._sendQueue.append(state2); + } + /** + * Performs the actual connection, retrying, generating the + * authorization key if necessary, and starting the send and + * receive loops. + * @returns {Promise<void>} + * @private + */ + async _connect() { + const connection = this._connection; + if (!connection.isConnected()) { + this._log.info("Connecting to {0}...".replace("{0}", connection.toString())); + await connection.connect(); + this._log.debug("Connection success!"); } - case State.InClosingTagName: { - this.stateInClosingTagName(c); - break; + if (!this.authKey.getKey()) { + const plain = new MTProtoPlainSender_1.MTProtoPlainSender(connection, this._log); + this._log.debug("New auth_key attempt ..."); + const res = await (0, Authenticator_1.doAuthentication)(plain, this._log); + this._log.debug("Generated new auth_key successfully"); + await this.authKey.setKey(res.authKey); + this._state.timeOffset = res.timeOffset; + if (this._authKeyCallback) { + await this._authKeyCallback(this.authKey, this._dcId); + } + } else { + this._authenticated = true; + this._log.debug("Already have an auth key ..."); } - case State.BeforeTagName: { - this.stateBeforeTagName(c); - break; + this._userConnected = true; + this.isReconnecting = false; + if (!this._sendLoopHandle) { + this._log.debug("Starting send loop"); + this._sendLoopHandle = this._sendLoop(); } - case State.AfterAttributeName: { - this.stateAfterAttributeName(c); - break; + if (!this._recvLoopHandle) { + this._log.debug("Starting receive loop"); + this._recvLoopHandle = this._recvLoop(); } - case State.InAttributeValueSq: { - this.stateInAttributeValueSingleQuotes(c); - break; + this._log.info("Connection to %s complete!".replace("%s", connection.toString())); + } + async _disconnect() { + const connection = this._connection; + if (this._updateCallback) { + this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.disconnected)); } - case State.BeforeAttributeValue: { - this.stateBeforeAttributeValue(c); - break; + if (connection === void 0) { + this._log.info("Not disconnecting (already have no connection)"); + return; } - case State.BeforeClosingTagName: { - this.stateBeforeClosingTagName(c); - break; + this._log.info("Disconnecting from %s...".replace("%s", connection.toString())); + this._userConnected = false; + this._log.debug("Closing current connection..."); + await connection.disconnect(); + } + _cancelLoops() { + this._cancelSend = true; + this.cancellableRecvLoopPromise.cancel(); + } + /** + * This loop is responsible for popping items off the send + * queue, encrypting them, and sending them over the network. + * Besides `connect`, only this method ever sends data. + * @returns {Promise<void>} + * @private + */ + async _sendLoop() { + this._sendQueue.prepend(this._pendingState.values()); + this._pendingState.clear(); + while (this._userConnected && !this.isReconnecting) { + const appendAcks = () => { + if (this._pendingAck.size) { + const ack = new RequestState_1.RequestState(new MsgsAck({ msgIds: Array(...this._pendingAck) })); + this._sendQueue.append(ack); + this._lastAcks.push(ack); + if (this._lastAcks.length >= 10) { + this._lastAcks.shift(); + } + this._pendingAck.clear(); + } + }; + appendAcks(); + this._log.debug(`Waiting for messages to send... ${this.isReconnecting}`); + await this._sendQueue.wait(); + appendAcks(); + const res = await this._sendQueue.get(); + this._log.debug(`Got ${res === null || res === void 0 ? void 0 : res.batch.length} message(s) to send`); + if (this.isReconnecting) { + this._log.debug("Reconnecting"); + this._sendLoopHandle = void 0; + return; + } + if (!res) { + continue; + } + let { data } = res; + const { batch } = res; + this._log.debug(`Encrypting ${batch.length} message(s) in ${data.length} bytes for sending`); + this._log.debug(`Sending ${batch.map((m) => m.request.className)}`); + data = await this._state.encryptMessageData(data); + for (const state2 of batch) { + if (!Array.isArray(state2)) { + if (state2.request.classType === "request") { + this._pendingState.set(state2.msgId, state2); + } + } else { + for (const s of state2) { + if (s.request.classType === "request") { + this._pendingState.set(s.msgId, s); + } + } + } + } + try { + await this._connection.send(data); + } catch (e) { + if (!this.userDisconnected) { + this._log.debug(`Connection closed while sending data ${e}`); + if (this._log.canSend(Logger_1.LogLevel.DEBUG)) { + console.error(e); + } + this.reconnect(); + } + this._sendLoopHandle = void 0; + return; + } + this._log.debug("Encrypted messages put in a queue to be sent"); } - case State.AfterClosingTagName: { - this.stateAfterClosingTagName(c); - break; + this._sendLoopHandle = void 0; + } + async _recvLoop() { + let body; + let message; + while (this._userConnected && !this.isReconnecting) { + this._log.debug("Receiving items from the network..."); + try { + body = await this._connection.recv(); + } catch (e) { + if (this._currentRetries > this._reconnectRetries) { + for (const state2 of this._pendingState.values()) { + state2.reject("Maximum reconnection retries reached. Aborting!"); + } + this.userDisconnected = true; + return; + } + if (!this.userDisconnected) { + this._log.warn("Connection closed while receiving data"); + if (this._log.canSend(Logger_1.LogLevel.WARN)) { + console.error(e); + } + this.reconnect(); + } + this._recvLoopHandle = void 0; + return; + } + try { + message = await this._state.decryptMessageData(body); + } catch (e) { + this._log.debug(`Error while receiving items from the network ${e}`); + if (e instanceof errors_1.TypeNotFoundError) { + this._log.info(`Type ${e.invalidConstructorId} not found, remaining data ${e.remaining}`); + continue; + } else if (e instanceof errors_1.SecurityError) { + this._log.warn(`Security error while unpacking a received message: ${e}`); + continue; + } else if (e instanceof errors_1.InvalidBufferError) { + if (e.code === 404) { + this._handleBadAuthKey(); + } else { + this._log.warn(`Invalid buffer ${e.code} for dc ${this._dcId}`); + this.reconnect(); + } + this._recvLoopHandle = void 0; + return; + } else { + this._log.error("Unhandled error while receiving data"); + if (this._client._errorHandler) { + await this._client._errorHandler(e); + } + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.log(e); + } + this.reconnect(); + this._recvLoopHandle = void 0; + return; + } + } + try { + await this._processMessage(message); + } catch (e) { + if (e instanceof errors_1.RPCError) { + if (e.message === "AUTH_KEY_UNREGISTERED" || e.message === "SESSION_REVOKED") { + this._handleBadAuthKey(true); + } + } else { + this._log.error("Unhandled error while receiving data"); + if (this._client._errorHandler) { + await this._client._errorHandler(e); + } + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.log(e); + } + } + } + this._currentRetries = 0; } - case State.BeforeSpecialS: { - this.stateBeforeSpecialS(c); - break; + this._recvLoopHandle = void 0; + } + // Response Handlers + _handleBadAuthKey(shouldSkipForMain = false) { + if (shouldSkipForMain && this._isMainSender) { + return; } - case State.BeforeSpecialT: { - this.stateBeforeSpecialT(c); - break; + this._log.warn(`Broken authorization key for dc ${this._dcId}, resetting...`); + if (this._isMainSender && this._updateCallback) { + this._updateCallback(this._client, new _1.UpdateConnectionState(_1.UpdateConnectionState.broken)); + } else if (!this._isMainSender && this._onConnectionBreak) { + this._onConnectionBreak(this._dcId); } - case State.InAttributeValueNq: { - this.stateInAttributeValueNoQuotes(c); - break; + } + /** + * Adds the given message to the list of messages that must be + * acknowledged and dispatches control to different ``_handle_*`` + * method based on its type. + * @param message + * @returns {Promise<void>} + * @private + */ + async _processMessage(message) { + this._pendingAck.add(message.msgId); + message.obj = await message.obj; + let handler = this._handlers[message.obj.CONSTRUCTOR_ID.toString()]; + if (!handler) { + handler = this._handleUpdate.bind(this); } - case State.InSelfClosingTag: { - this.stateInSelfClosingTag(c); - break; + await handler(message); + } + /** + * Pops the states known to match the given ID from pending messages. + * This method should be used when the response isn't specific. + * @param msgId + * @returns {*[]} + * @private + */ + _popStates(msgId) { + var _a; + const state2 = this._pendingState.getAndDelete(msgId); + if (state2) { + return [state2]; } - case State.InDeclaration: { - this.stateInDeclaration(c); - break; + const toPop = []; + for (const pendingState of this._pendingState.values()) { + if ((_a = pendingState.containerId) === null || _a === void 0 ? void 0 : _a.equals(msgId)) { + toPop.push(pendingState.msgId); + } } - case State.BeforeDeclaration: { - this.stateBeforeDeclaration(c); - break; + if (toPop.length) { + const temp = []; + for (const x of toPop) { + temp.push(this._pendingState.getAndDelete(x)); + } + return temp; } - case State.BeforeComment: { - this.stateBeforeComment(c); - break; + for (const ack of this._lastAcks) { + if (ack.msgId === msgId) { + return [ack]; + } } - case State.InProcessingInstruction: { - this.stateInProcessingInstruction(c); - break; + return []; + } + /** + * Handles the result for Remote Procedure Calls: + * rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult; + * This is where the future results for sent requests are set. + * @param message + * @returns {Promise<void>} + * @private + */ + _handleRPCResult(message) { + const result = message.obj; + const state2 = this._pendingState.getAndDelete(result.reqMsgId); + this._log.debug(`Handling RPC result for message ${result.reqMsgId}`); + if (!state2) { + try { + const reader = new extensions_1.BinaryReader(result.body); + if (!(reader.tgReadObject() instanceof tl_1.Api.upload.File)) { + throw new errors_1.TypeNotFoundError(0, Buffer.alloc(0)); + } + } catch (e) { + if (e instanceof errors_1.TypeNotFoundError) { + this._log.info(`Received response without parent request: ${result.body}`); + return; + } + throw e; + } + return; } - case State.InEntity: { - this.stateInEntity(); - break; + if (result.error) { + const error = (0, errors_1.RPCMessageToError)(result.error, state2.request); + this._sendQueue.append(new RequestState_1.RequestState(new MsgsAck({ msgIds: [state2.msgId] }))); + state2.reject(error); + throw error; + } else { + try { + const reader = new extensions_1.BinaryReader(result.body); + const read = state2.request.readResult(reader); + this._log.debug(`Handling RPC result ${read === null || read === void 0 ? void 0 : read.className}`); + state2.resolve(read); + } catch (err) { + state2.reject(err); + throw err; + } } } - this.index++; - } - this.cleanup(); - } - finish() { - if (this.state === State.InEntity) { - this.entityDecoder.end(); - this.state = this.baseState; - } - this.handleTrailingData(); - this.cbs.onend(); - } - /** Handle any trailing data. */ - handleTrailingData() { - const endIndex = this.buffer.length + this.offset; - if (this.sectionStart >= endIndex) { - return; - } - if (this.state === State.InCommentLike) { - if (this.currentSequence === Sequences.CdataEnd) { - this.cbs.oncdata(this.sectionStart, endIndex, 0); - } else { - this.cbs.oncomment(this.sectionStart, endIndex, 0); - } - } else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) { - } else { - this.cbs.ontext(this.sectionStart, endIndex); - } - } - emitCodePoint(cp, consumed) { - if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) { - if (this.sectionStart < this.entityStart) { - this.cbs.onattribdata(this.sectionStart, this.entityStart); - } - this.sectionStart = this.entityStart + consumed; - this.index = this.sectionStart - 1; - this.cbs.onattribentity(cp); - } else { - if (this.sectionStart < this.entityStart) { - this.cbs.ontext(this.sectionStart, this.entityStart); - } - this.sectionStart = this.entityStart + consumed; - this.index = this.sectionStart - 1; - this.cbs.ontextentity(cp, this.sectionStart); - } - } -}; - -// node_modules/htmlparser2/dist/esm/Parser.js -var formTags = /* @__PURE__ */ new Set([ - "input", - "option", - "optgroup", - "select", - "button", - "datalist", - "textarea" -]); -var pTag = /* @__PURE__ */ new Set(["p"]); -var tableSectionTags = /* @__PURE__ */ new Set(["thead", "tbody"]); -var ddtTags = /* @__PURE__ */ new Set(["dd", "dt"]); -var rtpTags = /* @__PURE__ */ new Set(["rt", "rp"]); -var openImpliesClose = /* @__PURE__ */ new Map([ - ["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])], - ["th", /* @__PURE__ */ new Set(["th"])], - ["td", /* @__PURE__ */ new Set(["thead", "th", "td"])], - ["body", /* @__PURE__ */ new Set(["head", "link", "script"])], - ["li", /* @__PURE__ */ new Set(["li"])], - ["p", pTag], - ["h1", pTag], - ["h2", pTag], - ["h3", pTag], - ["h4", pTag], - ["h5", pTag], - ["h6", pTag], - ["select", formTags], - ["input", formTags], - ["output", formTags], - ["button", formTags], - ["datalist", formTags], - ["textarea", formTags], - ["option", /* @__PURE__ */ new Set(["option"])], - ["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])], - ["dd", ddtTags], - ["dt", ddtTags], - ["address", pTag], - ["article", pTag], - ["aside", pTag], - ["blockquote", pTag], - ["details", pTag], - ["div", pTag], - ["dl", pTag], - ["fieldset", pTag], - ["figcaption", pTag], - ["figure", pTag], - ["footer", pTag], - ["form", pTag], - ["header", pTag], - ["hr", pTag], - ["main", pTag], - ["nav", pTag], - ["ol", pTag], - ["pre", pTag], - ["section", pTag], - ["table", pTag], - ["ul", pTag], - ["rt", rtpTags], - ["rp", rtpTags], - ["tbody", tableSectionTags], - ["tfoot", tableSectionTags] -]); -var voidElements = /* @__PURE__ */ new Set([ - "area", - "base", - "basefont", - "br", - "col", - "command", - "embed", - "frame", - "hr", - "img", - "input", - "isindex", - "keygen", - "link", - "meta", - "param", - "source", - "track", - "wbr" -]); -var foreignContextElements = /* @__PURE__ */ new Set(["math", "svg"]); -var htmlIntegrationElements = /* @__PURE__ */ new Set([ - "mi", - "mo", - "mn", - "ms", - "mtext", - "annotation-xml", - "foreignobject", - "desc", - "title" -]); -var reNameEnd = /\s|\//; -var Parser = class { - constructor(cbs, options = {}) { - var _a3, _b, _c, _d, _e, _f; - this.options = options; - this.startIndex = 0; - this.endIndex = 0; - this.openTagStart = 0; - this.tagname = ""; - this.attribname = ""; - this.attribvalue = ""; - this.attribs = null; - this.stack = []; - this.buffers = []; - this.bufferOffset = 0; - this.writeIndex = 0; - this.ended = false; - this.cbs = cbs !== null && cbs !== void 0 ? cbs : {}; - this.htmlMode = !this.options.xmlMode; - this.lowerCaseTagNames = (_a3 = options.lowerCaseTags) !== null && _a3 !== void 0 ? _a3 : this.htmlMode; - this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : this.htmlMode; - this.recognizeSelfClosing = (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode; - this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer)(this.options, this); - this.foreignContext = [!this.htmlMode]; - (_f = (_e = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e, this); - } - // Tokenizer event handlers - /** @internal */ - ontext(start, endIndex) { - var _a3, _b; - const data = this.getSlice(start, endIndex); - this.endIndex = endIndex - 1; - (_b = (_a3 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a3, data); - this.startIndex = endIndex; - } - /** @internal */ - ontextentity(cp, endIndex) { - var _a3, _b; - this.endIndex = endIndex - 1; - (_b = (_a3 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a3, fromCodePoint(cp)); - this.startIndex = endIndex; - } - /** - * Checks if the current tag is a void element. Override this if you want - * to specify your own additional void elements. - */ - isVoidElement(name) { - return this.htmlMode && voidElements.has(name); - } - /** @internal */ - onopentagname(start, endIndex) { - this.endIndex = endIndex; - let name = this.getSlice(start, endIndex); - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - this.emitOpenTag(name); - } - emitOpenTag(name) { - var _a3, _b, _c, _d; - this.openTagStart = this.startIndex; - this.tagname = name; - const impliesClose = this.htmlMode && openImpliesClose.get(name); - if (impliesClose) { - while (this.stack.length > 0 && impliesClose.has(this.stack[0])) { - const element = this.stack.shift(); - (_b = (_a3 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a3, element, true); - } - } - if (!this.isVoidElement(name)) { - this.stack.unshift(name); - if (this.htmlMode) { - if (foreignContextElements.has(name)) { - this.foreignContext.unshift(true); - } else if (htmlIntegrationElements.has(name)) { - this.foreignContext.unshift(false); - } - } - } - (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name); - if (this.cbs.onopentag) - this.attribs = {}; - } - endOpenTag(isImplied) { - var _a3, _b; - this.startIndex = this.openTagStart; - if (this.attribs) { - (_b = (_a3 = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a3, this.tagname, this.attribs, isImplied); - this.attribs = null; - } - if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) { - this.cbs.onclosetag(this.tagname, true); - } - this.tagname = ""; - } - /** @internal */ - onopentagend(endIndex) { - this.endIndex = endIndex; - this.endOpenTag(false); - this.startIndex = endIndex + 1; - } - /** @internal */ - onclosetag(start, endIndex) { - var _a3, _b, _c, _d, _e, _f, _g, _h; - this.endIndex = endIndex; - let name = this.getSlice(start, endIndex); - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - if (this.htmlMode && (foreignContextElements.has(name) || htmlIntegrationElements.has(name))) { - this.foreignContext.shift(); - } - if (!this.isVoidElement(name)) { - const pos = this.stack.indexOf(name); - if (pos !== -1) { - for (let index2 = 0; index2 <= pos; index2++) { - const element = this.stack.shift(); - (_b = (_a3 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a3, element, index2 !== pos); - } - } else if (this.htmlMode && name === "p") { - this.emitOpenTag("p"); - this.closeCurrentTag(true); - } - } else if (this.htmlMode && name === "br") { - (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, "br"); - (_f = (_e = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", {}, true); - (_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, "br", false); - } - this.startIndex = endIndex + 1; - } - /** @internal */ - onselfclosingtag(endIndex) { - this.endIndex = endIndex; - if (this.recognizeSelfClosing || this.foreignContext[0]) { - this.closeCurrentTag(false); - this.startIndex = endIndex + 1; - } else { - this.onopentagend(endIndex); - } - } - closeCurrentTag(isOpenImplied) { - var _a3, _b; - const name = this.tagname; - this.endOpenTag(isOpenImplied); - if (this.stack[0] === name) { - (_b = (_a3 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a3, name, !isOpenImplied); - this.stack.shift(); - } - } - /** @internal */ - onattribname(start, endIndex) { - this.startIndex = start; - const name = this.getSlice(start, endIndex); - this.attribname = this.lowerCaseAttributeNames ? name.toLowerCase() : name; - } - /** @internal */ - onattribdata(start, endIndex) { - this.attribvalue += this.getSlice(start, endIndex); - } - /** @internal */ - onattribentity(cp) { - this.attribvalue += fromCodePoint(cp); - } - /** @internal */ - onattribend(quote, endIndex) { - var _a3, _b; - this.endIndex = endIndex; - (_b = (_a3 = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a3, this.attribname, this.attribvalue, quote === QuoteType.Double ? '"' : quote === QuoteType.Single ? "'" : quote === QuoteType.NoValue ? void 0 : null); - if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) { - this.attribs[this.attribname] = this.attribvalue; - } - this.attribvalue = ""; - } - getInstructionName(value) { - const index2 = value.search(reNameEnd); - let name = index2 < 0 ? value : value.substr(0, index2); - if (this.lowerCaseTagNames) { - name = name.toLowerCase(); - } - return name; - } - /** @internal */ - ondeclaration(start, endIndex) { - this.endIndex = endIndex; - const value = this.getSlice(start, endIndex); - if (this.cbs.onprocessinginstruction) { - const name = this.getInstructionName(value); - this.cbs.onprocessinginstruction(`!${name}`, `!${value}`); - } - this.startIndex = endIndex + 1; - } - /** @internal */ - onprocessinginstruction(start, endIndex) { - this.endIndex = endIndex; - const value = this.getSlice(start, endIndex); - if (this.cbs.onprocessinginstruction) { - const name = this.getInstructionName(value); - this.cbs.onprocessinginstruction(`?${name}`, `?${value}`); - } - this.startIndex = endIndex + 1; - } - /** @internal */ - oncomment(start, endIndex, offset) { - var _a3, _b, _c, _d; - this.endIndex = endIndex; - (_b = (_a3 = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a3, this.getSlice(start, endIndex - offset)); - (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c); - this.startIndex = endIndex + 1; - } - /** @internal */ - oncdata(start, endIndex, offset) { - var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k; - this.endIndex = endIndex; - const value = this.getSlice(start, endIndex - offset); - if (!this.htmlMode || this.options.recognizeCDATA) { - (_b = (_a3 = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a3); - (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value); - (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e); - } else { - (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`); - (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j); - } - this.startIndex = endIndex + 1; - } - /** @internal */ - onend() { - var _a3, _b; - if (this.cbs.onclosetag) { - this.endIndex = this.startIndex; - for (let index2 = 0; index2 < this.stack.length; index2++) { - this.cbs.onclosetag(this.stack[index2], true); - } - } - (_b = (_a3 = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a3); - } - /** - * Resets the parser to a blank state, ready to parse a new HTML document - */ - reset() { - var _a3, _b, _c, _d; - (_b = (_a3 = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a3); - this.tokenizer.reset(); - this.tagname = ""; - this.attribname = ""; - this.attribs = null; - this.stack.length = 0; - this.startIndex = 0; - this.endIndex = 0; - (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this); - this.buffers.length = 0; - this.foreignContext.length = 0; - this.foreignContext.unshift(!this.htmlMode); - this.bufferOffset = 0; - this.writeIndex = 0; - this.ended = false; - } - /** - * Resets the parser, then parses a complete document and - * pushes it to the handler. - * - * @param data Document to parse. - */ - parseComplete(data) { - this.reset(); - this.end(data); - } - getSlice(start, end) { - while (start - this.bufferOffset >= this.buffers[0].length) { - this.shiftBuffer(); - } - let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset); - while (end - this.bufferOffset > this.buffers[0].length) { - this.shiftBuffer(); - slice += this.buffers[0].slice(0, end - this.bufferOffset); - } - return slice; - } - shiftBuffer() { - this.bufferOffset += this.buffers[0].length; - this.writeIndex--; - this.buffers.shift(); - } - /** - * Parses a chunk of data and calls the corresponding callbacks. - * - * @param chunk Chunk to parse. - */ - write(chunk) { - var _a3, _b; - if (this.ended) { - (_b = (_a3 = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a3, new Error(".write() after done!")); - return; - } - this.buffers.push(chunk); - if (this.tokenizer.running) { - this.tokenizer.write(chunk); - this.writeIndex++; - } - } - /** - * Parses the end of the buffer and clears the stack, calls onend. - * - * @param chunk Optional final chunk to parse. - */ - end(chunk) { - var _a3, _b; - if (this.ended) { - (_b = (_a3 = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a3, new Error(".end() after done!")); - return; - } - if (chunk) - this.write(chunk); - this.ended = true; - this.tokenizer.end(); - } - /** - * Pauses parsing. The parser won't emit events until `resume` is called. - */ - pause() { - this.tokenizer.pause(); - } - /** - * Resumes parsing after `pause` was called. - */ - resume() { - this.tokenizer.resume(); - while (this.tokenizer.running && this.writeIndex < this.buffers.length) { - this.tokenizer.write(this.buffers[this.writeIndex++]); - } - if (this.ended) - this.tokenizer.end(); - } - /** - * Alias of `write`, for backwards compatibility. - * - * @param chunk Chunk to parse. - * @deprecated - */ - parseChunk(chunk) { - this.write(chunk); - } - /** - * Alias of `end`, for backwards compatibility. - * - * @param chunk Optional final chunk to parse. - * @deprecated - */ - done(chunk) { - this.end(chunk); - } -}; - -// node_modules/htmlparser2/node_modules/domhandler/lib/esm/index.js -init_define_import_meta_env(); - -// node_modules/domelementtype/lib/esm/index.js -var esm_exports = {}; -__export(esm_exports, { - CDATA: () => CDATA, - Comment: () => Comment, - Directive: () => Directive, - Doctype: () => Doctype, - ElementType: () => ElementType, - Root: () => Root, - Script: () => Script, - Style: () => Style, - Tag: () => Tag, - Text: () => Text, - isTag: () => isTag -}); -init_define_import_meta_env(); -var ElementType; -(function(ElementType5) { - ElementType5["Root"] = "root"; - ElementType5["Text"] = "text"; - ElementType5["Directive"] = "directive"; - ElementType5["Comment"] = "comment"; - ElementType5["Script"] = "script"; - ElementType5["Style"] = "style"; - ElementType5["Tag"] = "tag"; - ElementType5["CDATA"] = "cdata"; - ElementType5["Doctype"] = "doctype"; -})(ElementType || (ElementType = {})); -function isTag(elem) { - return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style; -} -var Root = ElementType.Root; -var Text = ElementType.Text; -var Directive = ElementType.Directive; -var Comment = ElementType.Comment; -var Script = ElementType.Script; -var Style = ElementType.Style; -var Tag = ElementType.Tag; -var CDATA = ElementType.CDATA; -var Doctype = ElementType.Doctype; - -// node_modules/htmlparser2/node_modules/domhandler/lib/esm/node.js -init_define_import_meta_env(); -var Node = class { - constructor() { - this.parent = null; - this.prev = null; - this.next = null; - this.startIndex = null; - this.endIndex = null; - } - // Read-write aliases for properties - /** - * Same as {@link parent}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get parentNode() { - return this.parent; - } - set parentNode(parent) { - this.parent = parent; - } - /** - * Same as {@link prev}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get previousSibling() { - return this.prev; - } - set previousSibling(prev) { - this.prev = prev; - } - /** - * Same as {@link next}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get nextSibling() { - return this.next; - } - set nextSibling(next) { - this.next = next; - } - /** - * Clone this node, and optionally its children. - * - * @param recursive Clone child nodes as well. - * @returns A clone of the node. - */ - cloneNode(recursive = false) { - return cloneNode(this, recursive); - } -}; -var DataNode = class extends Node { - /** - * @param data The content of the data node - */ - constructor(data) { - super(); - this.data = data; - } - /** - * Same as {@link data}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get nodeValue() { - return this.data; - } - set nodeValue(data) { - this.data = data; - } -}; -var Text2 = class extends DataNode { - constructor() { - super(...arguments); - this.type = ElementType.Text; - } - get nodeType() { - return 3; - } -}; -var Comment2 = class extends DataNode { - constructor() { - super(...arguments); - this.type = ElementType.Comment; - } - get nodeType() { - return 8; - } -}; -var ProcessingInstruction = class extends DataNode { - constructor(name, data) { - super(data); - this.name = name; - this.type = ElementType.Directive; - } - get nodeType() { - return 1; - } -}; -var NodeWithChildren = class extends Node { - /** - * @param children Children of the node. Only certain node types can have children. - */ - constructor(children) { - super(); - this.children = children; - } - // Aliases - /** First child of the node. */ - get firstChild() { - var _a3; - return (_a3 = this.children[0]) !== null && _a3 !== void 0 ? _a3 : null; - } - /** Last child of the node. */ - get lastChild() { - return this.children.length > 0 ? this.children[this.children.length - 1] : null; - } - /** - * Same as {@link children}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get childNodes() { - return this.children; - } - set childNodes(children) { - this.children = children; - } -}; -var CDATA2 = class extends NodeWithChildren { - constructor() { - super(...arguments); - this.type = ElementType.CDATA; - } - get nodeType() { - return 4; - } -}; -var Document = class extends NodeWithChildren { - constructor() { - super(...arguments); - this.type = ElementType.Root; - } - get nodeType() { - return 9; - } -}; -var Element = class extends NodeWithChildren { - /** - * @param name Name of the tag, eg. `div`, `span`. - * @param attribs Object mapping attribute names to attribute values. - * @param children Children of the node. - */ - constructor(name, attribs, children = [], type = name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag) { - super(children); - this.name = name; - this.attribs = attribs; - this.type = type; - } - get nodeType() { - return 1; - } - // DOM Level 1 aliases - /** - * Same as {@link name}. - * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. - */ - get tagName() { - return this.name; - } - set tagName(name) { - this.name = name; - } - get attributes() { - return Object.keys(this.attribs).map((name) => { - var _a3, _b; - return { - name, - value: this.attribs[name], - namespace: (_a3 = this["x-attribsNamespace"]) === null || _a3 === void 0 ? void 0 : _a3[name], - prefix: (_b = this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name] - }; - }); - } -}; -function isTag2(node) { - return isTag(node); -} -function isCDATA(node) { - return node.type === ElementType.CDATA; -} -function isText(node) { - return node.type === ElementType.Text; -} -function isComment(node) { - return node.type === ElementType.Comment; -} -function isDirective(node) { - return node.type === ElementType.Directive; -} -function isDocument(node) { - return node.type === ElementType.Root; -} -function hasChildren(node) { - return Object.prototype.hasOwnProperty.call(node, "children"); -} -function cloneNode(node, recursive = false) { - let result; - if (isText(node)) { - result = new Text2(node.data); - } else if (isComment(node)) { - result = new Comment2(node.data); - } else if (isTag2(node)) { - const children = recursive ? cloneChildren(node.children) : []; - const clone = new Element(node.name, { ...node.attribs }, children); - children.forEach((child) => child.parent = clone); - if (node.namespace != null) { - clone.namespace = node.namespace; - } - if (node["x-attribsNamespace"]) { - clone["x-attribsNamespace"] = { ...node["x-attribsNamespace"] }; - } - if (node["x-attribsPrefix"]) { - clone["x-attribsPrefix"] = { ...node["x-attribsPrefix"] }; - } - result = clone; - } else if (isCDATA(node)) { - const children = recursive ? cloneChildren(node.children) : []; - const clone = new CDATA2(children); - children.forEach((child) => child.parent = clone); - result = clone; - } else if (isDocument(node)) { - const children = recursive ? cloneChildren(node.children) : []; - const clone = new Document(children); - children.forEach((child) => child.parent = clone); - if (node["x-mode"]) { - clone["x-mode"] = node["x-mode"]; - } - result = clone; - } else if (isDirective(node)) { - const instruction = new ProcessingInstruction(node.name, node.data); - if (node["x-name"] != null) { - instruction["x-name"] = node["x-name"]; - instruction["x-publicId"] = node["x-publicId"]; - instruction["x-systemId"] = node["x-systemId"]; - } - result = instruction; - } else { - throw new Error(`Not implemented yet: ${node.type}`); - } - result.startIndex = node.startIndex; - result.endIndex = node.endIndex; - if (node.sourceCodeLocation != null) { - result.sourceCodeLocation = node.sourceCodeLocation; - } - return result; -} -function cloneChildren(childs) { - const children = childs.map((child) => cloneNode(child, true)); - for (let i = 1; i < children.length; i++) { - children[i].prev = children[i - 1]; - children[i - 1].next = children[i]; - } - return children; -} - -// node_modules/htmlparser2/node_modules/domhandler/lib/esm/index.js -var defaultOpts = { - withStartIndices: false, - withEndIndices: false, - xmlMode: false -}; -var DomHandler = class { - /** - * @param callback Called once parsing has completed. - * @param options Settings for the handler. - * @param elementCB Callback whenever a tag is closed. - */ - constructor(callback, options, elementCB) { - this.dom = []; - this.root = new Document(this.dom); - this.done = false; - this.tagStack = [this.root]; - this.lastNode = null; - this.parser = null; - if (typeof options === "function") { - elementCB = options; - options = defaultOpts; - } - if (typeof callback === "object") { - options = callback; - callback = void 0; - } - this.callback = callback !== null && callback !== void 0 ? callback : null; - this.options = options !== null && options !== void 0 ? options : defaultOpts; - this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null; - } - onparserinit(parser) { - this.parser = parser; - } - // Resets the handler back to starting state - onreset() { - this.dom = []; - this.root = new Document(this.dom); - this.done = false; - this.tagStack = [this.root]; - this.lastNode = null; - this.parser = null; - } - // Signals the handler that parsing is done - onend() { - if (this.done) - return; - this.done = true; - this.parser = null; - this.handleCallback(null); - } - onerror(error) { - this.handleCallback(error); - } - onclosetag() { - this.lastNode = null; - const elem = this.tagStack.pop(); - if (this.options.withEndIndices) { - elem.endIndex = this.parser.endIndex; - } - if (this.elementCB) - this.elementCB(elem); - } - onopentag(name, attribs) { - const type = this.options.xmlMode ? ElementType.Tag : void 0; - const element = new Element(name, attribs, void 0, type); - this.addNode(element); - this.tagStack.push(element); - } - ontext(data) { - const { lastNode } = this; - if (lastNode && lastNode.type === ElementType.Text) { - lastNode.data += data; - if (this.options.withEndIndices) { - lastNode.endIndex = this.parser.endIndex; - } - } else { - const node = new Text2(data); - this.addNode(node); - this.lastNode = node; - } - } - oncomment(data) { - if (this.lastNode && this.lastNode.type === ElementType.Comment) { - this.lastNode.data += data; - return; - } - const node = new Comment2(data); - this.addNode(node); - this.lastNode = node; - } - oncommentend() { - this.lastNode = null; - } - oncdatastart() { - const text = new Text2(""); - const node = new CDATA2([text]); - this.addNode(node); - text.parent = node; - this.lastNode = text; - } - oncdataend() { - this.lastNode = null; - } - onprocessinginstruction(name, data) { - const node = new ProcessingInstruction(name, data); - this.addNode(node); - } - handleCallback(error) { - if (typeof this.callback === "function") { - this.callback(error, this.dom); - } else if (error) { - throw error; - } - } - addNode(node) { - const parent = this.tagStack[this.tagStack.length - 1]; - const previousSibling2 = parent.children[parent.children.length - 1]; - if (this.options.withStartIndices) { - node.startIndex = this.parser.startIndex; - } - if (this.options.withEndIndices) { - node.endIndex = this.parser.endIndex; - } - parent.children.push(node); - if (previousSibling2) { - node.prev = previousSibling2; - previousSibling2.next = node; - } - node.parent = parent; - this.lastNode = null; - } -}; - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/index.js -var esm_exports2 = {}; -__export(esm_exports2, { - DocumentPosition: () => DocumentPosition, - append: () => append, - appendChild: () => appendChild, - compareDocumentPosition: () => compareDocumentPosition, - existsOne: () => existsOne, - filter: () => filter, - find: () => find, - findAll: () => findAll, - findOne: () => findOne, - findOneChild: () => findOneChild, - getAttributeValue: () => getAttributeValue, - getChildren: () => getChildren, - getElementById: () => getElementById, - getElements: () => getElements, - getElementsByClassName: () => getElementsByClassName, - getElementsByTagName: () => getElementsByTagName, - getElementsByTagType: () => getElementsByTagType, - getFeed: () => getFeed, - getInnerHTML: () => getInnerHTML, - getName: () => getName, - getOuterHTML: () => getOuterHTML, - getParent: () => getParent, - getSiblings: () => getSiblings, - getText: () => getText, - hasAttrib: () => hasAttrib, - hasChildren: () => hasChildren, - innerText: () => innerText, - isCDATA: () => isCDATA, - isComment: () => isComment, - isDocument: () => isDocument, - isTag: () => isTag2, - isText: () => isText, - nextElementSibling: () => nextElementSibling, - prepend: () => prepend, - prependChild: () => prependChild, - prevElementSibling: () => prevElementSibling, - removeElement: () => removeElement, - removeSubsets: () => removeSubsets, - replaceElement: () => replaceElement, - testElement: () => testElement, - textContent: () => textContent, - uniqueSort: () => uniqueSort -}); -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/stringify.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/esm/index.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/index.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/decode.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/generated/decode-data-html.js -init_define_import_meta_env(); -var decode_data_html_default = new Uint16Array( - // prettier-ignore - '\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map((c) => c.charCodeAt(0)) -); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/generated/decode-data-xml.js -init_define_import_meta_env(); -var decode_data_xml_default = new Uint16Array( - // prettier-ignore - "\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map((c) => c.charCodeAt(0)) -); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/decode_codepoint.js -init_define_import_meta_env(); -var _a2; -var decodeMap2 = /* @__PURE__ */ new Map([ - [0, 65533], - // C1 Unicode control character reference replacements - [128, 8364], - [130, 8218], - [131, 402], - [132, 8222], - [133, 8230], - [134, 8224], - [135, 8225], - [136, 710], - [137, 8240], - [138, 352], - [139, 8249], - [140, 338], - [142, 381], - [145, 8216], - [146, 8217], - [147, 8220], - [148, 8221], - [149, 8226], - [150, 8211], - [151, 8212], - [152, 732], - [153, 8482], - [154, 353], - [155, 8250], - [156, 339], - [158, 382], - [159, 376] -]); -var fromCodePoint2 = ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins - (_a2 = String.fromCodePoint) !== null && _a2 !== void 0 ? _a2 : function(codePoint) { - let output = ""; - if (codePoint > 65535) { - codePoint -= 65536; - output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - output += String.fromCharCode(codePoint); - return output; - } -); -function replaceCodePoint2(codePoint) { - var _a3; - if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) { - return 65533; - } - return (_a3 = decodeMap2.get(codePoint)) !== null && _a3 !== void 0 ? _a3 : codePoint; -} - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/decode.js -var CharCodes3; -(function(CharCodes4) { - CharCodes4[CharCodes4["NUM"] = 35] = "NUM"; - CharCodes4[CharCodes4["SEMI"] = 59] = "SEMI"; - CharCodes4[CharCodes4["EQUALS"] = 61] = "EQUALS"; - CharCodes4[CharCodes4["ZERO"] = 48] = "ZERO"; - CharCodes4[CharCodes4["NINE"] = 57] = "NINE"; - CharCodes4[CharCodes4["LOWER_A"] = 97] = "LOWER_A"; - CharCodes4[CharCodes4["LOWER_F"] = 102] = "LOWER_F"; - CharCodes4[CharCodes4["LOWER_X"] = 120] = "LOWER_X"; - CharCodes4[CharCodes4["LOWER_Z"] = 122] = "LOWER_Z"; - CharCodes4[CharCodes4["UPPER_A"] = 65] = "UPPER_A"; - CharCodes4[CharCodes4["UPPER_F"] = 70] = "UPPER_F"; - CharCodes4[CharCodes4["UPPER_Z"] = 90] = "UPPER_Z"; -})(CharCodes3 || (CharCodes3 = {})); -var TO_LOWER_BIT2 = 32; -var BinTrieFlags2; -(function(BinTrieFlags3) { - BinTrieFlags3[BinTrieFlags3["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH"; - BinTrieFlags3[BinTrieFlags3["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH"; - BinTrieFlags3[BinTrieFlags3["JUMP_TABLE"] = 127] = "JUMP_TABLE"; -})(BinTrieFlags2 || (BinTrieFlags2 = {})); -function isNumber2(code) { - return code >= CharCodes3.ZERO && code <= CharCodes3.NINE; -} -function isHexadecimalCharacter2(code) { - return code >= CharCodes3.UPPER_A && code <= CharCodes3.UPPER_F || code >= CharCodes3.LOWER_A && code <= CharCodes3.LOWER_F; -} -function isAsciiAlphaNumeric2(code) { - return code >= CharCodes3.UPPER_A && code <= CharCodes3.UPPER_Z || code >= CharCodes3.LOWER_A && code <= CharCodes3.LOWER_Z || isNumber2(code); -} -function isEntityInAttributeInvalidEnd2(code) { - return code === CharCodes3.EQUALS || isAsciiAlphaNumeric2(code); -} -var EntityDecoderState2; -(function(EntityDecoderState3) { - EntityDecoderState3[EntityDecoderState3["EntityStart"] = 0] = "EntityStart"; - EntityDecoderState3[EntityDecoderState3["NumericStart"] = 1] = "NumericStart"; - EntityDecoderState3[EntityDecoderState3["NumericDecimal"] = 2] = "NumericDecimal"; - EntityDecoderState3[EntityDecoderState3["NumericHex"] = 3] = "NumericHex"; - EntityDecoderState3[EntityDecoderState3["NamedEntity"] = 4] = "NamedEntity"; -})(EntityDecoderState2 || (EntityDecoderState2 = {})); -var DecodingMode2; -(function(DecodingMode3) { - DecodingMode3[DecodingMode3["Legacy"] = 0] = "Legacy"; - DecodingMode3[DecodingMode3["Strict"] = 1] = "Strict"; - DecodingMode3[DecodingMode3["Attribute"] = 2] = "Attribute"; -})(DecodingMode2 || (DecodingMode2 = {})); -var EntityDecoder2 = class { - constructor(decodeTree, emitCodePoint, errors) { - this.decodeTree = decodeTree; - this.emitCodePoint = emitCodePoint; - this.errors = errors; - this.state = EntityDecoderState2.EntityStart; - this.consumed = 1; - this.result = 0; - this.treeIndex = 0; - this.excess = 1; - this.decodeMode = DecodingMode2.Strict; - } - /** Resets the instance to make it reusable. */ - startEntity(decodeMode) { - this.decodeMode = decodeMode; - this.state = EntityDecoderState2.EntityStart; - this.result = 0; - this.treeIndex = 0; - this.excess = 1; - this.consumed = 1; - } - /** - * Write an entity to the decoder. This can be called multiple times with partial entities. - * If the entity is incomplete, the decoder will return -1. - * - * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the - * entity is incomplete, and resume when the next string is written. - * - * @param string The string containing the entity (or a continuation of the entity). - * @param offset The offset at which the entity begins. Should be 0 if this is not the first call. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - write(str, offset) { - switch (this.state) { - case EntityDecoderState2.EntityStart: { - if (str.charCodeAt(offset) === CharCodes3.NUM) { - this.state = EntityDecoderState2.NumericStart; - this.consumed += 1; - return this.stateNumericStart(str, offset + 1); + /** + * Processes the inner messages of a container with many of them: + * msg_container#73f1f8dc messages:vector<%Message> = MessageContainer; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleContainer(message) { + this._log.debug("Handling container"); + for (const innerMessage of message.obj.messages) { + await this._processMessage(innerMessage); } - this.state = EntityDecoderState2.NamedEntity; - return this.stateNamedEntity(str, offset); } - case EntityDecoderState2.NumericStart: { - return this.stateNumericStart(str, offset); + /** + * Unpacks the data from a gzipped object and processes it: + * gzip_packed#3072cfa1 packed_data:bytes = Object; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleGzipPacked(message) { + this._log.debug("Handling gzipped data"); + const reader = new extensions_1.BinaryReader(message.obj.data); + message.obj = reader.tgReadObject(); + await this._processMessage(message); } - case EntityDecoderState2.NumericDecimal: { - return this.stateNumericDecimal(str, offset); + async _handleUpdate(message) { + if (message.obj.SUBCLASS_OF_ID !== 2331323052) { + this._log.warn(`Note: ${message.obj.className} is not an update, not dispatching it`); + return; + } + this._log.debug("Handling update " + message.obj.className); + if (this._updateCallback) { + this._updateCallback(this._client, message.obj); + } } - case EntityDecoderState2.NumericHex: { - return this.stateNumericHex(str, offset); + /** + * Handles pong results, which don't come inside a ``RPCResult`` + * but are still sent through a request: + * pong#347773c5 msg_id:long ping_id:long = Pong; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handlePong(message) { + const pong = message.obj; + this._log.debug(`Handling pong for message ${pong.msgId}`); + const state2 = this._pendingState.get(pong.msgId.toString()); + this._pendingState.delete(pong.msgId.toString()); + if (state2) { + state2.resolve(pong); + } } - case EntityDecoderState2.NamedEntity: { - return this.stateNamedEntity(str, offset); + /** + * Corrects the currently used server salt to use the right value + * before enqueuing the rejected message to be re-sent: + * bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int + * error_code:int new_server_salt:long = BadMsgNotification; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleBadServerSalt(message) { + const badSalt = message.obj; + this._log.debug(`Handling bad salt for message ${badSalt.badMsgId}`); + this._state.salt = badSalt.newServerSalt; + const states = this._popStates(badSalt.badMsgId); + this._sendQueue.extend(states); + this._log.debug(`${states.length} message(s) will be resent`); } - } - } - /** - * Switches between the numeric decimal and hexadecimal states. - * - * Equivalent to the `Numeric character reference state` in the HTML spec. - * - * @param str The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericStart(str, offset) { - if (offset >= str.length) { - return -1; - } - if ((str.charCodeAt(offset) | TO_LOWER_BIT2) === CharCodes3.LOWER_X) { - this.state = EntityDecoderState2.NumericHex; - this.consumed += 1; - return this.stateNumericHex(str, offset + 1); - } - this.state = EntityDecoderState2.NumericDecimal; - return this.stateNumericDecimal(str, offset); - } - addToNumericResult(str, start, end, base) { - if (start !== end) { - const digitCount = end - start; - this.result = this.result * Math.pow(base, digitCount) + parseInt(str.substr(start, digitCount), base); - this.consumed += digitCount; - } - } - /** - * Parses a hexadecimal numeric entity. - * - * Equivalent to the `Hexademical character reference state` in the HTML spec. - * - * @param str The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericHex(str, offset) { - const startIdx = offset; - while (offset < str.length) { - const char = str.charCodeAt(offset); - if (isNumber2(char) || isHexadecimalCharacter2(char)) { - offset += 1; - } else { - this.addToNumericResult(str, startIdx, offset, 16); - return this.emitNumericEntity(char, 3); + /** + * Adjusts the current state to be correct based on the + * received bad message notification whenever possible: + * bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int + * error_code:int = BadMsgNotification; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleBadNotification(message) { + const badMsg = message.obj; + const states = this._popStates(badMsg.badMsgId); + this._log.debug(`Handling bad msg ${JSON.stringify(badMsg)}`); + if ([16, 17].includes(badMsg.errorCode)) { + const to = this._state.updateTimeOffset((0, big_integer_1.default)(message.msgId)); + this._log.info(`System clock is wrong, set time offset to ${to}s`); + } else if (badMsg.errorCode === 32) { + this._state._sequence += 64; + } else if (badMsg.errorCode === 33) { + this._state._sequence -= 16; + } else { + for (const state2 of states) { + state2.reject(new errors_1.BadMessageError(state2.request, badMsg.errorCode)); + } + return; + } + this._sendQueue.extend(states); + this._log.debug(`${states.length} messages will be resent due to bad msg`); } - } - this.addToNumericResult(str, startIdx, offset, 16); - return -1; - } - /** - * Parses a decimal numeric entity. - * - * Equivalent to the `Decimal character reference state` in the HTML spec. - * - * @param str The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNumericDecimal(str, offset) { - const startIdx = offset; - while (offset < str.length) { - const char = str.charCodeAt(offset); - if (isNumber2(char)) { - offset += 1; - } else { - this.addToNumericResult(str, startIdx, offset, 10); - return this.emitNumericEntity(char, 2); + /** + * Updates the current status with the received detailed information: + * msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long + * bytes:int status:int = MsgDetailedInfo; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleDetailedInfo(message) { + const msgId = message.obj.answerMsgId; + this._log.debug(`Handling detailed info for message ${msgId}`); + this._pendingAck.add(msgId); } - } - this.addToNumericResult(str, startIdx, offset, 10); - return -1; - } - /** - * Validate and emit a numeric entity. - * - * Implements the logic from the `Hexademical character reference start - * state` and `Numeric character reference end state` in the HTML spec. - * - * @param lastCp The last code point of the entity. Used to see if the - * entity was terminated with a semicolon. - * @param expectedLength The minimum number of characters that should be - * consumed. Used to validate that at least one digit - * was consumed. - * @returns The number of characters that were consumed. - */ - emitNumericEntity(lastCp, expectedLength) { - var _a3; - if (this.consumed <= expectedLength) { - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.absenceOfDigitsInNumericCharacterReference(this.consumed); - return 0; - } - if (lastCp === CharCodes3.SEMI) { - this.consumed += 1; - } else if (this.decodeMode === DecodingMode2.Strict) { - return 0; - } - this.emitCodePoint(replaceCodePoint2(this.result), this.consumed); - if (this.errors) { - if (lastCp !== CharCodes3.SEMI) { - this.errors.missingSemicolonAfterCharacterReference(); + /** + * Updates the current status with the received detailed information: + * msg_new_detailed_info#809db6df answer_msg_id:long + * bytes:int status:int = MsgDetailedInfo; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleNewDetailedInfo(message) { + const msgId = message.obj.answerMsgId; + this._log.debug(`Handling new detailed info for message ${msgId}`); + this._pendingAck.add(msgId); } - this.errors.validateNumericCharacterReference(this.result); - } - return this.consumed; - } - /** - * Parses a named entity. - * - * Equivalent to the `Named character reference state` in the HTML spec. - * - * @param str The string containing the entity (or a continuation of the entity). - * @param offset The current offset. - * @returns The number of characters that were consumed, or -1 if the entity is incomplete. - */ - stateNamedEntity(str, offset) { - const { decodeTree } = this; - let current = decodeTree[this.treeIndex]; - let valueLength = (current & BinTrieFlags2.VALUE_LENGTH) >> 14; - for (; offset < str.length; offset++, this.excess++) { - const char = str.charCodeAt(offset); - this.treeIndex = determineBranch2(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char); - if (this.treeIndex < 0) { - return this.result === 0 || // If we are parsing an attribute - this.decodeMode === DecodingMode2.Attribute && // We shouldn't have consumed any characters after the entity, - (valueLength === 0 || // And there should be no invalid characters. - isEntityInAttributeInvalidEnd2(char)) ? 0 : this.emitNotTerminatedNamedEntity(); - } - current = decodeTree[this.treeIndex]; - valueLength = (current & BinTrieFlags2.VALUE_LENGTH) >> 14; - if (valueLength !== 0) { - if (char === CharCodes3.SEMI) { - return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess); - } - if (this.decodeMode !== DecodingMode2.Strict) { - this.result = this.treeIndex; - this.consumed += this.excess; - this.excess = 0; - } - } - } - return -1; - } - /** - * Emit a named entity that was not terminated with a semicolon. - * - * @returns The number of characters consumed. - */ - emitNotTerminatedNamedEntity() { - var _a3; - const { result, decodeTree } = this; - const valueLength = (decodeTree[result] & BinTrieFlags2.VALUE_LENGTH) >> 14; - this.emitNamedEntityData(result, valueLength, this.consumed); - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.missingSemicolonAfterCharacterReference(); - return this.consumed; - } - /** - * Emit a named entity. - * - * @param result The index of the entity in the decode tree. - * @param valueLength The number of bytes in the entity. - * @param consumed The number of characters consumed. - * - * @returns The number of characters consumed. - */ - emitNamedEntityData(result, valueLength, consumed) { - const { decodeTree } = this; - this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags2.VALUE_LENGTH : decodeTree[result + 1], consumed); - if (valueLength === 3) { - this.emitCodePoint(decodeTree[result + 2], consumed); - } - return consumed; - } - /** - * Signal to the parser that the end of the input was reached. - * - * Remaining data will be emitted and relevant errors will be produced. - * - * @returns The number of characters consumed. - */ - end() { - var _a3; - switch (this.state) { - case EntityDecoderState2.NamedEntity: { - return this.result !== 0 && (this.decodeMode !== DecodingMode2.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0; - } - // Otherwise, emit a numeric entity if we have one. - case EntityDecoderState2.NumericDecimal: { - return this.emitNumericEntity(0, 2); - } - case EntityDecoderState2.NumericHex: { - return this.emitNumericEntity(0, 3); - } - case EntityDecoderState2.NumericStart: { - (_a3 = this.errors) === null || _a3 === void 0 ? void 0 : _a3.absenceOfDigitsInNumericCharacterReference(this.consumed); - return 0; + /** + * Updates the current status with the received session information: + * new_session_created#9ec20908 first_msg_id:long unique_id:long + * server_salt:long = NewSession; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleNewSessionCreated(message) { + this._log.debug("Handling new session created"); + this._state.salt = message.obj.serverSalt; } - case EntityDecoderState2.EntityStart: { - return 0; + /** + * Handles a server acknowledge about our messages. Normally these can be ignored + */ + _handleAck() { } - } - } -}; -function getDecoder(decodeTree) { - let ret = ""; - const decoder = new EntityDecoder2(decodeTree, (str) => ret += fromCodePoint2(str)); - return function decodeWithTrie(str, decodeMode) { - let lastIndex = 0; - let offset = 0; - while ((offset = str.indexOf("&", offset)) >= 0) { - ret += str.slice(lastIndex, offset); - decoder.startEntity(decodeMode); - const len = decoder.write( - str, - // Skip the "&" - offset + 1 - ); - if (len < 0) { - lastIndex = offset + decoder.end(); - break; + /** + * Handles future salt results, which don't come inside a + * ``rpc_result`` but are still sent through a request: + * future_salts#ae500895 req_msg_id:long now:int + * salts:vector<future_salt> = FutureSalts; + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleFutureSalts(message) { + this._log.debug(`Handling future salts for message ${message.msgId}`); + const state2 = this._pendingState.getAndDelete(message.msgId); + if (state2) { + state2.resolve(message.obj); + } } - lastIndex = offset + len; - offset = len === 0 ? lastIndex + 1 : lastIndex; - } - const result = ret + str.slice(lastIndex); - ret = ""; - return result; - }; -} -function determineBranch2(decodeTree, current, nodeIdx, char) { - const branchCount = (current & BinTrieFlags2.BRANCH_LENGTH) >> 7; - const jumpOffset = current & BinTrieFlags2.JUMP_TABLE; - if (branchCount === 0) { - return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1; - } - if (jumpOffset) { - const value = char - jumpOffset; - return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIdx + value] - 1; - } - let lo = nodeIdx; - let hi = lo + branchCount - 1; - while (lo <= hi) { - const mid = lo + hi >>> 1; - const midVal = decodeTree[mid]; - if (midVal < char) { - lo = mid + 1; - } else if (midVal > char) { - hi = mid - 1; - } else { - return decodeTree[mid + branchCount]; - } - } - return -1; -} -var htmlDecoder = getDecoder(decode_data_html_default); -var xmlDecoder = getDecoder(decode_data_xml_default); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/encode.js -init_define_import_meta_env(); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/generated/encode-html.js -init_define_import_meta_env(); -function restoreDiff(arr) { - for (let i = 1; i < arr.length; i++) { - arr[i][0] += arr[i - 1][0] + 1; - } - return arr; -} -var encode_html_default = new Map(/* @__PURE__ */ restoreDiff([[9, " "], [0, " "], [22, "!"], [0, """], [0, "#"], [0, "$"], [0, "%"], [0, "&"], [0, "'"], [0, "("], [0, ")"], [0, "*"], [0, "+"], [0, ","], [1, "."], [0, "/"], [10, ":"], [0, ";"], [0, { v: "<", n: 8402, o: "<⃒" }], [0, { v: "=", n: 8421, o: "=⃥" }], [0, { v: ">", n: 8402, o: ">⃒" }], [0, "?"], [0, "@"], [26, "["], [0, "\"], [0, "]"], [0, "^"], [0, "_"], [0, "`"], [5, { n: 106, o: "fj" }], [20, "{"], [0, "|"], [0, "}"], [34, " "], [0, "¡"], [0, "¢"], [0, "£"], [0, "¤"], [0, "¥"], [0, "¦"], [0, "§"], [0, "¨"], [0, "©"], [0, "ª"], [0, "«"], [0, "¬"], [0, "­"], [0, "®"], [0, "¯"], [0, "°"], [0, "±"], [0, "²"], [0, "³"], [0, "´"], [0, "µ"], [0, "¶"], [0, "·"], [0, "¸"], [0, "¹"], [0, "º"], [0, "»"], [0, "¼"], [0, "½"], [0, "¾"], [0, "¿"], [0, "À"], [0, "Á"], [0, "Â"], [0, "Ã"], [0, "Ä"], [0, "Å"], [0, "Æ"], [0, "Ç"], [0, "È"], [0, "É"], [0, "Ê"], [0, "Ë"], [0, "Ì"], [0, "Í"], [0, "Î"], [0, "Ï"], [0, "Ð"], [0, "Ñ"], [0, "Ò"], [0, "Ó"], [0, "Ô"], [0, "Õ"], [0, "Ö"], [0, "×"], [0, "Ø"], [0, "Ù"], [0, "Ú"], [0, "Û"], [0, "Ü"], [0, "Ý"], [0, "Þ"], [0, "ß"], [0, "à"], [0, "á"], [0, "â"], [0, "ã"], [0, "ä"], [0, "å"], [0, "æ"], [0, "ç"], [0, "è"], [0, "é"], [0, "ê"], [0, "ë"], [0, "ì"], [0, "í"], [0, "î"], [0, "ï"], [0, "ð"], [0, "ñ"], [0, "ò"], [0, "ó"], [0, "ô"], [0, "õ"], [0, "ö"], [0, "÷"], [0, "ø"], [0, "ù"], [0, "ú"], [0, "û"], [0, "ü"], [0, "ý"], [0, "þ"], [0, "ÿ"], [0, "Ā"], [0, "ā"], [0, "Ă"], [0, "ă"], [0, "Ą"], [0, "ą"], [0, "Ć"], [0, "ć"], [0, "Ĉ"], [0, "ĉ"], [0, "Ċ"], [0, "ċ"], [0, "Č"], [0, "č"], [0, "Ď"], [0, "ď"], [0, "Đ"], [0, "đ"], [0, "Ē"], [0, "ē"], [2, "Ė"], [0, "ė"], [0, "Ę"], [0, "ę"], [0, "Ě"], [0, "ě"], [0, "Ĝ"], [0, "ĝ"], [0, "Ğ"], [0, "ğ"], [0, "Ġ"], [0, "ġ"], [0, "Ģ"], [1, "Ĥ"], [0, "ĥ"], [0, "Ħ"], [0, "ħ"], [0, "Ĩ"], [0, "ĩ"], [0, "Ī"], [0, "ī"], [2, "Į"], [0, "į"], [0, "İ"], [0, "ı"], [0, "IJ"], [0, "ij"], [0, "Ĵ"], [0, "ĵ"], [0, "Ķ"], [0, "ķ"], [0, "ĸ"], [0, "Ĺ"], [0, "ĺ"], [0, "Ļ"], [0, "ļ"], [0, "Ľ"], [0, "ľ"], [0, "Ŀ"], [0, "ŀ"], [0, "Ł"], [0, "ł"], [0, "Ń"], [0, "ń"], [0, "Ņ"], [0, "ņ"], [0, "Ň"], [0, "ň"], [0, "ʼn"], [0, "Ŋ"], [0, "ŋ"], [0, "Ō"], [0, "ō"], [2, "Ő"], [0, "ő"], [0, "Œ"], [0, "œ"], [0, "Ŕ"], [0, "ŕ"], [0, "Ŗ"], [0, "ŗ"], [0, "Ř"], [0, "ř"], [0, "Ś"], [0, "ś"], [0, "Ŝ"], [0, "ŝ"], [0, "Ş"], [0, "ş"], [0, "Š"], [0, "š"], [0, "Ţ"], [0, "ţ"], [0, "Ť"], [0, "ť"], [0, "Ŧ"], [0, "ŧ"], [0, "Ũ"], [0, "ũ"], [0, "Ū"], [0, "ū"], [0, "Ŭ"], [0, "ŭ"], [0, "Ů"], [0, "ů"], [0, "Ű"], [0, "ű"], [0, "Ų"], [0, "ų"], [0, "Ŵ"], [0, "ŵ"], [0, "Ŷ"], [0, "ŷ"], [0, "Ÿ"], [0, "Ź"], [0, "ź"], [0, "Ż"], [0, "ż"], [0, "Ž"], [0, "ž"], [19, "ƒ"], [34, "Ƶ"], [63, "ǵ"], [65, "ȷ"], [142, "ˆ"], [0, "ˇ"], [16, "˘"], [0, "˙"], [0, "˚"], [0, "˛"], [0, "˜"], [0, "˝"], [51, "̑"], [127, "Α"], [0, "Β"], [0, "Γ"], [0, "Δ"], [0, "Ε"], [0, "Ζ"], [0, "Η"], [0, "Θ"], [0, "Ι"], [0, "Κ"], [0, "Λ"], [0, "Μ"], [0, "Ν"], [0, "Ξ"], [0, "Ο"], [0, "Π"], [0, "Ρ"], [1, "Σ"], [0, "Τ"], [0, "Υ"], [0, "Φ"], [0, "Χ"], [0, "Ψ"], [0, "Ω"], [7, "α"], [0, "β"], [0, "γ"], [0, "δ"], [0, "ε"], [0, "ζ"], [0, "η"], [0, "θ"], [0, "ι"], [0, "κ"], [0, "λ"], [0, "μ"], [0, "ν"], [0, "ξ"], [0, "ο"], [0, "π"], [0, "ρ"], [0, "ς"], [0, "σ"], [0, "τ"], [0, "υ"], [0, "φ"], [0, "χ"], [0, "ψ"], [0, "ω"], [7, "ϑ"], [0, "ϒ"], [2, "ϕ"], [0, "ϖ"], [5, "Ϝ"], [0, "ϝ"], [18, "ϰ"], [0, "ϱ"], [3, "ϵ"], [0, "϶"], [10, "Ё"], [0, "Ђ"], [0, "Ѓ"], [0, "Є"], [0, "Ѕ"], [0, "І"], [0, "Ї"], [0, "Ј"], [0, "Љ"], [0, "Њ"], [0, "Ћ"], [0, "Ќ"], [1, "Ў"], [0, "Џ"], [0, "А"], [0, "Б"], [0, "В"], [0, "Г"], [0, "Д"], [0, "Е"], [0, "Ж"], [0, "З"], [0, "И"], [0, "Й"], [0, "К"], [0, "Л"], [0, "М"], [0, "Н"], [0, "О"], [0, "П"], [0, "Р"], [0, "С"], [0, "Т"], [0, "У"], [0, "Ф"], [0, "Х"], [0, "Ц"], [0, "Ч"], [0, "Ш"], [0, "Щ"], [0, "Ъ"], [0, "Ы"], [0, "Ь"], [0, "Э"], [0, "Ю"], [0, "Я"], [0, "а"], [0, "б"], [0, "в"], [0, "г"], [0, "д"], [0, "е"], [0, "ж"], [0, "з"], [0, "и"], [0, "й"], [0, "к"], [0, "л"], [0, "м"], [0, "н"], [0, "о"], [0, "п"], [0, "р"], [0, "с"], [0, "т"], [0, "у"], [0, "ф"], [0, "х"], [0, "ц"], [0, "ч"], [0, "ш"], [0, "щ"], [0, "ъ"], [0, "ы"], [0, "ь"], [0, "э"], [0, "ю"], [0, "я"], [1, "ё"], [0, "ђ"], [0, "ѓ"], [0, "є"], [0, "ѕ"], [0, "і"], [0, "ї"], [0, "ј"], [0, "љ"], [0, "њ"], [0, "ћ"], [0, "ќ"], [1, "ў"], [0, "џ"], [7074, " "], [0, " "], [0, " "], [0, " "], [1, " "], [0, " "], [0, " "], [0, " "], [0, "​"], [0, "‌"], [0, "‍"], [0, "‎"], [0, "‏"], [0, "‐"], [2, "–"], [0, "—"], [0, "―"], [0, "‖"], [1, "‘"], [0, "’"], [0, "‚"], [1, "“"], [0, "”"], [0, "„"], [1, "†"], [0, "‡"], [0, "•"], [2, "‥"], [0, "…"], [9, "‰"], [0, "‱"], [0, "′"], [0, "″"], [0, "‴"], [0, "‵"], [3, "‹"], [0, "›"], [3, "‾"], [2, "⁁"], [1, "⁃"], [0, "⁄"], [10, "⁏"], [7, "⁗"], [7, { v: " ", n: 8202, o: "  " }], [0, "⁠"], [0, "⁡"], [0, "⁢"], [0, "⁣"], [72, "€"], [46, "⃛"], [0, "⃜"], [37, "ℂ"], [2, "℅"], [4, "ℊ"], [0, "ℋ"], [0, "ℌ"], [0, "ℍ"], [0, "ℎ"], [0, "ℏ"], [0, "ℐ"], [0, "ℑ"], [0, "ℒ"], [0, "ℓ"], [1, "ℕ"], [0, "№"], [0, "℗"], [0, "℘"], [0, "ℙ"], [0, "ℚ"], [0, "ℛ"], [0, "ℜ"], [0, "ℝ"], [0, "℞"], [3, "™"], [1, "ℤ"], [2, "℧"], [0, "ℨ"], [0, "℩"], [2, "ℬ"], [0, "ℭ"], [1, "ℯ"], [0, "ℰ"], [0, "ℱ"], [1, "ℳ"], [0, "ℴ"], [0, "ℵ"], [0, "ℶ"], [0, "ℷ"], [0, "ℸ"], [12, "ⅅ"], [0, "ⅆ"], [0, "ⅇ"], [0, "ⅈ"], [10, "⅓"], [0, "⅔"], [0, "⅕"], [0, "⅖"], [0, "⅗"], [0, "⅘"], [0, "⅙"], [0, "⅚"], [0, "⅛"], [0, "⅜"], [0, "⅝"], [0, "⅞"], [49, "←"], [0, "↑"], [0, "→"], [0, "↓"], [0, "↔"], [0, "↕"], [0, "↖"], [0, "↗"], [0, "↘"], [0, "↙"], [0, "↚"], [0, "↛"], [1, { v: "↝", n: 824, o: "↝̸" }], [0, "↞"], [0, "↟"], [0, "↠"], [0, "↡"], [0, "↢"], [0, "↣"], [0, "↤"], [0, "↥"], [0, "↦"], [0, "↧"], [1, "↩"], [0, "↪"], [0, "↫"], [0, "↬"], [0, "↭"], [0, "↮"], [1, "↰"], [0, "↱"], [0, "↲"], [0, "↳"], [1, "↵"], [0, "↶"], [0, "↷"], [2, "↺"], [0, "↻"], [0, "↼"], [0, "↽"], [0, "↾"], [0, "↿"], [0, "⇀"], [0, "⇁"], [0, "⇂"], [0, "⇃"], [0, "⇄"], [0, "⇅"], [0, "⇆"], [0, "⇇"], [0, "⇈"], [0, "⇉"], [0, "⇊"], [0, "⇋"], [0, "⇌"], [0, "⇍"], [0, "⇎"], [0, "⇏"], [0, "⇐"], [0, "⇑"], [0, "⇒"], [0, "⇓"], [0, "⇔"], [0, "⇕"], [0, "⇖"], [0, "⇗"], [0, "⇘"], [0, "⇙"], [0, "⇚"], [0, "⇛"], [1, "⇝"], [6, "⇤"], [0, "⇥"], [15, "⇵"], [7, "⇽"], [0, "⇾"], [0, "⇿"], [0, "∀"], [0, "∁"], [0, { v: "∂", n: 824, o: "∂̸" }], [0, "∃"], [0, "∄"], [0, "∅"], [1, "∇"], [0, "∈"], [0, "∉"], [1, "∋"], [0, "∌"], [2, "∏"], [0, "∐"], [0, "∑"], [0, "−"], [0, "∓"], [0, "∔"], [1, "∖"], [0, "∗"], [0, "∘"], [1, "√"], [2, "∝"], [0, "∞"], [0, "∟"], [0, { v: "∠", n: 8402, o: "∠⃒" }], [0, "∡"], [0, "∢"], [0, "∣"], [0, "∤"], [0, "∥"], [0, "∦"], [0, "∧"], [0, "∨"], [0, { v: "∩", n: 65024, o: "∩︀" }], [0, { v: "∪", n: 65024, o: "∪︀" }], [0, "∫"], [0, "∬"], [0, "∭"], [0, "∮"], [0, "∯"], [0, "∰"], [0, "∱"], [0, "∲"], [0, "∳"], [0, "∴"], [0, "∵"], [0, "∶"], [0, "∷"], [0, "∸"], [1, "∺"], [0, "∻"], [0, { v: "∼", n: 8402, o: "∼⃒" }], [0, { v: "∽", n: 817, o: "∽̱" }], [0, { v: "∾", n: 819, o: "∾̳" }], [0, "∿"], [0, "≀"], [0, "≁"], [0, { v: "≂", n: 824, o: "≂̸" }], [0, "≃"], [0, "≄"], [0, "≅"], [0, "≆"], [0, "≇"], [0, "≈"], [0, "≉"], [0, "≊"], [0, { v: "≋", n: 824, o: "≋̸" }], [0, "≌"], [0, { v: "≍", n: 8402, o: "≍⃒" }], [0, { v: "≎", n: 824, o: "≎̸" }], [0, { v: "≏", n: 824, o: "≏̸" }], [0, { v: "≐", n: 824, o: "≐̸" }], [0, "≑"], [0, "≒"], [0, "≓"], [0, "≔"], [0, "≕"], [0, "≖"], [0, "≗"], [1, "≙"], [0, "≚"], [1, "≜"], [2, "≟"], [0, "≠"], [0, { v: "≡", n: 8421, o: "≡⃥" }], [0, "≢"], [1, { v: "≤", n: 8402, o: "≤⃒" }], [0, { v: "≥", n: 8402, o: "≥⃒" }], [0, { v: "≦", n: 824, o: "≦̸" }], [0, { v: "≧", n: 824, o: "≧̸" }], [0, { v: "≨", n: 65024, o: "≨︀" }], [0, { v: "≩", n: 65024, o: "≩︀" }], [0, { v: "≪", n: new Map(/* @__PURE__ */ restoreDiff([[824, "≪̸"], [7577, "≪⃒"]])) }], [0, { v: "≫", n: new Map(/* @__PURE__ */ restoreDiff([[824, "≫̸"], [7577, "≫⃒"]])) }], [0, "≬"], [0, "≭"], [0, "≮"], [0, "≯"], [0, "≰"], [0, "≱"], [0, "≲"], [0, "≳"], [0, "≴"], [0, "≵"], [0, "≶"], [0, "≷"], [0, "≸"], [0, "≹"], [0, "≺"], [0, "≻"], [0, "≼"], [0, "≽"], [0, "≾"], [0, { v: "≿", n: 824, o: "≿̸" }], [0, "⊀"], [0, "⊁"], [0, { v: "⊂", n: 8402, o: "⊂⃒" }], [0, { v: "⊃", n: 8402, o: "⊃⃒" }], [0, "⊄"], [0, "⊅"], [0, "⊆"], [0, "⊇"], [0, "⊈"], [0, "⊉"], [0, { v: "⊊", n: 65024, o: "⊊︀" }], [0, { v: "⊋", n: 65024, o: "⊋︀" }], [1, "⊍"], [0, "⊎"], [0, { v: "⊏", n: 824, o: "⊏̸" }], [0, { v: "⊐", n: 824, o: "⊐̸" }], [0, "⊑"], [0, "⊒"], [0, { v: "⊓", n: 65024, o: "⊓︀" }], [0, { v: "⊔", n: 65024, o: "⊔︀" }], [0, "⊕"], [0, "⊖"], [0, "⊗"], [0, "⊘"], [0, "⊙"], [0, "⊚"], [0, "⊛"], [1, "⊝"], [0, "⊞"], [0, "⊟"], [0, "⊠"], [0, "⊡"], [0, "⊢"], [0, "⊣"], [0, "⊤"], [0, "⊥"], [1, "⊧"], [0, "⊨"], [0, "⊩"], [0, "⊪"], [0, "⊫"], [0, "⊬"], [0, "⊭"], [0, "⊮"], [0, "⊯"], [0, "⊰"], [1, "⊲"], [0, "⊳"], [0, { v: "⊴", n: 8402, o: "⊴⃒" }], [0, { v: "⊵", n: 8402, o: "⊵⃒" }], [0, "⊶"], [0, "⊷"], [0, "⊸"], [0, "⊹"], [0, "⊺"], [0, "⊻"], [1, "⊽"], [0, "⊾"], [0, "⊿"], [0, "⋀"], [0, "⋁"], [0, "⋂"], [0, "⋃"], [0, "⋄"], [0, "⋅"], [0, "⋆"], [0, "⋇"], [0, "⋈"], [0, "⋉"], [0, "⋊"], [0, "⋋"], [0, "⋌"], [0, "⋍"], [0, "⋎"], [0, "⋏"], [0, "⋐"], [0, "⋑"], [0, "⋒"], [0, "⋓"], [0, "⋔"], [0, "⋕"], [0, "⋖"], [0, "⋗"], [0, { v: "⋘", n: 824, o: "⋘̸" }], [0, { v: "⋙", n: 824, o: "⋙̸" }], [0, { v: "⋚", n: 65024, o: "⋚︀" }], [0, { v: "⋛", n: 65024, o: "⋛︀" }], [2, "⋞"], [0, "⋟"], [0, "⋠"], [0, "⋡"], [0, "⋢"], [0, "⋣"], [2, "⋦"], [0, "⋧"], [0, "⋨"], [0, "⋩"], [0, "⋪"], [0, "⋫"], [0, "⋬"], [0, "⋭"], [0, "⋮"], [0, "⋯"], [0, "⋰"], [0, "⋱"], [0, "⋲"], [0, "⋳"], [0, "⋴"], [0, { v: "⋵", n: 824, o: "⋵̸" }], [0, "⋶"], [0, "⋷"], [1, { v: "⋹", n: 824, o: "⋹̸" }], [0, "⋺"], [0, "⋻"], [0, "⋼"], [0, "⋽"], [0, "⋾"], [6, "⌅"], [0, "⌆"], [1, "⌈"], [0, "⌉"], [0, "⌊"], [0, "⌋"], [0, "⌌"], [0, "⌍"], [0, "⌎"], [0, "⌏"], [0, "⌐"], [1, "⌒"], [0, "⌓"], [1, "⌕"], [0, "⌖"], [5, "⌜"], [0, "⌝"], [0, "⌞"], [0, "⌟"], [2, "⌢"], [0, "⌣"], [9, "⌭"], [0, "⌮"], [7, "⌶"], [6, "⌽"], [1, "⌿"], [60, "⍼"], [51, "⎰"], [0, "⎱"], [2, "⎴"], [0, "⎵"], [0, "⎶"], [37, "⏜"], [0, "⏝"], [0, "⏞"], [0, "⏟"], [2, "⏢"], [4, "⏧"], [59, "␣"], [164, "Ⓢ"], [55, "─"], [1, "│"], [9, "┌"], [3, "┐"], [3, "└"], [3, "┘"], [3, "├"], [7, "┤"], [7, "┬"], [7, "┴"], [7, "┼"], [19, "═"], [0, "║"], [0, "╒"], [0, "╓"], [0, "╔"], [0, "╕"], [0, "╖"], [0, "╗"], [0, "╘"], [0, "╙"], [0, "╚"], [0, "╛"], [0, "╜"], [0, "╝"], [0, "╞"], [0, "╟"], [0, "╠"], [0, "╡"], [0, "╢"], [0, "╣"], [0, "╤"], [0, "╥"], [0, "╦"], [0, "╧"], [0, "╨"], [0, "╩"], [0, "╪"], [0, "╫"], [0, "╬"], [19, "▀"], [3, "▄"], [3, "█"], [8, "░"], [0, "▒"], [0, "▓"], [13, "□"], [8, "▪"], [0, "▫"], [1, "▭"], [0, "▮"], [2, "▱"], [1, "△"], [0, "▴"], [0, "▵"], [2, "▸"], [0, "▹"], [3, "▽"], [0, "▾"], [0, "▿"], [2, "◂"], [0, "◃"], [6, "◊"], [0, "○"], [32, "◬"], [2, "◯"], [8, "◸"], [0, "◹"], [0, "◺"], [0, "◻"], [0, "◼"], [8, "★"], [0, "☆"], [7, "☎"], [49, "♀"], [1, "♂"], [29, "♠"], [2, "♣"], [1, "♥"], [0, "♦"], [3, "♪"], [2, "♭"], [0, "♮"], [0, "♯"], [163, "✓"], [3, "✗"], [8, "✠"], [21, "✶"], [33, "❘"], [25, "❲"], [0, "❳"], [84, "⟈"], [0, "⟉"], [28, "⟦"], [0, "⟧"], [0, "⟨"], [0, "⟩"], [0, "⟪"], [0, "⟫"], [0, "⟬"], [0, "⟭"], [7, "⟵"], [0, "⟶"], [0, "⟷"], [0, "⟸"], [0, "⟹"], [0, "⟺"], [1, "⟼"], [2, "⟿"], [258, "⤂"], [0, "⤃"], [0, "⤄"], [0, "⤅"], [6, "⤌"], [0, "⤍"], [0, "⤎"], [0, "⤏"], [0, "⤐"], [0, "⤑"], [0, "⤒"], [0, "⤓"], [2, "⤖"], [2, "⤙"], [0, "⤚"], [0, "⤛"], [0, "⤜"], [0, "⤝"], [0, "⤞"], [0, "⤟"], [0, "⤠"], [2, "⤣"], [0, "⤤"], [0, "⤥"], [0, "⤦"], [0, "⤧"], [0, "⤨"], [0, "⤩"], [0, "⤪"], [8, { v: "⤳", n: 824, o: "⤳̸" }], [1, "⤵"], [0, "⤶"], [0, "⤷"], [0, "⤸"], [0, "⤹"], [2, "⤼"], [0, "⤽"], [7, "⥅"], [2, "⥈"], [0, "⥉"], [0, "⥊"], [0, "⥋"], [2, "⥎"], [0, "⥏"], [0, "⥐"], [0, "⥑"], [0, "⥒"], [0, "⥓"], [0, "⥔"], [0, "⥕"], [0, "⥖"], [0, "⥗"], [0, "⥘"], [0, "⥙"], [0, "⥚"], [0, "⥛"], [0, "⥜"], [0, "⥝"], [0, "⥞"], [0, "⥟"], [0, "⥠"], [0, "⥡"], [0, "⥢"], [0, "⥣"], [0, "⥤"], [0, "⥥"], [0, "⥦"], [0, "⥧"], [0, "⥨"], [0, "⥩"], [0, "⥪"], [0, "⥫"], [0, "⥬"], [0, "⥭"], [0, "⥮"], [0, "⥯"], [0, "⥰"], [0, "⥱"], [0, "⥲"], [0, "⥳"], [0, "⥴"], [0, "⥵"], [0, "⥶"], [1, "⥸"], [0, "⥹"], [1, "⥻"], [0, "⥼"], [0, "⥽"], [0, "⥾"], [0, "⥿"], [5, "⦅"], [0, "⦆"], [4, "⦋"], [0, "⦌"], [0, "⦍"], [0, "⦎"], [0, "⦏"], [0, "⦐"], [0, "⦑"], [0, "⦒"], [0, "⦓"], [0, "⦔"], [0, "⦕"], [0, "⦖"], [3, "⦚"], [1, "⦜"], [0, "⦝"], [6, "⦤"], [0, "⦥"], [0, "⦦"], [0, "⦧"], [0, "⦨"], [0, "⦩"], [0, "⦪"], [0, "⦫"], [0, "⦬"], [0, "⦭"], [0, "⦮"], [0, "⦯"], [0, "⦰"], [0, "⦱"], [0, "⦲"], [0, "⦳"], [0, "⦴"], [0, "⦵"], [0, "⦶"], [0, "⦷"], [1, "⦹"], [1, "⦻"], [0, "⦼"], [1, "⦾"], [0, "⦿"], [0, "⧀"], [0, "⧁"], [0, "⧂"], [0, "⧃"], [0, "⧄"], [0, "⧅"], [3, "⧉"], [3, "⧍"], [0, "⧎"], [0, { v: "⧏", n: 824, o: "⧏̸" }], [0, { v: "⧐", n: 824, o: "⧐̸" }], [11, "⧜"], [0, "⧝"], [0, "⧞"], [4, "⧣"], [0, "⧤"], [0, "⧥"], [5, "⧫"], [8, "⧴"], [1, "⧶"], [9, "⨀"], [0, "⨁"], [0, "⨂"], [1, "⨄"], [1, "⨆"], [5, "⨌"], [0, "⨍"], [2, "⨐"], [0, "⨑"], [0, "⨒"], [0, "⨓"], [0, "⨔"], [0, "⨕"], [0, "⨖"], [0, "⨗"], [10, "⨢"], [0, "⨣"], [0, "⨤"], [0, "⨥"], [0, "⨦"], [0, "⨧"], [1, "⨩"], [0, "⨪"], [2, "⨭"], [0, "⨮"], [0, "⨯"], [0, "⨰"], [0, "⨱"], [1, "⨳"], [0, "⨴"], [0, "⨵"], [0, "⨶"], [0, "⨷"], [0, "⨸"], [0, "⨹"], [0, "⨺"], [0, "⨻"], [0, "⨼"], [2, "⨿"], [0, "⩀"], [1, "⩂"], [0, "⩃"], [0, "⩄"], [0, "⩅"], [0, "⩆"], [0, "⩇"], [0, "⩈"], [0, "⩉"], [0, "⩊"], [0, "⩋"], [0, "⩌"], [0, "⩍"], [2, "⩐"], [2, "⩓"], [0, "⩔"], [0, "⩕"], [0, "⩖"], [0, "⩗"], [0, "⩘"], [1, "⩚"], [0, "⩛"], [0, "⩜"], [0, "⩝"], [1, "⩟"], [6, "⩦"], [3, "⩪"], [2, { v: "⩭", n: 824, o: "⩭̸" }], [0, "⩮"], [0, "⩯"], [0, { v: "⩰", n: 824, o: "⩰̸" }], [0, "⩱"], [0, "⩲"], [0, "⩳"], [0, "⩴"], [0, "⩵"], [1, "⩷"], [0, "⩸"], [0, "⩹"], [0, "⩺"], [0, "⩻"], [0, "⩼"], [0, { v: "⩽", n: 824, o: "⩽̸" }], [0, { v: "⩾", n: 824, o: "⩾̸" }], [0, "⩿"], [0, "⪀"], [0, "⪁"], [0, "⪂"], [0, "⪃"], [0, "⪄"], [0, "⪅"], [0, "⪆"], [0, "⪇"], [0, "⪈"], [0, "⪉"], [0, "⪊"], [0, "⪋"], [0, "⪌"], [0, "⪍"], [0, "⪎"], [0, "⪏"], [0, "⪐"], [0, "⪑"], [0, "⪒"], [0, "⪓"], [0, "⪔"], [0, "⪕"], [0, "⪖"], [0, "⪗"], [0, "⪘"], [0, "⪙"], [0, "⪚"], [2, "⪝"], [0, "⪞"], [0, "⪟"], [0, "⪠"], [0, { v: "⪡", n: 824, o: "⪡̸" }], [0, { v: "⪢", n: 824, o: "⪢̸" }], [1, "⪤"], [0, "⪥"], [0, "⪦"], [0, "⪧"], [0, "⪨"], [0, "⪩"], [0, "⪪"], [0, "⪫"], [0, { v: "⪬", n: 65024, o: "⪬︀" }], [0, { v: "⪭", n: 65024, o: "⪭︀" }], [0, "⪮"], [0, { v: "⪯", n: 824, o: "⪯̸" }], [0, { v: "⪰", n: 824, o: "⪰̸" }], [2, "⪳"], [0, "⪴"], [0, "⪵"], [0, "⪶"], [0, "⪷"], [0, "⪸"], [0, "⪹"], [0, "⪺"], [0, "⪻"], [0, "⪼"], [0, "⪽"], [0, "⪾"], [0, "⪿"], [0, "⫀"], [0, "⫁"], [0, "⫂"], [0, "⫃"], [0, "⫄"], [0, { v: "⫅", n: 824, o: "⫅̸" }], [0, { v: "⫆", n: 824, o: "⫆̸" }], [0, "⫇"], [0, "⫈"], [2, { v: "⫋", n: 65024, o: "⫋︀" }], [0, { v: "⫌", n: 65024, o: "⫌︀" }], [2, "⫏"], [0, "⫐"], [0, "⫑"], [0, "⫒"], [0, "⫓"], [0, "⫔"], [0, "⫕"], [0, "⫖"], [0, "⫗"], [0, "⫘"], [0, "⫙"], [0, "⫚"], [0, "⫛"], [8, "⫤"], [1, "⫦"], [0, "⫧"], [0, "⫨"], [0, "⫩"], [1, "⫫"], [0, "⫬"], [0, "⫭"], [0, "⫮"], [0, "⫯"], [0, "⫰"], [0, "⫱"], [0, "⫲"], [0, "⫳"], [9, { v: "⫽", n: 8421, o: "⫽⃥" }], [44343, { n: new Map(/* @__PURE__ */ restoreDiff([[56476, "𝒜"], [1, "𝒞"], [0, "𝒟"], [2, "𝒢"], [2, "𝒥"], [0, "𝒦"], [2, "𝒩"], [0, "𝒪"], [0, "𝒫"], [0, "𝒬"], [1, "𝒮"], [0, "𝒯"], [0, "𝒰"], [0, "𝒱"], [0, "𝒲"], [0, "𝒳"], [0, "𝒴"], [0, "𝒵"], [0, "𝒶"], [0, "𝒷"], [0, "𝒸"], [0, "𝒹"], [1, "𝒻"], [1, "𝒽"], [0, "𝒾"], [0, "𝒿"], [0, "𝓀"], [0, "𝓁"], [0, "𝓂"], [0, "𝓃"], [1, "𝓅"], [0, "𝓆"], [0, "𝓇"], [0, "𝓈"], [0, "𝓉"], [0, "𝓊"], [0, "𝓋"], [0, "𝓌"], [0, "𝓍"], [0, "𝓎"], [0, "𝓏"], [52, "𝔄"], [0, "𝔅"], [1, "𝔇"], [0, "𝔈"], [0, "𝔉"], [0, "𝔊"], [2, "𝔍"], [0, "𝔎"], [0, "𝔏"], [0, "𝔐"], [0, "𝔑"], [0, "𝔒"], [0, "𝔓"], [0, "𝔔"], [1, "𝔖"], [0, "𝔗"], [0, "𝔘"], [0, "𝔙"], [0, "𝔚"], [0, "𝔛"], [0, "𝔜"], [1, "𝔞"], [0, "𝔟"], [0, "𝔠"], [0, "𝔡"], [0, "𝔢"], [0, "𝔣"], [0, "𝔤"], [0, "𝔥"], [0, "𝔦"], [0, "𝔧"], [0, "𝔨"], [0, "𝔩"], [0, "𝔪"], [0, "𝔫"], [0, "𝔬"], [0, "𝔭"], [0, "𝔮"], [0, "𝔯"], [0, "𝔰"], [0, "𝔱"], [0, "𝔲"], [0, "𝔳"], [0, "𝔴"], [0, "𝔵"], [0, "𝔶"], [0, "𝔷"], [0, "𝔸"], [0, "𝔹"], [1, "𝔻"], [0, "𝔼"], [0, "𝔽"], [0, "𝔾"], [1, "𝕀"], [0, "𝕁"], [0, "𝕂"], [0, "𝕃"], [0, "𝕄"], [1, "𝕆"], [3, "𝕊"], [0, "𝕋"], [0, "𝕌"], [0, "𝕍"], [0, "𝕎"], [0, "𝕏"], [0, "𝕐"], [1, "𝕒"], [0, "𝕓"], [0, "𝕔"], [0, "𝕕"], [0, "𝕖"], [0, "𝕗"], [0, "𝕘"], [0, "𝕙"], [0, "𝕚"], [0, "𝕛"], [0, "𝕜"], [0, "𝕝"], [0, "𝕞"], [0, "𝕟"], [0, "𝕠"], [0, "𝕡"], [0, "𝕢"], [0, "𝕣"], [0, "𝕤"], [0, "𝕥"], [0, "𝕦"], [0, "𝕧"], [0, "𝕨"], [0, "𝕩"], [0, "𝕪"], [0, "𝕫"]])) }], [8906, "ff"], [0, "fi"], [0, "fl"], [0, "ffi"], [0, "ffl"]])); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/escape.js -init_define_import_meta_env(); -var xmlReplacer = /["&'<>$\x80-\uFFFF]/g; -var xmlCodeMap = /* @__PURE__ */ new Map([ - [34, """], - [38, "&"], - [39, "'"], - [60, "<"], - [62, ">"] -]); -var getCodePoint = ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - String.prototype.codePointAt != null ? (str, index2) => str.codePointAt(index2) : ( - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - (c, index2) => (c.charCodeAt(index2) & 64512) === 55296 ? (c.charCodeAt(index2) - 55296) * 1024 + c.charCodeAt(index2 + 1) - 56320 + 65536 : c.charCodeAt(index2) - ) -); -function encodeXML(str) { - let ret = ""; - let lastIdx = 0; - let match; - while ((match = xmlReplacer.exec(str)) !== null) { - const i = match.index; - const char = str.charCodeAt(i); - const next = xmlCodeMap.get(char); - if (next !== void 0) { - ret += str.substring(lastIdx, i) + next; - lastIdx = i + 1; - } else { - ret += `${str.substring(lastIdx, i)}&#x${getCodePoint(str, i).toString(16)};`; - lastIdx = xmlReplacer.lastIndex += Number((char & 64512) === 55296); - } - } - return ret + str.substr(lastIdx); -} -function getEscaper(regex, map) { - return function escape5(data) { - let match; - let lastIdx = 0; - let result = ""; - while (match = regex.exec(data)) { - if (lastIdx !== match.index) { - result += data.substring(lastIdx, match.index); - } - result += map.get(match[0].charCodeAt(0)); - lastIdx = match.index + 1; - } - return result + data.substring(lastIdx); - }; -} -var escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap); -var escapeAttribute = getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([ - [34, """], - [38, "&"], - [160, " "] -])); -var escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([ - [38, "&"], - [60, "<"], - [62, ">"], - [160, " "] -])); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/node_modules/entities/lib/esm/index.js -var EntityLevel; -(function(EntityLevel3) { - EntityLevel3[EntityLevel3["XML"] = 0] = "XML"; - EntityLevel3[EntityLevel3["HTML"] = 1] = "HTML"; -})(EntityLevel || (EntityLevel = {})); -var EncodingMode; -(function(EncodingMode3) { - EncodingMode3[EncodingMode3["UTF8"] = 0] = "UTF8"; - EncodingMode3[EncodingMode3["ASCII"] = 1] = "ASCII"; - EncodingMode3[EncodingMode3["Extensive"] = 2] = "Extensive"; - EncodingMode3[EncodingMode3["Attribute"] = 3] = "Attribute"; - EncodingMode3[EncodingMode3["Text"] = 4] = "Text"; -})(EncodingMode || (EncodingMode = {})); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/esm/foreignNames.js -init_define_import_meta_env(); -var elementNames = new Map([ - "altGlyph", - "altGlyphDef", - "altGlyphItem", - "animateColor", - "animateMotion", - "animateTransform", - "clipPath", - "feBlend", - "feColorMatrix", - "feComponentTransfer", - "feComposite", - "feConvolveMatrix", - "feDiffuseLighting", - "feDisplacementMap", - "feDistantLight", - "feDropShadow", - "feFlood", - "feFuncA", - "feFuncB", - "feFuncG", - "feFuncR", - "feGaussianBlur", - "feImage", - "feMerge", - "feMergeNode", - "feMorphology", - "feOffset", - "fePointLight", - "feSpecularLighting", - "feSpotLight", - "feTile", - "feTurbulence", - "foreignObject", - "glyphRef", - "linearGradient", - "radialGradient", - "textPath" -].map((val) => [val.toLowerCase(), val])); -var attributeNames = new Map([ - "definitionURL", - "attributeName", - "attributeType", - "baseFrequency", - "baseProfile", - "calcMode", - "clipPathUnits", - "diffuseConstant", - "edgeMode", - "filterUnits", - "glyphRef", - "gradientTransform", - "gradientUnits", - "kernelMatrix", - "kernelUnitLength", - "keyPoints", - "keySplines", - "keyTimes", - "lengthAdjust", - "limitingConeAngle", - "markerHeight", - "markerUnits", - "markerWidth", - "maskContentUnits", - "maskUnits", - "numOctaves", - "pathLength", - "patternContentUnits", - "patternTransform", - "patternUnits", - "pointsAtX", - "pointsAtY", - "pointsAtZ", - "preserveAlpha", - "preserveAspectRatio", - "primitiveUnits", - "refX", - "refY", - "repeatCount", - "repeatDur", - "requiredExtensions", - "requiredFeatures", - "specularConstant", - "specularExponent", - "spreadMethod", - "startOffset", - "stdDeviation", - "stitchTiles", - "surfaceScale", - "systemLanguage", - "tableValues", - "targetX", - "targetY", - "textLength", - "viewBox", - "viewTarget", - "xChannelSelector", - "yChannelSelector", - "zoomAndPan" -].map((val) => [val.toLowerCase(), val])); - -// node_modules/htmlparser2/node_modules/domutils/node_modules/dom-serializer/lib/esm/index.js -var unencodedElements = /* @__PURE__ */ new Set([ - "style", - "script", - "xmp", - "iframe", - "noembed", - "noframes", - "plaintext", - "noscript" -]); -function replaceQuotes(value) { - return value.replace(/"/g, """); -} -function formatAttributes(attributes, opts) { - var _a3; - if (!attributes) - return; - const encode = ((_a3 = opts.encodeEntities) !== null && _a3 !== void 0 ? _a3 : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML : escapeAttribute; - return Object.keys(attributes).map((key2) => { - var _a4, _b; - const value = (_a4 = attributes[key2]) !== null && _a4 !== void 0 ? _a4 : ""; - if (opts.xmlMode === "foreign") { - key2 = (_b = attributeNames.get(key2)) !== null && _b !== void 0 ? _b : key2; - } - if (!opts.emptyAttrs && !opts.xmlMode && value === "") { - return key2; - } - return `${key2}="${encode(value)}"`; - }).join(" "); -} -var singleTag = /* @__PURE__ */ new Set([ - "area", - "base", - "basefont", - "br", - "col", - "command", - "embed", - "frame", - "hr", - "img", - "input", - "isindex", - "keygen", - "link", - "meta", - "param", - "source", - "track", - "wbr" -]); -function render(node, options = {}) { - const nodes = "length" in node ? node : [node]; - let output = ""; - for (let i = 0; i < nodes.length; i++) { - output += renderNode(nodes[i], options); - } - return output; -} -var esm_default = render; -function renderNode(node, options) { - switch (node.type) { - case Root: - return render(node.children, options); - // @ts-expect-error We don't use `Doctype` yet - case Doctype: - case Directive: - return renderDirective(node); - case Comment: - return renderComment(node); - case CDATA: - return renderCdata(node); - case Script: - case Style: - case Tag: - return renderTag(node, options); - case Text: - return renderText(node, options); - } -} -var foreignModeIntegrationPoints = /* @__PURE__ */ new Set([ - "mi", - "mo", - "mn", - "ms", - "mtext", - "annotation-xml", - "foreignObject", - "desc", - "title" -]); -var foreignElements = /* @__PURE__ */ new Set(["svg", "math"]); -function renderTag(elem, opts) { - var _a3; - if (opts.xmlMode === "foreign") { - elem.name = (_a3 = elementNames.get(elem.name)) !== null && _a3 !== void 0 ? _a3 : elem.name; - if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) { - opts = { ...opts, xmlMode: false }; - } - } - if (!opts.xmlMode && foreignElements.has(elem.name)) { - opts = { ...opts, xmlMode: "foreign" }; - } - let tag = `<${elem.name}`; - const attribs = formatAttributes(elem.attribs, opts); - if (attribs) { - tag += ` ${attribs}`; - } - if (elem.children.length === 0 && (opts.xmlMode ? ( - // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags - opts.selfClosingTags !== false - ) : ( - // User explicitly asked for self-closing tags, even in HTML mode - opts.selfClosingTags && singleTag.has(elem.name) - ))) { - if (!opts.xmlMode) - tag += " "; - tag += "/>"; - } else { - tag += ">"; - if (elem.children.length > 0) { - tag += render(elem.children, opts); - } - if (opts.xmlMode || !singleTag.has(elem.name)) { - tag += `</${elem.name}>`; - } - } - return tag; -} -function renderDirective(elem) { - return `<${elem.data}>`; -} -function renderText(elem, opts) { - var _a3; - let data = elem.data || ""; - if (((_a3 = opts.encodeEntities) !== null && _a3 !== void 0 ? _a3 : opts.decodeEntities) !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) { - data = opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML(data) : escapeText(data); - } - return data; -} -function renderCdata(elem) { - return `<![CDATA[${elem.children[0].data}]]>`; -} -function renderComment(elem) { - return `<!--${elem.data}-->`; -} - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/stringify.js -function getOuterHTML(node, options) { - return esm_default(node, options); -} -function getInnerHTML(node, options) { - return hasChildren(node) ? node.children.map((node2) => getOuterHTML(node2, options)).join("") : ""; -} -function getText(node) { - if (Array.isArray(node)) - return node.map(getText).join(""); - if (isTag2(node)) - return node.name === "br" ? "\n" : getText(node.children); - if (isCDATA(node)) - return getText(node.children); - if (isText(node)) - return node.data; - return ""; -} -function textContent(node) { - if (Array.isArray(node)) - return node.map(textContent).join(""); - if (hasChildren(node) && !isComment(node)) { - return textContent(node.children); - } - if (isText(node)) - return node.data; - return ""; -} -function innerText(node) { - if (Array.isArray(node)) - return node.map(innerText).join(""); - if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) { - return innerText(node.children); - } - if (isText(node)) - return node.data; - return ""; -} - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/traversal.js -init_define_import_meta_env(); -function getChildren(elem) { - return hasChildren(elem) ? elem.children : []; -} -function getParent(elem) { - return elem.parent || null; -} -function getSiblings(elem) { - const parent = getParent(elem); - if (parent != null) - return getChildren(parent); - const siblings = [elem]; - let { prev, next } = elem; - while (prev != null) { - siblings.unshift(prev); - ({ prev } = prev); - } - while (next != null) { - siblings.push(next); - ({ next } = next); - } - return siblings; -} -function getAttributeValue(elem, name) { - var _a3; - return (_a3 = elem.attribs) === null || _a3 === void 0 ? void 0 : _a3[name]; -} -function hasAttrib(elem, name) { - return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null; -} -function getName(elem) { - return elem.name; -} -function nextElementSibling(elem) { - let { next } = elem; - while (next !== null && !isTag2(next)) - ({ next } = next); - return next; -} -function prevElementSibling(elem) { - let { prev } = elem; - while (prev !== null && !isTag2(prev)) - ({ prev } = prev); - return prev; -} - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/manipulation.js -init_define_import_meta_env(); -function removeElement(elem) { - if (elem.prev) - elem.prev.next = elem.next; - if (elem.next) - elem.next.prev = elem.prev; - if (elem.parent) { - const childs = elem.parent.children; - const childsIndex = childs.lastIndexOf(elem); - if (childsIndex >= 0) { - childs.splice(childsIndex, 1); - } - } - elem.next = null; - elem.prev = null; - elem.parent = null; -} -function replaceElement(elem, replacement) { - const prev = replacement.prev = elem.prev; - if (prev) { - prev.next = replacement; - } - const next = replacement.next = elem.next; - if (next) { - next.prev = replacement; - } - const parent = replacement.parent = elem.parent; - if (parent) { - const childs = parent.children; - childs[childs.lastIndexOf(elem)] = replacement; - elem.parent = null; - } -} -function appendChild(parent, child) { - removeElement(child); - child.next = null; - child.parent = parent; - if (parent.children.push(child) > 1) { - const sibling = parent.children[parent.children.length - 2]; - sibling.next = child; - child.prev = sibling; - } else { - child.prev = null; - } -} -function append(elem, next) { - removeElement(next); - const { parent } = elem; - const currNext = elem.next; - next.next = currNext; - next.prev = elem; - elem.next = next; - next.parent = parent; - if (currNext) { - currNext.prev = next; - if (parent) { - const childs = parent.children; - childs.splice(childs.lastIndexOf(currNext), 0, next); - } - } else if (parent) { - parent.children.push(next); - } -} -function prependChild(parent, child) { - removeElement(child); - child.parent = parent; - child.prev = null; - if (parent.children.unshift(child) !== 1) { - const sibling = parent.children[1]; - sibling.prev = child; - child.next = sibling; - } else { - child.next = null; - } -} -function prepend(elem, prev) { - removeElement(prev); - const { parent } = elem; - if (parent) { - const childs = parent.children; - childs.splice(childs.indexOf(elem), 0, prev); - } - if (elem.prev) { - elem.prev.next = prev; - } - prev.parent = parent; - prev.prev = elem.prev; - prev.next = elem; - elem.prev = prev; -} - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/querying.js -init_define_import_meta_env(); -function filter(test, node, recurse = true, limit = Infinity) { - return find(test, Array.isArray(node) ? node : [node], recurse, limit); -} -function find(test, nodes, recurse, limit) { - const result = []; - const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (indexStack.length === 1) { - return result; + /** + * Handles both :tl:`MsgsStateReq` and :tl:`MsgResendReq` by + * enqueuing a :tl:`MsgsStateInfo` to be sent at a later point. + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleStateForgotten(message) { + this._sendQueue.append(new RequestState_1.RequestState(new tl_1.Api.MsgsStateInfo({ + reqMsgId: message.msgId, + info: String.fromCharCode(1).repeat(message.obj.msgIds) + }))); } - nodeStack.shift(); - indexStack.shift(); - continue; - } - const elem = nodeStack[0][indexStack[0]++]; - if (test(elem)) { - result.push(elem); - if (--limit <= 0) - return result; - } - if (recurse && hasChildren(elem) && elem.children.length > 0) { - indexStack.unshift(0); - nodeStack.unshift(elem.children); - } - } -} -function findOneChild(test, nodes) { - return nodes.find(test); -} -function findOne(test, nodes, recurse = true) { - const searchedNodes = Array.isArray(nodes) ? nodes : [nodes]; - for (let i = 0; i < searchedNodes.length; i++) { - const node = searchedNodes[i]; - if (isTag2(node) && test(node)) { - return node; - } - if (recurse && hasChildren(node) && node.children.length > 0) { - const found = findOne(test, node.children, true); - if (found) - return found; - } - } - return null; -} -function existsOne(test, nodes) { - return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => isTag2(node) && test(node) || hasChildren(node) && existsOne(test, node.children)); -} -function findAll(test, nodes) { - const result = []; - const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (nodeStack.length === 1) { - return result; + /** + * Handles :tl:`MsgsAllInfo` by doing nothing (yet). + * @param message + * @returns {Promise<void>} + * @private + */ + async _handleMsgAll(message) { + } + reconnect() { + if (this._userConnected && !this.isReconnecting) { + this.isReconnecting = true; + this._currentRetries++; + if (this._isMainSender) { + this._log.debug("Reconnecting all senders"); + for (const promise of this._exportedSenderPromises.values()) { + promise.then((sender) => { + if (sender && !sender._isMainSender) { + sender.reconnect(); + } + }).catch((error) => { + this._log.warn("Error getting sender to reconnect to"); + }); + } + } + (0, Helpers_1.sleep)(1e3).then(() => { + this._log.info("Started reconnecting"); + this._reconnect(); + }); + } } - nodeStack.shift(); - indexStack.shift(); - continue; - } - const elem = nodeStack[0][indexStack[0]++]; - if (isTag2(elem) && test(elem)) - result.push(elem); - if (hasChildren(elem) && elem.children.length > 0) { - indexStack.unshift(0); - nodeStack.unshift(elem.children); - } - } -} - -// node_modules/htmlparser2/node_modules/domutils/lib/esm/legacy.js -init_define_import_meta_env(); -var Checks = { - tag_name(name) { - if (typeof name === "function") { - return (elem) => isTag2(elem) && name(elem.name); - } else if (name === "*") { - return isTag2; - } - return (elem) => isTag2(elem) && elem.name === name; - }, - tag_type(type) { - if (typeof type === "function") { - return (elem) => type(elem.type); - } - return (elem) => elem.type === type; - }, - tag_contains(data) { - if (typeof data === "function") { - return (elem) => isText(elem) && data(elem.data); - } - return (elem) => isText(elem) && elem.data === data; - } -}; -function getAttribCheck(attrib, value) { - if (typeof value === "function") { - return (elem) => isTag2(elem) && value(elem.attribs[attrib]); + async _reconnect() { + try { + this._log.warn("[Reconnect] Closing current connection..."); + await this._disconnect(); + } catch (err) { + this._log.warn("Error happened while disconnecting"); + if (this._client._errorHandler) { + await this._client._errorHandler(err); + } + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(err); + } + } + this._log.debug(`Adding ${this._sendQueue._pendingStates.length} old request to resend`); + for (let i = 0; i < this._sendQueue._pendingStates.length; i++) { + if (this._sendQueue._pendingStates[i].msgId != void 0) { + this._pendingState.set(this._sendQueue._pendingStates[i].msgId, this._sendQueue._pendingStates[i]); + } + } + this._sendQueue.clear(); + this._state.reset(); + const connection = this._connection; + const newConnection = new connection.constructor({ + ip: connection._ip, + port: connection._port, + dcId: connection._dcId, + loggers: connection._log, + proxy: connection._proxy, + testServers: connection._testServers, + socket: this._client.networkSocket + }); + await this.connect(newConnection, true); + this.isReconnecting = false; + this._sendQueue.prepend(this._pendingState.values()); + this._pendingState.clear(); + if (this._autoReconnectCallback) { + await this._autoReconnectCallback(); + } + } + }; + exports2.MTProtoSender = MTProtoSender; + MTProtoSender.DEFAULT_OPTIONS = { + logger: null, + reconnectRetries: Infinity, + retries: Infinity, + delay: 2e3, + autoReconnect: true, + connectTimeout: null, + authKeyCallback: null, + updateCallback: null, + autoReconnectCallback: null, + isMainSender: null, + senderCallback: null, + onConnectionBreak: void 0, + securityChecks: true + }; } - return (elem) => isTag2(elem) && elem.attribs[attrib] === value; -} -function combineFuncs(a, b) { - return (elem) => a(elem) || b(elem); -} -function compileTest(options) { - const funcs = Object.keys(options).map((key2) => { - const value = options[key2]; - return Object.prototype.hasOwnProperty.call(Checks, key2) ? Checks[key2](value) : getAttribCheck(key2, value); - }); - return funcs.length === 0 ? null : funcs.reduce(combineFuncs); -} -function testElement(options, node) { - const test = compileTest(options); - return test ? test(node) : true; -} -function getElements(options, nodes, recurse, limit = Infinity) { - const test = compileTest(options); - return test ? filter(test, nodes, recurse, limit) : []; -} -function getElementById(id, nodes, recurse = true) { - if (!Array.isArray(nodes)) - nodes = [nodes]; - return findOne(getAttribCheck("id", id), nodes, recurse); -} -function getElementsByTagName(tagName19, nodes, recurse = true, limit = Infinity) { - return filter(Checks["tag_name"](tagName19), nodes, recurse, limit); -} -function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) { - return filter(getAttribCheck("class", className), nodes, recurse, limit); -} -function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) { - return filter(Checks["tag_type"](type), nodes, recurse, limit); -} +}); -// node_modules/htmlparser2/node_modules/domutils/lib/esm/helpers.js -init_define_import_meta_env(); -function removeSubsets(nodes) { - let idx = nodes.length; - while (--idx >= 0) { - const node = nodes[idx]; - if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) { - nodes.splice(idx, 1); - continue; - } - for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - if (nodes.includes(ancestor)) { - nodes.splice(idx, 1); - break; +// node_modules/telegram/network/index.js +var require_network = __commonJS({ + "node_modules/telegram/network/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConnectionTCPObfuscated = exports2.ConnectionTCPAbridged = exports2.ConnectionTCPFull = exports2.Connection = exports2.UpdateConnectionState = exports2.MTProtoSender = exports2.doAuthentication = exports2.MTProtoPlainSender = void 0; + var MTProtoPlainSender_1 = require_MTProtoPlainSender(); + Object.defineProperty(exports2, "MTProtoPlainSender", { enumerable: true, get: function() { + return MTProtoPlainSender_1.MTProtoPlainSender; + } }); + var Authenticator_1 = require_Authenticator(); + Object.defineProperty(exports2, "doAuthentication", { enumerable: true, get: function() { + return Authenticator_1.doAuthentication; + } }); + var MTProtoSender_1 = require_MTProtoSender(); + Object.defineProperty(exports2, "MTProtoSender", { enumerable: true, get: function() { + return MTProtoSender_1.MTProtoSender; + } }); + var UpdateConnectionState = class { + constructor(state2) { + this.state = state2; } - } - } - return nodes; -} -var DocumentPosition; -(function(DocumentPosition3) { - DocumentPosition3[DocumentPosition3["DISCONNECTED"] = 1] = "DISCONNECTED"; - DocumentPosition3[DocumentPosition3["PRECEDING"] = 2] = "PRECEDING"; - DocumentPosition3[DocumentPosition3["FOLLOWING"] = 4] = "FOLLOWING"; - DocumentPosition3[DocumentPosition3["CONTAINS"] = 8] = "CONTAINS"; - DocumentPosition3[DocumentPosition3["CONTAINED_BY"] = 16] = "CONTAINED_BY"; -})(DocumentPosition || (DocumentPosition = {})); -function compareDocumentPosition(nodeA, nodeB) { - const aParents = []; - const bParents = []; - if (nodeA === nodeB) { - return 0; - } - let current = hasChildren(nodeA) ? nodeA : nodeA.parent; - while (current) { - aParents.unshift(current); - current = current.parent; - } - current = hasChildren(nodeB) ? nodeB : nodeB.parent; - while (current) { - bParents.unshift(current); - current = current.parent; - } - const maxIdx = Math.min(aParents.length, bParents.length); - let idx = 0; - while (idx < maxIdx && aParents[idx] === bParents[idx]) { - idx++; - } - if (idx === 0) { - return DocumentPosition.DISCONNECTED; - } - const sharedParent = aParents[idx - 1]; - const siblings = sharedParent.children; - const aSibling = aParents[idx]; - const bSibling = bParents[idx]; - if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { - if (sharedParent === nodeB) { - return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY; - } - return DocumentPosition.FOLLOWING; - } - if (sharedParent === nodeA) { - return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS; + }; + exports2.UpdateConnectionState = UpdateConnectionState; + UpdateConnectionState.disconnected = -1; + UpdateConnectionState.connected = 1; + UpdateConnectionState.broken = 0; + var connection_1 = require_connection(); + Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { + return connection_1.Connection; + } }); + Object.defineProperty(exports2, "ConnectionTCPFull", { enumerable: true, get: function() { + return connection_1.ConnectionTCPFull; + } }); + Object.defineProperty(exports2, "ConnectionTCPAbridged", { enumerable: true, get: function() { + return connection_1.ConnectionTCPAbridged; + } }); + Object.defineProperty(exports2, "ConnectionTCPObfuscated", { enumerable: true, get: function() { + return connection_1.ConnectionTCPObfuscated; + } }); } - return DocumentPosition.PRECEDING; -} -function uniqueSort(nodes) { - nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1)); - nodes.sort((a, b) => { - const relative = compareDocumentPosition(a, b); - if (relative & DocumentPosition.PRECEDING) { - return -1; - } else if (relative & DocumentPosition.FOLLOWING) { - return 1; - } - return 0; - }); - return nodes; -} +}); -// node_modules/htmlparser2/node_modules/domutils/lib/esm/feeds.js -init_define_import_meta_env(); -function getFeed(doc) { - const feedRoot = getOneElement(isValidFeed, doc); - return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot); -} -function getAtomFeed(feedRoot) { - var _a3; - const childs = feedRoot.children; - const feed = { - type: "atom", - items: getElementsByTagName("entry", childs).map((item) => { - var _a4; - const { children } = item; - const entry = { media: getMediaElements(children) }; - addConditionally(entry, "id", "id", children); - addConditionally(entry, "title", "title", children); - const href2 = (_a4 = getOneElement("link", children)) === null || _a4 === void 0 ? void 0 : _a4.attribs["href"]; - if (href2) { - entry.link = href2; +// node_modules/telegram/network/connection/TCPMTProxy.js +var require_TCPMTProxy = __commonJS({ + "node_modules/telegram/network/connection/TCPMTProxy.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConnectionTCPMTProxyAbridged = exports2.TCPMTProxy = void 0; + var Connection_1 = require_Connection(); + var TCPAbridged_1 = require_TCPAbridged(); + var Helpers_1 = require_Helpers(); + var CTR_1 = require_CTR(); + var MTProxyIO = class { + constructor(connection) { + this.header = void 0; + this.connection = connection.socket; + this._packetClass = connection.PacketCodecClass; + this._secret = connection._secret; + this._dcId = connection._dcId; } - const description = fetch2("summary", children) || fetch2("content", children); - if (description) { - entry.description = description; + async initHeader() { + let secret = this._secret; + const isDD = secret.length == 17 && secret[0] == 221; + secret = isDD ? secret.slice(1) : secret; + if (secret.length != 16) { + throw new Error("MTProxy secret must be a hex-string representing 16 bytes"); + } + const keywords = [ + Buffer.from("50567247", "hex"), + Buffer.from("474554", "hex"), + Buffer.from("504f5354", "hex"), + Buffer.from("eeeeeeee", "hex") + ]; + let random; + while (true) { + random = (0, Helpers_1.generateRandomBytes)(64); + if (random[0] !== 239 && !random.slice(4, 8).equals(Buffer.alloc(4))) { + let ok = true; + for (const key of keywords) { + if (key.equals(random.slice(0, 4))) { + ok = false; + break; + } + } + if (ok) { + break; + } + } + } + random = random.toJSON().data; + const randomReversed = Buffer.from(random.slice(8, 56)).reverse(); + const encryptKey = await (0, Helpers_1.sha256)(Buffer.concat([Buffer.from(random.slice(8, 40)), secret])); + const encryptIv = Buffer.from(random.slice(40, 56)); + const decryptKey = await (0, Helpers_1.sha256)(Buffer.concat([Buffer.from(randomReversed.slice(0, 32)), secret])); + const decryptIv = Buffer.from(randomReversed.slice(32, 48)); + const encryptor = new CTR_1.CTR(encryptKey, encryptIv); + const decryptor = new CTR_1.CTR(decryptKey, decryptIv); + random = Buffer.concat([ + Buffer.from(random.slice(0, 56)), + this._packetClass.obfuscateTag, + Buffer.from(random.slice(60)) + ]); + const dcIdBytes = Buffer.alloc(2); + dcIdBytes.writeInt8(this._dcId, 0); + random = Buffer.concat([ + Buffer.from(random.slice(0, 60)), + dcIdBytes, + Buffer.from(random.slice(62)) + ]); + random = Buffer.concat([ + Buffer.from(random.slice(0, 56)), + Buffer.from(encryptor.encrypt(random).slice(56, 64)), + Buffer.from(random.slice(64)) + ]); + this.header = random; + this._encrypt = encryptor; + this._decrypt = decryptor; } - const pubDate = fetch2("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); + async read(n) { + const data = await this.connection.readExactly(n); + return this._decrypt.encrypt(data); } - return entry; - }) - }; - addConditionally(feed, "id", "id", childs); - addConditionally(feed, "title", "title", childs); - const href = (_a3 = getOneElement("link", childs)) === null || _a3 === void 0 ? void 0 : _a3.attribs["href"]; - if (href) { - feed.link = href; - } - addConditionally(feed, "description", "subtitle", childs); - const updated = fetch2("updated", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally(feed, "author", "email", childs, true); - return feed; -} -function getRssFeed(feedRoot) { - var _a3, _b; - const childs = (_b = (_a3 = getOneElement("channel", feedRoot.children)) === null || _a3 === void 0 ? void 0 : _a3.children) !== null && _b !== void 0 ? _b : []; - const feed = { - type: feedRoot.name.substr(0, 3), - id: "", - items: getElementsByTagName("item", feedRoot.children).map((item) => { - const { children } = item; - const entry = { media: getMediaElements(children) }; - addConditionally(entry, "id", "guid", children); - addConditionally(entry, "title", "title", children); - addConditionally(entry, "link", "link", children); - addConditionally(entry, "description", "description", children); - const pubDate = fetch2("pubDate", children) || fetch2("dc:date", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - return entry; - }) - }; - addConditionally(feed, "title", "title", childs); - addConditionally(feed, "link", "link", childs); - addConditionally(feed, "description", "description", childs); - const updated = fetch2("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally(feed, "author", "managingEditor", childs, true); - return feed; -} -var MEDIA_KEYS_STRING = ["url", "type", "lang"]; -var MEDIA_KEYS_INT = [ - "fileSize", - "bitrate", - "framerate", - "samplingrate", - "channels", - "duration", - "height", - "width" -]; -function getMediaElements(where) { - return getElementsByTagName("media:content", where).map((elem) => { - const { attribs } = elem; - const media = { - medium: attribs["medium"], - isDefault: !!attribs["isDefault"] - }; - for (const attrib of MEDIA_KEYS_STRING) { - if (attribs[attrib]) { - media[attrib] = attribs[attrib]; + write(data) { + this.connection.write(this._encrypt.encrypt(data)); } - } - for (const attrib of MEDIA_KEYS_INT) { - if (attribs[attrib]) { - media[attrib] = parseInt(attribs[attrib], 10); + }; + var TCPMTProxy = class extends Connection_1.ObfuscatedConnection { + constructor({ ip, port, dcId, loggers, proxy, socket, testServers }) { + super({ + ip: proxy.ip, + port: proxy.port, + dcId, + loggers, + socket, + proxy, + testServers + }); + this.ObfuscatedIO = MTProxyIO; + if (!("MTProxy" in proxy)) { + throw new Error("This connection only supports MPTProxies"); + } + if (!proxy.secret) { + throw new Error("You need to provide the secret for the MTProxy"); + } + if (proxy.secret && proxy.secret.match(/^[0-9a-f]+$/i)) { + this._secret = Buffer.from(proxy.secret, "hex"); + } else { + this._secret = Buffer.from(proxy.secret, "base64"); + } } - } - if (attribs["expression"]) { - media.expression = attribs["expression"]; - } - return media; - }); -} -function getOneElement(tagName19, node) { - return getElementsByTagName(tagName19, node, true, 1)[0]; -} -function fetch2(tagName19, where, recurse = false) { - return textContent(getElementsByTagName(tagName19, where, recurse, 1)).trim(); -} -function addConditionally(obj, prop2, tagName19, where, recurse = false) { - const val = fetch2(tagName19, where, recurse); - if (val) - obj[prop2] = val; -} -function isValidFeed(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; -} - -// node_modules/htmlparser2/dist/esm/index.js -function parseDocument(data, options) { - const handler4 = new DomHandler(void 0, options); - new Parser(handler4, options).end(data); - return handler4.root; -} -function parseDOM(data, options) { - return parseDocument(data, options).children; -} -function createDocumentStream(callback, options, elementCallback) { - const handler4 = new DomHandler((error) => callback(error, handler4.root), options, elementCallback); - return new Parser(handler4, options); -} -function createDomStream(callback, options, elementCallback) { - const handler4 = new DomHandler(callback, options, elementCallback); - return new Parser(handler4, options); -} -var parseFeedDefaultOptions = { xmlMode: true }; -function parseFeed(feed, options = parseFeedDefaultOptions) { - return getFeed(parseDOM(feed, options)); -} - -// node_modules/linkedom/esm/shared/constants.js -init_define_import_meta_env(); -var NODE_END = -1; -var ELEMENT_NODE = 1; -var ATTRIBUTE_NODE = 2; -var TEXT_NODE = 3; -var CDATA_SECTION_NODE = 4; -var COMMENT_NODE = 8; -var DOCUMENT_NODE = 9; -var DOCUMENT_TYPE_NODE = 10; -var DOCUMENT_FRAGMENT_NODE = 11; -var BLOCK_ELEMENTS = /* @__PURE__ */ new Set(["ARTICLE", "ASIDE", "BLOCKQUOTE", "BODY", "BR", "BUTTON", "CANVAS", "CAPTION", "COL", "COLGROUP", "DD", "DIV", "DL", "DT", "EMBED", "FIELDSET", "FIGCAPTION", "FIGURE", "FOOTER", "FORM", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "UL", "OL", "P"]); -var SHOW_ALL = -1; -var SHOW_ELEMENT = 1; -var SHOW_TEXT = 4; -var SHOW_CDATA_SECTION = 8; -var SHOW_COMMENT = 128; -var DOCUMENT_POSITION_DISCONNECTED = 1; -var DOCUMENT_POSITION_PRECEDING = 2; -var DOCUMENT_POSITION_FOLLOWING = 4; -var DOCUMENT_POSITION_CONTAINS = 8; -var DOCUMENT_POSITION_CONTAINED_BY = 16; -var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32; -var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; - -// node_modules/linkedom/esm/shared/object.js -init_define_import_meta_env(); -var { - assign, - create, - defineProperties, - entries, - getOwnPropertyDescriptors, - keys, - setPrototypeOf -} = Object; - -// node_modules/linkedom/esm/shared/utils.js -init_define_import_meta_env(); -var $String = String; -var getEnd = (node) => node.nodeType === ELEMENT_NODE ? node[END] : node; -var ignoreCase = ({ ownerDocument }) => ownerDocument[MIME].ignoreCase; -var knownAdjacent = (prev, next) => { - prev[NEXT] = next; - next[PREV] = prev; -}; -var knownBoundaries = (prev, current, next) => { - knownAdjacent(prev, current); - knownAdjacent(getEnd(current), next); -}; -var knownSegment = (prev, start, end, next) => { - knownAdjacent(prev, start); - knownAdjacent(getEnd(end), next); -}; -var knownSiblings = (prev, current, next) => { - knownAdjacent(prev, current); - knownAdjacent(current, next); -}; -var localCase = ({ localName, ownerDocument }) => { - return ownerDocument[MIME].ignoreCase ? localName.toUpperCase() : localName; -}; -var setAdjacent = (prev, next) => { - if (prev) - prev[NEXT] = next; - if (next) - next[PREV] = prev; -}; -var htmlToFragment = (ownerDocument, html) => { - const fragment = ownerDocument.createDocumentFragment(); - const elem = ownerDocument.createElement(""); - elem.innerHTML = html; - const { firstChild, lastChild } = elem; - if (firstChild) { - knownSegment(fragment, firstChild, lastChild, fragment[END]); - let child = firstChild; - do { - child.parentNode = fragment; - } while (child !== lastChild && (child = getEnd(child)[NEXT])); - } - return fragment; -}; - -// node_modules/linkedom/esm/interface/custom-element-registry.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/shadow-roots.js -init_define_import_meta_env(); -var shadowRoots = /* @__PURE__ */ new WeakMap(); - -// node_modules/linkedom/esm/interface/custom-element-registry.js -var reactive = false; -var Classes = /* @__PURE__ */ new WeakMap(); -var customElements = /* @__PURE__ */ new WeakMap(); -var attributeChangedCallback = (element, attributeName, oldValue, newValue) => { - if (reactive && customElements.has(element) && element.attributeChangedCallback && element.constructor.observedAttributes.includes(attributeName)) { - element.attributeChangedCallback(attributeName, oldValue, newValue); - } -}; -var createTrigger = (method, isConnected2) => (element) => { - if (customElements.has(element)) { - const info = customElements.get(element); - if (info.connected !== isConnected2 && element.isConnected === isConnected2) { - info.connected = isConnected2; - if (method in element) - element[method](); - } - } -}; -var triggerConnected = createTrigger("connectedCallback", true); -var connectedCallback = (element) => { - if (reactive) { - triggerConnected(element); - if (shadowRoots.has(element)) - element = shadowRoots.get(element).shadowRoot; - let { [NEXT]: next, [END]: end } = element; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE) - triggerConnected(next); - next = next[NEXT]; - } - } -}; -var triggerDisconnected = createTrigger("disconnectedCallback", false); -var disconnectedCallback = (element) => { - if (reactive) { - triggerDisconnected(element); - if (shadowRoots.has(element)) - element = shadowRoots.get(element).shadowRoot; - let { [NEXT]: next, [END]: end } = element; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE) - triggerDisconnected(next); - next = next[NEXT]; - } - } -}; -var CustomElementRegistry = class { - /** - * @param {Document} ownerDocument - */ - constructor(ownerDocument) { - this.ownerDocument = ownerDocument; - this.registry = /* @__PURE__ */ new Map(); - this.waiting = /* @__PURE__ */ new Map(); - this.active = false; - } - /** - * @param {string} localName the custom element definition name - * @param {Function} Class the custom element **Class** definition - * @param {object?} options the optional object with an `extends` property - */ - define(localName, Class, options = {}) { - const { ownerDocument, registry, waiting } = this; - if (registry.has(localName)) - throw new Error("unable to redefine " + localName); - if (Classes.has(Class)) - throw new Error("unable to redefine the same class: " + Class); - this.active = reactive = true; - const { extends: extend } = options; - Classes.set(Class, { - ownerDocument, - options: { is: extend ? localName : "" }, - localName: extend || localName - }); - const check = extend ? (element) => { - return element.localName === extend && element.getAttribute("is") === localName; - } : (element) => element.localName === localName; - registry.set(localName, { Class, check }); - if (waiting.has(localName)) { - for (const resolve of waiting.get(localName)) - resolve(Class); - waiting.delete(localName); - } - ownerDocument.querySelectorAll( - extend ? `${extend}[is="${localName}"]` : localName - ).forEach(this.upgrade, this); - } - /** - * @param {Element} element - */ - upgrade(element) { - if (customElements.has(element)) - return; - const { ownerDocument, registry } = this; - const ce = element.getAttribute("is") || element.localName; - if (registry.has(ce)) { - const { Class, check } = registry.get(ce); - if (check(element)) { - const { attributes, isConnected: isConnected2 } = element; - for (const attr of attributes) - element.removeAttributeNode(attr); - const values = entries(element); - for (const [key2] of values) - delete element[key2]; - setPrototypeOf(element, Class.prototype); - ownerDocument[UPGRADE] = { element, values }; - new Class(ownerDocument, ce); - customElements.set(element, { connected: isConnected2 }); - for (const attr of attributes) - element.setAttributeNode(attr); - if (isConnected2 && element.connectedCallback) - element.connectedCallback(); - } - } - } - /** - * @param {string} localName the custom element definition name - */ - whenDefined(localName) { - const { registry, waiting } = this; - return new Promise((resolve) => { - if (registry.has(localName)) - resolve(registry.get(localName).Class); - else { - if (!waiting.has(localName)) - waiting.set(localName, []); - waiting.get(localName).push(resolve); + }; + exports2.TCPMTProxy = TCPMTProxy; + var ConnectionTCPMTProxyAbridged = class extends TCPMTProxy { + constructor() { + super(...arguments); + this.PacketCodecClass = TCPAbridged_1.AbridgedPacketCodec; } - }); - } - /** - * @param {string} localName the custom element definition name - * @returns {Function?} the custom element **Class**, if any - */ - get(localName) { - const info = this.registry.get(localName); - return info && info.Class; - } - /** - * @param {Function} Class **Class** of custom element - * @returns {string?} found tag name or null - */ - getName(Class) { - if (Classes.has(Class)) { - const { localName } = Classes.get(Class); - return localName; - } - return null; - } -}; - -// node_modules/linkedom/esm/shared/parse-from-string.js -var { Parser: Parser2 } = esm_exports3; -var notParsing = true; -var append2 = (self2, node, active) => { - const end = self2[END]; - node.parentNode = self2; - knownBoundaries(end[PREV], node, end); - if (active && node.nodeType === ELEMENT_NODE) - connectedCallback(node); - return node; -}; -var attribute = (element, end, attribute2, value, active) => { - attribute2[VALUE] = value; - attribute2.ownerElement = element; - knownSiblings(end[PREV], attribute2, end); - if (attribute2.name === "class") - element.className = value; - if (active) - attributeChangedCallback(element, attribute2.name, null, value); -}; -var parseFromString = (document2, isHTML, markupLanguage) => { - const { active, registry } = document2[CUSTOM_ELEMENTS]; - let node = document2; - let ownerSVGElement = null; - let parsingCData = false; - notParsing = false; - const content = new Parser2({ - // <!DOCTYPE ...> - onprocessinginstruction(name, data) { - if (name.toLowerCase() === "!doctype") - document2.doctype = data.slice(name.length).trim(); - }, - // <tagName> - onopentag(name, attributes) { - let create3 = true; - if (isHTML) { - if (ownerSVGElement) { - node = append2(node, document2.createElementNS(SVG_NAMESPACE, name), active); - node.ownerSVGElement = ownerSVGElement; - create3 = false; - } else if (name === "svg" || name === "SVG") { - ownerSVGElement = document2.createElementNS(SVG_NAMESPACE, name); - node = append2(node, ownerSVGElement, active); - create3 = false; - } else if (active) { - const ce = name.includes("-") ? name : attributes.is || ""; - if (ce && registry.has(ce)) { - const { Class } = registry.get(ce); - node = append2(node, new Class(), active); - delete attributes.is; - create3 = false; - } - } - } - if (create3) - node = append2(node, document2.createElement(name), false); - let end = node[END]; - for (const name2 of keys(attributes)) - attribute(node, end, document2.createAttribute(name2), attributes[name2], active); - }, - // #text, #comment - oncomment(data) { - append2(node, document2.createComment(data), active); - }, - ontext(text) { - if (parsingCData) { - append2(node, document2.createCDATASection(text), active); - } else { - append2(node, document2.createTextNode(text), active); - } - }, - // #cdata - oncdatastart() { - parsingCData = true; - }, - oncdataend() { - parsingCData = false; - }, - // </tagName> - onclosetag() { - if (isHTML && node === ownerSVGElement) - ownerSVGElement = null; - node = node.parentNode; - } - }, { - lowerCaseAttributeNames: false, - decodeEntities: true, - xmlMode: !isHTML - }); - content.write(markupLanguage); - content.end(); - notParsing = true; - return document2; -}; - -// node_modules/linkedom/esm/html/document.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/register-html-class.js -init_define_import_meta_env(); -var htmlClasses = /* @__PURE__ */ new Map(); -var registerHTMLClass = (names, Class) => { - for (const name of [].concat(names)) { - htmlClasses.set(name, Class); - htmlClasses.set(name.toUpperCase(), Class); - } -}; - -// node_modules/linkedom/esm/interface/document.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/facades.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/interface/attr.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/jsdon.js -init_define_import_meta_env(); -var loopSegment = ({ [NEXT]: next, [END]: end }, json2) => { - while (next !== end) { - switch (next.nodeType) { - case ATTRIBUTE_NODE: - attrAsJSON(next, json2); - break; - case TEXT_NODE: - case COMMENT_NODE: - case CDATA_SECTION_NODE: - characterDataAsJSON(next, json2); - break; - case ELEMENT_NODE: - elementAsJSON(next, json2); - next = getEnd(next); - break; - case DOCUMENT_TYPE_NODE: - documentTypeAsJSON(next, json2); - break; - } - next = next[NEXT]; + }; + exports2.ConnectionTCPMTProxyAbridged = ConnectionTCPMTProxyAbridged; } - const last = json2.length - 1; - const value = json2[last]; - if (typeof value === "number" && value < 0) - json2[last] += NODE_END; - else - json2.push(NODE_END); -}; -var attrAsJSON = (attr, json2) => { - json2.push(ATTRIBUTE_NODE, attr.name); - const value = attr[VALUE].trim(); - if (value) - json2.push(value); -}; -var characterDataAsJSON = (node, json2) => { - const value = node[VALUE]; - if (value.trim()) - json2.push(node.nodeType, value); -}; -var nonElementAsJSON = (node, json2) => { - json2.push(node.nodeType); - loopSegment(node, json2); -}; -var documentTypeAsJSON = ({ name, publicId, systemId }, json2) => { - json2.push(DOCUMENT_TYPE_NODE, name); - if (publicId) - json2.push(publicId); - if (systemId) - json2.push(systemId); -}; -var elementAsJSON = (element, json2) => { - json2.push(ELEMENT_NODE, element.localName); - loopSegment(element, json2); -}; - -// node_modules/linkedom/esm/shared/attributes.js -init_define_import_meta_env(); +}); -// node_modules/linkedom/esm/interface/mutation-observer.js -init_define_import_meta_env(); -var createRecord = (type, target, element, addedNodes, removedNodes, attributeName, oldValue) => ({ - type, - target, - addedNodes, - removedNodes, - attributeName, - oldValue, - previousSibling: element?.previousSibling || null, - nextSibling: element?.nextSibling || null -}); -var queueAttribute = (observer, target, attributeName, attributeFilter, attributeOldValue, oldValue) => { - if (!attributeFilter || attributeFilter.includes(attributeName)) { - const { callback, records, scheduled } = observer; - records.push(createRecord( - "attributes", - target, - null, - [], - [], - attributeName, - attributeOldValue ? oldValue : void 0 - )); - if (!scheduled) { - observer.scheduled = true; - Promise.resolve().then(() => { - observer.scheduled = false; - callback(records.splice(0), observer); - }); - } - } -}; -var attributeChangedCallback2 = (element, attributeName, oldValue) => { - const { ownerDocument } = element; - const { active, observers } = ownerDocument[MUTATION_OBSERVER]; - if (active) { - for (const observer of observers) { - for (const [ - target, - { - childList, - subtree, - attributes, - attributeFilter, - attributeOldValue - } - ] of observer.nodes) { - if (childList) { - if (subtree && (target === ownerDocument || target.contains(element)) || !subtree && target.children.includes(element)) { - queueAttribute( - observer, - element, - attributeName, - attributeFilter, - attributeOldValue, - oldValue - ); - break; - } - } else if (attributes && target === element) { - queueAttribute( - observer, - element, - attributeName, - attributeFilter, - attributeOldValue, - oldValue - ); - break; +// node_modules/telegram/client/telegramBaseClient.js +var require_telegramBaseClient = __commonJS({ + "node_modules/telegram/client/telegramBaseClient.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TelegramBaseClient = void 0; + var __1 = require_telegram(); + var Helpers_1 = require_Helpers(); + var connection_1 = require_connection(); + var sessions_1 = require_sessions(); + var extensions_1 = require_extensions(); + var tl_1 = require_tl(); + var os_1 = __importDefault2(require_os()); + var entityCache_1 = require_entityCache(); + var markdown_1 = require_markdown(); + var network_1 = require_network(); + var AllTLObjects_1 = require_AllTLObjects(); + var TCPMTProxy_1 = require_TCPMTProxy(); + var async_mutex_1 = require_lib16(); + var Logger_1 = require_Logger(); + var platform_1 = require_platform(); + var Deferred_1 = __importDefault2(require_Deferred()); + var EXPORTED_SENDER_RECONNECT_TIMEOUT = 1e3; + var EXPORTED_SENDER_RELEASE_TIMEOUT = 3e4; + var DEFAULT_DC_ID = 4; + var DEFAULT_IPV4_IP = platform_1.isNode ? "149.154.167.91" : "vesta.web.telegram.org"; + var DEFAULT_IPV6_IP = "2001:067c:04e8:f004:0000:0000:0000:000a"; + var clientParamsDefault = { + connection: platform_1.isNode ? connection_1.ConnectionTCPFull : connection_1.ConnectionTCPObfuscated, + networkSocket: platform_1.isNode ? extensions_1.PromisedNetSockets : extensions_1.PromisedWebSockets, + useIPV6: false, + timeout: 10, + requestRetries: 5, + connectionRetries: Infinity, + retryDelay: 1e3, + downloadRetries: 5, + autoReconnect: true, + sequentialUpdates: false, + floodSleepThreshold: 60, + deviceModel: "", + systemVersion: "", + appVersion: "", + langCode: "en", + systemLangCode: "en", + _securityChecks: true, + useWSS: platform_1.isBrowser ? window.location.protocol == "https:" : false, + testServers: false + }; + var TelegramBaseClient = class { + constructor(session2, apiId, apiHash, clientParams) { + this.__version__ = __1.version; + this._ALBUMS = /* @__PURE__ */ new Map(); + this._exportedSenderPromises = /* @__PURE__ */ new Map(); + this._exportedSenderReleaseTimeouts = /* @__PURE__ */ new Map(); + clientParams = Object.assign(Object.assign({}, clientParamsDefault), clientParams); + if (!apiId || !apiHash) { + throw new Error("Your API ID or Hash cannot be empty or undefined"); + } + if (clientParams.baseLogger) { + this._log = clientParams.baseLogger; + } else { + this._log = new extensions_1.Logger(); + } + this._log.info("Running gramJS version " + __1.version); + if (session2 && typeof session2 == "string") { + session2 = new sessions_1.StoreSession(session2); + } + if (!(session2 instanceof sessions_1.Session)) { + throw new Error("Only StringSession and StoreSessions are supported currently :( "); + } + this._floodSleepThreshold = clientParams.floodSleepThreshold; + this.session = session2; + this.apiId = apiId; + this.apiHash = apiHash; + this._useIPV6 = clientParams.useIPV6; + this._requestRetries = clientParams.requestRetries; + this._downloadRetries = clientParams.downloadRetries; + this._connectionRetries = clientParams.connectionRetries; + this._reconnectRetries = clientParams.reconnectRetries; + this._retryDelay = clientParams.retryDelay || 0; + this._timeout = clientParams.timeout; + this._autoReconnect = clientParams.autoReconnect; + this._proxy = clientParams.proxy; + this._semaphore = new async_mutex_1.Semaphore(clientParams.maxConcurrentDownloads || 1); + this.testServers = clientParams.testServers || false; + this.networkSocket = clientParams.networkSocket || extensions_1.PromisedNetSockets; + if (!(clientParams.connection instanceof Function)) { + throw new Error("Connection should be a class not an instance"); + } + this._connection = clientParams.connection; + let initProxy; + if (this._proxy && "MTProxy" in this._proxy) { + this._connection = TCPMTProxy_1.ConnectionTCPMTProxyAbridged; + initProxy = new tl_1.Api.InputClientProxy({ + address: this._proxy.ip, + port: this._proxy.port + }); + } + this._initRequest = new tl_1.Api.InitConnection({ + apiId: this.apiId, + deviceModel: clientParams.deviceModel || os_1.default.type().toString() || "Unknown", + systemVersion: clientParams.systemVersion || os_1.default.release().toString() || "1.0", + appVersion: clientParams.appVersion || "1.0", + langCode: clientParams.langCode, + langPack: "", + // this should be left empty. + systemLangCode: clientParams.systemLangCode, + proxy: initProxy + }); + this._eventBuilders = []; + this._floodWaitedRequests = {}; + this._borrowedSenderPromises = {}; + this._bot = void 0; + this._selfInputPeer = void 0; + this.useWSS = clientParams.useWSS; + this._securityChecks = !!clientParams.securityChecks; + if (this.useWSS && this._proxy) { + throw new Error("Cannot use SSL with proxies. You need to disable the useWSS client param in TelegramClient"); } + this._entityCache = new entityCache_1.EntityCache(); + this._config = void 0; + this._loopStarted = false; + this._reconnecting = false; + this._destroyed = false; + this._isSwitchingDc = false; + this._connectedDeferred = new Deferred_1.default(); + this._parseMode = markdown_1.MarkdownParser; } - } - } -}; -var moCallback = (element, parentNode) => { - const { ownerDocument } = element; - const { active, observers } = ownerDocument[MUTATION_OBSERVER]; - if (active) { - for (const observer of observers) { - for (const [target, { subtree, childList, characterData }] of observer.nodes) { - if (childList) { - if (parentNode && (target === parentNode || /* c8 ignore next */ - subtree && target.contains(parentNode)) || !parentNode && (subtree && (target === ownerDocument || /* c8 ignore next */ - target.contains(element)) || !subtree && target[characterData ? "childNodes" : "children"].includes(element))) { - const { callback, records, scheduled } = observer; - records.push(createRecord( - "childList", - target, - element, - parentNode ? [] : [element], - parentNode ? [element] : [] - )); - if (!scheduled) { - observer.scheduled = true; - Promise.resolve().then(() => { - observer.scheduled = false; - callback(records.splice(0), observer); - }); - } - break; - } + get floodSleepThreshold() { + return this._floodSleepThreshold; + } + set floodSleepThreshold(value) { + this._floodSleepThreshold = Math.min(value || 0, 24 * 60 * 60); + } + set maxConcurrentDownloads(value) { + this._semaphore._value = value; + } + // region connecting + async _initSession() { + await this.session.load(); + if (!this.session.serverAddress) { + this.session.setDC(DEFAULT_DC_ID, this._useIPV6 ? DEFAULT_IPV6_IP : DEFAULT_IPV4_IP, this.useWSS ? 443 : 80); + } else { + this._useIPV6 = this.session.serverAddress.includes(":"); } } - } - } -}; -var MutationObserverClass = class { - constructor(ownerDocument) { - const observers = /* @__PURE__ */ new Set(); - this.observers = observers; - this.active = false; - this.class = class MutationObserver { - constructor(callback) { - this.callback = callback; - this.nodes = /* @__PURE__ */ new Map(); - this.records = []; - this.scheduled = false; - } - disconnect() { - this.records.splice(0); - this.nodes.clear(); - observers.delete(this); - ownerDocument[MUTATION_OBSERVER].active = !!observers.size; + get connected() { + return this._sender && this._sender.isConnected(); } - /** - * @param {Element} target - * @param {MutationObserverInit} options - */ - observe(target, options = { - subtree: false, - childList: false, - attributes: false, - attributeFilter: null, - attributeOldValue: false, - characterData: false - // TODO: not implemented yet - // characterDataOldValue: false - }) { - if ("attributeOldValue" in options || "attributeFilter" in options) - options.attributes = true; - options.childList = !!options.childList; - options.subtree = !!options.subtree; - this.nodes.set(target, options); - observers.add(this); - ownerDocument[MUTATION_OBSERVER].active = true; + async disconnect() { + await this._disconnect(); + await Promise.all(Object.values(this._exportedSenderPromises).map((promises) => { + return Object.values(promises).map((promise) => { + return promise && promise.then((sender) => { + if (sender) { + return sender.disconnect(); + } + return void 0; + }); + }); + }).flat()); + Object.values(this._exportedSenderReleaseTimeouts).forEach((timeouts) => { + Object.values(timeouts).forEach((releaseTimeout) => { + clearTimeout(releaseTimeout); + }); + }); + this._exportedSenderPromises.clear(); + } + get disconnected() { + return !this._sender || this._sender._disconnected; + } + async _disconnect() { + var _a; + await ((_a = this._sender) === null || _a === void 0 ? void 0 : _a.disconnect()); } /** - * @returns {MutationRecord[]} + * Disconnects all senders and removes all handlers + * Disconnect is safer as it will not remove your event handlers */ - takeRecords() { - return this.records.splice(0); - } - }; - } -}; - -// node_modules/linkedom/esm/shared/attributes.js -var emptyAttributes = /* @__PURE__ */ new Set([ - "allowfullscreen", - "allowpaymentrequest", - "async", - "autofocus", - "autoplay", - "checked", - "class", - "contenteditable", - "controls", - "default", - "defer", - "disabled", - "draggable", - "formnovalidate", - "hidden", - "id", - "ismap", - "itemscope", - "loop", - "multiple", - "muted", - "nomodule", - "novalidate", - "open", - "playsinline", - "readonly", - "required", - "reversed", - "selected", - "style", - "truespeed" -]); -var setAttribute = (element, attribute2) => { - const { [VALUE]: value, name } = attribute2; - attribute2.ownerElement = element; - knownSiblings(element, attribute2, element[NEXT]); - if (name === "class") - element.className = value; - attributeChangedCallback2(element, name, null); - attributeChangedCallback(element, name, null, value); -}; -var removeAttribute = (element, attribute2) => { - const { [VALUE]: value, name } = attribute2; - knownAdjacent(attribute2[PREV], attribute2[NEXT]); - attribute2.ownerElement = attribute2[PREV] = attribute2[NEXT] = null; - if (name === "class") - element[CLASS_LIST] = null; - attributeChangedCallback2(element, name, value); - attributeChangedCallback(element, name, value, null); -}; -var booleanAttribute = { - get(element, name) { - return element.hasAttribute(name); - }, - set(element, name, value) { - if (value) - element.setAttribute(name, ""); - else - element.removeAttribute(name); - } -}; -var numericAttribute = { - get(element, name) { - return parseFloat(element.getAttribute(name) || 0); - }, - set(element, name, value) { - element.setAttribute(name, value); - } -}; -var stringAttribute = { - get(element, name) { - return element.getAttribute(name) || ""; - }, - set(element, name, value) { - element.setAttribute(name, value); - } -}; - -// node_modules/linkedom/esm/interface/node.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/interface/event-target.js -init_define_import_meta_env(); -var wm = /* @__PURE__ */ new WeakMap(); -function dispatch(event, listener) { - if (typeof listener === "function") - listener.call(event.target, event); - else - listener.handleEvent(event); - return event._stopImmediatePropagationFlag; -} -function invokeListeners({ currentTarget, target }) { - const map = wm.get(currentTarget); - if (map && map.has(this.type)) { - const listeners = map.get(this.type); - if (currentTarget === target) { - this.eventPhase = this.AT_TARGET; - } else { - this.eventPhase = this.BUBBLING_PHASE; - } - this.currentTarget = currentTarget; - this.target = target; - for (const [listener, options] of listeners) { - if (options && options.once) - listeners.delete(listener); - if (dispatch(this, listener)) - break; - } - delete this.currentTarget; - delete this.target; - return this.cancelBubble; - } -} -var DOMEventTarget = class { - constructor() { - wm.set(this, /* @__PURE__ */ new Map()); - } - /** - * @protected - */ - _getParent() { - return null; - } - addEventListener(type, listener, options) { - const map = wm.get(this); - if (!map.has(type)) - map.set(type, /* @__PURE__ */ new Map()); - map.get(type).set(listener, options); - } - removeEventListener(type, listener) { - const map = wm.get(this); - if (map.has(type)) { - const listeners = map.get(type); - if (listeners.delete(listener) && !listeners.size) - map.delete(type); - } - } - dispatchEvent(event) { - let node = this; - event.eventPhase = event.CAPTURING_PHASE; - while (node) { - if (node.dispatchEvent) - event._path.push({ currentTarget: node, target: this }); - node = event.bubbles && node._getParent && node._getParent(); - } - event._path.some(invokeListeners, event); - event._path = []; - event.eventPhase = event.NONE; - return !event.defaultPrevented; - } -}; - -// node_modules/linkedom/esm/interface/node-list.js -init_define_import_meta_env(); -var NodeList = class extends Array { - item(i) { - return i < this.length ? this[i] : null; - } -}; - -// node_modules/linkedom/esm/interface/node.js -var getParentNodeCount = ({ parentNode }) => { - let count = 0; - while (parentNode) { - count++; - parentNode = parentNode.parentNode; - } - return count; -}; -var Node2 = class extends DOMEventTarget { - static get ELEMENT_NODE() { - return ELEMENT_NODE; - } - static get ATTRIBUTE_NODE() { - return ATTRIBUTE_NODE; - } - static get TEXT_NODE() { - return TEXT_NODE; - } - static get CDATA_SECTION_NODE() { - return CDATA_SECTION_NODE; - } - static get COMMENT_NODE() { - return COMMENT_NODE; - } - static get DOCUMENT_NODE() { - return DOCUMENT_NODE; - } - static get DOCUMENT_FRAGMENT_NODE() { - return DOCUMENT_FRAGMENT_NODE; - } - static get DOCUMENT_TYPE_NODE() { - return DOCUMENT_TYPE_NODE; - } - constructor(ownerDocument, localName, nodeType) { - super(); - this.ownerDocument = ownerDocument; - this.localName = localName; - this.nodeType = nodeType; - this.parentNode = null; - this[NEXT] = null; - this[PREV] = null; - } - get ELEMENT_NODE() { - return ELEMENT_NODE; - } - get ATTRIBUTE_NODE() { - return ATTRIBUTE_NODE; - } - get TEXT_NODE() { - return TEXT_NODE; - } - get CDATA_SECTION_NODE() { - return CDATA_SECTION_NODE; - } - get COMMENT_NODE() { - return COMMENT_NODE; - } - get DOCUMENT_NODE() { - return DOCUMENT_NODE; - } - get DOCUMENT_FRAGMENT_NODE() { - return DOCUMENT_FRAGMENT_NODE; - } - get DOCUMENT_TYPE_NODE() { - return DOCUMENT_TYPE_NODE; - } - get baseURI() { - const ownerDocument = this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument; - if (ownerDocument) { - const base = ownerDocument.querySelector("base"); - if (base) - return base.getAttribute("href"); - const { location } = ownerDocument.defaultView; - if (location) - return location.href; - } - return null; - } - /* c8 ignore start */ - // mixin: node - get isConnected() { - return false; - } - get nodeName() { - return this.localName; - } - get parentElement() { - return null; - } - get previousSibling() { - return null; - } - get previousElementSibling() { - return null; - } - get nextSibling() { - return null; - } - get nextElementSibling() { - return null; - } - get childNodes() { - return new NodeList(); - } - get firstChild() { - return null; - } - get lastChild() { - return null; - } - // default values - get nodeValue() { - return null; - } - set nodeValue(value) { - } - get textContent() { - return null; - } - set textContent(value) { - } - normalize() { - } - cloneNode() { - return null; - } - contains() { - return false; - } - /** - * Inserts a node before a reference node as a child of this parent node. - * @param {Node} newNode The node to be inserted. - * @param {Node} referenceNode The node before which newNode is inserted. If this is null, then newNode is inserted at the end of node's child nodes. - * @returns The added child - */ - // eslint-disable-next-line no-unused-vars - insertBefore(newNode, referenceNode) { - return newNode; - } - /** - * Adds a node to the end of the list of children of this node. - * @param {Node} child The node to append to the given parent node. - * @returns The appended child. - */ - appendChild(child) { - return child; - } - /** - * Replaces a child node within this node - * @param {Node} newChild The new node to replace oldChild. - * @param {Node} oldChild The child to be replaced. - * @returns The replaced Node. This is the same node as oldChild. - */ - replaceChild(newChild, oldChild) { - return oldChild; - } - /** - * Removes a child node from the DOM. - * @param {Node} child A Node that is the child node to be removed from the DOM. - * @returns The removed node. - */ - removeChild(child) { - return child; - } - toString() { - return ""; - } - /* c8 ignore stop */ - hasChildNodes() { - return !!this.lastChild; - } - isSameNode(node) { - return this === node; - } - // TODO: attributes? - compareDocumentPosition(target) { - let result = 0; - if (this !== target) { - let self2 = getParentNodeCount(this); - let other = getParentNodeCount(target); - if (self2 < other) { - result += DOCUMENT_POSITION_FOLLOWING; - if (this.contains(target)) - result += DOCUMENT_POSITION_CONTAINED_BY; - } else if (other < self2) { - result += DOCUMENT_POSITION_PRECEDING; - if (target.contains(this)) - result += DOCUMENT_POSITION_CONTAINS; - } else if (self2 && other) { - const { childNodes } = this.parentNode; - if (childNodes.indexOf(this) < childNodes.indexOf(target)) - result += DOCUMENT_POSITION_FOLLOWING; - else - result += DOCUMENT_POSITION_PRECEDING; + async destroy() { + this._destroyed = true; + await Promise.all([ + this.disconnect(), + ...Object.values(this._borrowedSenderPromises).map((promise) => { + return promise.then((sender) => sender.disconnect()); + }) + ]); + this._eventBuilders = []; } - if (!self2 || !other) { - result += DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; - result += DOCUMENT_POSITION_DISCONNECTED; + /** @hidden */ + async _authKeyCallback(authKey, dcId) { + this.session.setAuthKey(authKey, dcId); + await this.session.save(); } - } - return result; - } - isEqualNode(node) { - if (this === node) - return true; - if (this.nodeType === node.nodeType) { - switch (this.nodeType) { - case DOCUMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: { - const aNodes = this.childNodes; - const bNodes = node.childNodes; - return aNodes.length === bNodes.length && aNodes.every((node2, i) => node2.isEqualNode(bNodes[i])); + /** @hidden */ + async _cleanupExportedSender(dcId) { + if (this.session.dcId !== dcId) { + this.session.setAuthKey(void 0, dcId); } + let sender = await this._exportedSenderPromises.get(dcId); + this._exportedSenderPromises.delete(dcId); + await (sender === null || sender === void 0 ? void 0 : sender.disconnect()); } - return this.toString() === node.toString(); - } - return false; - } - /** - * @protected - */ - _getParent() { - return this.parentNode; - } - /** - * Calling it on an element inside a standard web page will return an HTMLDocument object representing the entire page (or <iframe>). - * Calling it on an element inside a shadow DOM will return the associated ShadowRoot. - * @return {ShadowRoot | HTMLDocument} - */ - getRootNode() { - let root = this; - while (root.parentNode) - root = root.parentNode; - return root; - } -}; - -// node_modules/linkedom/esm/shared/text-escaper.js -init_define_import_meta_env(); -var { replace } = ""; -var ca = /[<>&\xA0]/g; -var esca = { - "\xA0": " ", - "&": "&", - "<": "<", - ">": ">" -}; -var pe = (m) => esca[m]; -var escape3 = (es) => replace.call(es, ca, pe); - -// node_modules/linkedom/esm/interface/attr.js -var QUOTE = /"/g; -var Attr = class _Attr extends Node2 { - constructor(ownerDocument, name, value = "") { - super(ownerDocument, name, ATTRIBUTE_NODE); - this.ownerElement = null; - this.name = $String(name); - this[VALUE] = $String(value); - this[CHANGED] = false; - } - get value() { - return this[VALUE]; - } - set value(newValue) { - const { [VALUE]: oldValue, name, ownerElement } = this; - this[VALUE] = $String(newValue); - this[CHANGED] = true; - if (ownerElement) { - attributeChangedCallback2(ownerElement, name, oldValue); - attributeChangedCallback(ownerElement, name, oldValue, this[VALUE]); - } - } - cloneNode() { - const { ownerDocument, name, [VALUE]: value } = this; - return new _Attr(ownerDocument, name, value); - } - toString() { - const { name, [VALUE]: value } = this; - if (emptyAttributes.has(name) && !value) { - return ignoreCase(this) ? name : `${name}=""`; - } - const escapedValue = (ignoreCase(this) ? value : escape3(value)).replace(QUOTE, """); - return `${name}="${escapedValue}"`; - } - toJSON() { - const json2 = []; - attrAsJSON(this, json2); - return json2; - } -}; - -// node_modules/linkedom/esm/interface/character-data.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/node.js -init_define_import_meta_env(); -var isConnected = ({ ownerDocument, parentNode }) => { - while (parentNode) { - if (parentNode === ownerDocument) - return true; - parentNode = parentNode.parentNode || parentNode.host; - } - return false; -}; -var parentElement = ({ parentNode }) => { - if (parentNode) { - switch (parentNode.nodeType) { - case DOCUMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - return null; - } - } - return parentNode; -}; -var previousSibling = ({ [PREV]: prev }) => { - switch (prev ? prev.nodeType : 0) { - case NODE_END: - return prev[START]; - case TEXT_NODE: - case COMMENT_NODE: - case CDATA_SECTION_NODE: - return prev; - } - return null; -}; -var nextSibling = (node) => { - const next = getEnd(node)[NEXT]; - return next && (next.nodeType === NODE_END ? null : next); -}; - -// node_modules/linkedom/esm/mixin/non-document-type-child-node.js -init_define_import_meta_env(); -var nextElementSibling2 = (node) => { - let next = nextSibling(node); - while (next && next.nodeType !== ELEMENT_NODE) - next = nextSibling(next); - return next; -}; -var previousElementSibling = (node) => { - let prev = previousSibling(node); - while (prev && prev.nodeType !== ELEMENT_NODE) - prev = previousSibling(prev); - return prev; -}; - -// node_modules/linkedom/esm/mixin/child-node.js -init_define_import_meta_env(); -var asFragment = (ownerDocument, nodes) => { - const fragment = ownerDocument.createDocumentFragment(); - fragment.append(...nodes); - return fragment; -}; -var before = (node, nodes) => { - const { ownerDocument, parentNode } = node; - if (parentNode) - parentNode.insertBefore( - asFragment(ownerDocument, nodes), - node - ); -}; -var after = (node, nodes) => { - const { ownerDocument, parentNode } = node; - if (parentNode) - parentNode.insertBefore( - asFragment(ownerDocument, nodes), - getEnd(node)[NEXT] - ); -}; -var replaceWith = (node, nodes) => { - const { ownerDocument, parentNode } = node; - if (parentNode) { - if (nodes.includes(node)) - replaceWith(node, [node = node.cloneNode()]); - parentNode.insertBefore( - asFragment(ownerDocument, nodes), - node - ); - node.remove(); - } -}; -var remove = (prev, current, next) => { - const { parentNode, nodeType } = current; - if (prev || next) { - setAdjacent(prev, next); - current[PREV] = null; - getEnd(current)[NEXT] = null; - } - if (parentNode) { - current.parentNode = null; - moCallback(current, parentNode); - if (nodeType === ELEMENT_NODE) - disconnectedCallback(current); - } -}; - -// node_modules/linkedom/esm/interface/character-data.js -var CharacterData = class extends Node2 { - constructor(ownerDocument, localName, nodeType, data) { - super(ownerDocument, localName, nodeType); - this[VALUE] = $String(data); - } - // <Mixins> - get isConnected() { - return isConnected(this); - } - get parentElement() { - return parentElement(this); - } - get previousSibling() { - return previousSibling(this); - } - get nextSibling() { - return nextSibling(this); - } - get previousElementSibling() { - return previousElementSibling(this); - } - get nextElementSibling() { - return nextElementSibling2(this); - } - before(...nodes) { - before(this, nodes); - } - after(...nodes) { - after(this, nodes); - } - replaceWith(...nodes) { - replaceWith(this, nodes); - } - remove() { - remove(this[PREV], this, this[NEXT]); - } - // </Mixins> - // CharacterData only - /* c8 ignore start */ - get data() { - return this[VALUE]; - } - set data(value) { - this[VALUE] = $String(value); - moCallback(this, this.parentNode); - } - get nodeValue() { - return this.data; - } - set nodeValue(value) { - this.data = value; - } - get textContent() { - return this.data; - } - set textContent(value) { - this.data = value; - } - get length() { - return this.data.length; - } - substringData(offset, count) { - return this.data.substr(offset, count); - } - appendData(data) { - this.data += data; - } - insertData(offset, data) { - const { data: t } = this; - this.data = t.slice(0, offset) + data + t.slice(offset); - } - deleteData(offset, count) { - const { data: t } = this; - this.data = t.slice(0, offset) + t.slice(offset + count); - } - replaceData(offset, count, data) { - const { data: t } = this; - this.data = t.slice(0, offset) + data + t.slice(offset + count); - } - /* c8 ignore stop */ - toJSON() { - const json2 = []; - characterDataAsJSON(this, json2); - return json2; - } -}; - -// node_modules/linkedom/esm/interface/cdata-section.js -init_define_import_meta_env(); -var CDATASection = class _CDATASection extends CharacterData { - constructor(ownerDocument, data = "") { - super(ownerDocument, "#cdatasection", CDATA_SECTION_NODE, data); - } - cloneNode() { - const { ownerDocument, [VALUE]: data } = this; - return new _CDATASection(ownerDocument, data); - } - toString() { - return `<![CDATA[${this[VALUE]}]]>`; - } -}; - -// node_modules/linkedom/esm/interface/comment.js -init_define_import_meta_env(); -var Comment3 = class _Comment extends CharacterData { - constructor(ownerDocument, data = "") { - super(ownerDocument, "#comment", COMMENT_NODE, data); - } - cloneNode() { - const { ownerDocument, [VALUE]: data } = this; - return new _Comment(ownerDocument, data); - } - toString() { - return `<!--${this[VALUE]}-->`; - } -}; - -// node_modules/linkedom/esm/interface/document-fragment.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/mixin/non-element-parent-node.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/mixin/parent-node.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/shared/matches.js -init_define_import_meta_env(); - -// node_modules/css-select/dist/index.js -init_define_import_meta_env(); - -// node_modules/boolbase/dist/index.js -init_define_import_meta_env(); -function trueFunc() { - return true; -} -function falseFunc() { - return false; -} - -// node_modules/css-what/dist/index.js -init_define_import_meta_env(); - -// node_modules/css-what/dist/parse.js -init_define_import_meta_env(); - -// node_modules/css-what/dist/types.js -init_define_import_meta_env(); -var SelectorType; -(function(SelectorType2) { - SelectorType2["Attribute"] = "attribute"; - SelectorType2["Pseudo"] = "pseudo"; - SelectorType2["PseudoElement"] = "pseudo-element"; - SelectorType2["Tag"] = "tag"; - SelectorType2["Universal"] = "universal"; - SelectorType2["Adjacent"] = "adjacent"; - SelectorType2["Child"] = "child"; - SelectorType2["Descendant"] = "descendant"; - SelectorType2["Parent"] = "parent"; - SelectorType2["Sibling"] = "sibling"; - SelectorType2["ColumnCombinator"] = "column-combinator"; -})(SelectorType || (SelectorType = {})); -var AttributeAction; -(function(AttributeAction2) { - AttributeAction2["Any"] = "any"; - AttributeAction2["Element"] = "element"; - AttributeAction2["End"] = "end"; - AttributeAction2["Equals"] = "equals"; - AttributeAction2["Exists"] = "exists"; - AttributeAction2["Hyphen"] = "hyphen"; - AttributeAction2["Not"] = "not"; - AttributeAction2["Start"] = "start"; -})(AttributeAction || (AttributeAction = {})); - -// node_modules/css-what/dist/parse.js -var reName = /^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/; -var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi; -var CharCode; -(function(CharCode2) { - CharCode2[CharCode2["LeftParenthesis"] = 40] = "LeftParenthesis"; - CharCode2[CharCode2["RightParenthesis"] = 41] = "RightParenthesis"; - CharCode2[CharCode2["LeftSquareBracket"] = 91] = "LeftSquareBracket"; - CharCode2[CharCode2["RightSquareBracket"] = 93] = "RightSquareBracket"; - CharCode2[CharCode2["Comma"] = 44] = "Comma"; - CharCode2[CharCode2["Period"] = 46] = "Period"; - CharCode2[CharCode2["Colon"] = 58] = "Colon"; - CharCode2[CharCode2["SingleQuote"] = 39] = "SingleQuote"; - CharCode2[CharCode2["DoubleQuote"] = 34] = "DoubleQuote"; - CharCode2[CharCode2["Plus"] = 43] = "Plus"; - CharCode2[CharCode2["Tilde"] = 126] = "Tilde"; - CharCode2[CharCode2["QuestionMark"] = 63] = "QuestionMark"; - CharCode2[CharCode2["ExclamationMark"] = 33] = "ExclamationMark"; - CharCode2[CharCode2["Slash"] = 47] = "Slash"; - CharCode2[CharCode2["Equal"] = 61] = "Equal"; - CharCode2[CharCode2["Dollar"] = 36] = "Dollar"; - CharCode2[CharCode2["Pipe"] = 124] = "Pipe"; - CharCode2[CharCode2["Circumflex"] = 94] = "Circumflex"; - CharCode2[CharCode2["Asterisk"] = 42] = "Asterisk"; - CharCode2[CharCode2["GreaterThan"] = 62] = "GreaterThan"; - CharCode2[CharCode2["LessThan"] = 60] = "LessThan"; - CharCode2[CharCode2["Hash"] = 35] = "Hash"; - CharCode2[CharCode2["LowerI"] = 105] = "LowerI"; - CharCode2[CharCode2["LowerS"] = 115] = "LowerS"; - CharCode2[CharCode2["BackSlash"] = 92] = "BackSlash"; - CharCode2[CharCode2["Space"] = 32] = "Space"; - CharCode2[CharCode2["Tab"] = 9] = "Tab"; - CharCode2[CharCode2["NewLine"] = 10] = "NewLine"; - CharCode2[CharCode2["FormFeed"] = 12] = "FormFeed"; - CharCode2[CharCode2["CarriageReturn"] = 13] = "CarriageReturn"; -})(CharCode || (CharCode = {})); -var actionTypes = /* @__PURE__ */ new Map([ - [CharCode.Tilde, AttributeAction.Element], - [CharCode.Circumflex, AttributeAction.Start], - [CharCode.Dollar, AttributeAction.End], - [CharCode.Asterisk, AttributeAction.Any], - [CharCode.ExclamationMark, AttributeAction.Not], - [CharCode.Pipe, AttributeAction.Hyphen] -]); -var unpackPseudos = /* @__PURE__ */ new Set([ - "has", - "not", - "matches", - "is", - "where", - "host", - "host-context" -]); -var pseudosToPseudoElements = /* @__PURE__ */ new Set([ - "before", - "after", - "first-line", - "first-letter" -]); -function isTraversal(selector) { - switch (selector.type) { - case SelectorType.Adjacent: - case SelectorType.Child: - case SelectorType.Descendant: - case SelectorType.Parent: - case SelectorType.Sibling: - case SelectorType.ColumnCombinator: { - return true; - } - case SelectorType.Attribute: - case SelectorType.Pseudo: - case SelectorType.PseudoElement: - case SelectorType.Tag: - case SelectorType.Universal: { - return false; - } - } -} -var stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]); -function funescape(_, escaped, escapedWhitespace) { - const high = Number.parseInt(escaped, 16) - 65536; - return Number.isNaN(high) || escapedWhitespace ? escaped : high < 0 ? ( - // BMP codepoint - String.fromCharCode(high + 65536) - ) : ( - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320) - ); -} -function unescapeCSS(cssString) { - return cssString.replace(reEscape, funescape); -} -function isQuote(c) { - return c === CharCode.SingleQuote || c === CharCode.DoubleQuote; -} -function isWhitespace2(c) { - return c === CharCode.Space || c === CharCode.Tab || c === CharCode.NewLine || c === CharCode.FormFeed || c === CharCode.CarriageReturn; -} -function parse(selector) { - const subselects2 = []; - const endIndex = parseSelector(subselects2, `${selector}`, 0); - if (endIndex < selector.length) { - throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`); - } - return subselects2; -} -function parseSelector(subselects2, selector, selectorIndex) { - let tokens = []; - function getName4(offset) { - const match = selector.slice(selectorIndex + offset).match(reName); - if (!match) { - throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`); - } - const [name] = match; - selectorIndex += offset + name.length; - return unescapeCSS(name); - } - function stripWhitespace(offset) { - selectorIndex += offset; - while (selectorIndex < selector.length && isWhitespace2(selector.charCodeAt(selectorIndex))) { - selectorIndex++; - } - } - function readValueWithParenthesis() { - selectorIndex += 1; - const start = selectorIndex; - for (let counter = 1; selectorIndex < selector.length; selectorIndex++) { - switch (selector.charCodeAt(selectorIndex)) { - case CharCode.BackSlash: { - selectorIndex += 1; - break; + /** @hidden */ + async _connectSender(sender, dcId) { + const dc = await this.getDC(dcId, !!sender.authKey.getKey()); + while (true) { + try { + await sender.connect(new this._connection({ + ip: dc.ipAddress, + port: dc.port, + dcId, + loggers: this._log, + proxy: this._proxy, + testServers: this.testServers, + socket: this.networkSocket + }), false); + if (this.session.dcId !== dcId && !sender._authenticated) { + this._log.info(`Exporting authorization for data center ${dc.ipAddress} with layer ${AllTLObjects_1.LAYER}`); + const auth = await this.invoke(new tl_1.Api.auth.ExportAuthorization({ dcId })); + this._initRequest.query = new tl_1.Api.auth.ImportAuthorization({ + id: auth.id, + bytes: auth.bytes + }); + const req = new tl_1.Api.InvokeWithLayer({ + layer: AllTLObjects_1.LAYER, + query: this._initRequest + }); + await sender.send(req); + sender._authenticated = true; + } + sender.dcId = dcId; + sender.userDisconnected = false; + return sender; + } catch (err) { + if (err.errorMessage === "DC_ID_INVALID") { + sender._authenticated = true; + sender.userDisconnected = false; + return sender; + } + if (this._errorHandler) { + await this._errorHandler(err); + } else if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(err); + } + await (0, Helpers_1.sleep)(1e3); + await sender.disconnect(); + } } - case CharCode.LeftParenthesis: { - counter += 1; - break; + } + /** @hidden */ + async _borrowExportedSender(dcId, shouldReconnect, existingSender) { + if (!this._exportedSenderPromises.get(dcId) || shouldReconnect) { + this._exportedSenderPromises.set(dcId, this._connectSender(existingSender || this._createExportedSender(dcId), dcId)); } - case CharCode.RightParenthesis: { - counter -= 1; - if (counter === 0) { - return unescapeCSS(selector.slice(start, selectorIndex++)); + let sender; + try { + sender = await this._exportedSenderPromises.get(dcId); + if (!sender.isConnected()) { + if (sender.isConnecting) { + await (0, Helpers_1.sleep)(EXPORTED_SENDER_RECONNECT_TIMEOUT); + return this._borrowExportedSender(dcId, false, sender); + } else { + return this._borrowExportedSender(dcId, true, sender); + } + } + } catch (err) { + if (this._errorHandler) { + await this._errorHandler(err); + } + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(err); } - break; + return this._borrowExportedSender(dcId, true); } - } - } - throw new Error("Parenthesis not matched"); - } - function ensureNotTraversal() { - if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) { - throw new Error("Did not expect successive traversals."); - } - } - function addTraversal(type) { - if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) { - tokens[tokens.length - 1].type = type; - return; - } - ensureNotTraversal(); - tokens.push({ type }); - } - function addSpecialAttribute(name, action) { - tokens.push({ - type: SelectorType.Attribute, - name, - action, - value: getName4(1), - namespace: null, - ignoreCase: "quirks" - }); - } - function finalizeSubselector() { - if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) { - tokens.pop(); - } - if (tokens.length === 0) { - throw new Error("Empty sub-selector"); - } - subselects2.push(tokens); - } - stripWhitespace(0); - if (selector.length === selectorIndex) { - return selectorIndex; - } - loop: while (selectorIndex < selector.length) { - const firstChar = selector.charCodeAt(selectorIndex); - switch (firstChar) { - // Whitespace - case CharCode.Space: - case CharCode.Tab: - case CharCode.NewLine: - case CharCode.FormFeed: - case CharCode.CarriageReturn: { - if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) { - ensureNotTraversal(); - tokens.push({ type: SelectorType.Descendant }); + if (this._exportedSenderReleaseTimeouts.get(dcId)) { + clearTimeout(this._exportedSenderReleaseTimeouts.get(dcId)); + this._exportedSenderReleaseTimeouts.delete(dcId); } - stripWhitespace(1); - break; + this._exportedSenderReleaseTimeouts.set(dcId, setTimeout(() => { + this._exportedSenderReleaseTimeouts.delete(dcId); + if (sender._pendingState.values().length) { + console.log("sender already has some hanging states. reconnecting"); + sender._reconnect(); + this._borrowExportedSender(dcId, false, sender); + } else { + sender.disconnect(); + } + }, EXPORTED_SENDER_RELEASE_TIMEOUT)); + return sender; } - // Traversals - case CharCode.GreaterThan: { - addTraversal(SelectorType.Child); - stripWhitespace(1); - break; + /** @hidden */ + _createExportedSender(dcId) { + return new network_1.MTProtoSender(this.session.getAuthKey(dcId), { + logger: this._log, + dcId, + retries: this._connectionRetries, + delay: this._retryDelay, + autoReconnect: this._autoReconnect, + connectTimeout: this._timeout, + authKeyCallback: this._authKeyCallback.bind(this), + isMainSender: dcId === this.session.dcId, + onConnectionBreak: this._cleanupExportedSender.bind(this), + client: this, + securityChecks: this._securityChecks, + _exportedSenderPromises: this._exportedSenderPromises, + reconnectRetries: this._reconnectRetries + }); } - case CharCode.LessThan: { - addTraversal(SelectorType.Parent); - stripWhitespace(1); - break; + /** @hidden */ + getSender(dcId) { + return dcId ? this._borrowExportedSender(dcId) : Promise.resolve(this._sender); } - case CharCode.Tilde: { - addTraversal(SelectorType.Sibling); - stripWhitespace(1); - break; + // endregion + async getDC(dcId, download) { + throw new Error("Cannot be called from here!"); } - case CharCode.Plus: { - addTraversal(SelectorType.Adjacent); - stripWhitespace(1); - break; + invoke(request) { + throw new Error("Cannot be called from here!"); } - // Special attribute selectors: .class, #id - case CharCode.Period: { - addSpecialAttribute("class", AttributeAction.Element); - break; + setLogLevel(level) { + this._log.setLevel(level); } - case CharCode.Hash: { - addSpecialAttribute("id", AttributeAction.Equals); - break; + get logger() { + return this._log; } - case CharCode.LeftSquareBracket: { - stripWhitespace(1); - let name; - let namespace = null; - if (selector.charCodeAt(selectorIndex) === CharCode.Pipe) { - name = getName4(1); - } else if (selector.startsWith("*|", selectorIndex)) { - namespace = "*"; - name = getName4(2); - } else { - name = getName4(0); - if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) { - namespace = name; - name = getName4(1); + /** + * Custom error handler for the client + * @example + * ```ts + * client.onError = async (error)=>{ + * console.log("error is",error) + * } + * ``` + */ + set onError(handler) { + this._errorHandler = async (error) => { + try { + await handler(error); + } catch (e) { + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + e.message = `Error ${e.message} thrown while handling top-level error: ${error.message}`; + console.error(e); + } } - } - stripWhitespace(0); - let action = AttributeAction.Exists; - const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex)); - if (possibleAction) { - action = possibleAction; - if (selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) { - throw new Error("Expected `=`"); + }; + } + }; + exports2.TelegramBaseClient = TelegramBaseClient; + } +}); + +// node_modules/telegram/client/auth.js +var require_auth = __commonJS({ + "node_modules/telegram/client/auth.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.start = start; + exports2.checkAuthorization = checkAuthorization; + exports2.signInUser = signInUser; + exports2.signInUserWithQrCode = signInUserWithQrCode; + exports2.sendCode = sendCode; + exports2.signInWithPassword = signInWithPassword; + exports2.signInBot = signInBot; + exports2._authFlow = _authFlow; + var tl_1 = require_tl(); + var utils = __importStar2(require_Utils()); + var Helpers_1 = require_Helpers(); + var Password_1 = require_Password(); + var QR_CODE_TIMEOUT = 3e4; + async function start(client2, authParams) { + if (!client2.connected) { + await client2.connect(); + } + if (await client2.checkAuthorization()) { + return; + } + const apiCredentials = { + apiId: client2.apiId, + apiHash: client2.apiHash + }; + await _authFlow(client2, apiCredentials, authParams); + } + async function checkAuthorization(client2) { + try { + await client2.invoke(new tl_1.Api.updates.GetState()); + return true; + } catch (e) { + return false; + } + } + async function signInUser(client2, apiCredentials, authParams) { + let phoneNumber; + let phoneCodeHash; + let isCodeViaApp = false; + while (1) { + try { + if (typeof authParams.phoneNumber === "function") { + try { + phoneNumber = await authParams.phoneNumber(); + } catch (err) { + if (err.errorMessage === "RESTART_AUTH_WITH_QR") { + return client2.signInUserWithQrCode(apiCredentials, authParams); + } + throw err; + } + } else { + phoneNumber = authParams.phoneNumber; + } + const sendCodeResult = await client2.sendCode(apiCredentials, phoneNumber, authParams.forceSMS); + phoneCodeHash = sendCodeResult.phoneCodeHash; + isCodeViaApp = sendCodeResult.isCodeViaApp; + if (typeof phoneCodeHash !== "string") { + throw new Error("Failed to retrieve phone code hash"); + } + break; + } catch (err) { + if (typeof authParams.phoneNumber !== "function") { + throw err; + } + const shouldWeStop = await authParams.onError(err); + if (shouldWeStop) { + throw new Error("AUTH_USER_CANCEL"); } - stripWhitespace(2); - } else if (selector.charCodeAt(selectorIndex) === CharCode.Equal) { - action = AttributeAction.Equals; - stripWhitespace(1); } - let value = ""; - let ignoreCase2 = null; - if (action !== "exists") { - if (isQuote(selector.charCodeAt(selectorIndex))) { - const quote = selector.charCodeAt(selectorIndex); - selectorIndex += 1; - const sectionStart = selectorIndex; - while (selectorIndex < selector.length && selector.charCodeAt(selectorIndex) !== quote) { - selectorIndex += // Skip next character if it is escaped - selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1; - } - if (selector.charCodeAt(selectorIndex) !== quote) { - throw new Error("Attribute value didn't end"); + } + let phoneCode; + let isRegistrationRequired = false; + let termsOfService; + while (1) { + try { + try { + phoneCode = await authParams.phoneCode(isCodeViaApp); + } catch (err) { + if (err.errorMessage === "RESTART_AUTH") { + return client2.signInUser(apiCredentials, authParams); } - value = unescapeCSS(selector.slice(sectionStart, selectorIndex)); - selectorIndex += 1; + } + if (!phoneCode) { + throw new Error("Code is empty"); + } + const result = await client2.invoke(new tl_1.Api.auth.SignIn({ + phoneNumber, + phoneCodeHash, + phoneCode + })); + if (result instanceof tl_1.Api.auth.AuthorizationSignUpRequired) { + isRegistrationRequired = true; + termsOfService = result.termsOfService; + break; + } + return result.user; + } catch (err) { + if (err.errorMessage === "SESSION_PASSWORD_NEEDED") { + return client2.signInWithPassword(apiCredentials, authParams); } else { - const valueStart = selectorIndex; - while (selectorIndex < selector.length && !isWhitespace2(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) { - selectorIndex += // Skip next character if it is escaped - selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1; + const shouldWeStop = await authParams.onError(err); + if (shouldWeStop) { + throw new Error("AUTH_USER_CANCEL"); } - value = unescapeCSS(selector.slice(valueStart, selectorIndex)); } - stripWhitespace(0); - switch (selector.charCodeAt(selectorIndex) | 32) { - // If the forceIgnore flag is set (either `i` or `s`), use that value - case CharCode.LowerI: { - ignoreCase2 = true; - stripWhitespace(1); - break; + } + } + if (isRegistrationRequired) { + while (1) { + try { + let lastName; + let firstName = "first name"; + if (authParams.firstAndLastNames) { + const result = await authParams.firstAndLastNames(); + firstName = result[0]; + lastName = result[1]; } - case CharCode.LowerS: { - ignoreCase2 = false; - stripWhitespace(1); - break; + if (!firstName) { + throw new Error("First name is required"); + } + const { user } = await client2.invoke(new tl_1.Api.auth.SignUp({ + phoneNumber, + phoneCodeHash, + firstName, + lastName + })); + if (termsOfService) { + await client2.invoke(new tl_1.Api.help.AcceptTermsOfService({ + id: termsOfService.id + })); + } + return user; + } catch (err) { + const shouldWeStop = await authParams.onError(err); + if (shouldWeStop) { + throw new Error("AUTH_USER_CANCEL"); } } } - if (selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) { - throw new Error("Attribute selector didn't terminate"); - } - selectorIndex += 1; - const attributeSelector = { - type: SelectorType.Attribute, - name, - action, - value, - namespace, - ignoreCase: ignoreCase2 - }; - tokens.push(attributeSelector); - break; } - case CharCode.Colon: { - if (selector.charCodeAt(selectorIndex + 1) === CharCode.Colon) { - tokens.push({ - type: SelectorType.PseudoElement, - name: getName4(2).toLowerCase(), - data: selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis ? readValueWithParenthesis() : null - }); - break; - } - const name = getName4(1).toLowerCase(); - if (pseudosToPseudoElements.has(name)) { - tokens.push({ - type: SelectorType.PseudoElement, - name, - data: null - }); - break; + await authParams.onError(new Error("Auth failed")); + return client2.signInUser(apiCredentials, authParams); + } + async function signInUserWithQrCode(client2, apiCredentials, authParams) { + let isScanningComplete = false; + if (authParams.qrCode == void 0) { + throw new Error("qrCode callback not defined"); + } + const inputPromise = (async () => { + while (1) { + if (isScanningComplete) { + break; + } + const result = await client2.invoke(new tl_1.Api.auth.ExportLoginToken({ + apiId: Number(apiCredentials.apiId), + apiHash: apiCredentials.apiHash, + exceptIds: [] + })); + if (!(result instanceof tl_1.Api.auth.LoginToken)) { + throw new Error("Unexpected"); + } + const { token, expires } = result; + await Promise.race([ + authParams.qrCode({ token, expires }), + (0, Helpers_1.sleep)(QR_CODE_TIMEOUT) + ]); + await (0, Helpers_1.sleep)(QR_CODE_TIMEOUT); } - let data = null; - if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) { - if (unpackPseudos.has(name)) { - if (isQuote(selector.charCodeAt(selectorIndex + 1))) { - throw new Error(`Pseudo-selector ${name} cannot be quoted`); - } - data = []; - selectorIndex = parseSelector(data, selector, selectorIndex + 1); - if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) { - throw new Error(`Missing closing parenthesis in :${name} (${selector})`); - } - selectorIndex += 1; + })(); + const updatePromise = new Promise((resolve) => { + client2.addEventHandler((update) => { + if (update instanceof tl_1.Api.UpdateLoginToken) { + resolve(void 0); + } + }); + }); + try { + await Promise.race([updatePromise, inputPromise]); + } catch (err) { + throw err; + } finally { + isScanningComplete = true; + } + try { + const result2 = await client2.invoke(new tl_1.Api.auth.ExportLoginToken({ + apiId: Number(apiCredentials.apiId), + apiHash: apiCredentials.apiHash, + exceptIds: [] + })); + if (result2 instanceof tl_1.Api.auth.LoginTokenSuccess && result2.authorization instanceof tl_1.Api.auth.Authorization) { + return result2.authorization.user; + } else if (result2 instanceof tl_1.Api.auth.LoginTokenMigrateTo) { + await client2._switchDC(result2.dcId); + const migratedResult = await client2.invoke(new tl_1.Api.auth.ImportLoginToken({ + token: result2.token + })); + if (migratedResult instanceof tl_1.Api.auth.LoginTokenSuccess && migratedResult.authorization instanceof tl_1.Api.auth.Authorization) { + return migratedResult.authorization.user; } else { - data = readValueWithParenthesis(); - if (stripQuotesFromPseudos.has(name)) { - const quot = data.charCodeAt(0); - if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) { - data = data.slice(1, -1); - } - } - data = unescapeCSS(data); + client2._log.error(`Received unknown result while scanning QR ${result2.className}`); + throw new Error(`Received unknown result while scanning QR ${result2.className}`); } + } else { + client2._log.error(`Received unknown result while scanning QR ${result2.className}`); + throw new Error(`Received unknown result while scanning QR ${result2.className}`); } - tokens.push({ type: SelectorType.Pseudo, name, data }); - break; + } catch (err) { + if (err.errorMessage === "SESSION_PASSWORD_NEEDED") { + return client2.signInWithPassword(apiCredentials, authParams); + } + throw err; } - case CharCode.Comma: { - finalizeSubselector(); - tokens = []; - stripWhitespace(1); - break; + await authParams.onError(new Error("QR auth failed")); + throw new Error("QR auth failed"); + } + async function sendCode(client2, apiCredentials, phoneNumber, forceSMS = false) { + try { + const { apiId, apiHash } = apiCredentials; + const sendResult = await client2.invoke(new tl_1.Api.auth.SendCode({ + phoneNumber, + apiId, + apiHash, + settings: new tl_1.Api.CodeSettings({}) + })); + if (sendResult instanceof tl_1.Api.auth.SentCodeSuccess) + throw new Error("logged in right after sending the code"); + if (!forceSMS || sendResult.type instanceof tl_1.Api.auth.SentCodeTypeSms) { + return { + phoneCodeHash: sendResult.phoneCodeHash, + isCodeViaApp: sendResult.type instanceof tl_1.Api.auth.SentCodeTypeApp + }; + } + const resendResult = await client2.invoke(new tl_1.Api.auth.ResendCode({ + phoneNumber, + phoneCodeHash: sendResult.phoneCodeHash + })); + if (resendResult instanceof tl_1.Api.auth.SentCodeSuccess) + throw new Error("logged in right after resending the code"); + return { + phoneCodeHash: resendResult.phoneCodeHash, + isCodeViaApp: resendResult.type instanceof tl_1.Api.auth.SentCodeTypeApp + }; + } catch (err) { + if (err.errorMessage === "AUTH_RESTART") { + return client2.sendCode(apiCredentials, phoneNumber, forceSMS); + } else { + throw err; + } } - default: { - if (selector.startsWith("/*", selectorIndex)) { - const endIndex = selector.indexOf("*/", selectorIndex + 2); - if (endIndex === -1) { - throw new Error("Comment was not terminated"); + } + async function signInWithPassword(client2, apiCredentials, authParams) { + let emptyPassword = false; + while (1) { + try { + const passwordSrpResult = await client2.invoke(new tl_1.Api.account.GetPassword()); + if (!authParams.password) { + emptyPassword = true; + break; } - selectorIndex = endIndex + 2; - if (tokens.length === 0) { - stripWhitespace(0); + const password = await authParams.password(passwordSrpResult.hint); + if (!password) { + throw new Error("Password is empty"); } - break; - } - let namespace = null; - let name; - if (firstChar === CharCode.Asterisk) { - selectorIndex += 1; - name = "*"; - } else if (firstChar === CharCode.Pipe) { - name = ""; - if (selector.charCodeAt(selectorIndex + 1) === CharCode.Pipe) { - addTraversal(SelectorType.ColumnCombinator); - stripWhitespace(2); - break; + const passwordSrpCheck = await (0, Password_1.computeCheck)(passwordSrpResult, password); + const { user } = await client2.invoke(new tl_1.Api.auth.CheckPassword({ + password: passwordSrpCheck + })); + return user; + } catch (err) { + const shouldWeStop = await authParams.onError(err); + if (shouldWeStop) { + throw new Error("AUTH_USER_CANCEL"); } - } else if (reName.test(selector.slice(selectorIndex))) { - name = getName4(0); - } else { - break loop; } - if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Pipe) { - namespace = name; - if (selector.charCodeAt(selectorIndex + 1) === CharCode.Asterisk) { - name = "*"; - selectorIndex += 2; - } else { - name = getName4(1); + } + if (emptyPassword) { + throw new Error("Account has 2FA enabled."); + } + return void 0; + } + async function signInBot(client2, apiCredentials, authParams) { + const { apiId, apiHash } = apiCredentials; + let { botAuthToken } = authParams; + if (!botAuthToken) { + throw new Error("a valid BotToken is required"); + } + if (typeof botAuthToken === "function") { + let token; + while (true) { + token = await botAuthToken(); + if (token) { + botAuthToken = token; + break; } } - tokens.push(name === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name, namespace }); } + const { user } = await client2.invoke(new tl_1.Api.auth.ImportBotAuthorization({ + apiId, + apiHash, + botAuthToken + })); + return user; + } + async function _authFlow(client2, apiCredentials, authParams) { + const me = "phoneNumber" in authParams ? await client2.signInUser(apiCredentials, authParams) : await client2.signInBot(apiCredentials, authParams); + client2._log.info("Signed in successfully as " + utils.getDisplayName(me)); } } - finalizeSubselector(); - return selectorIndex; -} - -// node_modules/domhandler/node_modules/domelementtype/dist/index.js -init_define_import_meta_env(); -var ElementType2; -(function(ElementType5) { - ElementType5["Root"] = "root"; - ElementType5["Text"] = "text"; - ElementType5["Directive"] = "directive"; - ElementType5["Comment"] = "comment"; - ElementType5["Script"] = "script"; - ElementType5["Style"] = "style"; - ElementType5["Tag"] = "tag"; - ElementType5["CDATA"] = "cdata"; - ElementType5["Doctype"] = "doctype"; -})(ElementType2 || (ElementType2 = {})); -function isTag3(element) { - return element.type === ElementType2.Tag || element.type === ElementType2.Script || element.type === ElementType2.Style; -} -var Root2 = ElementType2.Root; -var Text3 = ElementType2.Text; -var Directive2 = ElementType2.Directive; -var Comment4 = ElementType2.Comment; -var Script2 = ElementType2.Script; -var Style2 = ElementType2.Style; -var Tag2 = ElementType2.Tag; -var CDATA3 = ElementType2.CDATA; -var Doctype2 = ElementType2.Doctype; - -// node_modules/domhandler/dist/node.js -init_define_import_meta_env(); -function isTag4(node) { - return isTag3(node); -} -function isCDATA2(node) { - return node.type === ElementType2.CDATA; -} -function isText2(node) { - return node.type === ElementType2.Text; -} -function isComment2(node) { - return node.type === ElementType2.Comment; -} -function hasChildren2(node) { - return Object.hasOwn(node, "children"); -} - -// node_modules/domutils/dist/index.js -var dist_exports2 = {}; -__export(dist_exports2, { - DocumentPosition: () => DocumentPosition2, - append: () => append3, - appendChild: () => appendChild2, - compareDocumentPosition: () => compareDocumentPosition2, - existsOne: () => existsOne2, - filter: () => filter2, - find: () => find2, - findAll: () => findAll2, - findOne: () => findOne2, - getAttributeValue: () => getAttributeValue2, - getChildren: () => getChildren2, - getElementById: () => getElementById2, - getElements: () => getElements2, - getElementsByClassName: () => getElementsByClassName2, - getElementsByTagName: () => getElementsByTagName2, - getElementsByTagType: () => getElementsByTagType2, - getFeed: () => getFeed2, - getInnerHTML: () => getInnerHTML2, - getName: () => getName2, - getOuterHTML: () => getOuterHTML2, - getParent: () => getParent2, - getSiblings: () => getSiblings2, - getText: () => getText2, - hasAttrib: () => hasAttrib2, - innerText: () => innerText2, - nextElementSibling: () => nextElementSibling3, - prepend: () => prepend2, - prependChild: () => prependChild2, - prevElementSibling: () => prevElementSibling2, - removeElement: () => removeElement2, - removeSubsets: () => removeSubsets2, - replaceElement: () => replaceElement2, - testElement: () => testElement2, - textContent: () => textContent2, - uniqueSort: () => uniqueSort2 }); -init_define_import_meta_env(); - -// node_modules/domutils/dist/feeds.js -init_define_import_meta_env(); - -// node_modules/domutils/dist/legacy.js -init_define_import_meta_env(); -// node_modules/domutils/dist/querying.js -init_define_import_meta_env(); -function filter2(test, node, recurse = true, limit = Number.POSITIVE_INFINITY) { - return find2(test, Array.isArray(node) ? node : [node], recurse, limit); -} -function find2(test, nodes, recurse, limit) { - const result = []; - const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (indexStack.length === 1) { - return result; +// node_modules/telegram/tl/custom/inlineResult.js +var require_inlineResult = __commonJS({ + "node_modules/telegram/tl/custom/inlineResult.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InlineResult = void 0; + var api_1 = require_api(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var Utils_1 = require_Utils(); + var InlineResult = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - nodeStack.shift(); - indexStack.shift(); - continue; - } - const element = nodeStack[0][indexStack[0]++]; - if (test(element)) { - result.push(element); - if (--limit <= 0) - return result; - } - if (recurse && hasChildren2(element) && element.children.length > 0) { - indexStack.unshift(0); - nodeStack.unshift(element.children); - } - } -} -function findOne2(test, nodes, recurse = true) { - const searchedNodes = Array.isArray(nodes) ? nodes : [nodes]; - for (const node of searchedNodes) { - if (isTag4(node) && test(node)) { - return node; - } - if (recurse && hasChildren2(node) && node.children.length > 0) { - const found = findOne2(test, node.children, true); - if (found) - return found; - } - } - return null; -} -function existsOne2(test, nodes) { - return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => isTag4(node) && test(node) || hasChildren2(node) && existsOne2(test, node.children)); -} -function findAll2(test, nodes) { - const result = []; - const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (nodeStack.length === 1) { - return result; + constructor(client2, original, queryId, entity) { + this._ARTICLE = "article"; + this._PHOTO = "photo"; + this._GIF = "gif"; + this._VIDEO = "video"; + this._VIDEO_GIF = "mpeg4_gif"; + this._AUDIO = "audio"; + this._DOCUMENT = "document"; + this._LOCATION = "location"; + this._VENUE = "venue"; + this._CONTACT = "contact"; + this._GAME = "game"; + this._client = client2; + this.result = original; + this._queryId = queryId; + this._entity = entity; } - nodeStack.shift(); - indexStack.shift(); - continue; - } - const element = nodeStack[0][indexStack[0]++]; - if (isTag4(element) && test(element)) - result.push(element); - if (hasChildren2(element) && element.children.length > 0) { - indexStack.unshift(0); - nodeStack.unshift(element.children); - } - } -} - -// node_modules/domutils/dist/legacy.js -var Checks2 = { - tag_name(name) { - if (typeof name === "function") { - return (element) => isTag4(element) && name(element.name); - } - if (name === "*") { - return isTag4; - } - return (element) => isTag4(element) && element.name === name; - }, - tag_type(type) { - if (typeof type === "function") { - return (element) => type(element.type); - } - return (element) => element.type === type; - }, - tag_contains(data) { - if (typeof data === "function") { - return (element) => isText2(element) && data(element.data); - } - return (element) => isText2(element) && element.data === data; - } -}; -function getAttribCheck2(attrib, value) { - if (typeof value === "function") { - return (element) => isTag4(element) && value(element.attribs[attrib]); + get type() { + return this.result.type; + } + get message() { + return this.result.sendMessage; + } + get description() { + return this.result.description; + } + get url() { + if (this.result instanceof api_1.Api.BotInlineResult) { + return this.result.url; + } + } + get photo() { + if (this.result instanceof api_1.Api.BotInlineResult) { + return this.result.thumb; + } else { + return this.result.photo; + } + } + get document() { + if (this.result instanceof api_1.Api.BotInlineResult) { + return this.result.content; + } else { + return this.result.document; + } + } + async click(entity, replyTo, silent = false, clearDraft = false, hideVia = false) { + if (entity) { + entity = await this._client.getInputEntity(entity); + } else if (this._entity) { + entity = this._entity; + } else { + throw new Error("You must provide the entity where the result should be sent to"); + } + let replyObject = void 0; + if (replyTo != void 0) { + replyObject = new api_1.Api.InputReplyToMessage({ + replyToMsgId: (0, Utils_1.getMessageId)(replyTo) + }); + } + const request = new api_1.Api.messages.SendInlineBotResult({ + peer: entity, + queryId: this._queryId, + id: this.result.id, + silent, + clearDraft, + hideVia, + replyTo: replyObject + }); + return await this._client.invoke(request); + } + }; + exports2.InlineResult = InlineResult; } - return (element) => isTag4(element) && element.attribs[attrib] === value; -} -function combineFuncs2(a, b) { - return (element) => a(element) || b(element); -} -function compileTest2(options) { - const funcs = Object.keys(options).map((key2) => { - const value = options[key2]; - return Object.hasOwn(Checks2, key2) ? Checks2[key2](value) : getAttribCheck2(key2, value); - }); - return funcs.length === 0 ? null : funcs.reduce(combineFuncs2); -} -function testElement2(options, node) { - const test = compileTest2(options); - return test ? test(node) : true; -} -function getElements2(options, nodes, recurse, limit = Number.POSITIVE_INFINITY) { - const test = compileTest2(options); - return test ? filter2(test, nodes, recurse, limit) : []; -} -function getElementById2(id, nodes, recurse = true) { - if (!Array.isArray(nodes)) - nodes = [nodes]; - return findOne2(getAttribCheck2("id", id), nodes, recurse); -} -function getElementsByTagName2(tagName19, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { - return filter2(Checks2["tag_name"](tagName19), nodes, recurse, limit); -} -function getElementsByClassName2(className, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { - return filter2(getAttribCheck2("class", className), nodes, recurse, limit); -} -function getElementsByTagType2(type, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) { - return filter2(Checks2["tag_type"](type), nodes, recurse, limit); -} - -// node_modules/domutils/dist/stringify.js -init_define_import_meta_env(); - -// node_modules/dom-serializer/dist/index.js -init_define_import_meta_env(); - -// node_modules/dom-serializer/node_modules/domelementtype/dist/index.js -init_define_import_meta_env(); -var ElementType3; -(function(ElementType5) { - ElementType5["Root"] = "root"; - ElementType5["Text"] = "text"; - ElementType5["Directive"] = "directive"; - ElementType5["Comment"] = "comment"; - ElementType5["Script"] = "script"; - ElementType5["Style"] = "style"; - ElementType5["Tag"] = "tag"; - ElementType5["CDATA"] = "cdata"; - ElementType5["Doctype"] = "doctype"; -})(ElementType3 || (ElementType3 = {})); -var Root3 = ElementType3.Root; -var Text4 = ElementType3.Text; -var Directive3 = ElementType3.Directive; -var Comment5 = ElementType3.Comment; -var Script3 = ElementType3.Script; -var Style3 = ElementType3.Style; -var Tag3 = ElementType3.Tag; -var CDATA4 = ElementType3.CDATA; -var Doctype3 = ElementType3.Doctype; - -// node_modules/dom-serializer/node_modules/entities/dist/index.js -init_define_import_meta_env(); +}); -// node_modules/dom-serializer/node_modules/entities/dist/escape.js -init_define_import_meta_env(); -function getEscape(char) { - return char === 34 ? """ : char === 38 ? "&" : char === 39 ? "'" : char === 60 ? "<" : char === 62 ? ">" : " "; -} -var XML_BITSET_VALUE = 1342177476; -var xmlEncodeRegex = /["&'<>\u0080-\uFFFF]/g; -function isXmlEscapable(code) { - return code >= 128 || code >= 32 && code < 64 && (XML_BITSET_VALUE >>> code & 1) === 1; -} -function encodeXML2(input) { - const { length } = input; - let out; - let last = 0; - let index2 = 0; - while (index2 < length) { - const char = input.charCodeAt(index2); - if (!isXmlEscapable(char)) { - const bound = Math.min(index2 + 32, length); - let next = index2 + 1; - while (next < bound && !isXmlEscapable(input.charCodeAt(next))) { - next++; +// node_modules/telegram/tl/custom/inlineResults.js +var require_inlineResults = __commonJS({ + "node_modules/telegram/tl/custom/inlineResults.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InlineResults = void 0; + var inlineResult_1 = require_inlineResult(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var InlineResults = class extends Array { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); } - if (next < bound) { - index2 = next; - continue; + constructor(client2, original, entity) { + super(...original.results.map((res) => new inlineResult_1.InlineResult(client2, res, original.queryId, entity))); + this.result = original; + this.queryId = original.queryId; + this.cacheTime = original.cacheTime; + this._validUntil = (/* @__PURE__ */ new Date()).getTime() / 1e3 + this.cacheTime; + this.users = original.users; + this.gallery = Boolean(original.gallery); + this.nextOffset = original.nextOffset; + this.switchPm = original.switchPm; } - if (next >= length) - break; - xmlEncodeRegex.lastIndex = next; - if (!xmlEncodeRegex.test(input)) - break; - index2 = xmlEncodeRegex.lastIndex - 1; - continue; - } - if (out === void 0) - out = input.substring(0, index2); - else if (last !== index2) - out += input.substring(last, index2); - if (char < 64) { - out += getEscape(char); - last = index2 += 1; - continue; - } - const cp = input.codePointAt(index2); - out += `&#x${cp.toString(16)};`; - if (cp !== char) - index2++; - last = index2 += 1; + resultsValid() { + return (/* @__PURE__ */ new Date()).getTime() / 1e3 < this._validUntil; + } + }; + exports2.InlineResults = InlineResults; } - if (out === void 0) - return input; - if (last < length) - out += input.substr(last); - return out; -} -function escapeWithRegex(re, data) { - re.lastIndex = 0; - if (!re.test(data)) - return data; - let out = ""; - let last = 0; - do { - const index2 = re.lastIndex - 1; - if (last !== index2) - out += data.substring(last, index2); - const char = data.charCodeAt(index2); - out += getEscape(char); - last = index2 + 1; - } while (re.test(data)); - return out + data.substring(last); -} -var attributeEscapeRegex = /["&\u{A0}]/gu; -function escapeAttribute2(data) { - return escapeWithRegex(attributeEscapeRegex, data); -} -var textEscapeRegex = /[&<>\u{A0}]/gu; -function escapeText2(data) { - return escapeWithRegex(textEscapeRegex, data); -} - -// node_modules/dom-serializer/node_modules/entities/dist/index.js -var EntityLevel2; -(function(EntityLevel3) { - EntityLevel3[EntityLevel3["XML"] = 0] = "XML"; - EntityLevel3[EntityLevel3["HTML"] = 1] = "HTML"; -})(EntityLevel2 || (EntityLevel2 = {})); -var EncodingMode2; -(function(EncodingMode3) { - EncodingMode3[EncodingMode3["UTF8"] = 0] = "UTF8"; - EncodingMode3[EncodingMode3["ASCII"] = 1] = "ASCII"; - EncodingMode3[EncodingMode3["Extensive"] = 2] = "Extensive"; - EncodingMode3[EncodingMode3["Attribute"] = 3] = "Attribute"; - EncodingMode3[EncodingMode3["Text"] = 4] = "Text"; -})(EncodingMode2 || (EncodingMode2 = {})); - -// node_modules/dom-serializer/dist/foreign-names.js -init_define_import_meta_env(); -var elementNames2 = new Map("altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath".split(" ").map((name) => [name.toLowerCase(), name])); -var attributeNames2 = new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map((name) => [name.toLowerCase(), name])); +}); -// node_modules/dom-serializer/dist/index.js -var unencodedElements2 = new Set("style script xmp iframe noembed noframes plaintext noscript".split(" ")); -var voidElements2 = new Set("area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr".split(" ")); -var foreignElements2 = /* @__PURE__ */ new Set(["svg", "math"]); -var foreignModeIntegrationPoints2 = new Set("mi mo mn ms mtext annotation-xml foreignObject desc title".split(" ")); -function render2(node, options = {}) { - const nodes = "length" in node ? node : [node]; - const xmlMode = options.xmlMode ?? false; - let output = ""; - for (let index2 = 0; index2 < nodes.length; index2++) { - output += renderNode2(nodes[index2], options, xmlMode); - } - return output; -} -var dist_default = render2; -function renderChildren(children, options, xmlMode) { - let output = ""; - for (let index2 = 0; index2 < children.length; index2++) { - output += renderNode2(children[index2], options, xmlMode); - } - return output; -} -function renderNode2(node, options, xmlMode) { - switch (node.type) { - case Root3: { - return renderChildren(node.children, options, xmlMode); - } - case Directive3: { - return `<${node.data}>`; - } - case Comment5: { - return `<!--${node.data}-->`; - } - case CDATA4: { - return `<![CDATA[${node.children[0].data}]]>`; - } - case Script3: - case Style3: - case Tag3: { - return renderTag2(node, options, xmlMode); - } - case Text4: { - const element = node; - const data = element.data || ""; - if ((options.encodeEntities ?? options.decodeEntities) !== false && !(!xmlMode && element.parent && unencodedElements2.has(element.parent.name))) { - return xmlMode || options.encodeEntities !== "utf8" ? encodeXML2(data) : escapeText2(data); +// node_modules/telegram/client/bots.js +var require_bots = __commonJS({ + "node_modules/telegram/client/bots.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.inlineQuery = inlineQuery; + var tl_1 = require_tl(); + var inlineResults_1 = require_inlineResults(); + var GetInlineBotResults = tl_1.Api.messages.GetInlineBotResults; + async function inlineQuery(client2, bot, query, entity, offset, geoPoint) { + bot = await client2.getInputEntity(bot); + let peer = new tl_1.Api.InputPeerSelf(); + if (entity) { + peer = await client2.getInputEntity(entity); } - return data; - } - } -} -function renderTag2(element, options, xmlMode) { - if (xmlMode === "foreign") { - element.name = elementNames2.get(element.name) ?? element.name; - if (element.parent && foreignModeIntegrationPoints2.has(element.parent.name)) { - xmlMode = false; + const result = await client2.invoke(new GetInlineBotResults({ + bot, + peer, + query, + offset: offset || "", + geoPoint + })); + return new inlineResults_1.InlineResults(client2, result, entity ? peer : void 0); } } - if (!xmlMode && foreignElements2.has(element.name)) { - xmlMode = "foreign"; - } - const { name, children } = element; - const isVoid2 = !xmlMode && voidElements2.has(name); - let tag = `<${name}${formatAttributes2(element.attribs, options, xmlMode)}`; - if (children.length === 0 && (xmlMode ? options.selfClosingTags !== false : options.selfClosingTags && isVoid2)) { - tag += xmlMode ? "/>" : " />"; - } else { - tag += ">"; - if (children.length > 0) { - tag += renderChildren(children, options, xmlMode); - } - if (!isVoid2) { - tag += `</${name}>`; +}); + +// node_modules/telegram/client/buttons.js +var require_buttons = __commonJS({ + "node_modules/telegram/client/buttons.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.buildReplyMarkup = buildReplyMarkup; + var tl_1 = require_tl(); + var button_1 = require_button(); + var messageButton_1 = require_messageButton(); + var Helpers_1 = require_Helpers(); + function buildReplyMarkup(buttons, inlineOnly = false) { + if (buttons == void 0) { + return void 0; + } + if ("SUBCLASS_OF_ID" in buttons) { + if (buttons.SUBCLASS_OF_ID == 3806400242) { + return buttons; + } + } + if (!(0, Helpers_1.isArrayLike)(buttons)) { + buttons = [[buttons]]; + } else if (!buttons || !(0, Helpers_1.isArrayLike)(buttons[0])) { + buttons = [buttons]; + } + let isInline = false; + let isNormal = false; + let resize = void 0; + const singleUse = false; + const selective = false; + const rows = []; + for (const row of buttons) { + const current = []; + for (let button of row) { + if (button instanceof button_1.Button) { + if (button.resize != void 0) { + resize = button.resize; + } + if (button.singleUse != void 0) { + resize = button.singleUse; + } + if (button.selective != void 0) { + resize = button.selective; + } + button = button.button; + } else if (button instanceof messageButton_1.MessageButton) { + button = button.button; + } + const inline = button_1.Button._isInline(button); + if (!isInline && inline) { + isInline = true; + } + if (!isNormal && inline) { + isNormal = false; + } + if (button.SUBCLASS_OF_ID == 195916963) { + current.push(button); + } + } + if (current) { + rows.push(new tl_1.Api.KeyboardButtonRow({ + buttons: current + })); + } + } + if (inlineOnly && isNormal) { + throw new Error("You cannot use non-inline buttons here"); + } else if (isInline === isNormal && isNormal) { + throw new Error("You cannot mix inline with normal buttons"); + } else if (isInline) { + return new tl_1.Api.ReplyInlineMarkup({ + rows + }); + } + return new tl_1.Api.ReplyKeyboardMarkup({ + rows, + resize, + singleUse, + selective + }); } } - return tag; -} -function replaceQuotes2(value) { - return value.replaceAll('"', """); -} -function formatAttributes2(attributes, options, xmlMode) { - if (!attributes) - return ""; - const encode = (options.encodeEntities ?? options.decodeEntities) === false ? replaceQuotes2 : xmlMode || options.encodeEntities !== "utf8" ? encodeXML2 : escapeAttribute2; - const isForeign = xmlMode === "foreign"; - const showEmpty = !!(options.emptyAttrs ?? xmlMode); - let result = ""; - for (const key2 in attributes) { - if (!Object.hasOwn(attributes, key2)) - continue; - const value = attributes[key2]; - const k = isForeign ? attributeNames2.get(key2) ?? key2 : key2; - result += !showEmpty && (value == null || value === "") ? ` ${k}` : ` ${k}="${encode(value == null ? "" : String(value))}"`; - } - return result; -} - -// node_modules/domutils/node_modules/domelementtype/dist/index.js -init_define_import_meta_env(); -var ElementType4; -(function(ElementType5) { - ElementType5["Root"] = "root"; - ElementType5["Text"] = "text"; - ElementType5["Directive"] = "directive"; - ElementType5["Comment"] = "comment"; - ElementType5["Script"] = "script"; - ElementType5["Style"] = "style"; - ElementType5["Tag"] = "tag"; - ElementType5["CDATA"] = "cdata"; - ElementType5["Doctype"] = "doctype"; -})(ElementType4 || (ElementType4 = {})); -var Root4 = ElementType4.Root; -var Text5 = ElementType4.Text; -var Directive4 = ElementType4.Directive; -var Comment6 = ElementType4.Comment; -var Script4 = ElementType4.Script; -var Style4 = ElementType4.Style; -var Tag4 = ElementType4.Tag; -var CDATA5 = ElementType4.CDATA; -var Doctype4 = ElementType4.Doctype; - -// node_modules/domutils/dist/stringify.js -function getOuterHTML2(node, options) { - return dist_default(node, options); -} -function getInnerHTML2(node, options) { - return hasChildren2(node) ? node.children.map((node2) => getOuterHTML2(node2, options)).join("") : ""; -} -function getText2(node) { - if (Array.isArray(node)) - return node.map(getText2).join(""); - if (isTag4(node)) - return node.name === "br" ? "\n" : getText2(node.children); - if (isCDATA2(node)) - return getText2(node.children); - if (isText2(node)) - return node.data; - return ""; -} -function textContent2(node) { - if (Array.isArray(node)) - return node.map(textContent2).join(""); - if (hasChildren2(node) && !isComment2(node)) { - return textContent2(node.children); - } - if (isText2(node)) - return node.data; - return ""; -} -function innerText2(node) { - if (Array.isArray(node)) - return node.map(innerText2).join(""); - if (hasChildren2(node) && (node.type === ElementType4.Tag || isCDATA2(node))) { - return innerText2(node.children); - } - if (isText2(node)) - return node.data; - return ""; -} +}); -// node_modules/domutils/dist/feeds.js -function getFeed2(document2) { - const feedRoot = getOneElement2(isValidFeed2, document2); - return feedRoot ? feedRoot.name === "feed" ? getAtomFeed2(feedRoot) : getRssFeed2(feedRoot) : null; -} -function getAtomFeed2(feedRoot) { - const childs = feedRoot.children; - const feed = { - type: "atom", - items: getElementsByTagName2("entry", childs).map((item) => { - const { children } = item; - const entry = { media: getMediaElements2(children) }; - addConditionally2(entry, "id", "id", children); - addConditionally2(entry, "title", "title", children); - const href2 = getOneElement2("link", children)?.attribs["href"]; - if (href2) { - entry.link = href2; - } - const description = fetch3("summary", children) || fetch3("content", children); - if (description) { - entry.description = description; +// node_modules/telegram/requestIter.js +var require_requestIter = __commonJS({ + "node_modules/telegram/requestIter.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; } - const pubDate = fetch3("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); } - return entry; - }) - }; - addConditionally2(feed, "id", "id", childs); - addConditionally2(feed, "title", "title", childs); - const href = getOneElement2("link", childs)?.attribs["href"]; - if (href) { - feed.link = href; - } - addConditionally2(feed, "description", "subtitle", childs); - const updated = fetch3("updated", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally2(feed, "author", "email", childs, true); - return feed; -} -function getRssFeed2(feedRoot) { - const childs = getOneElement2("channel", feedRoot.children)?.children ?? []; - const feed = { - type: feedRoot.name.substr(0, 3), - id: "", - items: getElementsByTagName2("item", feedRoot.children).map((item) => { - const { children } = item; - const entry = { media: getMediaElements2(children) }; - addConditionally2(entry, "id", "guid", children); - addConditionally2(entry, "title", "title", children); - addConditionally2(entry, "link", "link", children); - addConditionally2(entry, "description", "description", children); - const pubDate = fetch3("pubDate", children) || fetch3("dc:date", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - return entry; - }) - }; - addConditionally2(feed, "title", "title", childs); - addConditionally2(feed, "link", "link", childs); - addConditionally2(feed, "description", "description", childs); - const updated = fetch3("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally2(feed, "author", "managingEditor", childs, true); - return feed; -} -var MEDIA_KEYS_STRING2 = ["url", "type", "lang"]; -var MEDIA_KEYS_INT2 = [ - "fileSize", - "bitrate", - "framerate", - "samplingrate", - "channels", - "duration", - "height", - "width" -]; -function getMediaElements2(where) { - return getElementsByTagName2("media:content", where).map((element) => { - const { attribs } = element; - const media = { - medium: attribs["medium"], - isDefault: !!attribs["isDefault"] }; - for (const attrib of MEDIA_KEYS_STRING2) { - if (attribs[attrib]) { - media[attrib] = attribs[attrib]; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RequestIter = void 0; + var Helpers_1 = require_Helpers(); + var _1 = require_telegram(); + var RequestIter = class { + constructor(client2, limit, params = {}, args = {}) { + this.client = client2; + this.reverse = params.reverse; + this.waitTime = params.waitTime; + this.limit = Math.max(!limit ? Number.MAX_SAFE_INTEGER : limit, 0); + this.left = this.limit; + this.buffer = void 0; + this.kwargs = args; + this.index = 0; + this.total = void 0; + this.lastLoad = 0; } - } - for (const attrib of MEDIA_KEYS_INT2) { - if (attribs[attrib]) { - media[attrib] = Number.parseInt(attribs[attrib], 10); + async _init(kwargs) { } - } - if (attribs["expression"]) { - media.expression = attribs["expression"]; - } - return media; - }); -} -function getOneElement2(tagName19, node) { - return getElementsByTagName2(tagName19, node, true, 1)[0]; -} -function fetch3(tagName19, where, recurse = false) { - return textContent2(getElementsByTagName2(tagName19, where, recurse, 1)).trim(); -} -function addConditionally2(object, property, tagName19, where, recurse = false) { - const value = fetch3(tagName19, where, recurse); - if (value) - object[property] = value; -} -function isValidFeed2(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; -} - -// node_modules/domutils/dist/helpers.js -init_define_import_meta_env(); -function removeSubsets2(nodes) { - let index2 = nodes.length; - while (--index2 >= 0) { - const node = nodes[index2]; - if (index2 > 0 && nodes.lastIndexOf(node, index2 - 1) >= 0) { - nodes.splice(index2, 1); - continue; - } - for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - if (nodes.includes(ancestor)) { - nodes.splice(index2, 1); - break; + [Symbol.asyncIterator]() { + this.buffer = void 0; + this.index = 0; + this.lastLoad = 0; + this.left = this.limit; + return { + next: async () => { + if (this.buffer == void 0) { + this.buffer = []; + if (await this._init(this.kwargs)) { + this.left = this.buffer.length; + } + } + if (this.left <= 0) { + return { + value: void 0, + done: true + }; + } + if (this.index == this.buffer.length) { + if (this.waitTime) { + await (0, Helpers_1.sleep)(this.waitTime - ((/* @__PURE__ */ new Date()).getTime() / 1e3 - this.lastLoad)); + } + this.lastLoad = (/* @__PURE__ */ new Date()).getTime() / 1e3; + this.index = 0; + this.buffer = []; + const nextChunk = await this._loadNextChunk(); + if (nextChunk === false) { + return { + value: void 0, + done: true + }; + } + if (nextChunk) { + this.left = this.buffer.length; + } + } + if (!this.buffer || !this.buffer.length) { + return { + value: void 0, + done: true + }; + } + const result = this.buffer[this.index]; + this.left -= 1; + this.index += 1; + return { + value: result, + done: false + }; + } + }; } - } - } - return nodes; -} -var DocumentPosition2; -(function(DocumentPosition3) { - DocumentPosition3[DocumentPosition3["DISCONNECTED"] = 1] = "DISCONNECTED"; - DocumentPosition3[DocumentPosition3["PRECEDING"] = 2] = "PRECEDING"; - DocumentPosition3[DocumentPosition3["FOLLOWING"] = 4] = "FOLLOWING"; - DocumentPosition3[DocumentPosition3["CONTAINS"] = 8] = "CONTAINS"; - DocumentPosition3[DocumentPosition3["CONTAINED_BY"] = 16] = "CONTAINED_BY"; -})(DocumentPosition2 || (DocumentPosition2 = {})); -function compareDocumentPosition2(nodeA, nodeB) { - const aParents = []; - const bParents = []; - if (nodeA === nodeB) { - return 0; - } - let current = hasChildren2(nodeA) ? nodeA : nodeA.parent; - while (current) { - aParents.unshift(current); - current = current.parent; - } - current = hasChildren2(nodeB) ? nodeB : nodeB.parent; - while (current) { - bParents.unshift(current); - current = current.parent; - } - const maxIndex = Math.min(aParents.length, bParents.length); - let index2 = 0; - while (index2 < maxIndex && aParents[index2] === bParents[index2]) { - index2++; - } - if (index2 === 0) { - return DocumentPosition2.DISCONNECTED; - } - const sharedParent = aParents[index2 - 1]; - const siblings = sharedParent.children; - const aSibling = aParents[index2]; - const bSibling = bParents[index2]; - if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { - if (sharedParent === nodeB) { - return DocumentPosition2.FOLLOWING | DocumentPosition2.CONTAINED_BY; - } - return DocumentPosition2.FOLLOWING; - } - if (sharedParent === nodeA) { - return DocumentPosition2.PRECEDING | DocumentPosition2.CONTAINS; + async collect() { + var _a, e_1, _b, _c; + const result = new _1.helpers.TotalList(); + try { + for (var _d = true, _e = __asyncValues2(this), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { + _c = _f.value; + _d = false; + const message = _c; + result.push(message); + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (!_d && !_a && (_b = _e.return)) await _b.call(_e); + } finally { + if (e_1) throw e_1.error; + } + } + result.total = this.total; + return result; + } + async _loadNextChunk() { + throw new Error("Not Implemented"); + } + }; + exports2.RequestIter = RequestIter; } - return DocumentPosition2.PRECEDING; -} -function uniqueSort2(nodes) { - nodes = nodes.filter((node, index2, array) => !array.includes(node, index2 + 1)); - nodes.sort((a, b) => { - const relative = compareDocumentPosition2(a, b); - if (relative & DocumentPosition2.PRECEDING) { - return -1; - } - if (relative & DocumentPosition2.FOLLOWING) { - return 1; - } - return 0; - }); - return nodes; -} +}); -// node_modules/domutils/dist/manipulation.js -init_define_import_meta_env(); -function removeElement2(element) { - if (element.prev) - element.prev.next = element.next; - if (element.next) - element.next.prev = element.prev; - if (element.parent) { - const childs = element.parent.children; - const childsIndex = childs.lastIndexOf(element); - if (childsIndex !== -1) { - childs.splice(childsIndex, 1); - } - } - element.next = null; - element.prev = null; - element.parent = null; -} -function replaceElement2(element, replacement) { - replacement.prev = element.prev; - if (replacement.prev) { - replacement.prev.next = replacement; - } - replacement.next = element.next; - if (replacement.next) { - replacement.next.prev = replacement; - } - replacement.parent = element.parent; - if (replacement.parent) { - const { children } = replacement.parent; - const elementIndex = children.lastIndexOf(element); - if (elementIndex === -1) { - return; - } - children[elementIndex] = replacement; - element.parent = null; - } -} -function appendChild2(parent, child) { - removeElement2(child); - child.next = null; - child.parent = parent; - if (parent.children.push(child) > 1) { - const sibling = parent.children[parent.children.length - 2]; - sibling.next = child; - child.prev = sibling; - } else { - child.prev = null; - } -} -function append3(element, next) { - removeElement2(next); - const { parent } = element; - const currentNext = element.next; - next.next = currentNext; - next.prev = element; - element.next = next; - next.parent = parent; - if (currentNext) { - currentNext.prev = next; - if (parent) { - const childs = parent.children; - childs.splice(childs.lastIndexOf(currentNext), 0, next); - } - } else if (parent) { - parent.children.push(next); - } -} -function prependChild2(parent, child) { - removeElement2(child); - child.parent = parent; - child.prev = null; - if (parent.children.unshift(child) === 1) { - child.next = null; - } else { - const sibling = parent.children[1]; - sibling.prev = child; - child.next = sibling; - } -} -function prepend2(element, previous) { - removeElement2(previous); - const { parent } = element; - if (parent) { - const childs = parent.children; - childs.splice(childs.indexOf(element), 0, previous); - } - if (element.prev) { - element.prev.next = previous; +// node_modules/telegram/client/fs.js +var require_fs = __commonJS({ + "node_modules/telegram/client/fs.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + __exportStar2(require("fs"), exports2); } - previous.parent = parent; - previous.prev = element.prev; - previous.next = element; - element.prev = previous; -} +}); -// node_modules/domutils/dist/traversal.js -init_define_import_meta_env(); -function getChildren2(element) { - return hasChildren2(element) ? element.children : []; -} -function getParent2(element) { - return element.parent || null; -} -function getSiblings2(element) { - const parent = getParent2(element); - if (parent != null) - return getChildren2(parent); - const siblings = [element]; - let { prev, next } = element; - while (prev != null) { - siblings.unshift(prev); - ({ prev } = prev); - } - while (next != null) { - siblings.push(next); - ({ next } = next); +// node_modules/telegram/client/path.js +var require_path = __commonJS({ + "node_modules/telegram/client/path.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + var path_1 = __importDefault2(require("path")); + exports2.default = path_1.default; } - return siblings; -} -function getAttributeValue2(element, name) { - const { attribs } = element; - return attribs?.[name]; -} -function hasAttrib2(element, name) { - const { attribs } = element; - return attribs != null && Object.hasOwn(attribs, name) && attribs[name] != null; -} -function getName2(element) { - return element.name; -} -function nextElementSibling3(element) { - let { next } = element; - while (next !== null && !isTag4(next)) - ({ next } = next); - return next; -} -function prevElementSibling2(element) { - let { prev } = element; - while (prev !== null && !isTag4(prev)) - ({ prev } = prev); - return prev; -} - -// node_modules/css-select/dist/compile.js -init_define_import_meta_env(); - -// node_modules/css-select/dist/general.js -init_define_import_meta_env(); +}); -// node_modules/css-select/dist/attributes.js -init_define_import_meta_env(); -var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g; -var whitespaceRe = /\s/; -function escapeRegex(value) { - return value.replace(reChars, "\\$&"); -} -var caseInsensitiveAttributes = /* @__PURE__ */ new Set([ - "accept", - "accept-charset", - "align", - "alink", - "axis", - "bgcolor", - "charset", - "checked", - "clear", - "codetype", - "color", - "compact", - "declare", - "defer", - "dir", - "direction", - "disabled", - "enctype", - "face", - "frame", - "hreflang", - "http-equiv", - "lang", - "language", - "link", - "media", - "method", - "multiple", - "nohref", - "noresize", - "noshade", - "nowrap", - "readonly", - "rel", - "rev", - "rules", - "scope", - "scrolling", - "selected", - "shape", - "target", - "text", - "type", - "valign", - "valuetype", - "vlink" -]); -function shouldIgnoreCase(selector, options) { - return typeof selector.ignoreCase === "boolean" ? selector.ignoreCase : selector.ignoreCase === "quirks" ? !!options.quirksMode : !options.xmlMode && caseInsensitiveAttributes.has(selector.name); -} -var attributeRules = { - equals(next, data, options) { - const { adapter: adapter2 } = options; - const { name } = data; - let { value } = data; - if (shouldIgnoreCase(data, options)) { - value = value.toLowerCase(); - return (element) => { - const attribute2 = adapter2.getAttributeValue(element, name); - return attribute2 != null && attribute2.length === value.length && attribute2.toLowerCase() === value && next(element); - }; - } - return (element) => adapter2.getAttributeValue(element, name) === value && next(element); - }, - hyphen(next, data, options) { - const { adapter: adapter2 } = options; - const { name } = data; - let { value } = data; - const { length } = value; - if (shouldIgnoreCase(data, options)) { - value = value.toLowerCase(); - return function hyphenIC(element) { - const attribute2 = adapter2.getAttributeValue(element, name); - return attribute2 != null && (attribute2.length === length || attribute2.charAt(length) === "-") && attribute2.substr(0, length).toLowerCase() === value && next(element); - }; - } - return function hyphen(element) { - const attribute2 = adapter2.getAttributeValue(element, name); - return attribute2 != null && (attribute2.length === length || attribute2.charAt(length) === "-") && attribute2.substr(0, length) === value && next(element); +// node_modules/telegram/client/downloads.js +var require_downloads = __commonJS({ + "node_modules/telegram/client/downloads.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } }; - }, - element(next, data, options) { - const { adapter: adapter2 } = options; - const { name, value } = data; - if (whitespaceRe.test(value)) { - return falseFunc; - } - const regex = new RegExp(`(?:^|\\s)${escapeRegex(value)}(?:$|\\s)`, shouldIgnoreCase(data, options) ? "i" : ""); - return function element(node) { - const attribute2 = adapter2.getAttributeValue(node, name); - return attribute2 != null && attribute2.length >= value.length && regex.test(attribute2) && next(node); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; - }, - exists(next, { name }, { adapter: adapter2 }) { - return (element) => adapter2.hasAttrib(element, name) && next(element); - }, - start(next, data, options) { - const { adapter: adapter2 } = options; - const { name } = data; - let { value } = data; - const { length } = value; - if (length === 0) { - return falseFunc; - } - if (shouldIgnoreCase(data, options)) { - value = value.toLowerCase(); - return (element) => { - const attribute2 = adapter2.getAttributeValue(element, name); - return attribute2 != null && attribute2.length >= length && attribute2.substr(0, length).toLowerCase() === value && next(element); - }; - } - return (element) => !!adapter2.getAttributeValue(element, name)?.startsWith(value) && next(element); - }, - end(next, data, options) { - const { adapter: adapter2 } = options; - const { name } = data; - let { value } = data; - const length = -value.length; - if (length === 0) { - return falseFunc; - } - if (shouldIgnoreCase(data, options)) { - value = value.toLowerCase(); - return (element) => adapter2.getAttributeValue(element, name)?.substr(length).toLowerCase() === value && next(element); - } - return (element) => !!adapter2.getAttributeValue(element, name)?.endsWith(value) && next(element); - }, - any(next, data, options) { - const { adapter: adapter2 } = options; - const { name, value } = data; - if (value === "") { - return falseFunc; - } - if (shouldIgnoreCase(data, options)) { - const regex = new RegExp(escapeRegex(value), "i"); - return function anyIC(element) { - const attribute2 = adapter2.getAttributeValue(element, name); - return attribute2 != null && attribute2.length >= value.length && regex.test(attribute2) && next(element); - }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GenericDownloadIter = exports2.DirectDownloadIter = void 0; + exports2.iterDownload = iterDownload; + exports2.downloadFileV2 = downloadFileV2; + exports2.downloadMedia = downloadMedia; + exports2._downloadDocument = _downloadDocument; + exports2._downloadContact = _downloadContact; + exports2._downloadWebDocument = _downloadWebDocument; + exports2._downloadCachedPhotoSize = _downloadCachedPhotoSize; + exports2._downloadPhoto = _downloadPhoto; + exports2.downloadProfilePhoto = downloadProfilePhoto; + var tl_1 = require_tl(); + var Utils_1 = require_Utils(); + var Helpers_1 = require_Helpers(); + var __1 = require_telegram(); + var requestIter_1 = require_requestIter(); + var errors_1 = require_errors(); + var fs_1 = require_fs(); + var extensions_1 = require_extensions(); + var fs = __importStar2(require_fs()); + var path_1 = __importDefault2(require_path()); + var big_integer_1 = __importDefault2(require_BigInteger()); + var MIN_CHUNK_SIZE = 4096; + var ONE_MB = 1024 * 1024; + var TIMED_OUT_SLEEP = 1e3; + var MAX_CHUNK_SIZE = 512 * 1024; + var DirectDownloadIter = class extends requestIter_1.RequestIter { + constructor() { + super(...arguments); + this._timedOut = false; + } + async _init({ fileLocation, dcId, offset, stride, chunkSize, requestSize, fileSize, msgData }) { + this.request = new tl_1.Api.upload.GetFile({ + location: fileLocation, + offset, + limit: requestSize + }); + this.total = fileSize; + this._stride = stride; + this._chunkSize = chunkSize; + this._lastPart = void 0; + this._timedOut = false; + this._sender = await this.client.getSender(dcId); + } + async _loadNextChunk() { + const current = await this._request(); + this.buffer.push(current); + if (current.length < this.request.limit) { + this.left = this.buffer.length; + await this.close(); + return true; + } else { + this.request.offset = this.request.offset.add(this._stride); + } + } + async _request() { + try { + this._sender = await this.client.getSender(this._sender.dcId); + const result = await this.client.invokeWithSender(this.request, this._sender); + this._timedOut = false; + if (result instanceof tl_1.Api.upload.FileCdnRedirect) { + throw new Error("CDN Not supported. Please Add an issue in github"); + } + return result.bytes; + } catch (e) { + if (e.errorMessage == "TIMEOUT") { + if (this._timedOut) { + this.client._log.warn("Got two timeouts in a row while downloading file"); + throw e; + } + this._timedOut = true; + this.client._log.info("Got timeout while downloading file, retrying once"); + await (0, Helpers_1.sleep)(TIMED_OUT_SLEEP); + return await this._request(); + } else if (e instanceof errors_1.FileMigrateError) { + this.client._log.info("File lives in another DC"); + this._sender = await this.client.getSender(e.newDc); + return await this._request(); + } else if (e.errorMessage == "FILEREF_UPGRADE_NEEDED") { + throw e; + } else { + throw e; + } + } + } + async close() { + this.client._log.debug("Finished downloading file ..."); + } + [Symbol.asyncIterator]() { + return super[Symbol.asyncIterator](); + } + }; + exports2.DirectDownloadIter = DirectDownloadIter; + var GenericDownloadIter = class extends DirectDownloadIter { + async _loadNextChunk() { + let data = Buffer.alloc(0); + const bad = this.request.offset.mod(this.request.limit).toJSNumber(); + const before = this.request.offset; + this.request.offset = this.request.offset.subtract(bad); + let done = false; + while (!done && data.length - bad < this._chunkSize) { + const current = await this._request(); + this.request.offset = this.request.offset.add(this.request.limit); + data = Buffer.concat([data, current]); + done = current.length < this.request.limit; + } + this.request.offset = before; + for (let i = bad; i < data.length; i += this._stride) { + this.buffer.push(data.slice(i, i + this._chunkSize)); + this.request.offset = this.request.offset.add(this._stride); + } + if (done) { + this.left = this.buffer.length; + await this.close(); + return; + } + if (this.buffer[this.buffer.length - 1].length != this._chunkSize) { + this._lastPart = this.buffer.pop(); + this.request.offset = this.request.offset.subtract(this._stride); + } + } + }; + exports2.GenericDownloadIter = GenericDownloadIter; + function iterDownload(client2, { file, offset = big_integer_1.default.zero, stride, limit, chunkSize, requestSize = MAX_CHUNK_SIZE, fileSize, dcId, msgData }) { + const info = __1.utils.getFileInfo(file); + if (info.dcId != void 0) { + dcId = info.dcId; + } + if (fileSize == void 0) { + fileSize = info.size; + } + file = info.location; + if (chunkSize == void 0) { + chunkSize = requestSize; + } + if (limit == void 0 && fileSize != void 0) { + limit = Math.floor(fileSize.add(chunkSize).subtract(1).divide(chunkSize).toJSNumber()); + } + if (stride == void 0) { + stride = chunkSize; + } else if (stride < chunkSize) { + throw new Error("Stride must be >= chunkSize"); + } + requestSize -= requestSize % MIN_CHUNK_SIZE; + if (requestSize < MIN_CHUNK_SIZE) { + requestSize = MIN_CHUNK_SIZE; + } else if (requestSize > MAX_CHUNK_SIZE) { + requestSize = MAX_CHUNK_SIZE; + } + let cls; + if (chunkSize == requestSize && offset.divide(MAX_CHUNK_SIZE).eq(big_integer_1.default.zero) && stride % MIN_CHUNK_SIZE == 0 && (limit == void 0 || offset.divide(limit).eq(big_integer_1.default.zero))) { + cls = DirectDownloadIter; + client2._log.info(`Starting direct file download in chunks of ${requestSize} at ${offset}, stride ${stride}`); + } else { + cls = GenericDownloadIter; + client2._log.info(`Starting indirect file download in chunks of ${requestSize} at ${offset}, stride ${stride}`); + } + return new cls(client2, limit, {}, { + fileLocation: file, + dcId, + offset, + stride, + chunkSize, + requestSize, + fileSize, + msgData + }); } - return (element) => !!adapter2.getAttributeValue(element, name)?.includes(value) && next(element); - }, - not(next, data, options) { - const { adapter: adapter2 } = options; - const { name } = data; - let { value } = data; - if (value === "") { - return (element) => !!adapter2.getAttributeValue(element, name) && next(element); - } - if (shouldIgnoreCase(data, options)) { - value = value.toLowerCase(); - return (element) => { - const attribute2 = adapter2.getAttributeValue(element, name); - return (attribute2 == null || attribute2.length !== value.length || attribute2.toLowerCase() !== value) && next(element); - }; + function getWriter(outputFile) { + if (!outputFile || Buffer.isBuffer(outputFile)) { + return new extensions_1.BinaryWriter(Buffer.alloc(0)); + } else if (typeof outputFile == "string") { + return (0, fs_1.createWriteStream)(outputFile); + } else { + return outputFile; + } } - return (element) => adapter2.getAttributeValue(element, name) !== value && next(element); - } -}; - -// node_modules/css-select/dist/helpers/querying.js -init_define_import_meta_env(); -function findAll3(query2, nodes, options) { - const { adapter: adapter2, xmlMode = false } = options; - const result = []; - const nodeStack = [nodes]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (nodeStack.length === 1) { - return result; + function closeWriter(writer) { + if ("close" in writer && writer.close) { + writer.close(); } - nodeStack.shift(); - indexStack.shift(); - continue; } - const element = nodeStack[0][indexStack[0]++]; - if (!adapter2.isTag(element)) { - continue; + function returnWriterValue(writer) { + if (writer instanceof extensions_1.BinaryWriter) { + return writer.getValue(); + } + if (writer instanceof fs.WriteStream) { + if (typeof writer.path == "string") { + return path_1.default.resolve(writer.path); + } else { + return Buffer.from(writer.path); + } + } } - if (query2(element)) { - result.push(element); + async function downloadFileV2(client2, inputLocation, { outputFile = void 0, partSizeKb = void 0, fileSize = void 0, progressCallback = void 0, dcId = void 0, msgData = void 0 }) { + var _a, e_1, _b, _c; + if (!partSizeKb) { + if (!fileSize) { + partSizeKb = 64; + } else { + partSizeKb = __1.utils.getAppropriatedPartSize(fileSize); + } + } + const partSize = Math.floor(partSizeKb * 1024); + if (partSize % MIN_CHUNK_SIZE != 0) { + throw new Error("The part size must be evenly divisible by 4096"); + } + const writer = getWriter(outputFile); + let downloaded = big_integer_1.default.zero; + try { + try { + for (var _d = true, _e = __asyncValues2(iterDownload(client2, { + file: inputLocation, + requestSize: partSize, + dcId, + msgData + })), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { + _c = _f.value; + _d = false; + const chunk = _c; + await writer.write(chunk); + downloaded = downloaded.add(chunk.length); + if (progressCallback) { + await progressCallback(downloaded, (0, big_integer_1.default)(fileSize || big_integer_1.default.zero)); + } + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (!_d && !_a && (_b = _e.return)) await _b.call(_e); + } finally { + if (e_1) throw e_1.error; + } + } + return returnWriterValue(writer); + } finally { + closeWriter(writer); + } } - if (xmlMode || adapter2.getName(element) !== "template") { - const children = adapter2.getChildren(element); - if (children.length > 0) { - nodeStack.unshift(children); - indexStack.unshift(0); + async function downloadMedia(client2, messageOrMedia, outputFile, thumb, progressCallback) { + let msgData; + let date; + let media; + if (messageOrMedia instanceof tl_1.Api.Message) { + media = messageOrMedia.media; + date = messageOrMedia.date; + msgData = messageOrMedia.inputChat ? [messageOrMedia.inputChat, messageOrMedia.id] : void 0; + } else { + media = messageOrMedia; + date = Date.now(); + } + if (typeof media == "string") { + throw new Error("not implemented"); + } + if (media instanceof tl_1.Api.MessageMediaWebPage) { + if (media.webpage instanceof tl_1.Api.WebPage) { + media = media.webpage.document || media.webpage.photo; + } + } + if (media instanceof tl_1.Api.MessageMediaPhoto || media instanceof tl_1.Api.Photo) { + return _downloadPhoto(client2, media, outputFile, date, thumb, progressCallback); + } else if (media instanceof tl_1.Api.MessageMediaDocument || media instanceof tl_1.Api.Document) { + return _downloadDocument(client2, media, outputFile, date, thumb, progressCallback, msgData); + } else if (media instanceof tl_1.Api.MessageMediaContact) { + return _downloadContact(client2, media, {}); + } else if (media instanceof tl_1.Api.WebDocument || media instanceof tl_1.Api.WebDocumentNoProxy) { + return _downloadWebDocument(client2, media, {}); + } else { + return Buffer.alloc(0); } } - } -} -function findOne3(query2, nodes, options) { - const { adapter: adapter2, xmlMode = false } = options; - const nodeStack = [nodes]; - const indexStack = [0]; - for (; ; ) { - if (indexStack[0] >= nodeStack[0].length) { - if (nodeStack.length === 1) { - return null; + async function _downloadDocument(client2, doc, outputFile, date, thumb, progressCallback, msgData) { + if (doc instanceof tl_1.Api.MessageMediaDocument) { + if (!doc.document) { + return Buffer.alloc(0); + } + doc = doc.document; } - nodeStack.shift(); - indexStack.shift(); - continue; + if (!(doc instanceof tl_1.Api.Document)) { + return Buffer.alloc(0); + } + let size; + if (thumb == void 0) { + outputFile = getProperFilename(outputFile, "document", "." + (__1.utils.getExtension(doc) || "bin"), date); + } else { + outputFile = getProperFilename(outputFile, "photo", ".jpg", date); + size = getThumb(doc.thumbs || [], thumb); + if (size instanceof tl_1.Api.PhotoCachedSize || size instanceof tl_1.Api.PhotoStrippedSize) { + return _downloadCachedPhotoSize(size, outputFile); + } + } + return await downloadFileV2(client2, new tl_1.Api.InputDocumentFileLocation({ + id: doc.id, + accessHash: doc.accessHash, + fileReference: doc.fileReference, + thumbSize: size && "type" in size ? size.type : "" + }), { + outputFile, + fileSize: size && "size" in size ? (0, big_integer_1.default)(size.size) : doc.size, + progressCallback, + msgData + }); } - const element = nodeStack[0][indexStack[0]++]; - if (!adapter2.isTag(element)) { - continue; + async function _downloadContact(client2, media, args) { + throw new Error("not implemented"); } - if (query2(element)) { - return element; + async function _downloadWebDocument(client2, media, args) { + throw new Error("not implemented"); } - if (xmlMode || adapter2.getName(element) !== "template") { - const children = adapter2.getChildren(element); - if (children.length > 0) { - nodeStack.unshift(children); - indexStack.unshift(0); + function getThumb(thumbs, thumb) { + function sortThumb(thumb2) { + if (thumb2 instanceof tl_1.Api.PhotoStrippedSize) { + return thumb2.bytes.length; + } + if (thumb2 instanceof tl_1.Api.PhotoCachedSize) { + return thumb2.bytes.length; + } + if (thumb2 instanceof tl_1.Api.PhotoSize) { + return thumb2.size; + } + if (thumb2 instanceof tl_1.Api.PhotoSizeProgressive) { + return Math.max(...thumb2.sizes); + } + if (thumb2 instanceof tl_1.Api.VideoSize) { + return thumb2.size; + } + return 0; + } + thumbs = thumbs.sort((a, b) => sortThumb(a) - sortThumb(b)); + const correctThumbs = []; + for (const t of thumbs) { + if (!(t instanceof tl_1.Api.PhotoPathSize)) { + correctThumbs.push(t); + } + } + if (thumb == void 0) { + return correctThumbs.pop(); + } else if (typeof thumb == "number") { + return correctThumbs[thumb]; + } else if (typeof thumb == "string") { + for (const t of correctThumbs) { + if ("type" in t && t.type == thumb) { + return t; + } + } + } else if (thumb instanceof tl_1.Api.PhotoSize || thumb instanceof tl_1.Api.PhotoCachedSize || thumb instanceof tl_1.Api.PhotoStrippedSize || thumb instanceof tl_1.Api.VideoSize) { + return thumb; } } - } -} -function getNextSiblings(element, adapter2) { - const siblings = adapter2.getSiblings(element); - if (siblings.length <= 1) { - return []; - } - const elementIndex = siblings.indexOf(element); - if (elementIndex === -1 || elementIndex === siblings.length - 1) { - return []; - } - return siblings.slice(elementIndex + 1).filter(adapter2.isTag); -} -function getElementParent(node, adapter2) { - const parent = adapter2.getParent(node); - return parent != null && adapter2.isTag(parent) ? parent : null; -} - -// node_modules/css-select/dist/pseudo-selectors/index.js -init_define_import_meta_env(); - -// node_modules/css-select/dist/pseudo-selectors/aliases.js -init_define_import_meta_env(); -var textControl = "input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])"; -var aliases = { - // Links - "any-link": ":is(a, area, link)[href]", - link: ":any-link:not(:visited)", - // Forms - // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements - disabled: `:is( - :is(button, input, select, textarea, optgroup, option)[disabled], - optgroup[disabled] > option, - fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *) - )`, - enabled: ":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)", - checked: ":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)", - required: ":is(input, select, textarea)[required]", - optional: ":is(input, select, textarea):not([required])", - "read-only": `[readonly]:is(textarea, ${textControl})`, - "read-write": `:not([readonly]):is(textarea, ${textControl})`, - // JQuery extensions - /** - * `:selected` matches option elements that have the `selected` attribute, - * or are the first option element in a select element that does not have - * the `multiple` attribute and does not have any option elements with the - * `selected` attribute. - * @see https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness - */ - selected: "option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)", - checkbox: "[type=checkbox]", - file: "[type=file]", - password: "[type=password]", - radio: "[type=radio]", - reset: "[type=reset]", - image: "[type=image]", - submit: "[type=submit]", - parent: ":not(:empty)", - header: ":is(h1, h2, h3, h4, h5, h6)", - button: ":is(button, input[type=button])", - input: ":is(input, textarea, select, button)", - text: "input:is(:not([type!='']), [type=text])" -}; - -// node_modules/css-select/dist/pseudo-selectors/filters.js -init_define_import_meta_env(); - -// node_modules/nth-check/dist/index.js -init_define_import_meta_env(); - -// node_modules/nth-check/dist/compile.js -init_define_import_meta_env(); -function compile(parsed) { - const a = parsed[0]; - const b = parsed[1] - 1; - if (b < 0 && a <= 0) - return falseFunc; - if (a === -1) - return (index2) => index2 <= b; - if (a === 0) - return (index2) => index2 === b; - if (a === 1) - return b < 0 ? trueFunc : (index2) => index2 >= b; - const absA = Math.abs(a); - const bModulo = (b % absA + absA) % absA; - return a > 1 ? (index2) => index2 >= b && index2 % absA === bModulo : (index2) => index2 <= b && index2 % absA === bModulo; -} - -// node_modules/nth-check/dist/parse.js -init_define_import_meta_env(); -var whitespace = /* @__PURE__ */ new Set([9, 10, 12, 13, 32]); -var ZERO = "0".charCodeAt(0); -var NINE = "9".charCodeAt(0); -function parse2(formula) { - formula = formula.trim().toLowerCase(); - switch (formula) { - case "even": { - return [2, 0]; - } - case "odd": { - return [2, 1]; + async function _downloadCachedPhotoSize(size, outputFile) { + let data; + if (size instanceof tl_1.Api.PhotoStrippedSize) { + data = (0, Utils_1.strippedPhotoToJpg)(size.bytes); + } else { + data = size.bytes; + } + const writer = getWriter(outputFile); + try { + await writer.write(data); + } finally { + closeWriter(writer); + } + return returnWriterValue(writer); } - } - let index2 = 0; - let a = 0; - let sign = readSign(); - let number = readNumber(); - if (index2 < formula.length && formula.charAt(index2) === "n") { - index2++; - a = sign * (number ?? 1); - skipWhitespace(); - if (index2 < formula.length) { - sign = readSign(); - skipWhitespace(); - number = readNumber(); - } else { - sign = number = 0; + function getProperFilename(file, fileType, extension, date) { + if (!file || typeof file != "string") { + return file; + } + if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) { + let fullName = fileType + date + extension; + return path_1.default.join(file, fullName); + } + return file; } - } - if (number === null || index2 < formula.length) { - throw new Error(`n-th rule couldn't be parsed ('${formula}')`); - } - return [a, sign * number]; - function readSign() { - switch (formula.charAt(index2)) { - case "-": { - index2++; - return -1; + async function _downloadPhoto(client2, photo, file, date, thumb, progressCallback) { + if (photo instanceof tl_1.Api.MessageMediaPhoto) { + if (photo.photo instanceof tl_1.Api.PhotoEmpty || !photo.photo) { + return Buffer.alloc(0); + } + photo = photo.photo; + } + if (!(photo instanceof tl_1.Api.Photo)) { + return Buffer.alloc(0); + } + const photoSizes = [...photo.sizes || [], ...photo.videoSizes || []]; + const size = getThumb(photoSizes, thumb); + if (!size || size instanceof tl_1.Api.PhotoSizeEmpty) { + return Buffer.alloc(0); } - case "+": { - index2++; - break; + if (!date) { + date = Date.now(); } + file = getProperFilename(file, "photo", ".jpg", date); + if (size instanceof tl_1.Api.PhotoCachedSize || size instanceof tl_1.Api.PhotoStrippedSize) { + return _downloadCachedPhotoSize(size, file); + } + let fileSize; + if (size instanceof tl_1.Api.PhotoSizeProgressive) { + fileSize = Math.max(...size.sizes); + } else { + fileSize = "size" in size ? size.size : 512; + } + return downloadFileV2(client2, new tl_1.Api.InputPhotoFileLocation({ + id: photo.id, + accessHash: photo.accessHash, + fileReference: photo.fileReference, + thumbSize: "type" in size ? size.type : "" + }), { + outputFile: file, + fileSize: (0, big_integer_1.default)(fileSize), + progressCallback, + dcId: photo.dcId + }); } - return 1; - } - function readNumber() { - const start = index2; - let value = 0; - while (index2 < formula.length && formula.charCodeAt(index2) >= ZERO && formula.charCodeAt(index2) <= NINE) { - value = value * 10 + (formula.charCodeAt(index2) - ZERO); - index2++; - } - return index2 === start ? null : value; - } - function skipWhitespace() { - while (index2 < formula.length && whitespace.has(formula.charCodeAt(index2))) { - index2++; + async function downloadProfilePhoto(client2, entity, fileParams) { + let photo; + if (typeof entity == "object" && "photo" in entity) { + photo = entity.photo; + } else { + entity = await client2.getEntity(entity); + if ("photo" in entity) { + photo = entity.photo; + } else { + throw new Error(`Could not get photo from ${entity ? entity.className : void 0}`); + } + } + let dcId; + let loc; + if (photo instanceof tl_1.Api.UserProfilePhoto || photo instanceof tl_1.Api.ChatPhoto) { + dcId = photo.dcId; + loc = new tl_1.Api.InputPeerPhotoFileLocation({ + peer: __1.utils.getInputPeer(entity), + photoId: photo.photoId, + big: fileParams.isBig + }); + } else { + return Buffer.alloc(0); + } + return client2.downloadFile(loc, { + outputFile: fileParams.outputFile, + dcId + }); } } -} - -// node_modules/nth-check/dist/index.js -function nthCheck(formula) { - return compile(parse2(formula)); -} +}); -// node_modules/css-select/dist/helpers/cache.js -init_define_import_meta_env(); -function cacheParentResults(next, { adapter: adapter2, cacheResults }, matches2) { - if (cacheResults === false || typeof WeakMap === "undefined") { - return (element) => next(element) && matches2(element); - } - const resultCache = /* @__PURE__ */ new WeakMap(); - function addResultToCache(element) { - const result = matches2(element); - resultCache.set(element, result); - return result; - } - return function cachedMatcher(element) { - if (!next(element)) { - return false; - } - if (resultCache.has(element)) { - return resultCache.get(element) ?? false; - } - let node = element; - do { - const parent = getElementParent(node, adapter2); - if (parent === null) { - return addResultToCache(element); +// node_modules/telegram/client/uploads.js +var require_uploads = __commonJS({ + "node_modules/telegram/client/uploads.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CustomFile = void 0; + exports2.uploadFile = uploadFile; + exports2._fileToMedia = _fileToMedia; + exports2._sendAlbum = _sendAlbum; + exports2.sendFile = sendFile; + var tl_1 = require_tl(); + var Helpers_1 = require_Helpers(); + var Utils_1 = require_Utils(); + var path_1 = __importDefault2(require_path()); + var fs_1 = require_fs(); + var index_1 = require_telegram(); + var messageParse_1 = require_messageParse(); + var messages_1 = require_messages2(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var CustomFile = class { + constructor(name, size, path2, buffer) { + this.name = name; + this.size = size; + this.path = path2; + this.buffer = buffer; } - node = parent; - } while (!resultCache.has(node)); - return resultCache.get(node) ? addResultToCache(element) : false; - }; -} - -// node_modules/css-select/dist/helpers/options.js -init_define_import_meta_env(); -function copyOptions(options) { - const { context: _, rootFunc: __, ...copied } = options; - return copied; -} - -// node_modules/css-select/dist/pseudo-selectors/filters.js -function extendedFilter(tag, range) { - if (range[0] !== "*" && range[0] !== tag[0]) - return false; - let tagIndex = 1; - for (let rangeIndex = 1; rangeIndex < range.length; rangeIndex++) { - if (range[rangeIndex] === "*") - continue; - while (tagIndex < tag.length && tag[tagIndex] !== range[rangeIndex]) { - if (tag[tagIndex++].length <= 1) - return false; - } - if (tagIndex >= tag.length) - return false; - tagIndex++; - } - return true; -} -var nthOfRegex = /^(.+?)\s+of\s+(.+)$/is; -function compileNth(reverse, ofType) { - return function nth(next, rule, options, context2, compileToken2) { - const { adapter: adapter2, equals } = options; - const ofMatch = ofType ? null : rule.match(nthOfRegex); - const nthCheck2 = nthCheck(ofMatch ? ofMatch[1].trim() : rule); - if (nthCheck2 === falseFunc) - return falseFunc; - const ofSelector = ofMatch && compileToken2 ? compileToken2(parse(ofMatch[2].trim()), copyOptions(options), context2) : void 0; - if (ofSelector === falseFunc) - return falseFunc; - if (nthCheck2 === trueFunc && !ofSelector) { - return (element) => getElementParent(element, adapter2) !== null && next(element); + }; + exports2.CustomFile = CustomFile; + var CustomBuffer = class { + constructor(options) { + this.options = options; + if (!options.buffer && !options.filePath) { + throw new Error("Either one of `buffer` or `filePath` should be specified"); + } + } + async slice(begin, end) { + const { buffer, filePath } = this.options; + if (buffer) { + return buffer.slice(begin, end); + } else if (filePath) { + const buffSize = end - begin; + const buff = Buffer.alloc(buffSize); + const fHandle = await fs_1.promises.open(filePath, "r"); + await fHandle.read(buff, 0, buffSize, begin); + await fHandle.close(); + return Buffer.from(buff); + } + return Buffer.alloc(0); + } + }; + var KB_TO_BYTES = 1024; + var LARGE_FILE_THRESHOLD = 10 * 1024 * 1024; + var UPLOAD_TIMEOUT = 15 * 1e3; + var DISCONNECT_SLEEP = 1e3; + var BUFFER_SIZE_2GB = 2 ** 31; + var BUFFER_SIZE_20MB = 20 * 1024 * 1024; + async function getFileBuffer(file, fileSize, maxBufferSize) { + const options = {}; + if (fileSize > maxBufferSize && file instanceof CustomFile) { + options.filePath = file.path; + } else { + options.buffer = Buffer.from(await fileToBuffer(file)); + } + return new CustomBuffer(options); } - const shouldCount = ofSelector ? (_element, sibling) => ofSelector(sibling) : ofType ? (element, sibling) => adapter2.getName(sibling) === adapter2.getName(element) : trueFunc; - if (reverse) { - return function nthLast(element) { - if (ofSelector && !ofSelector(element)) - return false; - const siblings = adapter2.getSiblings(element); - let pos = 0; - for (let index2 = siblings.length - 1; index2 >= 0; index2--) { - const sibling = siblings[index2]; - if (equals(element, sibling)) + async function uploadFile(client2, fileParams) { + const { file, onProgress } = fileParams; + let { workers } = fileParams; + const { name, size } = file; + const fileId = (0, Helpers_1.readBigIntFromBuffer)((0, Helpers_1.generateRandomBytes)(8), true, true); + const isLarge = size > LARGE_FILE_THRESHOLD; + const partSize = (0, Utils_1.getAppropriatedPartSize)((0, big_integer_1.default)(size)) * KB_TO_BYTES; + const partCount = Math.floor((size + partSize - 1) / partSize); + const buffer = await getFileBuffer(file, size, fileParams.maxBufferSize || BUFFER_SIZE_20MB - 1); + await client2.getSender(client2.session.dcId); + if (!workers || !size) { + workers = 1; + } + if (workers >= partCount) { + workers = partCount; + } + let progress = 0; + if (onProgress) { + onProgress(progress); + } + for (let i = 0; i < partCount; i += workers) { + const sendingParts = []; + let end = i + workers; + if (end > partCount) { + end = partCount; + } + for (let j = i; j < end; j++) { + let endPart = (j + 1) * partSize; + if (endPart > size) { + endPart = size; + } + if (endPart == j * partSize) { break; - if (adapter2.isTag(sibling) && shouldCount(element, sibling)) - pos++; + } + const bytes = await buffer.slice(j * partSize, endPart); + sendingParts.push((async (jMemo, bytesMemo) => { + while (true) { + let sender; + try { + sender = await client2.getSender(client2.session.dcId); + await sender.send(isLarge ? new tl_1.Api.upload.SaveBigFilePart({ + fileId, + filePart: jMemo, + fileTotalParts: partCount, + bytes: bytesMemo + }) : new tl_1.Api.upload.SaveFilePart({ + fileId, + filePart: jMemo, + bytes: bytesMemo + })); + } catch (err) { + if (sender && !sender.isConnected()) { + await (0, Helpers_1.sleep)(DISCONNECT_SLEEP); + continue; + } else if (err instanceof index_1.errors.FloodWaitError) { + await (0, Helpers_1.sleep)(err.seconds * 1e3); + continue; + } + throw err; + } + if (onProgress) { + if (onProgress.isCanceled) { + throw new Error("USER_CANCELED"); + } + progress += 1 / partCount; + onProgress(progress); + } + break; + } + })(j, bytes)); } - return nthCheck2(pos) && next(element); - }; - } - return function nth2(element) { - if (ofSelector && !ofSelector(element)) - return false; - const siblings = adapter2.getSiblings(element); - let pos = 0; - for (const sibling of siblings) { - if (equals(element, sibling)) - break; - if (adapter2.isTag(sibling) && shouldCount(element, sibling)) - pos++; + await Promise.all(sendingParts); } - return nthCheck2(pos) && next(element); - }; - }; -} -var filters = { - contains(next, text, options) { - const { getText: getText4 } = options.adapter; - return cacheParentResults(next, options, (element) => getText4(element).includes(text)); - }, - icontains(next, text, options) { - const itext = text.toLowerCase(); - const { getText: getText4 } = options.adapter; - return cacheParentResults(next, options, (element) => getText4(element).toLowerCase().includes(itext)); - }, - // Location specific methods - "nth-child": compileNth(false, false), - "nth-last-child": compileNth(true, false), - "nth-of-type": compileNth(false, true), - "nth-last-of-type": compileNth(true, true), - // TODO determine the actual root element - root(next, _rule, { adapter: adapter2 }) { - return (element) => getElementParent(element, adapter2) === null && next(element); - }, - scope(next, rule, options, context2) { - const { equals } = options; - if (!context2 || context2.length === 0) { - return filters["root"](next, rule, options); + return isLarge ? new tl_1.Api.InputFileBig({ + id: fileId, + parts: partCount, + name + }) : new tl_1.Api.InputFile({ + id: fileId, + parts: partCount, + name, + md5Checksum: "" + // This is not a "flag", so not sure if we can make it optional. + }); } - if (context2.length === 1) { - return (element) => equals(context2[0], element) && next(element); + async function _fileToMedia(client2, { file, forceDocument, fileSize, progressCallback, attributes, thumb, voiceNote = false, videoNote = false, supportsStreaming = false, mimeType, asImage, workers = 1 }) { + if (!file) { + return { fileHandle: void 0, media: void 0, image: void 0 }; + } + const isImage = index_1.utils.isImage(file); + if (asImage == void 0) { + asImage = isImage && !forceDocument; + } + if (typeof file == "object" && !Buffer.isBuffer(file) && !(file instanceof tl_1.Api.InputFile) && !(file instanceof tl_1.Api.InputFileBig) && !(file instanceof CustomFile) && !("read" in file)) { + try { + return { + fileHandle: void 0, + media: index_1.utils.getInputMedia(file, { + isPhoto: asImage, + attributes, + forceDocument, + voiceNote, + videoNote, + supportsStreaming + }), + image: asImage + }; + } catch (e) { + return { + fileHandle: void 0, + media: void 0, + image: isImage + }; + } + } + let media; + let fileHandle; + let createdFile; + if (file instanceof tl_1.Api.InputFile || file instanceof tl_1.Api.InputFileBig) { + fileHandle = file; + } else if (typeof file == "string" && (file.startsWith("https://") || file.startsWith("http://"))) { + if (asImage) { + media = new tl_1.Api.InputMediaPhotoExternal({ url: file }); + } else { + media = new tl_1.Api.InputMediaDocumentExternal({ url: file }); + } + } else if (!(typeof file == "string") || (await fs_1.promises.lstat(file)).isFile()) { + if (typeof file == "string") { + createdFile = new CustomFile(path_1.default.basename(file), (await fs_1.promises.stat(file)).size, file); + } else if (typeof File !== "undefined" && file instanceof File || file instanceof CustomFile) { + createdFile = file; + } else { + let name; + if ("name" in file) { + name = file.name; + } else { + name = "unnamed"; + } + if (Buffer.isBuffer(file)) { + createdFile = new CustomFile(name, file.length, "", file); + } + } + if (!createdFile) { + throw new Error(`Could not create file from ${JSON.stringify(file)}`); + } + fileHandle = await uploadFile(client2, { + file: createdFile, + onProgress: progressCallback, + workers + }); + } else { + throw new Error(`"Not a valid path nor a url ${file}`); + } + if (media != void 0) { + } else if (fileHandle == void 0) { + throw new Error(`Failed to convert ${file} to media. Not an existing file or an HTTP URL`); + } else if (asImage) { + media = new tl_1.Api.InputMediaUploadedPhoto({ + file: fileHandle + }); + } else { + let res = index_1.utils.getAttributes(file, { + mimeType, + attributes, + forceDocument: forceDocument && !isImage, + voiceNote, + videoNote, + supportsStreaming, + thumb + }); + attributes = res.attrs; + mimeType = res.mimeType; + let uploadedThumb; + if (!thumb) { + uploadedThumb = void 0; + } else { + if (typeof thumb == "string") { + uploadedThumb = new CustomFile(path_1.default.basename(thumb), (await fs_1.promises.stat(thumb)).size, thumb); + } else if (typeof File !== "undefined" && thumb instanceof File) { + uploadedThumb = thumb; + } else { + let name; + if ("name" in thumb) { + name = thumb.name; + } else { + name = "unnamed"; + } + if (Buffer.isBuffer(thumb)) { + uploadedThumb = new CustomFile(name, thumb.length, "", thumb); + } + } + if (!uploadedThumb) { + throw new Error(`Could not create file from ${file}`); + } + uploadedThumb = await uploadFile(client2, { + file: uploadedThumb, + workers: 1 + }); + } + media = new tl_1.Api.InputMediaUploadedDocument({ + file: fileHandle, + mimeType, + attributes, + thumb: uploadedThumb, + forceFile: forceDocument && !isImage + }); + } + return { + fileHandle, + media, + image: asImage + }; } - return (element) => context2.includes(element) && next(element); - }, - lang(next, code, { adapter: adapter2 }) { - const ranges = code.split(",").map((r) => r.trim()).filter((r) => r.length > 0).map((r) => r.replace(/^['"]|['"]$/g, "").toLowerCase().split("-")); - return function lang(element) { - let node = element; - while (node != null) { - const value = adapter2.getAttributeValue(node, "xml:lang") ?? adapter2.getAttributeValue(node, "lang"); - if (value != null) { - if (!value) { - return ranges.some((r) => r[0] === "") && next(element); + async function _sendAlbum(client2, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, voiceNote = false, videoNote = false, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId }) { + entity = await client2.getInputEntity(entity); + let files = []; + if (!Array.isArray(file)) { + files = [file]; + } else { + files = file; + } + if (!Array.isArray(caption)) { + if (!caption) { + caption = ""; + } + caption = [caption]; + } + const captions = []; + for (const c of caption) { + captions.push(await (0, messageParse_1._parseMessageText)(client2, c, parseMode)); + } + if (commentTo != void 0) { + const discussionData = await (0, messages_1.getCommentData)(client2, entity, commentTo); + entity = discussionData.entity; + replyTo = discussionData.replyTo; + } else { + replyTo = index_1.utils.getMessageId(replyTo); + } + if (!attributes) { + attributes = []; + } + let index2 = 0; + const albumFiles = []; + for (const file2 of files) { + let { fileHandle, media, image } = await _fileToMedia(client2, { + file: file2, + forceDocument, + fileSize, + progressCallback, + // @ts-ignore + attributes: attributes[index2], + thumb, + voiceNote, + videoNote, + supportsStreaming, + workers + }); + index2++; + if (media instanceof tl_1.Api.InputMediaUploadedPhoto || media instanceof tl_1.Api.InputMediaPhotoExternal) { + const r = await client2.invoke(new tl_1.Api.messages.UploadMedia({ + peer: entity, + media + })); + if (r instanceof tl_1.Api.MessageMediaPhoto) { + media = (0, Utils_1.getInputMedia)(r.photo); + } + } else if (media instanceof tl_1.Api.InputMediaUploadedDocument) { + const r = await client2.invoke(new tl_1.Api.messages.UploadMedia({ + peer: entity, + media + })); + if (r instanceof tl_1.Api.MessageMediaDocument) { + media = (0, Utils_1.getInputMedia)(r.document); } - const tag = value.toLowerCase().split("-"); - return ranges.some((r) => extendedFilter(tag, r)) && next(element); } - const parent = adapter2.getParent(node); - node = parent != null && adapter2.isTag(parent) ? parent : null; + let text = ""; + let msgEntities = []; + if (captions.length) { + [text, msgEntities] = captions.shift(); + } + albumFiles.push(new tl_1.Api.InputSingleMedia({ + media, + message: text, + entities: msgEntities + })); + } + let replyObject = void 0; + if (replyTo != void 0) { + replyObject = new tl_1.Api.InputReplyToMessage({ + replyToMsgId: (0, Utils_1.getMessageId)(replyTo), + topMsgId: (0, Utils_1.getMessageId)(topMsgId) + }); } - return ranges.some((r) => r[0] === "") && next(element); - }; - }, - hover: dynamicStatePseudo("isHovered"), - visited: dynamicStatePseudo("isVisited"), - active: dynamicStatePseudo("isActive") -}; -function dynamicStatePseudo(name) { - return function dynamicPseudo(next, _rule, { adapter: adapter2 }) { - const filterFunction = adapter2[name]; - if (typeof filterFunction !== "function") { - return falseFunc; - } - return function active(element) { - return filterFunction(element) && next(element); - }; - }; -} - -// node_modules/css-select/dist/pseudo-selectors/pseudos.js -init_define_import_meta_env(); -var isDocumentWhiteSpace = /^[ \t\r\n]*$/; -var pseudos = { - empty(element, { adapter: adapter2 }) { - const children = adapter2.getChildren(element); - return ( - // First, make sure the tag does not have any element children. - children.every((element2) => !adapter2.isTag(element2)) && // Then, check that the text content is only whitespace. - children.every((element2) => ( - // FIXME: `getText` call is potentially expensive. - isDocumentWhiteSpace.test(adapter2.getText(element2)) - )) - ); - }, - "first-child"(element, { adapter: adapter2, equals }) { - if (adapter2.prevElementSibling) { - return adapter2.prevElementSibling(element) == null; + const result = await client2.invoke(new tl_1.Api.messages.SendMultiMedia({ + peer: entity, + replyTo: replyObject, + multiMedia: albumFiles, + silent, + scheduleDate, + clearDraft, + noforwards + })); + const randomIds = albumFiles.map((m) => m.randomId); + return client2._getResponseMessage(randomIds, result, entity); } - const firstChild = adapter2.getSiblings(element).find((sibling) => adapter2.isTag(sibling)); - return firstChild != null && equals(element, firstChild); - }, - "last-child"(element, { adapter: adapter2, equals }) { - const siblings = adapter2.getSiblings(element); - for (let index2 = siblings.length - 1; index2 >= 0; index2--) { - if (equals(element, siblings[index2])) { - return true; + async function sendFile(client2, entity, { file, caption, forceDocument = false, fileSize, clearDraft = false, progressCallback, replyTo, attributes, thumb, parseMode, formattingEntities, voiceNote = false, videoNote = false, buttons, silent, supportsStreaming = false, scheduleDate, workers = 1, noforwards, commentTo, topMsgId }) { + if (!file) { + throw new Error("You need to specify a file"); } - if (adapter2.isTag(siblings[index2])) { - break; + if (!caption) { + caption = ""; } - } - return false; - }, - "first-of-type"(element, { adapter: adapter2, equals }) { - const siblings = adapter2.getSiblings(element); - const elementName = adapter2.getName(element); - for (const currentSibling of siblings) { - if (equals(element, currentSibling)) { - return true; + entity = await client2.getInputEntity(entity); + if (commentTo != void 0) { + const discussionData = await (0, messages_1.getCommentData)(client2, entity, commentTo); + entity = discussionData.entity; + replyTo = discussionData.replyTo; + } else { + replyTo = index_1.utils.getMessageId(replyTo); } - if (adapter2.isTag(currentSibling) && adapter2.getName(currentSibling) === elementName) { - break; + if (Array.isArray(file)) { + return await _sendAlbum(client2, entity, { + file, + caption, + replyTo, + parseMode, + attributes, + silent, + scheduleDate, + supportsStreaming, + clearDraft, + forceDocument, + noforwards, + topMsgId + }); } - } - return false; - }, - "last-of-type"(element, { adapter: adapter2, equals }) { - const siblings = adapter2.getSiblings(element); - const elementName = adapter2.getName(element); - for (let index2 = siblings.length - 1; index2 >= 0; index2--) { - const currentSibling = siblings[index2]; - if (equals(element, currentSibling)) { - return true; + if (Array.isArray(caption)) { + caption = caption[0] || ""; } - if (adapter2.isTag(currentSibling) && adapter2.getName(currentSibling) === elementName) { - break; + let msgEntities; + if (formattingEntities != void 0) { + msgEntities = formattingEntities; + } else { + [caption, msgEntities] = await (0, messageParse_1._parseMessageText)(client2, caption, parseMode); } - } - return false; - }, - "only-of-type"(element, { adapter: adapter2, equals }) { - const elementName = adapter2.getName(element); - return adapter2.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter2.isTag(sibling) || adapter2.getName(sibling) !== elementName); - }, - "only-child"(element, { adapter: adapter2, equals }) { - return adapter2.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter2.isTag(sibling)); - } -}; -function verifyPseudoArguments(pseudoClassCondition, name, subselect, argumentIndex) { - if (subselect === null) { - if (pseudoClassCondition.length > argumentIndex) { - throw new Error(`Pseudo-class :${name} requires an argument`); - } - } else if (pseudoClassCondition.length === argumentIndex) { - throw new Error(`Pseudo-class :${name} doesn't have any arguments`); - } -} - -// node_modules/css-select/dist/pseudo-selectors/subselects.js -init_define_import_meta_env(); - -// node_modules/css-select/dist/helpers/selectors.js -init_define_import_meta_env(); -function isTraversal2(token) { - return token.type === "_flexibleDescendant" || isTraversal(token); -} -function sortRules(array) { - const ratings = array.map(getQuality); - for (let index2 = 1; index2 < array.length; index2++) { - const procNew = ratings[index2]; - if (procNew < 0) { - continue; - } - for (let currentIndex = index2; currentIndex > 0 && procNew < ratings[currentIndex - 1]; currentIndex--) { - const token = array[currentIndex]; - array[currentIndex] = array[currentIndex - 1]; - array[currentIndex - 1] = token; - ratings[currentIndex] = ratings[currentIndex - 1]; - ratings[currentIndex - 1] = procNew; - } - } -} -function getAttributeQuality(token) { - switch (token.action) { - case AttributeAction.Exists: { - return 10; - } - case AttributeAction.Equals: { - return token.name === "id" ? 9 : 8; - } - case AttributeAction.Not: { - return 7; - } - case AttributeAction.Start: { - return 6; - } - case AttributeAction.End: { - return 6; - } - case AttributeAction.Any: { - return 5; - } - case AttributeAction.Hyphen: { - return 4; - } - case AttributeAction.Element: { - return 3; - } - } -} -function getQuality(token) { - switch (token.type) { - case SelectorType.Universal: { - return 50; - } - case SelectorType.Tag: { - return 30; - } - case SelectorType.Attribute: { - return Math.floor(getAttributeQuality(token) / // `ignoreCase` adds some overhead, half the result if applicable. - (token.ignoreCase ? 2 : 1)); - } - case SelectorType.Pseudo: { - return token.data ? token.name === "has" || token.name === "contains" || token.name === "icontains" ? ( - // Expensive in any case — run as late as possible. - 0 - ) : Array.isArray(token.data) ? ( - // Eg. `:is`, `:not` - Math.max( - // If we have traversals, try to avoid executing this selector - 0, - Math.min(...token.data.map((d) => Math.min(...d.map(getQuality)))) - ) - ) : 2 : 3; - } - default: { - return -1; - } - } -} -function includesScopePseudo(t) { - return t.type === SelectorType.Pseudo && (t.name === "scope" || Array.isArray(t.data) && t.data.some((data) => data.some(includesScopePseudo))); -} - -// node_modules/css-select/dist/pseudo-selectors/subselects.js -var PLACEHOLDER_ELEMENT = {}; -function hasDependsOnCurrentElement(selector) { - return selector.some((sel) => sel.length > 0 && (isTraversal2(sel[0]) || sel.some(includesScopePseudo))); -} -var is = (next, token, options, context2, compileToken2) => { - const compiledToken = compileToken2(token, copyOptions(options), context2); - return compiledToken === trueFunc ? next : compiledToken === falseFunc ? falseFunc : (element) => compiledToken(element) && next(element); -}; -var subselects = { - is, - /** - * `:matches` and `:where` are aliases for `:is`. - */ - matches: is, - where: is, - not(next, token, options, context2, compileToken2) { - const compiledToken = compileToken2(token, copyOptions(options), context2); - return compiledToken === falseFunc ? next : compiledToken === trueFunc ? falseFunc : (element) => !compiledToken(element) && next(element); - }, - has(next, subselect, options, _context, compileToken2) { - const { adapter: adapter2 } = options; - const copiedOptions = copyOptions(options); - copiedOptions.relativeSelector = true; - const context2 = subselect.some((s) => s.some(isTraversal2)) ? ( - // Used as a placeholder. Will be replaced with the actual element. - [PLACEHOLDER_ELEMENT] - ) : void 0; - const skipCache = hasDependsOnCurrentElement(subselect); - const compiled = compileToken2(subselect, copiedOptions, context2); - if (compiled === falseFunc) { - return falseFunc; - } - if (context2 && compiled !== trueFunc) { - return skipCache ? (element) => { - if (!next(element)) { - return false; - } - context2[0] = element; - const childs = adapter2.getChildren(element); - return findOne3(compiled, compiled.shouldTestNextSiblings ? [ - ...childs, - ...getNextSiblings(element, adapter2) - ] : childs, options) !== null; - } : cacheParentResults(next, options, (element) => { - context2[0] = element; - return findOne3(compiled, adapter2.getChildren(element), options) !== null; + const { fileHandle, media, image } = await _fileToMedia(client2, { + file, + forceDocument, + fileSize, + progressCallback, + // @ts-ignore + attributes, + thumb, + voiceNote, + videoNote, + supportsStreaming, + workers }); - } - const hasOne = (element) => findOne3(compiled, adapter2.getChildren(element), options) !== null; - return skipCache ? (element) => next(element) && hasOne(element) : cacheParentResults(next, options, hasOne); - } -}; - -// node_modules/css-select/dist/pseudo-selectors/index.js -function compilePseudoSelector(next, selector, options, context2, compileToken2) { - const { name, data } = selector; - if (Array.isArray(data)) { - if (!(name in subselects)) { - throw new Error(`Unknown pseudo-class :${name}(${data})`); - } - return subselects[name](next, data, options, context2, compileToken2); - } - const userPseudo = options.pseudos?.[name]; - const stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases[name]; - if (typeof stringPseudo === "string") { - if (data != null) { - throw new Error(`Pseudo ${name} doesn't have any arguments`); - } - const alias = parse(stringPseudo); - return subselects["is"](next, alias, options, context2, compileToken2); - } - if (typeof userPseudo === "function") { - verifyPseudoArguments(userPseudo, name, data, 1); - return (element) => userPseudo(element, data) && next(element); - } - if (name in filters) { - return filters[name](next, data, options, context2, compileToken2); - } - if (name in pseudos) { - const pseudo = pseudos[name]; - verifyPseudoArguments(pseudo, name, data, 2); - return (element) => pseudo(element, options, data) && next(element); - } - throw new Error(`Unknown pseudo-class :${name}`); -} - -// node_modules/css-select/dist/general.js -function compileGeneralSelector(next, selector, options, context2, compileToken2, hasExpensiveSubselector) { - const { adapter: adapter2, equals, cacheResults } = options; - switch (selector.type) { - case SelectorType.PseudoElement: { - throw new Error("Pseudo-elements are not supported by css-select"); - } - case SelectorType.ColumnCombinator: { - throw new Error("Column combinators are not yet supported by css-select"); - } - case SelectorType.Attribute: { - if (selector.namespace != null) { - throw new Error("Namespaced attributes are not yet supported by css-select"); + if (media == void 0) { + throw new Error(`Cannot use ${file} as file.`); } - if (!options.xmlMode || options.lowerCaseAttributeNames) { - selector.name = selector.name.toLowerCase(); + const markup = client2.buildReplyMarkup(buttons); + let replyObject = void 0; + if (replyTo != void 0) { + replyObject = new tl_1.Api.InputReplyToMessage({ + replyToMsgId: (0, Utils_1.getMessageId)(replyTo), + topMsgId: (0, Utils_1.getMessageId)(topMsgId) + }); } - return attributeRules[selector.action](next, selector, options); + const request = new tl_1.Api.messages.SendMedia({ + peer: entity, + media, + replyTo: replyObject, + message: caption, + entities: msgEntities, + replyMarkup: markup, + silent, + scheduleDate, + clearDraft, + noforwards + }); + const result = await client2.invoke(request); + return client2._getResponseMessage(request, result, entity); } - case SelectorType.Pseudo: { - return compilePseudoSelector(next, selector, options, context2, compileToken2); + function fileToBuffer(file) { + if (typeof File !== "undefined" && file instanceof File) { + return new Response(file).arrayBuffer(); + } else if (file instanceof CustomFile) { + if (file.buffer != void 0) { + return file.buffer; + } else { + return fs_1.promises.readFile(file.path); + } + } else { + throw new Error("Could not create buffer from file " + file); + } } - // Tags - case SelectorType.Tag: { - if (selector.namespace != null) { - throw new Error("Namespaced tag names are not yet supported by css-select"); + } +}); + +// node_modules/telegram/client/messages.js +var require_messages2 = __commonJS({ + "node_modules/telegram/client/messages.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __asyncValues2 = exports2 && exports2.__asyncValues || function(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; } - let { name } = selector; - if (!options.xmlMode || options.lowerCaseTags) { - name = name.toLowerCase(); + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); } - return function tag(element) { - return adapter2.getName(element) === name && next(element); - }; - } - // Traversal - case SelectorType.Descendant: { - if (!hasExpensiveSubselector || cacheResults === false || typeof WeakMap === "undefined") { - return function descendant(element) { - let current = element; - while (current = getElementParent(current, adapter2)) { - if (next(current)) { - return true; + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._IDsIter = exports2._MessagesIter = void 0; + exports2.iterMessages = iterMessages; + exports2.getMessages = getMessages; + exports2.sendMessage = sendMessage; + exports2.forwardMessages = forwardMessages; + exports2.editMessage = editMessage; + exports2.deleteMessages = deleteMessages; + exports2.pinMessage = pinMessage; + exports2.unpinMessage = unpinMessage; + exports2._pin = _pin; + exports2.markAsRead = markAsRead; + exports2.getCommentData = getCommentData; + var tl_1 = require_tl(); + var requestIter_1 = require_requestIter(); + var Helpers_1 = require_Helpers(); + var Utils_1 = require_Utils(); + var __1 = require_telegram(); + var messageParse_1 = require_messageParse(); + var users_1 = require_users(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var uploads_1 = require_uploads(); + var _MAX_CHUNK_SIZE = 100; + var _MessagesIter = class extends requestIter_1.RequestIter { + async _init({ entity, offsetId, minId, maxId, fromUser, offsetDate, addOffset, filter: filter2, search, replyTo }) { + var _a, e_1, _b, _c; + if (entity) { + this.entity = await this.client.getInputEntity(entity); + } else { + this.entity = void 0; + if (this.reverse) { + throw new Error("Cannot reverse global search"); + } + } + if (this.reverse) { + offsetId = Math.max(offsetId, minId); + if (offsetId && maxId) { + if (maxId - offsetId <= 1) { + return false; + } + } + if (!maxId) { + maxId = Number.MAX_SAFE_INTEGER; + } + } else { + offsetId = Math.max(offsetId, maxId); + if (offsetId && minId) { + if (offsetId - minId <= 1) { + return false; + } + } + } + if (this.reverse) { + if (offsetId) { + offsetId += 1; + } else if (!offsetDate) { + offsetId = 1; + } + } + if (fromUser) { + fromUser = await this.client.getInputEntity(fromUser); + } + if (!this.entity && fromUser) { + this.entity = new tl_1.Api.InputPeerEmpty(); + } + if (!filter2) { + filter2 = new tl_1.Api.InputMessagesFilterEmpty(); + } + if (!this.entity) { + this.request = new tl_1.Api.messages.SearchGlobal({ + q: search || "", + filter: filter2, + minDate: void 0, + // TODO fix this smh + maxDate: offsetDate, + offsetRate: void 0, + offsetPeer: new tl_1.Api.InputPeerEmpty(), + offsetId, + limit: 1 + }); + } else if (replyTo !== void 0) { + this.request = new tl_1.Api.messages.GetReplies({ + peer: this.entity, + msgId: replyTo, + offsetId, + offsetDate, + addOffset, + limit: 0, + maxId: 0, + minId: 0, + hash: big_integer_1.default.zero + }); + } else if (search !== void 0 || !(filter2 instanceof tl_1.Api.InputMessagesFilterEmpty) || fromUser !== void 0) { + this.request = new tl_1.Api.messages.Search({ + peer: this.entity, + q: search || "", + filter: typeof filter2 === "function" ? new filter2() : filter2, + minDate: void 0, + maxDate: offsetDate, + offsetId, + addOffset, + limit: 0, + maxId: 0, + minId: 0, + hash: (0, Helpers_1.generateRandomBigInt)(), + fromId: fromUser + }); + if (!(filter2 instanceof tl_1.Api.InputMessagesFilterEmpty) && offsetDate && !search && !offsetId) { + try { + for (var _d = true, _e = __asyncValues2(this.client.iterMessages(this.entity, { + limit: 1, + offsetDate + })), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { + _c = _f.value; + _d = false; + const m = _c; + this.request.offsetId = m.id + 1; + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (!_d && !_a && (_b = _e.return)) await _b.call(_e); + } finally { + if (e_1) throw e_1.error; + } + } + } + } else { + this.request = new tl_1.Api.messages.GetHistory({ + peer: this.entity, + limit: 1, + offsetDate, + offsetId, + minId: 0, + maxId: 0, + addOffset, + hash: big_integer_1.default.zero + }); + } + if (this.limit <= 0) { + const result = await this.client.invoke(this.request); + if (result instanceof tl_1.Api.messages.MessagesNotModified) { + this.total = result.count; + } else { + if ("count" in result) { + this.total = result.count; + } else { + this.total = result.messages.length; } } - return false; - }; + return false; + } + if (!this.waitTime) { + this.waitTime = this.limit > 3e3 ? 1 : 0; + } + if (this.reverse && !(this.request instanceof tl_1.Api.messages.SearchGlobal)) { + this.request.addOffset -= _MAX_CHUNK_SIZE; + } + this.addOffset = addOffset; + this.maxId = maxId; + this.minId = minId; + this.lastId = this.reverse ? 0 : Number.MAX_SAFE_INTEGER; + } + async _loadNextChunk() { + var _a; + if (!this.request) { + throw new Error("Request not set yet"); + } + this.request.limit = Math.min(this.left, _MAX_CHUNK_SIZE); + if (this.reverse && this.request.limit != _MAX_CHUNK_SIZE) { + if (!(this.request instanceof tl_1.Api.messages.SearchGlobal)) { + this.request.addOffset = this.addOffset - this.request.limit; + } + } + const r = await this.client.invoke(this.request); + if (r instanceof tl_1.Api.messages.MessagesNotModified) { + return true; + } + if ("count" in r) { + this.total = r.count; + } else { + this.total = r.messages.length; + } + const entities2 = /* @__PURE__ */ new Map(); + for (const x of [...r.users, ...r.chats]) { + entities2.set((0, Utils_1.getPeerId)(x), x); + } + const messages = this.reverse ? r.messages.reverse() : r.messages; + for (const message of messages) { + if (!this._messageInRange(message)) { + return true; + } + this.lastId = message.id; + try { + message._finishInit(this.client, entities2, this.entity); + } catch (e) { + } + message._entities = entities2; + (_a = this.buffer) === null || _a === void 0 ? void 0 : _a.push(message); + } + if (r.messages.length < this.request.limit) { + return true; + } + if (this.buffer) { + this._updateOffset(this.buffer[this.buffer.length - 1], r); + } else { + return true; + } } - const resultCache = /* @__PURE__ */ new WeakMap(); - return function cachedDescendant(element) { - let current = element; - let result; - while (current = getElementParent(current, adapter2)) { - const cached = resultCache.get(current); - if (cached === void 0) { - result ??= { matches: false }; - result.matches = next(current); - resultCache.set(current, result); - if (result.matches) { - return true; + _messageInRange(message) { + if (this.entity) { + if (this.reverse) { + if (message.id <= this.lastId || message.id >= this.maxId) { + return false; } } else { - if (result) { - result.matches = cached.matches; + if (message.id >= this.lastId || message.id <= this.minId) { + return false; } - return cached.matches; } } - return false; - }; - } - case "_flexibleDescendant": { - return function flexibleDescendant(element) { - let current = element; - do { - if (next(current)) { - return true; + return true; + } + [Symbol.asyncIterator]() { + return super[Symbol.asyncIterator](); + } + _updateOffset(lastMessage, response) { + if (!this.request) { + throw new Error("Request not set yet"); + } + this.request.offsetId = Number(lastMessage.id); + if (this.reverse) { + this.request.offsetId += 1; + } + if (this.request instanceof tl_1.Api.messages.Search) { + this.request.maxDate = -1; + } else { + if (!(this.request instanceof tl_1.Api.messages.SearchGlobal)) { + this.request.offsetDate = lastMessage.date; } - current = getElementParent(current, adapter2); - } while (current); - return false; - }; - } - case SelectorType.Parent: { - return function parent(element) { - return adapter2.getChildren(element).some((element2) => adapter2.isTag(element2) && next(element2)); - }; - } - case SelectorType.Child: { - return function child(element) { - const parent = getElementParent(element, adapter2); - return parent !== null && next(parent); - }; - } - case SelectorType.Sibling: { - return function sibling(element) { - const siblings = adapter2.getSiblings(element); - for (const currentSibling of siblings) { - if (equals(element, currentSibling)) { - break; + } + if (this.request instanceof tl_1.Api.messages.SearchGlobal) { + if (lastMessage.inputChat) { + this.request.offsetPeer = lastMessage.inputChat; + } else { + this.request.offsetPeer = new tl_1.Api.InputPeerEmpty(); } - if (adapter2.isTag(currentSibling) && next(currentSibling)) { - return true; + this.request.offsetRate = response.nextRate; + } + } + }; + exports2._MessagesIter = _MessagesIter; + var _IDsIter = class extends requestIter_1.RequestIter { + async _init({ entity, ids }) { + this.total = ids.length; + this._ids = this.reverse ? ids.reverse() : ids; + this._offset = 0; + this._entity = entity ? await this.client.getInputEntity(entity) : void 0; + this._ty = this._entity ? (0, Helpers_1._entityType)(this._entity) : void 0; + if (!this.waitTime) { + this.waitTime = this.limit > 300 ? 10 : 0; + } + } + [Symbol.asyncIterator]() { + return super[Symbol.asyncIterator](); + } + async _loadNextChunk() { + var _a, _b, _c; + const ids = this._ids.slice(this._offset, this._offset + _MAX_CHUNK_SIZE); + if (!ids.length) { + return false; + } + this._offset += _MAX_CHUNK_SIZE; + let fromId; + let r; + if (this._ty == Helpers_1._EntityType.CHANNEL) { + try { + r = await this.client.invoke(new tl_1.Api.channels.GetMessages({ + channel: this._entity, + id: ids + })); + } catch (e) { + if (e.errorMessage == "MESSAGE_IDS_EMPTY") { + r = new tl_1.Api.messages.MessagesNotModified({ + count: ids.length + }); + } else { + throw e; + } + } + } else { + r = await this.client.invoke(new tl_1.Api.messages.GetMessages({ + id: ids + })); + if (this._entity) { + fromId = await (0, users_1._getPeer)(this.client, this._entity); } } - return false; - }; + if (r instanceof tl_1.Api.messages.MessagesNotModified) { + (_a = this.buffer) === null || _a === void 0 ? void 0 : _a.push(...Array(ids.length)); + return; + } + const entities2 = /* @__PURE__ */ new Map(); + for (const entity of [...r.users, ...r.chats]) { + entities2.set(__1.utils.getPeerId(entity), entity); + } + let message; + for (message of r.messages) { + if (message instanceof tl_1.Api.MessageEmpty || fromId && __1.utils.getPeerId(message.peerId) != __1.utils.getPeerId(fromId)) { + (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(void 0); + } else { + const temp = message; + temp._finishInit(this.client, entities2, this._entity); + temp._entities = entities2; + (_c = this.buffer) === null || _c === void 0 ? void 0 : _c.push(temp); + } + } + } + }; + exports2._IDsIter = _IDsIter; + var IterMessagesDefaults = { + limit: void 0, + offsetDate: void 0, + offsetId: 0, + maxId: 0, + minId: 0, + addOffset: 0, + search: void 0, + filter: void 0, + fromUser: void 0, + waitTime: void 0, + ids: void 0, + reverse: false, + replyTo: void 0, + scheduled: false + }; + function iterMessages(client2, entity, options) { + const { limit, offsetDate, offsetId, maxId, minId, addOffset, search, filter: filter2, fromUser, waitTime, ids, reverse, replyTo } = Object.assign(Object.assign({}, IterMessagesDefaults), options); + if (ids) { + let idsArray; + if (!(0, Helpers_1.isArrayLike)(ids)) { + idsArray = [ids]; + } else { + idsArray = ids; + } + return new _IDsIter(client2, idsArray.length, { + reverse, + waitTime + }, { + entity, + ids: idsArray + }); + } + return new _MessagesIter(client2, limit, { + waitTime, + reverse + }, { + entity, + offsetId, + minId, + maxId, + fromUser, + offsetDate, + addOffset, + filter: filter2, + search, + replyTo + }); } - case SelectorType.Adjacent: { - if (adapter2.prevElementSibling) { - return function adjacent(element) { - const previous = adapter2.prevElementSibling(element); - return previous != null && next(previous); - }; + async function getMessages(client2, entity, params) { + var _a, e_2, _b, _c; + if (Object.keys(params).length == 1 && params.limit === void 0) { + if (params.minId === void 0 && params.maxId === void 0) { + params.limit = void 0; + } else { + params.limit = 1; + } } - return function adjacent(element) { - const siblings = adapter2.getSiblings(element); - let lastElement; - for (const currentSibling of siblings) { - if (equals(element, currentSibling)) { - break; + const it = client2.iterMessages(entity, params); + const ids = params.ids; + if (ids && !(0, Helpers_1.isArrayLike)(ids)) { + try { + for (var _d = true, it_1 = __asyncValues2(it), it_1_1; it_1_1 = await it_1.next(), _a = it_1_1.done, !_a; _d = true) { + _c = it_1_1.value; + _d = false; + const message = _c; + return [message]; } - if (adapter2.isTag(currentSibling)) { - lastElement = currentSibling; + } catch (e_2_1) { + e_2 = { error: e_2_1 }; + } finally { + try { + if (!_d && !_a && (_b = it_1.return)) await _b.call(it_1); + } finally { + if (e_2) throw e_2.error; } } - return !!lastElement && next(lastElement); - }; + return []; + } + return await it.collect(); } - case SelectorType.Universal: { - if (selector.namespace != null && selector.namespace !== "*") { - throw new Error("Namespaced universal selectors are not yet supported by css-select"); + async function sendMessage(client2, entity, { message, replyTo, attributes, parseMode, formattingEntities, linkPreview = true, file, thumb, forceDocument, clearDraft, buttons, silent, supportStreaming, schedule, noforwards, commentTo, topMsgId } = {}) { + if (file) { + return client2.sendFile(entity, { + file, + caption: message ? typeof message == "string" ? message : message.message : "", + forceDocument, + clearDraft, + replyTo, + attributes, + thumb, + supportsStreaming: supportStreaming, + parseMode, + formattingEntities, + silent, + scheduleDate: schedule, + buttons, + noforwards, + commentTo, + topMsgId + }); } - return next; + entity = await client2.getInputEntity(entity); + if (commentTo != void 0) { + const discussionData = await getCommentData(client2, entity, commentTo); + entity = discussionData.entity; + replyTo = discussionData.replyTo; + } + let markup, request; + let replyObject = void 0; + if (replyTo != void 0) { + replyObject = new tl_1.Api.InputReplyToMessage({ + replyToMsgId: (0, Utils_1.getMessageId)(replyTo), + topMsgId: (0, Utils_1.getMessageId)(topMsgId) + }); + } + if (message && message instanceof tl_1.Api.Message) { + if (buttons == void 0) { + markup = message.replyMarkup; + } else { + markup = client2.buildReplyMarkup(buttons); + } + if (silent == void 0) { + silent = message.silent; + } + if (message.media && !(message.media instanceof tl_1.Api.MessageMediaWebPage)) { + return client2.sendFile(entity, { + file: message.media, + caption: message.message, + silent, + replyTo, + buttons: markup, + formattingEntities: message.entities, + scheduleDate: schedule + }); + } + request = new tl_1.Api.messages.SendMessage({ + peer: entity, + message: message.message || "", + silent, + replyTo: replyObject, + replyMarkup: markup, + entities: message.entities, + clearDraft, + noWebpage: !(message.media instanceof tl_1.Api.MessageMediaWebPage), + scheduleDate: schedule, + noforwards + }); + message = message.message; + } else { + if (formattingEntities == void 0) { + [message, formattingEntities] = await (0, messageParse_1._parseMessageText)(client2, message || "", parseMode); + } + if (!message) { + throw new Error("The message cannot be empty unless a file is provided"); + } + request = new tl_1.Api.messages.SendMessage({ + peer: entity, + message: message.toString(), + entities: formattingEntities, + noWebpage: !linkPreview, + replyTo: replyObject, + clearDraft, + silent, + replyMarkup: client2.buildReplyMarkup(buttons), + scheduleDate: schedule, + noforwards + }); + } + const result = await client2.invoke(request); + if (result instanceof tl_1.Api.UpdateShortSentMessage) { + const msg = new tl_1.Api.Message({ + id: result.id, + peerId: await (0, users_1._getPeer)(client2, entity), + message, + date: result.date, + out: result.out, + media: result.media, + entities: result.entities, + replyMarkup: request.replyMarkup, + ttlPeriod: result.ttlPeriod + }); + msg._finishInit(client2, /* @__PURE__ */ new Map(), entity); + return msg; + } + return client2._getResponseMessage(request, result, entity); } - } -} - -// node_modules/css-select/dist/compile.js -var DESCENDANT_TOKEN = { type: SelectorType.Descendant }; -var FLEXIBLE_DESCENDANT_TOKEN = { - type: "_flexibleDescendant" -}; -var SCOPE_TOKEN = { - type: SelectorType.Pseudo, - name: "scope", - data: null -}; -function absolutize(token, { adapter: adapter2 }, context2) { - const hasContext = !!context2?.every((element) => element === PLACEHOLDER_ELEMENT || adapter2.isTag(element) && getElementParent(element, adapter2) !== null); - for (const t of token) { - if (t.length > 0 && isTraversal2(t[0]) && t[0].type !== SelectorType.Descendant) { - } else if (hasContext && !t.some(includesScopePseudo)) { - t.unshift(DESCENDANT_TOKEN); - } else { - continue; + async function forwardMessages(client2, entity, { messages, fromPeer, silent, schedule, noforwards, dropAuthor }) { + if (!(0, Helpers_1.isArrayLike)(messages)) { + messages = [messages]; + } + entity = await client2.getInputEntity(entity); + let fromPeerId; + if (fromPeer) { + fromPeer = await client2.getInputEntity(fromPeer); + fromPeerId = await client2.getPeerId(fromPeer); + } + const getKey = (m) => { + if (m instanceof tl_1.Api.Message) { + return m.chatId; + } + let msgId = (0, Utils_1.parseID)(m); + if (msgId) { + if (fromPeerId !== void 0) { + return fromPeerId; + } + throw new Error("fromPeer must be given if integer IDs are used"); + } else { + throw new Error(`Cannot forward ${m}`); + } + }; + const sent = []; + for (let [chatId, chunk] of (0, Helpers_1.groupBy)(messages, getKey)) { + let chat; + let numbers = []; + if (typeof chunk[0] == "number") { + chat = fromPeer; + numbers = chunk; + } else { + chat = await chunk[0].getInputChat(); + numbers = chunk.map((m) => m.id); + } + chunk.push(); + const request = new tl_1.Api.messages.ForwardMessages({ + fromPeer: chat, + id: numbers, + toPeer: entity, + silent, + scheduleDate: schedule, + noforwards, + dropAuthor + }); + const result = await client2.invoke(request); + sent.push(client2._getResponseMessage(request, result, entity)); + } + return sent; } - t.unshift(SCOPE_TOKEN); - } -} -function compileToken(token, options, compilationContext) { - for (const rules of token) { - sortRules(rules); - } - const { context: context2 = compilationContext, rootFunc: rootFunction = trueFunc } = options; - const isArrayContext = Array.isArray(context2); - const finalContext = context2 && (Array.isArray(context2) ? context2 : [context2]); - if (options.relativeSelector !== false) { - absolutize(token, options, finalContext); - } else if (token.some((t) => t.length > 0 && isTraversal2(t[0]))) { - throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled"); - } - let shouldTestNextSiblings = false; - let query2 = falseFunc; - combineLoop: for (const rules of token) { - if (rules.length >= 2) { - const [first, second] = rules; - if (first.type !== SelectorType.Pseudo || first.name !== "scope") { - } else if (isArrayContext && second.type === SelectorType.Descendant) { - rules[1] = FLEXIBLE_DESCENDANT_TOKEN; - } else if (second.type === SelectorType.Adjacent || second.type === SelectorType.Sibling) { - shouldTestNextSiblings = true; + async function editMessage(client2, entity, { message, text, parseMode, formattingEntities, linkPreview = true, file, forceDocument, buttons, schedule }) { + if (typeof message === "number" && typeof text === "undefined" && !file && !schedule) { + throw Error("You have to provide either file or text or schedule property."); + } + entity = await client2.getInputEntity(entity); + let id; + let markup; + let entities2; + let inputMedia; + if (file) { + const { fileHandle, media, image } = await (0, uploads_1._fileToMedia)(client2, { + file, + forceDocument + }); + inputMedia = media; + } + if (message instanceof tl_1.Api.Message) { + id = (0, Utils_1.getMessageId)(message); + text = message.message; + entities2 = message.entities; + if (buttons == void 0) { + markup = message.replyMarkup; + } else { + markup = client2.buildReplyMarkup(buttons); + } + if (message.media) { + inputMedia = (0, Utils_1.getInputMedia)(message.media, { forceDocument }); + } + } else { + if (typeof message !== "number") { + throw Error("editMessageParams.message must be either a number or a Api.Message type"); + } + id = message; + if (formattingEntities == void 0) { + [text, entities2] = await (0, messageParse_1._parseMessageText)(client2, text || "", parseMode); + } else { + entities2 = formattingEntities; + } + markup = client2.buildReplyMarkup(buttons); } + const request = new tl_1.Api.messages.EditMessage({ + peer: entity, + id, + message: text, + noWebpage: !linkPreview, + entities: entities2, + media: inputMedia, + replyMarkup: markup, + scheduleDate: schedule + }); + const result = await client2.invoke(request); + return client2._getResponseMessage(request, result, entity); } - let next = rootFunction; - let hasExpensiveSubselector = false; - for (const rule of rules) { - next = compileGeneralSelector(next, rule, options, finalContext, compileToken, hasExpensiveSubselector); - const quality = getQuality(rule); - if (quality === 0) { - hasExpensiveSubselector = true; + async function deleteMessages(client2, entity, messageIds, { revoke = false }) { + let ty = Helpers_1._EntityType.USER; + if (entity) { + entity = await client2.getInputEntity(entity); + ty = (0, Helpers_1._entityType)(entity); + } + const ids = []; + for (const messageId of messageIds) { + if (messageId instanceof tl_1.Api.Message || messageId instanceof tl_1.Api.MessageService || messageId instanceof tl_1.Api.MessageEmpty) { + ids.push(messageId.id); + } else if (typeof messageId === "number") { + ids.push(messageId); + } else { + throw new Error(`Cannot convert ${messageId} to an integer`); + } } - if (next === falseFunc) { - continue combineLoop; + const results = []; + if (ty == Helpers_1._EntityType.CHANNEL) { + for (const chunk of __1.utils.chunks(ids)) { + results.push(client2.invoke(new tl_1.Api.channels.DeleteMessages({ + channel: entity, + id: chunk + }))); + } + } else { + for (const chunk of __1.utils.chunks(ids)) { + results.push(client2.invoke(new tl_1.Api.messages.DeleteMessages({ + id: chunk, + revoke + }))); + } } + return Promise.all(results); } - if (next === rootFunction) { - return rootFunction; - } - query2 = query2 === falseFunc ? next : or(query2, next); - } - query2.shouldTestNextSiblings = shouldTestNextSiblings; - return query2; -} -function or(a, b) { - return (element) => a(element) || b(element); -} - -// node_modules/css-select/dist/index.js -var defaultEquals = (a, b) => a === b; -var defaultOptions = { - adapter: { ...dist_exports2, isTag: isTag4 }, - equals: defaultEquals -}; -function convertOptionFormats(options) { - const finalOptions = options ?? defaultOptions; - finalOptions.adapter ??= defaultOptions.adapter; - finalOptions.equals ??= finalOptions.adapter?.equals ?? defaultEquals; - return finalOptions; -} -function compile2(selector, options, context2) { - const convertedOptions = convertOptionFormats(options); - const next = _compileUnsafe(selector, convertedOptions, context2); - return next === falseFunc ? falseFunc : (element) => convertedOptions.adapter.isTag(element) && next(element); -} -function _compileUnsafe(selector, options, context2) { - return compileToken(typeof selector === "string" ? parse(selector) : selector, convertOptionFormats(options), context2); -} -function getSelectorFunction(searchFunction) { - return function select(query2, elements, options) { - const convertedOptions = convertOptionFormats(options); - if (typeof query2 !== "function") { - query2 = _compileUnsafe(query2, convertedOptions, elements); + async function pinMessage(client2, entity, message, pinMessageParams) { + return await _pin(client2, entity, message, false, pinMessageParams === null || pinMessageParams === void 0 ? void 0 : pinMessageParams.notify, pinMessageParams === null || pinMessageParams === void 0 ? void 0 : pinMessageParams.pmOneSide); } - const filteredElements = prepareContext(elements, convertedOptions.adapter, query2.shouldTestNextSiblings); - return searchFunction(query2, filteredElements, convertedOptions); - }; -} -function prepareContext(elements, adapter2, shouldTestNextSiblings = false) { - if (shouldTestNextSiblings) { - elements = appendNextSiblings(elements, adapter2); - } - return Array.isArray(elements) ? adapter2.removeSubsets(elements) : adapter2.getChildren(elements); -} -function appendNextSiblings(element, adapter2) { - const elements = Array.isArray(element) ? [...element] : [element]; - const elementsLength = elements.length; - for (let index2 = 0; index2 < elementsLength; index2++) { - const nextSiblings = getNextSiblings(elements[index2], adapter2); - elements.push(...nextSiblings); - } - return elements; -} -var selectAll = getSelectorFunction((query2, elements, options) => query2 === falseFunc || !elements || elements.length === 0 ? [] : findAll3(query2, elements, options)); -var selectOne = getSelectorFunction((query2, elements, options) => query2 === falseFunc || !elements || elements.length === 0 ? null : findOne3(query2, elements, options)); -function is2(element, query2, options) { - return (typeof query2 === "function" ? query2 : compile2(query2, options))(element); -} - -// node_modules/linkedom/esm/shared/matches.js -var { isArray } = Array; -var isTag5 = ({ nodeType }) => nodeType === ELEMENT_NODE; -var existsOne3 = (test, elements) => elements.some( - (element) => isTag5(element) && (test(element) || existsOne3(test, getChildren3(element))) -); -var getAttributeValue3 = (element, name) => name === "class" ? element.getAttributeNode("class")?.value ?? null : element.getAttribute(name); -var getChildren3 = ({ childNodes }) => childNodes; -var getName3 = (element) => { - const { localName } = element; - return ignoreCase(element) ? localName.toLowerCase() : localName; -}; -var getParent3 = ({ parentNode }) => parentNode; -var getSiblings3 = (element) => { - const { parentNode } = element; - return parentNode ? getChildren3(parentNode) : element; -}; -var getText3 = (node) => { - if (isArray(node)) - return node.map(getText3).join(""); - if (isTag5(node)) - return getText3(getChildren3(node)); - if (node.nodeType === TEXT_NODE) - return node.data; - return ""; -}; -var hasAttrib3 = (element, name) => element.hasAttribute(name); -var removeSubsets3 = (nodes) => { - let { length } = nodes; - while (length--) { - const node = nodes[length]; - if (length && -1 < nodes.lastIndexOf(node, length - 1)) { - nodes.splice(length, 1); - continue; + async function unpinMessage(client2, entity, message, unpinMessageParams) { + return await _pin(client2, entity, message, true, unpinMessageParams === null || unpinMessageParams === void 0 ? void 0 : unpinMessageParams.notify, unpinMessageParams === null || unpinMessageParams === void 0 ? void 0 : unpinMessageParams.pmOneSide); } - for (let { parentNode } = node; parentNode; parentNode = parentNode.parentNode) { - if (nodes.includes(parentNode)) { - nodes.splice(length, 1); - break; + async function _pin(client2, entity, message, unpin, notify = false, pmOneSide = false) { + message = __1.utils.getMessageId(message) || 0; + if (message === 0) { + return await client2.invoke(new tl_1.Api.messages.UnpinAllMessages({ + peer: entity + })); } + entity = await client2.getInputEntity(entity); + const request = new tl_1.Api.messages.UpdatePinnedMessage({ + silent: !notify, + unpin, + pmOneside: pmOneSide, + peer: entity, + id: message + }); + const result = await client2.invoke(request); + if (unpin || !("updates" in result) || "updates" in result && !result.updates) { + return; + } + return client2._getResponseMessage(request, result, entity); } - } - return nodes; -}; -var findAll4 = (test, nodes) => { - const matches2 = []; - for (const node of nodes) { - if (isTag5(node)) { - if (test(node)) - matches2.push(node); - matches2.push(...findAll4(test, getChildren3(node))); - } - } - return matches2; -}; -var findOne4 = (test, nodes) => { - for (let node of nodes) - if (test(node) || (node = findOne4(test, getChildren3(node)))) - return node; - return null; -}; -var adapter = { - isTag: isTag5, - existsOne: existsOne3, - getAttributeValue: getAttributeValue3, - getChildren: getChildren3, - getName: getName3, - getParent: getParent3, - getSiblings: getSiblings3, - getText: getText3, - hasAttrib: hasAttrib3, - removeSubsets: removeSubsets3, - findAll: findAll4, - findOne: findOne4 -}; -var prepareMatch = (element, selectors) => compile2( - selectors, - { - context: selectors.includes(":scope") ? element : void 0, - xmlMode: !ignoreCase(element), - adapter - } -); -var matches = (element, selectors) => is2( - element, - selectors, - { - strict: true, - context: selectors.includes(":scope") ? element : void 0, - xmlMode: !ignoreCase(element), - adapter - } -); - -// node_modules/linkedom/esm/interface/text.js -init_define_import_meta_env(); -var Text6 = class _Text extends CharacterData { - constructor(ownerDocument, data = "") { - super(ownerDocument, "#text", TEXT_NODE, data); - } - get wholeText() { - const text = []; - let { previousSibling: previousSibling2, nextSibling: nextSibling2 } = this; - while (previousSibling2) { - if (previousSibling2.nodeType === TEXT_NODE) - text.unshift(previousSibling2[VALUE]); - else - break; - previousSibling2 = previousSibling2.previousSibling; - } - text.push(this[VALUE]); - while (nextSibling2) { - if (nextSibling2.nodeType === TEXT_NODE) - text.push(nextSibling2[VALUE]); - else - break; - nextSibling2 = nextSibling2.nextSibling; - } - return text.join(""); - } - cloneNode() { - const { ownerDocument, [VALUE]: data } = this; - return new _Text(ownerDocument, data); - } - toString() { - return escape3(this[VALUE]); - } -}; - -// node_modules/linkedom/esm/mixin/parent-node.js -var isNode = (node) => node instanceof Node2; -var insert = (parentNode, child, nodes) => { - const { ownerDocument } = parentNode; - for (const node of nodes) - parentNode.insertBefore( - isNode(node) ? node : new Text6(ownerDocument, node), - child - ); -}; -var ParentNode = class extends Node2 { - constructor(ownerDocument, localName, nodeType) { - super(ownerDocument, localName, nodeType); - this[PRIVATE] = null; - this[NEXT] = this[END] = { - [NEXT]: null, - [PREV]: this, - [START]: this, - nodeType: NODE_END, - ownerDocument: this.ownerDocument, - parentNode: null - }; - } - get childNodes() { - const childNodes = new NodeList(); - let { firstChild } = this; - while (firstChild) { - childNodes.push(firstChild); - firstChild = nextSibling(firstChild); - } - return childNodes; - } - get children() { - const children = new NodeList(); - let { firstElementChild } = this; - while (firstElementChild) { - children.push(firstElementChild); - firstElementChild = nextElementSibling2(firstElementChild); - } - return children; - } - /** - * @returns {NodeStruct | null} - */ - get firstChild() { - let { [NEXT]: next, [END]: end } = this; - while (next.nodeType === ATTRIBUTE_NODE) - next = next[NEXT]; - return next === end ? null : next; - } - /** - * @returns {NodeStruct | null} - */ - get firstElementChild() { - let { firstChild } = this; - while (firstChild) { - if (firstChild.nodeType === ELEMENT_NODE) - return firstChild; - firstChild = nextSibling(firstChild); - } - return null; - } - get lastChild() { - const prev = this[END][PREV]; - switch (prev.nodeType) { - case NODE_END: - return prev[START]; - case ATTRIBUTE_NODE: - return null; - } - return prev === this ? null : prev; - } - get lastElementChild() { - let { lastChild } = this; - while (lastChild) { - if (lastChild.nodeType === ELEMENT_NODE) - return lastChild; - lastChild = previousSibling(lastChild); - } - return null; - } - get childElementCount() { - return this.children.length; - } - prepend(...nodes) { - insert(this, this.firstChild, nodes); - } - append(...nodes) { - insert(this, this[END], nodes); - } - replaceChildren(...nodes) { - let { [NEXT]: next, [END]: end } = this; - while (next !== end && next.nodeType === ATTRIBUTE_NODE) - next = next[NEXT]; - while (next !== end) { - const after2 = getEnd(next)[NEXT]; - next.remove(); - next = after2; - } - if (nodes.length) - insert(this, end, nodes); - } - getElementsByClassName(className) { - const elements = new NodeList(); - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE && next.hasAttribute("class") && next.classList.has(className)) - elements.push(next); - next = next[NEXT]; - } - return elements; - } - getElementsByTagName(tagName19) { - const elements = new NodeList(); - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE && (next.localName === tagName19 || localCase(next) === tagName19)) - elements.push(next); - next = next[NEXT]; - } - return elements; - } - querySelector(selectors) { - const matches2 = prepareMatch(this, selectors); - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE && matches2(next)) - return next; - next = next.nodeType === ELEMENT_NODE && next.localName === "template" ? next[END] : next[NEXT]; - } - return null; - } - querySelectorAll(selectors) { - const matches2 = prepareMatch(this, selectors); - const elements = new NodeList(); - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE && matches2(next)) - elements.push(next); - next = next.nodeType === ELEMENT_NODE && next.localName === "template" ? next[END] : next[NEXT]; - } - return elements; - } - appendChild(node) { - return this.insertBefore(node, this[END]); - } - contains(node) { - let parentNode = node; - while (parentNode && parentNode !== this) - parentNode = parentNode.parentNode; - return parentNode === this; - } - insertBefore(node, before2 = null) { - if (node === before2) - return node; - if (node === this) - throw new Error("unable to append a node to itself"); - const next = before2 || this[END]; - switch (node.nodeType) { - case ELEMENT_NODE: - node.remove(); - node.parentNode = this; - knownBoundaries(next[PREV], node, next); - moCallback(node, null); - connectedCallback(node); - break; - case DOCUMENT_FRAGMENT_NODE: { - let { [PRIVATE]: parentNode, firstChild, lastChild } = node; - if (firstChild) { - knownSegment(next[PREV], firstChild, lastChild, next); - knownAdjacent(node, node[END]); - if (parentNode) - parentNode.replaceChildren(); - do { - firstChild.parentNode = this; - moCallback(firstChild, null); - if (firstChild.nodeType === ELEMENT_NODE) - connectedCallback(firstChild); - } while (firstChild !== lastChild && (firstChild = nextSibling(firstChild))); + async function markAsRead(client2, entity, message, markAsReadParams) { + let maxId = (markAsReadParams === null || markAsReadParams === void 0 ? void 0 : markAsReadParams.maxId) || 0; + const maxIdIsUndefined = (markAsReadParams === null || markAsReadParams === void 0 ? void 0 : markAsReadParams.maxId) === void 0; + if (maxIdIsUndefined) { + if (message) { + if (Array.isArray(message)) { + maxId = Math.max(...message.map((v) => __1.utils.getMessageId(v))); + } else { + maxId = __1.utils.getMessageId(message); + } } - break; } - case TEXT_NODE: - case COMMENT_NODE: - case CDATA_SECTION_NODE: - node.remove(); - /* eslint no-fallthrough:0 */ - // this covers DOCUMENT_TYPE_NODE too - default: - node.parentNode = this; - knownSiblings(next[PREV], node, next); - moCallback(node, null); - break; - } - return node; - } - normalize() { - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - const { [NEXT]: $next, [PREV]: $prev, nodeType } = next; - if (nodeType === TEXT_NODE) { - if (!next[VALUE]) - next.remove(); - else if ($prev && $prev.nodeType === TEXT_NODE) { - $prev.textContent += next.textContent; - next.remove(); + entity = await client2.getInputEntity(entity); + if (markAsReadParams && !markAsReadParams.clearMentions) { + await client2.invoke(new tl_1.Api.messages.ReadMentions({ peer: entity })); + if (maxIdIsUndefined && message === void 0) { + return true; } } - next = $next; - } - } - removeChild(node) { - if (node.parentNode !== this) - throw new Error("node is not a child"); - node.remove(); - return node; - } - replaceChild(node, replaced) { - const next = getEnd(replaced)[NEXT]; - replaced.remove(); - this.insertBefore(node, next); - return replaced; - } -}; - -// node_modules/linkedom/esm/mixin/non-element-parent-node.js -var NonElementParentNode = class extends ParentNode { - getElementById(id) { - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE && next.id === id) - return next; - next = next[NEXT]; - } - return null; - } - cloneNode(deep) { - const { ownerDocument, constructor } = this; - const nonEPN = new constructor(ownerDocument); - if (deep) { - const { [END]: end } = nonEPN; - for (const node of this.childNodes) - nonEPN.insertBefore(node.cloneNode(deep), end); - } - return nonEPN; - } - toString() { - const { childNodes, localName } = this; - return `<${localName}>${childNodes.join("")}</${localName}>`; - } - toJSON() { - const json2 = []; - nonElementAsJSON(this, json2); - return json2; - } -}; - -// node_modules/linkedom/esm/interface/document-fragment.js -var DocumentFragment = class extends NonElementParentNode { - constructor(ownerDocument) { - super(ownerDocument, "#document-fragment", DOCUMENT_FRAGMENT_NODE); - } -}; - -// node_modules/linkedom/esm/interface/document-type.js -init_define_import_meta_env(); -var DocumentType = class _DocumentType extends Node2 { - constructor(ownerDocument, name, publicId = "", systemId = "") { - super(ownerDocument, "#document-type", DOCUMENT_TYPE_NODE); - this.name = name; - this.publicId = publicId; - this.systemId = systemId; - } - cloneNode() { - const { ownerDocument, name, publicId, systemId } = this; - return new _DocumentType(ownerDocument, name, publicId, systemId); - } - toString() { - const { name, publicId, systemId } = this; - const hasPublic = 0 < publicId.length; - const str = [name]; - if (hasPublic) - str.push("PUBLIC", `"${publicId}"`); - if (systemId.length) { - if (!hasPublic) - str.push("SYSTEM"); - str.push(`"${systemId}"`); - } - return `<!DOCTYPE ${str.join(" ")}>`; - } - toJSON() { - const json2 = []; - documentTypeAsJSON(this, json2); - return json2; - } -}; - -// node_modules/linkedom/esm/interface/element.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/mixin/inner-html.js -init_define_import_meta_env(); -var getInnerHtml = (node) => node.childNodes.join(""); -var setInnerHtml = (node, html) => { - const { ownerDocument } = node; - const { constructor } = ownerDocument; - const document2 = new constructor(); - document2[CUSTOM_ELEMENTS] = ownerDocument[CUSTOM_ELEMENTS]; - const { childNodes } = parseFromString(document2, ignoreCase(node), html); - node.replaceChildren(...childNodes.map(setOwnerDocument, ownerDocument)); -}; -function setOwnerDocument(node) { - node.ownerDocument = this; - switch (node.nodeType) { - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - node.childNodes.forEach(setOwnerDocument, this); - break; - } - return node; -} - -// node_modules/linkedom/esm/dom/string-map.js -init_define_import_meta_env(); - -// node_modules/uhyphen/esm/index.js -init_define_import_meta_env(); -var esm_default2 = (camel) => camel.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g, "$2$5-$3$6").toLowerCase(); - -// node_modules/linkedom/esm/dom/string-map.js -var refs = /* @__PURE__ */ new WeakMap(); -var key = (name) => `data-${esm_default2(name)}`; -var prop = (name) => name.slice(5).replace(/-([a-z])/g, (_, $1) => $1.toUpperCase()); -var handler = { - get(dataset, name) { - if (name in dataset) - return refs.get(dataset).getAttribute(key(name)); - }, - set(dataset, name, value) { - dataset[name] = value; - refs.get(dataset).setAttribute(key(name), value); - return true; - }, - deleteProperty(dataset, name) { - if (name in dataset) - refs.get(dataset).removeAttribute(key(name)); - return delete dataset[name]; - } -}; -var DOMStringMap = class { - /** - * @param {Element} ref - */ - constructor(ref) { - for (const { name, value } of ref.attributes) { - if (/^data-/.test(name)) - this[prop(name)] = value; - } - refs.set(this, ref); - return new Proxy(this, handler); - } -}; -setPrototypeOf(DOMStringMap.prototype, null); - -// node_modules/linkedom/esm/dom/token-list.js -init_define_import_meta_env(); -var { add } = Set.prototype; -var addTokens = (self2, tokens) => { - for (const token of tokens) { - if (token) - add.call(self2, token); - } -}; -var update = ({ [OWNER_ELEMENT]: ownerElement, value }) => { - const attribute2 = ownerElement.getAttributeNode("class"); - if (attribute2) - attribute2.value = value; - else - setAttribute( - ownerElement, - new Attr(ownerElement.ownerDocument, "class", value) - ); -}; -var DOMTokenList = class extends Set { - constructor(ownerElement) { - super(); - this[OWNER_ELEMENT] = ownerElement; - const attribute2 = ownerElement.getAttributeNode("class"); - if (attribute2) - addTokens(this, attribute2.value.split(/\s+/)); - } - get length() { - return this.size; - } - get value() { - return [...this].join(" "); - } - /** - * @param {...string} tokens - */ - add(...tokens) { - addTokens(this, tokens); - update(this); - } - /** - * @param {string} token - */ - contains(token) { - return this.has(token); - } - /** - * @param {...string} tokens - */ - remove(...tokens) { - for (const token of tokens) - this.delete(token); - update(this); - } - /** - * @param {string} token - * @param {boolean?} force - */ - toggle(token, force) { - if (this.has(token)) { - if (force) + if ((0, Helpers_1._entityType)(entity) === Helpers_1._EntityType.CHANNEL) { + return await client2.invoke(new tl_1.Api.channels.ReadHistory({ channel: entity, maxId })); + } else { + await client2.invoke(new tl_1.Api.messages.ReadHistory({ peer: entity, maxId })); return true; - this.delete(token); - update(this); - } else if (force || arguments.length === 1) { - super.add(token); - update(this); - return true; + } } - return false; - } - /** - * @param {string} token - * @param {string} newToken - */ - replace(token, newToken) { - if (this.has(token)) { - this.delete(token); - super.add(newToken); - update(this); - return true; + async function getCommentData(client2, entity, message) { + const result = await client2.invoke(new tl_1.Api.messages.GetDiscussionMessage({ + peer: entity, + msgId: __1.utils.getMessageId(message) + })); + const relevantMessage = result.messages.reduce((p, c) => p && p.id < c.id ? p : c); + let chat; + for (const c of result.chats) { + if (relevantMessage.peerId instanceof tl_1.Api.PeerChannel && c.id.eq(relevantMessage.peerId.channelId)) { + chat = c; + break; + } + } + return { + entity: __1.utils.getInputPeer(chat), + replyTo: relevantMessage.id + }; } - return false; } - /** - * @param {string} token - */ - supports() { - return true; +}); + +// node_modules/telegram/tl/custom/index.js +var require_custom = __commonJS({ + "node_modules/telegram/tl/custom/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ChatGetter = void 0; + var chatGetter_1 = require_chatGetter(); + Object.defineProperty(exports2, "ChatGetter", { enumerable: true, get: function() { + return chatGetter_1.ChatGetter; + } }); } -}; +}); -// node_modules/linkedom/esm/interface/css-style-declaration.js -init_define_import_meta_env(); -var refs2 = /* @__PURE__ */ new WeakMap(); -var getKeys = (style) => [...style.keys()].filter((key2) => key2 !== PRIVATE); -var updateKeys = (style) => { - const attr = refs2.get(style).getAttributeNode("style"); - if (!attr || attr[CHANGED] || style.get(PRIVATE) !== attr) { - style.clear(); - if (attr) { - style.set(PRIVATE, attr); - for (const rule of attr[VALUE].split(/\s*;\s*/)) { - let [key2, ...rest] = rule.split(":"); - if (rest.length > 0) { - key2 = key2.trim(); - const value = rest.join(":").trim(); - if (key2 && value) - style.set(key2, value); - } - } - } - } - return attr; -}; -var handler2 = { - get(style, name) { - if (name in prototype) - return style[name]; - updateKeys(style); - if (name === "length") - return getKeys(style).length; - if (/^\d+$/.test(name)) - return getKeys(style)[name]; - return style.get(esm_default2(name)) ?? ""; - }, - set(style, name, value) { - if (name === "cssText") - style[name] = value; - else { - let attr = updateKeys(style); - if (value == null) - style.delete(esm_default2(name)); - else - style.set(esm_default2(name), value); - if (!attr) { - const element = refs2.get(style); - attr = element.ownerDocument.createAttribute("style"); - element.setAttributeNode(attr); - style.set(PRIVATE, attr); +// node_modules/telegram/events/common.js +var require_common3 = __commonJS({ + "node_modules/telegram/events/common.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EventCommonSender = exports2.EventCommon = exports2.EventBuilder = void 0; + exports2._intoIdSet = _intoIdSet; + var tl_1 = require_tl(); + var custom_1 = require_custom(); + var Helpers_1 = require_Helpers(); + var __1 = require_telegram(); + var senderGetter_1 = require_senderGetter(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var Utils_1 = require_Utils(); + async function _intoIdSet(client2, chats) { + if (chats == void 0) { + return void 0; + } + if (!(0, Helpers_1.isArrayLike)(chats)) { + chats = [chats]; + } + const result = /* @__PURE__ */ new Set(); + for (let chat of chats) { + if (typeof chat == "number" || typeof chat == "bigint" || typeof chat == "string" && (0, Utils_1.parseID)(chat) || big_integer_1.default.isInstance(chat)) { + chat = (0, Helpers_1.returnBigInt)(chat); + if (chat.lesser(0)) { + result.add(chat.toString()); + } else { + result.add(__1.utils.getPeerId(new tl_1.Api.PeerUser({ + userId: chat + }))); + result.add(__1.utils.getPeerId(new tl_1.Api.PeerChat({ + chatId: chat + }))); + result.add(__1.utils.getPeerId(new tl_1.Api.PeerChannel({ + channelId: chat + }))); + } + } else if (typeof chat == "object" && chat.SUBCLASS_OF_ID == 47470215) { + result.add(__1.utils.getPeerId(chat)); + } else { + chat = await client2.getInputEntity(chat); + if (chat instanceof tl_1.Api.InputPeerSelf) { + chat = await client2.getMe(true); + } + result.add(__1.utils.getPeerId(chat)); + } } - attr[CHANGED] = false; - attr[VALUE] = style.toString(); + return Array.from(result); } - return true; - } -}; -var CSSStyleDeclaration = class extends Map { - constructor(element) { - super(); - refs2.set(this, element); - return new Proxy(this, handler2); - } - get cssText() { - return this.toString(); - } - set cssText(value) { - refs2.get(this).setAttribute("style", value); - } - getPropertyValue(name) { - const self2 = this[PRIVATE]; - return handler2.get(self2, name); - } - setProperty(name, value) { - const self2 = this[PRIVATE]; - handler2.set(self2, name, value); - } - removeProperty(name) { - const self2 = this[PRIVATE]; - handler2.set(self2, name, null); - } - [Symbol.iterator]() { - const self2 = this[PRIVATE]; - updateKeys(self2); - const keys2 = getKeys(self2); - const { length } = keys2; - let i = 0; - return { - next() { - const done = i === length; - return { done, value: done ? null : keys2[i++] }; + var EventBuilder = class { + constructor(eventParams) { + var _a; + this.chats = (_a = eventParams.chats) === null || _a === void 0 ? void 0 : _a.map((x) => x.toString()); + this.blacklistChats = eventParams.blacklistChats || false; + this.resolved = false; + this.func = eventParams.func; + } + build(update, callback, selfId) { + if (update) + return update; + } + async resolve(client2) { + if (this.resolved) { + return; + } + await this._resolve(client2); + this.resolved = true; + } + async _resolve(client2) { + this.chats = await _intoIdSet(client2, this.chats); + } + filter(event) { + if (!this.resolved) { + return; + } + if (this.chats != void 0) { + if (event.chatId == void 0) { + return; + } + const inside = this.chats.includes(event.chatId.toString()); + if (inside == this.blacklistChats) { + return; + } + } + if (this.func && !this.func(event)) { + return; + } + return event; } }; + exports2.EventBuilder = EventBuilder; + var EventCommon = class extends custom_1.ChatGetter { + constructor({ chatPeer = void 0, msgId = void 0, broadcast = void 0 }) { + super(); + this._eventName = "Event"; + custom_1.ChatGetter.initChatClass(this, { chatPeer, broadcast }); + this._entities = /* @__PURE__ */ new Map(); + this._client = void 0; + this._messageId = msgId; + } + _setClient(client2) { + this._client = client2; + } + get client() { + return this._client; + } + }; + exports2.EventCommon = EventCommon; + var EventCommonSender = class extends senderGetter_1.SenderGetter { + constructor({ chatPeer = void 0, msgId = void 0, broadcast = void 0 }) { + super(); + this._eventName = "Event"; + custom_1.ChatGetter.initChatClass(this, { chatPeer, broadcast }); + senderGetter_1.SenderGetter.initChatClass(this, { chatPeer, broadcast }); + this._entities = /* @__PURE__ */ new Map(); + this._client = void 0; + this._messageId = msgId; + } + _setClient(client2) { + this._client = client2; + } + get client() { + return this._client; + } + }; + exports2.EventCommonSender = EventCommonSender; } - get [PRIVATE]() { - return this; - } - toString() { - const self2 = this[PRIVATE]; - updateKeys(self2); - const cssText = []; - self2.forEach(push, cssText); - return cssText.join(";"); - } -}; -var { prototype } = CSSStyleDeclaration; -function push(value, key2) { - if (key2 !== PRIVATE) - this.push(`${key2}:${value}`); -} - -// node_modules/linkedom/esm/interface/event.js -init_define_import_meta_env(); -var BUBBLING_PHASE = 3; -var AT_TARGET = 2; -var CAPTURING_PHASE = 1; -var NONE = 0; -function getCurrentTarget(ev) { - return ev.currentTarget; -} -var GlobalEvent = class { - static get BUBBLING_PHASE() { - return BUBBLING_PHASE; - } - static get AT_TARGET() { - return AT_TARGET; - } - static get CAPTURING_PHASE() { - return CAPTURING_PHASE; - } - static get NONE() { - return NONE; - } - constructor(type, eventInitDict = {}) { - this.type = type; - this.bubbles = !!eventInitDict.bubbles; - this.cancelBubble = false; - this._stopImmediatePropagationFlag = false; - this.cancelable = !!eventInitDict.cancelable; - this.eventPhase = this.NONE; - this.timeStamp = Date.now(); - this.defaultPrevented = false; - this.originalTarget = null; - this.returnValue = null; - this.srcElement = null; - this.target = null; - this._path = []; - } - get BUBBLING_PHASE() { - return BUBBLING_PHASE; - } - get AT_TARGET() { - return AT_TARGET; - } - get CAPTURING_PHASE() { - return CAPTURING_PHASE; - } - get NONE() { - return NONE; - } - preventDefault() { - this.defaultPrevented = true; - } - // simplified implementation, should be https://dom.spec.whatwg.org/#dom-event-composedpath - composedPath() { - return this._path.map(getCurrentTarget); - } - stopPropagation() { - this.cancelBubble = true; - } - stopImmediatePropagation() { - this.stopPropagation(); - this._stopImmediatePropagationFlag = true; - } -}; - -// node_modules/linkedom/esm/interface/named-node-map.js -init_define_import_meta_env(); -var NamedNodeMap = class extends Array { - constructor(ownerElement) { - super(); - this.ownerElement = ownerElement; - } - getNamedItem(name) { - return this.ownerElement.getAttributeNode(name); - } - setNamedItem(attr) { - this.ownerElement.setAttributeNode(attr); - this.unshift(attr); - } - removeNamedItem(name) { - const item = this.getNamedItem(name); - this.ownerElement.removeAttribute(name); - this.splice(this.indexOf(item), 1); - } - item(index2) { - return index2 < this.length ? this[index2] : null; - } - /* c8 ignore start */ - getNamedItemNS(_, name) { - return this.getNamedItem(name); - } - setNamedItemNS(_, attr) { - return this.setNamedItem(attr); - } - removeNamedItemNS(_, name) { - return this.removeNamedItem(name); - } - /* c8 ignore stop */ -}; - -// node_modules/linkedom/esm/interface/shadow-root.js -init_define_import_meta_env(); -var ShadowRoot = class extends NonElementParentNode { - constructor(host) { - super(host.ownerDocument, "#shadow-root", DOCUMENT_FRAGMENT_NODE); - this.host = host; - } - get innerHTML() { - return getInnerHtml(this); - } - set innerHTML(html) { - setInnerHtml(this, html); - } -}; +}); -// node_modules/linkedom/esm/interface/element.js -var attributesHandler = { - get(target, key2) { - return key2 in target ? target[key2] : target.find(({ name }) => name === key2); - } -}; -var create2 = (ownerDocument, element, localName) => { - if ("ownerSVGElement" in element) { - const svg = ownerDocument.createElementNS(SVG_NAMESPACE, localName); - svg.ownerSVGElement = element.ownerSVGElement; - return svg; - } - return ownerDocument.createElement(localName); -}; -var isVoid = ({ localName, ownerDocument }) => { - return ownerDocument[MIME].voidElements.test(localName); -}; -var Element2 = class extends ParentNode { - constructor(ownerDocument, localName) { - super(ownerDocument, localName, ELEMENT_NODE); - this[CLASS_LIST] = null; - this[DATASET] = null; - this[STYLE] = null; - } - // <Mixins> - get isConnected() { - return isConnected(this); - } - get parentElement() { - return parentElement(this); - } - get previousSibling() { - return previousSibling(this); - } - get nextSibling() { - return nextSibling(this); - } - get namespaceURI() { - return "http://www.w3.org/1999/xhtml"; - } - get previousElementSibling() { - return previousElementSibling(this); - } - get nextElementSibling() { - return nextElementSibling2(this); - } - before(...nodes) { - before(this, nodes); - } - after(...nodes) { - after(this, nodes); - } - replaceWith(...nodes) { - replaceWith(this, nodes); - } - remove() { - remove(this[PREV], this, this[END][NEXT]); - } - // </Mixins> - // <specialGetters> - get id() { - return stringAttribute.get(this, "id"); - } - set id(value) { - stringAttribute.set(this, "id", value); - } - get className() { - return this.classList.value; - } - set className(value) { - const { classList } = this; - classList.clear(); - classList.add(...$String(value).split(/\s+/)); - } - get nodeName() { - return localCase(this); - } - get tagName() { - return localCase(this); - } - get classList() { - return this[CLASS_LIST] || (this[CLASS_LIST] = new DOMTokenList(this)); - } - get dataset() { - return this[DATASET] || (this[DATASET] = new DOMStringMap(this)); - } - getBoundingClientRect() { - return { - x: 0, - y: 0, - bottom: 0, - height: 0, - left: 0, - right: 0, - top: 0, - width: 0 - }; - } - get nonce() { - return stringAttribute.get(this, "nonce"); - } - set nonce(value) { - stringAttribute.set(this, "nonce", value); - } - get style() { - return this[STYLE] || (this[STYLE] = new CSSStyleDeclaration(this)); - } - get tabIndex() { - return numericAttribute.get(this, "tabindex") || -1; - } - set tabIndex(value) { - numericAttribute.set(this, "tabindex", value); - } - get slot() { - return stringAttribute.get(this, "slot"); - } - set slot(value) { - stringAttribute.set(this, "slot", value); - } - // </specialGetters> - // <contentRelated> - get innerText() { - const text = []; - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - if (next.nodeType === TEXT_NODE) { - text.push(next.textContent.replace(/\s+/g, " ")); - } else if (text.length && next[NEXT] != end && BLOCK_ELEMENTS.has(next.tagName)) { - text.push("\n"); - } - next = next[NEXT]; - } - return text.join(""); - } - /** - * @returns {String} - */ - get textContent() { - const text = []; - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - const nodeType = next.nodeType; - if (nodeType === TEXT_NODE || nodeType === CDATA_SECTION_NODE) - text.push(next.textContent); - next = next[NEXT]; - } - return text.join(""); - } - set textContent(text) { - this.replaceChildren(); - if (text != null && text !== "") - this.appendChild(new Text6(this.ownerDocument, text)); - } - get innerHTML() { - return getInnerHtml(this); - } - set innerHTML(html) { - setInnerHtml(this, html); - } - get outerHTML() { - return this.toString(); - } - set outerHTML(html) { - const template = this.ownerDocument.createElement(""); - template.innerHTML = html; - this.replaceWith(...template.childNodes); - } - // </contentRelated> - // <attributes> - get attributes() { - const attributes = new NamedNodeMap(this); - let next = this[NEXT]; - while (next.nodeType === ATTRIBUTE_NODE) { - attributes.push(next); - next = next[NEXT]; - } - return new Proxy(attributes, attributesHandler); - } - focus() { - this.dispatchEvent(new GlobalEvent("focus")); - } - getAttribute(name) { - if (name === "class") - return this.className; - const attribute2 = this.getAttributeNode(name); - return attribute2 && (ignoreCase(this) ? attribute2.value : escape3(attribute2.value)); - } - getAttributeNode(name) { - let next = this[NEXT]; - while (next.nodeType === ATTRIBUTE_NODE) { - if (next.name === name) - return next; - next = next[NEXT]; - } - return null; - } - getAttributeNames() { - const attributes = new NodeList(); - let next = this[NEXT]; - while (next.nodeType === ATTRIBUTE_NODE) { - attributes.push(next.name); - next = next[NEXT]; - } - return attributes; - } - hasAttribute(name) { - return !!this.getAttributeNode(name); - } - hasAttributes() { - return this[NEXT].nodeType === ATTRIBUTE_NODE; - } - removeAttribute(name) { - if (name === "class" && this[CLASS_LIST]) - this[CLASS_LIST].clear(); - let next = this[NEXT]; - while (next.nodeType === ATTRIBUTE_NODE) { - if (next.name === name) { - removeAttribute(this, next); - return; +// node_modules/telegram/events/Raw.js +var require_Raw = __commonJS({ + "node_modules/telegram/events/Raw.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Raw = void 0; + var common_1 = require_common3(); + var Raw = class extends common_1.EventBuilder { + constructor(params) { + super({ func: params.func }); + this.types = params.types; } - next = next[NEXT]; - } - } - removeAttributeNode(attribute2) { - let next = this[NEXT]; - while (next.nodeType === ATTRIBUTE_NODE) { - if (next === attribute2) { - removeAttribute(this, next); - return; + async resolve(client2) { + this.resolved = true; } - next = next[NEXT]; - } - } - setAttribute(name, value) { - if (name === "class") - this.className = value; - else { - const attribute2 = this.getAttributeNode(name); - if (attribute2) - attribute2.value = value; - else - setAttribute(this, new Attr(this.ownerDocument, name, value)); - } + build(update) { + return update; + } + filter(event) { + if (this.types) { + let correct = false; + for (const type of this.types) { + if (event instanceof type) { + correct = true; + break; + } + } + if (!correct) { + return; + } + } + return super.filter(event); + } + }; + exports2.Raw = Raw; } - setAttributeNode(attribute2) { - const { name } = attribute2; - const previously = this.getAttributeNode(name); - if (previously !== attribute2) { - if (previously) - this.removeAttributeNode(previously); - const { ownerElement } = attribute2; - if (ownerElement) - ownerElement.removeAttributeNode(attribute2); - setAttribute(this, attribute2); +}); + +// node_modules/telegram/client/updates.js +var require_updates = __commonJS({ + "node_modules/telegram/client/updates.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StopPropagation = void 0; + exports2.on = on; + exports2.addEventHandler = addEventHandler; + exports2.removeEventHandler = removeEventHandler; + exports2.listEventHandlers = listEventHandlers; + exports2.catchUp = catchUp; + exports2._handleUpdate = _handleUpdate; + exports2._processUpdate = _processUpdate; + exports2._dispatchUpdate = _dispatchUpdate; + exports2._updateLoop = _updateLoop; + var tl_1 = require_tl(); + var network_1 = require_network(); + var index_1 = require_telegram(); + var Helpers_1 = require_Helpers(); + var Logger_1 = require_Logger(); + var PING_INTERVAL = 9e3; + var PING_TIMEOUT = 1e4; + var PING_FAIL_ATTEMPTS = 3; + var PING_FAIL_INTERVAL = 100; + var PING_DISCONNECT_DELAY = 6e4; + var PING_INTERVAL_TO_WAKE_UP = 5e3; + var PING_WAKE_UP_TIMEOUT = 3e3; + var PING_WAKE_UP_WARNING_TIMEOUT = 1e3; + var StopPropagation = class extends Error { + }; + exports2.StopPropagation = StopPropagation; + function on(client2, event) { + return (f) => { + client2.addEventHandler(f, event); + return f; + }; } - return previously; - } - toggleAttribute(name, force) { - if (this.hasAttribute(name)) { - if (!force) { - this.removeAttribute(name); - return false; + function addEventHandler(client2, callback, event) { + if (event == void 0) { + const raw = require_Raw().Raw; + event = new raw({}); } - return true; - } else if (force || arguments.length === 1) { - this.setAttribute(name, ""); - return true; + event.client = client2; + client2._eventBuilders.push([event, callback]); } - return false; - } - // </attributes> - // <ShadowDOM> - get shadowRoot() { - if (shadowRoots.has(this)) { - const { mode, shadowRoot } = shadowRoots.get(this); - if (mode === "open") - return shadowRoot; + function removeEventHandler(client2, callback, event) { + client2._eventBuilders = client2._eventBuilders.filter(function(item) { + return item[0] !== event && item[1] !== callback; + }); } - return null; - } - attachShadow(init) { - if (shadowRoots.has(this)) - throw new Error("operation not supported"); - const shadowRoot = new ShadowRoot(this); - shadowRoots.set(this, { - mode: init.mode, - shadowRoot - }); - return shadowRoot; - } - // </ShadowDOM> - // <selectors> - matches(selectors) { - return matches(this, selectors); - } - closest(selectors) { - let parentElement2 = this; - const matches2 = prepareMatch(parentElement2, selectors); - while (parentElement2 && !matches2(parentElement2)) - parentElement2 = parentElement2.parentElement; - return parentElement2; - } - // </selectors> - // <insertAdjacent> - insertAdjacentElement(position, element) { - const { parentElement: parentElement2 } = this; - switch (position) { - case "beforebegin": - if (parentElement2) { - parentElement2.insertBefore(element, this); - break; - } - return null; - case "afterbegin": - this.insertBefore(element, this.firstChild); - break; - case "beforeend": - this.insertBefore(element, null); - break; - case "afterend": - if (parentElement2) { - parentElement2.insertBefore(element, this.nextSibling); - break; - } - return null; + function listEventHandlers(client2) { + return client2._eventBuilders; } - return element; - } - insertAdjacentHTML(position, html) { - this.insertAdjacentElement(position, htmlToFragment(this.ownerDocument, html)); - } - insertAdjacentText(position, text) { - const node = this.ownerDocument.createTextNode(text); - this.insertAdjacentElement(position, node); - } - // </insertAdjacent> - cloneNode(deep = false) { - const { ownerDocument, localName } = this; - const addNext = (next2) => { - next2.parentNode = parentNode; - knownAdjacent($next, next2); - $next = next2; - }; - const clone = create2(ownerDocument, this, localName); - let parentNode = clone, $next = clone; - let { [NEXT]: next, [END]: prev } = this; - while (next !== prev && (deep || next.nodeType === ATTRIBUTE_NODE)) { - switch (next.nodeType) { - case NODE_END: - knownAdjacent($next, parentNode[END]); - $next = parentNode[END]; - parentNode = parentNode.parentNode; - break; - case ELEMENT_NODE: { - const node = create2(ownerDocument, next, next.localName); - addNext(node); - parentNode = node; - break; - } - case ATTRIBUTE_NODE: { - const attr = next.cloneNode(deep); - attr.ownerElement = parentNode; - addNext(attr); - break; + function catchUp() { + } + function _handleUpdate(client2, update) { + if (typeof update === "number") { + if ([-1, 0, 1].includes(update)) { + _dispatchUpdate(client2, { + update: new network_1.UpdateConnectionState(update) + }); + return; } - case TEXT_NODE: - case COMMENT_NODE: - case CDATA_SECTION_NODE: - addNext(next.cloneNode(deep)); - break; } - next = next[NEXT]; - } - knownAdjacent($next, clone[END]); - return clone; - } - // <custom> - toString() { - const out = []; - const { [END]: end } = this; - let next = { [NEXT]: this }; - let isOpened = false; - do { - next = next[NEXT]; - switch (next.nodeType) { - case ATTRIBUTE_NODE: { - const attr = " " + next; - switch (attr) { - case " id": - case " class": - case " style": - break; - default: - out.push(attr); - } - break; + client2._entityCache.add(update); + client2.session.processEntities(update); + if (update instanceof tl_1.Api.Updates || update instanceof tl_1.Api.UpdatesCombined) { + const entities2 = /* @__PURE__ */ new Map(); + for (const x of [...update.users, ...update.chats]) { + entities2.set(index_1.utils.getPeerId(x), x); } - case NODE_END: { - const start = next[START]; - if (isOpened) { - if ("ownerSVGElement" in start) - out.push(" />"); - else if (isVoid(start)) - out.push(ignoreCase(start) ? ">" : " />"); - else - out.push(`></${start.localName}>`); - isOpened = false; - } else - out.push(`</${start.localName}>`); - break; + for (const u of update.updates) { + _processUpdate(client2, u, update.updates, entities2); } - case ELEMENT_NODE: - if (isOpened) - out.push(">"); - if (next.toString !== this.toString) { - out.push(next.toString()); - next = next[END]; - isOpened = false; - } else { - out.push(`<${next.localName}`); - isOpened = true; - } - break; - case TEXT_NODE: - case COMMENT_NODE: - case CDATA_SECTION_NODE: - out.push((isOpened ? ">" : "") + next); - isOpened = false; - break; + } else if (update instanceof tl_1.Api.UpdateShort) { + _processUpdate(client2, update.update, null); + } else { + _processUpdate(client2, update, null); } - } while (next !== end); - return out.join(""); - } - toJSON() { - const json2 = []; - elementAsJSON(this, json2); - return json2; - } - // </custom> - /* c8 ignore start */ - getAttributeNS(_, name) { - return this.getAttribute(name); - } - getElementsByTagNameNS(_, name) { - return this.getElementsByTagName(name); - } - hasAttributeNS(_, name) { - return this.hasAttribute(name); - } - removeAttributeNS(_, name) { - this.removeAttribute(name); - } - setAttributeNS(_, name, value) { - this.setAttribute(name, value); - } - setAttributeNodeNS(attr) { - return this.setAttributeNode(attr); - } - /* c8 ignore stop */ -}; - -// node_modules/linkedom/esm/svg/element.js -init_define_import_meta_env(); -var classNames = /* @__PURE__ */ new WeakMap(); -var handler3 = { - get(target, name) { - return target[name]; - }, - set(target, name, value) { - target[name] = value; - return true; - } -}; -var SVGElement = class extends Element2 { - constructor(ownerDocument, localName, ownerSVGElement = null) { - super(ownerDocument, localName); - this.ownerSVGElement = ownerSVGElement; - } - get className() { - if (!classNames.has(this)) - classNames.set(this, new Proxy({ baseVal: "", animVal: "" }, handler3)); - return classNames.get(this); - } - /* c8 ignore start */ - set className(value) { - const { classList } = this; - classList.clear(); - classList.add(...$String(value).split(/\s+/)); - } - /* c8 ignore stop */ - get namespaceURI() { - return "http://www.w3.org/2000/svg"; - } - getAttribute(name) { - return name === "class" ? [...this.classList].join(" ") : super.getAttribute(name); - } - setAttribute(name, value) { - if (name === "class") - this.className = value; - else if (name === "style") { - const { className } = this; - className.baseVal = className.animVal = value; - } - super.setAttribute(name, value); - } -}; - -// node_modules/linkedom/esm/shared/facades.js -var illegalConstructor = () => { - throw new TypeError("Illegal constructor"); -}; -function Attr2() { - illegalConstructor(); -} -setPrototypeOf(Attr2, Attr); -Attr2.prototype = Attr.prototype; -function CDATASection2() { - illegalConstructor(); -} -setPrototypeOf(CDATASection2, CDATASection); -CDATASection2.prototype = CDATASection.prototype; -function CharacterData2() { - illegalConstructor(); -} -setPrototypeOf(CharacterData2, CharacterData); -CharacterData2.prototype = CharacterData.prototype; -function Comment7() { - illegalConstructor(); -} -setPrototypeOf(Comment7, Comment3); -Comment7.prototype = Comment3.prototype; -function DocumentFragment2() { - illegalConstructor(); -} -setPrototypeOf(DocumentFragment2, DocumentFragment); -DocumentFragment2.prototype = DocumentFragment.prototype; -function DocumentType2() { - illegalConstructor(); -} -setPrototypeOf(DocumentType2, DocumentType); -DocumentType2.prototype = DocumentType.prototype; -function Element3() { - illegalConstructor(); -} -setPrototypeOf(Element3, Element2); -Element3.prototype = Element2.prototype; -function Node3() { - illegalConstructor(); -} -setPrototypeOf(Node3, Node2); -Node3.prototype = Node2.prototype; -function ShadowRoot2() { - illegalConstructor(); -} -setPrototypeOf(ShadowRoot2, ShadowRoot); -ShadowRoot2.prototype = ShadowRoot.prototype; -function Text7() { - illegalConstructor(); -} -setPrototypeOf(Text7, Text6); -Text7.prototype = Text6.prototype; -function SVGElement2() { - illegalConstructor(); -} -setPrototypeOf(SVGElement2, SVGElement); -SVGElement2.prototype = SVGElement.prototype; -var Facades = { - Attr: Attr2, - CDATASection: CDATASection2, - CharacterData: CharacterData2, - Comment: Comment7, - DocumentFragment: DocumentFragment2, - DocumentType: DocumentType2, - Element: Element3, - Node: Node3, - ShadowRoot: ShadowRoot2, - Text: Text7, - SVGElement: SVGElement2 -}; - -// node_modules/linkedom/esm/shared/html-classes.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/html/element.js -init_define_import_meta_env(); -var Level0 = /* @__PURE__ */ new WeakMap(); -var level0 = { - get(element, name) { - return Level0.has(element) && Level0.get(element)[name] || null; - }, - set(element, name, value) { - if (!Level0.has(element)) - Level0.set(element, {}); - const handlers = Level0.get(element); - const type = name.slice(2); - if (handlers[name]) - element.removeEventListener(type, handlers[name], false); - if (handlers[name] = value) - element.addEventListener(type, value, false); - } -}; -var HTMLElement2 = class extends Element2 { - static get observedAttributes() { - return []; - } - constructor(ownerDocument = null, localName = "") { - super(ownerDocument, localName); - const ownerLess = !ownerDocument; - let options; - if (ownerLess) { - const { constructor: Class } = this; - if (!Classes.has(Class)) - throw new Error("unable to initialize this Custom Element"); - ({ ownerDocument, localName, options } = Classes.get(Class)); - } - if (ownerDocument[UPGRADE]) { - const { element, values } = ownerDocument[UPGRADE]; - ownerDocument[UPGRADE] = null; - for (const [key2, value] of values) - element[key2] = value; - return element; - } - if (ownerLess) { - this.ownerDocument = this[END].ownerDocument = ownerDocument; - this.localName = localName; - customElements.set(this, { connected: false }); - if (options.is) - this.setAttribute("is", options.is); - } - } - /* c8 ignore start */ - /* TODO: what about these? - offsetHeight - offsetLeft - offsetParent - offsetTop - offsetWidth - */ - blur() { - this.dispatchEvent(new GlobalEvent("blur")); - } - click() { - const clickEvent = new GlobalEvent("click", { bubbles: true, cancelable: true }); - clickEvent.button = 0; - this.dispatchEvent(clickEvent); - } - // Boolean getters - get accessKeyLabel() { - const { accessKey } = this; - return accessKey && `Alt+Shift+${accessKey}`; - } - get isContentEditable() { - return this.hasAttribute("contenteditable"); - } - // Boolean Accessors - get contentEditable() { - return booleanAttribute.get(this, "contenteditable"); - } - set contentEditable(value) { - booleanAttribute.set(this, "contenteditable", value); - } - get draggable() { - return booleanAttribute.get(this, "draggable"); - } - set draggable(value) { - booleanAttribute.set(this, "draggable", value); - } - get hidden() { - return booleanAttribute.get(this, "hidden"); - } - set hidden(value) { - booleanAttribute.set(this, "hidden", value); - } - get spellcheck() { - return booleanAttribute.get(this, "spellcheck"); - } - set spellcheck(value) { - booleanAttribute.set(this, "spellcheck", value); - } - // String Accessors - get accessKey() { - return stringAttribute.get(this, "accesskey"); - } - set accessKey(value) { - stringAttribute.set(this, "accesskey", value); - } - get dir() { - return stringAttribute.get(this, "dir"); - } - set dir(value) { - stringAttribute.set(this, "dir", value); - } - get lang() { - return stringAttribute.get(this, "lang"); - } - set lang(value) { - stringAttribute.set(this, "lang", value); - } - get title() { - return stringAttribute.get(this, "title"); - } - set title(value) { - stringAttribute.set(this, "title", value); - } - // DOM Level 0 - get onabort() { - return level0.get(this, "onabort"); - } - set onabort(value) { - level0.set(this, "onabort", value); - } - get onblur() { - return level0.get(this, "onblur"); - } - set onblur(value) { - level0.set(this, "onblur", value); - } - get oncancel() { - return level0.get(this, "oncancel"); - } - set oncancel(value) { - level0.set(this, "oncancel", value); - } - get oncanplay() { - return level0.get(this, "oncanplay"); - } - set oncanplay(value) { - level0.set(this, "oncanplay", value); - } - get oncanplaythrough() { - return level0.get(this, "oncanplaythrough"); - } - set oncanplaythrough(value) { - level0.set(this, "oncanplaythrough", value); - } - get onchange() { - return level0.get(this, "onchange"); - } - set onchange(value) { - level0.set(this, "onchange", value); - } - get onclick() { - return level0.get(this, "onclick"); - } - set onclick(value) { - level0.set(this, "onclick", value); - } - get onclose() { - return level0.get(this, "onclose"); - } - set onclose(value) { - level0.set(this, "onclose", value); - } - get oncontextmenu() { - return level0.get(this, "oncontextmenu"); - } - set oncontextmenu(value) { - level0.set(this, "oncontextmenu", value); - } - get oncuechange() { - return level0.get(this, "oncuechange"); - } - set oncuechange(value) { - level0.set(this, "oncuechange", value); - } - get ondblclick() { - return level0.get(this, "ondblclick"); - } - set ondblclick(value) { - level0.set(this, "ondblclick", value); - } - get ondrag() { - return level0.get(this, "ondrag"); - } - set ondrag(value) { - level0.set(this, "ondrag", value); - } - get ondragend() { - return level0.get(this, "ondragend"); - } - set ondragend(value) { - level0.set(this, "ondragend", value); - } - get ondragenter() { - return level0.get(this, "ondragenter"); - } - set ondragenter(value) { - level0.set(this, "ondragenter", value); - } - get ondragleave() { - return level0.get(this, "ondragleave"); - } - set ondragleave(value) { - level0.set(this, "ondragleave", value); - } - get ondragover() { - return level0.get(this, "ondragover"); - } - set ondragover(value) { - level0.set(this, "ondragover", value); - } - get ondragstart() { - return level0.get(this, "ondragstart"); - } - set ondragstart(value) { - level0.set(this, "ondragstart", value); - } - get ondrop() { - return level0.get(this, "ondrop"); - } - set ondrop(value) { - level0.set(this, "ondrop", value); - } - get ondurationchange() { - return level0.get(this, "ondurationchange"); - } - set ondurationchange(value) { - level0.set(this, "ondurationchange", value); - } - get onemptied() { - return level0.get(this, "onemptied"); - } - set onemptied(value) { - level0.set(this, "onemptied", value); - } - get onended() { - return level0.get(this, "onended"); - } - set onended(value) { - level0.set(this, "onended", value); - } - get onerror() { - return level0.get(this, "onerror"); - } - set onerror(value) { - level0.set(this, "onerror", value); - } - get onfocus() { - return level0.get(this, "onfocus"); - } - set onfocus(value) { - level0.set(this, "onfocus", value); - } - get oninput() { - return level0.get(this, "oninput"); - } - set oninput(value) { - level0.set(this, "oninput", value); - } - get oninvalid() { - return level0.get(this, "oninvalid"); - } - set oninvalid(value) { - level0.set(this, "oninvalid", value); - } - get onkeydown() { - return level0.get(this, "onkeydown"); - } - set onkeydown(value) { - level0.set(this, "onkeydown", value); - } - get onkeypress() { - return level0.get(this, "onkeypress"); - } - set onkeypress(value) { - level0.set(this, "onkeypress", value); - } - get onkeyup() { - return level0.get(this, "onkeyup"); - } - set onkeyup(value) { - level0.set(this, "onkeyup", value); - } - get onload() { - return level0.get(this, "onload"); - } - set onload(value) { - level0.set(this, "onload", value); - } - get onloadeddata() { - return level0.get(this, "onloadeddata"); - } - set onloadeddata(value) { - level0.set(this, "onloadeddata", value); - } - get onloadedmetadata() { - return level0.get(this, "onloadedmetadata"); - } - set onloadedmetadata(value) { - level0.set(this, "onloadedmetadata", value); - } - get onloadstart() { - return level0.get(this, "onloadstart"); - } - set onloadstart(value) { - level0.set(this, "onloadstart", value); - } - get onmousedown() { - return level0.get(this, "onmousedown"); - } - set onmousedown(value) { - level0.set(this, "onmousedown", value); - } - get onmouseenter() { - return level0.get(this, "onmouseenter"); - } - set onmouseenter(value) { - level0.set(this, "onmouseenter", value); - } - get onmouseleave() { - return level0.get(this, "onmouseleave"); - } - set onmouseleave(value) { - level0.set(this, "onmouseleave", value); - } - get onmousemove() { - return level0.get(this, "onmousemove"); - } - set onmousemove(value) { - level0.set(this, "onmousemove", value); - } - get onmouseout() { - return level0.get(this, "onmouseout"); - } - set onmouseout(value) { - level0.set(this, "onmouseout", value); - } - get onmouseover() { - return level0.get(this, "onmouseover"); - } - set onmouseover(value) { - level0.set(this, "onmouseover", value); - } - get onmouseup() { - return level0.get(this, "onmouseup"); - } - set onmouseup(value) { - level0.set(this, "onmouseup", value); - } - get onmousewheel() { - return level0.get(this, "onmousewheel"); - } - set onmousewheel(value) { - level0.set(this, "onmousewheel", value); - } - get onpause() { - return level0.get(this, "onpause"); - } - set onpause(value) { - level0.set(this, "onpause", value); - } - get onplay() { - return level0.get(this, "onplay"); - } - set onplay(value) { - level0.set(this, "onplay", value); - } - get onplaying() { - return level0.get(this, "onplaying"); - } - set onplaying(value) { - level0.set(this, "onplaying", value); - } - get onprogress() { - return level0.get(this, "onprogress"); - } - set onprogress(value) { - level0.set(this, "onprogress", value); - } - get onratechange() { - return level0.get(this, "onratechange"); - } - set onratechange(value) { - level0.set(this, "onratechange", value); - } - get onreset() { - return level0.get(this, "onreset"); - } - set onreset(value) { - level0.set(this, "onreset", value); - } - get onresize() { - return level0.get(this, "onresize"); - } - set onresize(value) { - level0.set(this, "onresize", value); - } - get onscroll() { - return level0.get(this, "onscroll"); - } - set onscroll(value) { - level0.set(this, "onscroll", value); - } - get onseeked() { - return level0.get(this, "onseeked"); - } - set onseeked(value) { - level0.set(this, "onseeked", value); - } - get onseeking() { - return level0.get(this, "onseeking"); - } - set onseeking(value) { - level0.set(this, "onseeking", value); - } - get onselect() { - return level0.get(this, "onselect"); - } - set onselect(value) { - level0.set(this, "onselect", value); - } - get onshow() { - return level0.get(this, "onshow"); - } - set onshow(value) { - level0.set(this, "onshow", value); - } - get onstalled() { - return level0.get(this, "onstalled"); - } - set onstalled(value) { - level0.set(this, "onstalled", value); - } - get onsubmit() { - return level0.get(this, "onsubmit"); - } - set onsubmit(value) { - level0.set(this, "onsubmit", value); - } - get onsuspend() { - return level0.get(this, "onsuspend"); - } - set onsuspend(value) { - level0.set(this, "onsuspend", value); - } - get ontimeupdate() { - return level0.get(this, "ontimeupdate"); - } - set ontimeupdate(value) { - level0.set(this, "ontimeupdate", value); - } - get ontoggle() { - return level0.get(this, "ontoggle"); - } - set ontoggle(value) { - level0.set(this, "ontoggle", value); - } - get onvolumechange() { - return level0.get(this, "onvolumechange"); - } - set onvolumechange(value) { - level0.set(this, "onvolumechange", value); - } - get onwaiting() { - return level0.get(this, "onwaiting"); - } - set onwaiting(value) { - level0.set(this, "onwaiting", value); - } - get onauxclick() { - return level0.get(this, "onauxclick"); - } - set onauxclick(value) { - level0.set(this, "onauxclick", value); - } - get ongotpointercapture() { - return level0.get(this, "ongotpointercapture"); - } - set ongotpointercapture(value) { - level0.set(this, "ongotpointercapture", value); - } - get onlostpointercapture() { - return level0.get(this, "onlostpointercapture"); - } - set onlostpointercapture(value) { - level0.set(this, "onlostpointercapture", value); - } - get onpointercancel() { - return level0.get(this, "onpointercancel"); - } - set onpointercancel(value) { - level0.set(this, "onpointercancel", value); - } - get onpointerdown() { - return level0.get(this, "onpointerdown"); - } - set onpointerdown(value) { - level0.set(this, "onpointerdown", value); - } - get onpointerenter() { - return level0.get(this, "onpointerenter"); - } - set onpointerenter(value) { - level0.set(this, "onpointerenter", value); - } - get onpointerleave() { - return level0.get(this, "onpointerleave"); - } - set onpointerleave(value) { - level0.set(this, "onpointerleave", value); - } - get onpointermove() { - return level0.get(this, "onpointermove"); - } - set onpointermove(value) { - level0.set(this, "onpointermove", value); - } - get onpointerout() { - return level0.get(this, "onpointerout"); - } - set onpointerout(value) { - level0.set(this, "onpointerout", value); - } - get onpointerover() { - return level0.get(this, "onpointerover"); - } - set onpointerover(value) { - level0.set(this, "onpointerover", value); - } - get onpointerup() { - return level0.get(this, "onpointerup"); - } - set onpointerup(value) { - level0.set(this, "onpointerup", value); - } - /* c8 ignore stop */ -}; - -// node_modules/linkedom/esm/html/template-element.js -init_define_import_meta_env(); -var tagName = "template"; -var HTMLTemplateElement = class extends HTMLElement2 { - constructor(ownerDocument) { - super(ownerDocument, tagName); - const content = this.ownerDocument.createDocumentFragment(); - (this[CONTENT] = content)[PRIVATE] = this; - } - get content() { - if (this.hasChildNodes() && !this[CONTENT].hasChildNodes()) { - for (const node of this.childNodes) - this[CONTENT].appendChild(node.cloneNode(true)); - } - return this[CONTENT]; - } -}; -registerHTMLClass(tagName, HTMLTemplateElement); - -// node_modules/linkedom/esm/html/html-element.js -init_define_import_meta_env(); -var HTMLHtmlElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "html") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/script-element.js -init_define_import_meta_env(); - -// node_modules/linkedom/esm/html/text-element.js -init_define_import_meta_env(); -var { toString } = HTMLElement2.prototype; -var TextElement = class extends HTMLElement2 { - get innerHTML() { - return this.textContent; - } - set innerHTML(html) { - this.textContent = html; - } - toString() { - const outerHTML = toString.call(this.cloneNode()); - return outerHTML.replace("><", () => `>${this.textContent}<`); - } -}; - -// node_modules/linkedom/esm/html/script-element.js -var tagName2 = "script"; -var HTMLScriptElement = class extends TextElement { - constructor(ownerDocument, localName = tagName2) { - super(ownerDocument, localName); - } - get type() { - return stringAttribute.get(this, "type"); - } - set type(value) { - stringAttribute.set(this, "type", value); - } - get src() { - return stringAttribute.get(this, "src"); - } - set src(value) { - stringAttribute.set(this, "src", value); - } - get defer() { - return booleanAttribute.get(this, "defer"); - } - set defer(value) { - booleanAttribute.set(this, "defer", value); - } - get crossOrigin() { - return stringAttribute.get(this, "crossorigin"); - } - set crossOrigin(value) { - stringAttribute.set(this, "crossorigin", value); - } - get nomodule() { - return booleanAttribute.get(this, "nomodule"); - } - set nomodule(value) { - booleanAttribute.set(this, "nomodule", value); - } - get referrerPolicy() { - return stringAttribute.get(this, "referrerpolicy"); - } - set referrerPolicy(value) { - stringAttribute.set(this, "referrerpolicy", value); - } - get nonce() { - return stringAttribute.get(this, "nonce"); - } - set nonce(value) { - stringAttribute.set(this, "nonce", value); - } - get async() { - return booleanAttribute.get(this, "async"); - } - set async(value) { - booleanAttribute.set(this, "async", value); - } - get text() { - return this.textContent; - } - set text(content) { - this.textContent = content; - } -}; -registerHTMLClass(tagName2, HTMLScriptElement); - -// node_modules/linkedom/esm/html/frame-element.js -init_define_import_meta_env(); -var HTMLFrameElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "frame") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/i-frame-element.js -init_define_import_meta_env(); -var tagName3 = "iframe"; -var HTMLIFrameElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName3) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get src() { - return stringAttribute.get(this, "src"); - } - set src(value) { - stringAttribute.set(this, "src", value); - } - get srcdoc() { - return stringAttribute.get(this, "srcdoc"); - } - set srcdoc(value) { - stringAttribute.set(this, "srcdoc", value); - } - get name() { - return stringAttribute.get(this, "name"); - } - set name(value) { - stringAttribute.set(this, "name", value); - } - get allow() { - return stringAttribute.get(this, "allow"); - } - set allow(value) { - stringAttribute.set(this, "allow", value); - } - get allowFullscreen() { - return booleanAttribute.get(this, "allowfullscreen"); - } - set allowFullscreen(value) { - booleanAttribute.set(this, "allowfullscreen", value); - } - get referrerPolicy() { - return stringAttribute.get(this, "referrerpolicy"); - } - set referrerPolicy(value) { - stringAttribute.set(this, "referrerpolicy", value); - } - get loading() { - return stringAttribute.get(this, "loading"); - } - set loading(value) { - stringAttribute.set(this, "loading", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName3, HTMLIFrameElement); - -// node_modules/linkedom/esm/html/object-element.js -init_define_import_meta_env(); -var HTMLObjectElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "object") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/head-element.js -init_define_import_meta_env(); -var HTMLHeadElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "head") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/body-element.js -init_define_import_meta_env(); -var HTMLBodyElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "body") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/style-element.js -init_define_import_meta_env(); -var import_cssom = __toESM(require_lib5(), 1); -var tagName4 = "style"; -var HTMLStyleElement = class extends TextElement { - constructor(ownerDocument, localName = tagName4) { - super(ownerDocument, localName); - this[SHEET] = null; - } - get sheet() { - const sheet = this[SHEET]; - if (sheet !== null) { - return sheet; } - return this[SHEET] = (0, import_cssom.parse)(this.textContent); - } - get innerHTML() { - return super.innerHTML || ""; - } - set innerHTML(value) { - super.textContent = value; - this[SHEET] = null; - } - get innerText() { - return super.innerText || ""; - } - set innerText(value) { - super.textContent = value; - this[SHEET] = null; - } - get textContent() { - return super.textContent || ""; - } - set textContent(value) { - super.textContent = value; - this[SHEET] = null; - } -}; -registerHTMLClass(tagName4, HTMLStyleElement); - -// node_modules/linkedom/esm/html/time-element.js -init_define_import_meta_env(); -var HTMLTimeElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "time") { - super(ownerDocument, localName); - } - /** - * @type {string} - */ - get dateTime() { - return stringAttribute.get(this, "datetime"); - } - set dateTime(value) { - stringAttribute.set(this, "datetime", value); - } -}; -registerHTMLClass("time", HTMLTimeElement); - -// node_modules/linkedom/esm/html/field-set-element.js -init_define_import_meta_env(); -var HTMLFieldSetElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "fieldset") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/embed-element.js -init_define_import_meta_env(); -var HTMLEmbedElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "embed") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/hr-element.js -init_define_import_meta_env(); -var HTMLHRElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "hr") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/progress-element.js -init_define_import_meta_env(); -var HTMLProgressElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "progress") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/paragraph-element.js -init_define_import_meta_env(); -var HTMLParagraphElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "p") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/table-element.js -init_define_import_meta_env(); -var HTMLTableElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "table") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/frame-set-element.js -init_define_import_meta_env(); -var HTMLFrameSetElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "frameset") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/li-element.js -init_define_import_meta_env(); -var HTMLLIElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "li") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/base-element.js -init_define_import_meta_env(); -var HTMLBaseElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "base") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/data-list-element.js -init_define_import_meta_env(); -var HTMLDataListElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "datalist") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/input-element.js -init_define_import_meta_env(); -var tagName5 = "input"; -var HTMLInputElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName5) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get autofocus() { - return booleanAttribute.get(this, "autofocus") || -1; - } - set autofocus(value) { - booleanAttribute.set(this, "autofocus", value); - } - get disabled() { - return booleanAttribute.get(this, "disabled"); - } - set disabled(value) { - booleanAttribute.set(this, "disabled", value); - } - get name() { - return this.getAttribute("name"); - } - set name(value) { - this.setAttribute("name", value); - } - get placeholder() { - return this.getAttribute("placeholder"); - } - set placeholder(value) { - this.setAttribute("placeholder", value); - } - get type() { - return this.getAttribute("type"); - } - set type(value) { - this.setAttribute("type", value); - } - get value() { - return stringAttribute.get(this, "value"); - } - set value(value) { - stringAttribute.set(this, "value", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName5, HTMLInputElement); - -// node_modules/linkedom/esm/html/param-element.js -init_define_import_meta_env(); -var HTMLParamElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "param") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/media-element.js -init_define_import_meta_env(); -var HTMLMediaElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "media") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/audio-element.js -init_define_import_meta_env(); -var HTMLAudioElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "audio") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/heading-element.js -init_define_import_meta_env(); -var tagName6 = "h1"; -var HTMLHeadingElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName6) { - super(ownerDocument, localName); - } -}; -registerHTMLClass([tagName6, "h2", "h3", "h4", "h5", "h6"], HTMLHeadingElement); - -// node_modules/linkedom/esm/html/directory-element.js -init_define_import_meta_env(); -var HTMLDirectoryElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "dir") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/quote-element.js -init_define_import_meta_env(); -var HTMLQuoteElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "quote") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/canvas-element.js -init_define_import_meta_env(); -var import_canvas = __toESM(require_canvas(), 1); -var { createCanvas } = import_canvas.default; -var tagName7 = "canvas"; -var HTMLCanvasElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName7) { - super(ownerDocument, localName); - this[IMAGE] = createCanvas(300, 150); - } - get width() { - return this[IMAGE].width; - } - set width(value) { - numericAttribute.set(this, "width", value); - this[IMAGE].width = value; - } - get height() { - return this[IMAGE].height; - } - set height(value) { - numericAttribute.set(this, "height", value); - this[IMAGE].height = value; - } - getContext(type) { - return this[IMAGE].getContext(type); - } - toDataURL(...args) { - return this[IMAGE].toDataURL(...args); - } -}; -registerHTMLClass(tagName7, HTMLCanvasElement); - -// node_modules/linkedom/esm/html/legend-element.js -init_define_import_meta_env(); -var HTMLLegendElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "legend") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/option-element.js -init_define_import_meta_env(); -var tagName8 = "option"; -var HTMLOptionElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName8) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get value() { - return stringAttribute.get(this, "value"); - } - set value(value) { - stringAttribute.set(this, "value", value); - } - /* c8 ignore stop */ - get selected() { - return booleanAttribute.get(this, "selected"); - } - set selected(value) { - const option = this.parentElement?.querySelector("option[selected]"); - if (option && option !== this) - option.selected = false; - booleanAttribute.set(this, "selected", value); - } -}; -registerHTMLClass(tagName8, HTMLOptionElement); - -// node_modules/linkedom/esm/html/span-element.js -init_define_import_meta_env(); -var HTMLSpanElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "span") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/meter-element.js -init_define_import_meta_env(); -var HTMLMeterElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "meter") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/video-element.js -init_define_import_meta_env(); -var HTMLVideoElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "video") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/table-cell-element.js -init_define_import_meta_env(); -var HTMLTableCellElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "td") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/title-element.js -init_define_import_meta_env(); -var tagName9 = "title"; -var HTMLTitleElement = class extends TextElement { - constructor(ownerDocument, localName = tagName9) { - super(ownerDocument, localName); - } -}; -registerHTMLClass(tagName9, HTMLTitleElement); - -// node_modules/linkedom/esm/html/output-element.js -init_define_import_meta_env(); -var HTMLOutputElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "output") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/table-row-element.js -init_define_import_meta_env(); -var HTMLTableRowElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "tr") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/data-element.js -init_define_import_meta_env(); -var HTMLDataElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "data") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/menu-element.js -init_define_import_meta_env(); -var HTMLMenuElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "menu") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/select-element.js -init_define_import_meta_env(); -var tagName10 = "select"; -var HTMLSelectElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName10) { - super(ownerDocument, localName); - } - get options() { - let children = new NodeList(); - let { firstElementChild } = this; - while (firstElementChild) { - if (firstElementChild.tagName === "OPTGROUP") - children.push(...firstElementChild.children); - else - children.push(firstElementChild); - firstElementChild = firstElementChild.nextElementSibling; + function _processUpdate(client2, update, others, entities2) { + update._entities = entities2 || /* @__PURE__ */ new Map(); + const args = { + update, + others + }; + _dispatchUpdate(client2, args); + } + async function _dispatchUpdate(client2, args) { + for (const [builder, callback] of client2._eventBuilders) { + if (!builder || !callback) { + continue; + } + if (!builder.resolved) { + await builder.resolve(client2); + } + let event = args.update; + if (event) { + if (!client2._selfInputPeer) { + try { + await client2.getMe(true); + } catch (e) { + } + } + if (!(event instanceof network_1.UpdateConnectionState)) { + } + event = builder.build(event, callback, client2._selfInputPeer ? (0, Helpers_1.returnBigInt)(client2._selfInputPeer.userId) : void 0); + if (event) { + event._client = client2; + if ("_eventName" in event) { + event._setClient(client2); + event.originalUpdate = args.update; + event._entities = args.update._entities; + } + const filter2 = await builder.filter(event); + if (!filter2) { + continue; + } + try { + await callback(event); + } catch (e) { + if (e instanceof StopPropagation) { + break; + } + if (client2._errorHandler) { + await client2._errorHandler(e); + } + if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); + } + } + } + } + } + } + async function _updateLoop(client2) { + let lastPongAt; + while (!client2._destroyed) { + await (0, Helpers_1.sleep)(PING_INTERVAL, true); + if (client2._destroyed) + break; + if (client2._sender.isReconnecting || client2._isSwitchingDc) { + lastPongAt = void 0; + continue; + } + try { + const ping = () => { + return client2._sender.send(new tl_1.Api.PingDelayDisconnect({ + pingId: (0, Helpers_1.returnBigInt)((0, Helpers_1.getRandomInt)(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)), + disconnectDelay: PING_DISCONNECT_DELAY + })); + }; + const pingAt = Date.now(); + const lastInterval = lastPongAt ? pingAt - lastPongAt : void 0; + if (!lastInterval || lastInterval < PING_INTERVAL_TO_WAKE_UP) { + await attempts(() => timeout(ping, PING_TIMEOUT), PING_FAIL_ATTEMPTS, PING_FAIL_INTERVAL); + } else { + let wakeUpWarningTimeout = setTimeout(() => { + _handleUpdate(client2, network_1.UpdateConnectionState.disconnected); + wakeUpWarningTimeout = void 0; + }, PING_WAKE_UP_WARNING_TIMEOUT); + await timeout(ping, PING_WAKE_UP_TIMEOUT); + if (wakeUpWarningTimeout) { + clearTimeout(wakeUpWarningTimeout); + wakeUpWarningTimeout = void 0; + } + _handleUpdate(client2, network_1.UpdateConnectionState.connected); + } + lastPongAt = Date.now(); + } catch (err) { + if (client2._errorHandler) { + await client2._errorHandler(err); + } + if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(err); + } + lastPongAt = void 0; + if (client2._sender.isReconnecting || client2._isSwitchingDc) { + continue; + } + client2._sender.reconnect(); + } + if (Date.now() - (client2._lastRequest || 0) > 30 * 60 * 1e3) { + try { + await client2.invoke(new tl_1.Api.updates.GetState()); + } catch (e) { + } + lastPongAt = void 0; + } + } + await client2.disconnect(); + } + async function attempts(cb, times, pause) { + for (let i = 0; i < times; i++) { + try { + return await cb(); + } catch (err) { + if (i === times - 1) { + throw err; + } + await (0, Helpers_1.sleep)(pause); + } + } + return void 0; + } + function timeout(cb, ms) { + let isResolved = false; + return Promise.race([ + cb(), + (0, Helpers_1.sleep)(ms).then(() => isResolved ? void 0 : Promise.reject(new Error("TIMEOUT"))) + ]).finally(() => { + isResolved = true; + }); } - return children; - } - /* c8 ignore start */ - get disabled() { - return booleanAttribute.get(this, "disabled"); - } - set disabled(value) { - booleanAttribute.set(this, "disabled", value); - } - get name() { - return this.getAttribute("name"); - } - set name(value) { - this.setAttribute("name", value); - } - /* c8 ignore stop */ - get value() { - return this.querySelector("option[selected]")?.value; - } -}; -registerHTMLClass(tagName10, HTMLSelectElement); - -// node_modules/linkedom/esm/html/br-element.js -init_define_import_meta_env(); -var HTMLBRElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "br") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/button-element.js -init_define_import_meta_env(); -var tagName11 = "button"; -var HTMLButtonElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName11) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get disabled() { - return booleanAttribute.get(this, "disabled"); - } - set disabled(value) { - booleanAttribute.set(this, "disabled", value); - } - get name() { - return this.getAttribute("name"); - } - set name(value) { - this.setAttribute("name", value); - } - get type() { - return this.getAttribute("type"); - } - set type(value) { - this.setAttribute("type", value); } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName11, HTMLButtonElement); +}); -// node_modules/linkedom/esm/html/map-element.js -init_define_import_meta_env(); -var HTMLMapElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "map") { - super(ownerDocument, localName); +// node_modules/telegram/client/chats.js +var require_chats = __commonJS({ + "node_modules/telegram/client/chats.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._ParticipantsIter = void 0; + exports2.iterParticipants = iterParticipants; + exports2.getParticipants = getParticipants; + exports2.kickParticipant = kickParticipant; + var Helpers_1 = require_Helpers(); + var requestIter_1 = require_requestIter(); + var __1 = require_telegram(); + var tl_1 = require_tl(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var inspect_1 = require_inspect(); + var Utils_1 = require_Utils(); + var _MAX_PARTICIPANTS_CHUNK_SIZE = 200; + var _MAX_ADMIN_LOG_CHUNK_SIZE = 100; + var _ChatAction = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + constructor(client2, chat, action, params = { + delay: 4, + autoCancel: true + }) { + this._client = client2; + this._chat = chat; + this._action = action; + this._delay = params.delay; + this.autoCancel = params.autoCancel; + this._request = void 0; + this._task = null; + this._running = false; + } + async start() { + this._request = new tl_1.Api.messages.SetTyping({ + peer: this._chat, + action: this._action + }); + this._running = true; + this._update(); + } + async stop() { + this._running = false; + if (this.autoCancel) { + await this._client.invoke(new tl_1.Api.messages.SetTyping({ + peer: this._chat, + action: new tl_1.Api.SendMessageCancelAction() + })); + } + } + async _update() { + while (this._running) { + if (this._request != void 0) { + await this._client.invoke(this._request); + } + await (0, Helpers_1.sleep)(this._delay * 1e3); + } + } + progress(current, total) { + if ("progress" in this._action) { + this._action.progress = 100 * Math.round(current / total); + } + } + }; + _ChatAction._str_mapping = { + typing: new tl_1.Api.SendMessageTypingAction(), + contact: new tl_1.Api.SendMessageChooseContactAction(), + game: new tl_1.Api.SendMessageGamePlayAction(), + location: new tl_1.Api.SendMessageGeoLocationAction(), + "record-audio": new tl_1.Api.SendMessageRecordAudioAction(), + "record-voice": new tl_1.Api.SendMessageRecordAudioAction(), + //alias + "record-round": new tl_1.Api.SendMessageRecordRoundAction(), + "record-video": new tl_1.Api.SendMessageRecordVideoAction(), + audio: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), + voice: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), + // alias + song: new tl_1.Api.SendMessageUploadAudioAction({ progress: 1 }), + // alias + round: new tl_1.Api.SendMessageUploadRoundAction({ progress: 1 }), + video: new tl_1.Api.SendMessageUploadVideoAction({ progress: 1 }), + photo: new tl_1.Api.SendMessageUploadPhotoAction({ progress: 1 }), + document: new tl_1.Api.SendMessageUploadDocumentAction({ progress: 1 }), + file: new tl_1.Api.SendMessageUploadDocumentAction({ progress: 1 }), + // alias + cancel: new tl_1.Api.SendMessageCancelAction() + }; + var _ParticipantsIter = class extends requestIter_1.RequestIter { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + async _init({ entity, filter: filter2, offset, search, showTotal }) { + var _a, _b; + if (!offset) { + offset = 0; + } + if (filter2 && filter2.constructor === Function) { + if ([ + tl_1.Api.ChannelParticipantsBanned, + tl_1.Api.ChannelParticipantsKicked, + tl_1.Api.ChannelParticipantsSearch, + tl_1.Api.ChannelParticipantsContacts + ].includes(filter2)) { + filter2 = new filter2({ + q: "" + }); + } else { + filter2 = new filter2(); + } + } + entity = await this.client.getInputEntity(entity); + const ty = __1.helpers._entityType(entity); + if (search && (filter2 || ty != __1.helpers._EntityType.CHANNEL)) { + search = search.toLowerCase(); + this.filterEntity = (entity2) => { + return __1.utils.getDisplayName(entity2).toLowerCase().includes(search) || ("username" in entity2 ? entity2.username || "" : "").toLowerCase().includes(search); + }; + } else { + this.filterEntity = (entity2) => true; + } + this.requests = []; + if (ty == __1.helpers._EntityType.CHANNEL) { + if (showTotal) { + const channel = await this.client.invoke(new tl_1.Api.channels.GetFullChannel({ + channel: entity + })); + if (!(channel.fullChat instanceof tl_1.Api.ChatFull)) { + this.total = channel.fullChat.participantsCount; + } + } + if (this.total && this.total <= 0) { + return false; + } + this.requests.push(new tl_1.Api.channels.GetParticipants({ + channel: entity, + filter: filter2 || new tl_1.Api.ChannelParticipantsSearch({ + q: search || "" + }), + offset, + limit: _MAX_PARTICIPANTS_CHUNK_SIZE, + hash: big_integer_1.default.zero + })); + } else if (ty == __1.helpers._EntityType.CHAT) { + if (!("chatId" in entity)) { + throw new Error("Found chat without id " + JSON.stringify(entity)); + } + const full = await this.client.invoke(new tl_1.Api.messages.GetFullChat({ + chatId: entity.chatId + })); + if (full.fullChat instanceof tl_1.Api.ChatFull) { + if (!(full.fullChat.participants instanceof tl_1.Api.ChatParticipantsForbidden)) { + this.total = full.fullChat.participants.participants.length; + } else { + this.total = 0; + return false; + } + const users = /* @__PURE__ */ new Map(); + for (const user of full.users) { + users.set(user.id.toString(), user); + } + for (const participant of full.fullChat.participants.participants) { + const user = users.get(participant.userId.toString()); + if (!this.filterEntity(user)) { + continue; + } + user.participant = participant; + (_a = this.buffer) === null || _a === void 0 ? void 0 : _a.push(user); + } + return true; + } + } else { + this.total = 1; + if (this.limit != 0) { + const user = await this.client.getEntity(entity); + if (this.filterEntity(user)) { + user.participant = void 0; + (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(user); + } + } + return true; + } + } + async _loadNextChunk() { + var _a, _b; + if (!((_a = this.requests) === null || _a === void 0 ? void 0 : _a.length)) { + return true; + } + this.requests[0].limit = Math.min(this.limit - this.requests[0].offset, _MAX_PARTICIPANTS_CHUNK_SIZE); + const results = []; + for (const request of this.requests) { + results.push(await this.client.invoke(request)); + } + for (let i = this.requests.length - 1; i >= 0; i--) { + const participants = results[i]; + if (participants instanceof tl_1.Api.channels.ChannelParticipantsNotModified || !participants.users.length) { + this.requests.splice(i, 1); + continue; + } + this.requests[i].offset += participants.participants.length; + const users = /* @__PURE__ */ new Map(); + for (const user of participants.users) { + users.set(user.id.toString(), user); + } + for (const participant of participants.participants) { + if (!("userId" in participant)) { + continue; + } + const user = users.get(participant.userId.toString()); + if (this.filterEntity && !this.filterEntity(user)) { + continue; + } + user.participant = participant; + (_b = this.buffer) === null || _b === void 0 ? void 0 : _b.push(user); + } + } + return void 0; + } + [Symbol.asyncIterator]() { + return super[Symbol.asyncIterator](); + } + }; + exports2._ParticipantsIter = _ParticipantsIter; + var _AdminLogIter = class extends requestIter_1.RequestIter { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + async _init(entity, searchArgs, filterArgs) { + let eventsFilter = void 0; + if (filterArgs && Object.values(filterArgs).find((element) => element === true)) { + eventsFilter = new tl_1.Api.ChannelAdminLogEventsFilter(Object.assign({}, filterArgs)); + } + this.entity = await this.client.getInputEntity(entity); + const adminList = []; + if (searchArgs && searchArgs.admins) { + for (const admin of searchArgs.admins) { + adminList.push(await this.client.getInputEntity(admin)); + } + } + this.request = new tl_1.Api.channels.GetAdminLog({ + channel: this.entity, + q: (searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.search) || "", + minId: searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.minId, + maxId: searchArgs === null || searchArgs === void 0 ? void 0 : searchArgs.maxId, + limit: 0, + eventsFilter, + admins: adminList || void 0 + }); + } + async _loadNextChunk() { + if (!this.request) { + return true; + } + this.request.limit = Math.min(this.left, _MAX_ADMIN_LOG_CHUNK_SIZE); + const r = await this.client.invoke(this.request); + const entities2 = /* @__PURE__ */ new Map(); + for (const entity of [...r.users, ...r.chats]) { + entities2.set(__1.utils.getPeerId(entity), entity); + } + const eventIds = []; + for (const e of r.events) { + eventIds.push(e.id); + } + this.request.maxId = (0, Helpers_1.getMinBigInt)([big_integer_1.default.zero, ...eventIds]); + for (const ev of r.events) { + if (ev.action instanceof tl_1.Api.ChannelAdminLogEventActionEditMessage) { + } + } + } + }; + function iterParticipants(client2, entity, { limit, offset, search, filter: filter2, showTotal = true }) { + return new _ParticipantsIter(client2, limit !== null && limit !== void 0 ? limit : Number.MAX_SAFE_INTEGER, {}, { + entity, + filter: filter2, + offset: offset !== null && offset !== void 0 ? offset : 0, + search, + showTotal + }); + } + async function getParticipants(client2, entity, params) { + const it = client2.iterParticipants(entity, params); + return await it.collect(); + } + async function kickParticipant(client2, entity, participant) { + const peer = await client2.getInputEntity(entity); + const user = await client2.getInputEntity(participant); + let resp; + let request; + const type = __1.helpers._entityType(peer); + if (type === __1.helpers._EntityType.CHAT) { + request = new tl_1.Api.messages.DeleteChatUser({ + chatId: (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(entity)), + userId: (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(participant)) + }); + resp = await client2.invoke(request); + } else if (type === __1.helpers._EntityType.CHANNEL) { + if (user instanceof tl_1.Api.InputPeerSelf) { + request = new tl_1.Api.channels.LeaveChannel({ + channel: peer + }); + resp = await client2.invoke(request); + } else { + request = new tl_1.Api.channels.EditBanned({ + channel: peer, + participant: user, + bannedRights: new tl_1.Api.ChatBannedRights({ + untilDate: 0, + viewMessages: true + }) + }); + resp = await client2.invoke(request); + await (0, Helpers_1.sleep)(500); + await client2.invoke(new tl_1.Api.channels.EditBanned({ + channel: peer, + participant: user, + bannedRights: new tl_1.Api.ChatBannedRights({ untilDate: 0 }) + })); + } + } else { + throw new Error("You must pass either a channel or a chat"); + } + return client2._getResponseMessage(request, resp, entity); + } } -}; +}); -// node_modules/linkedom/esm/html/opt-group-element.js -init_define_import_meta_env(); -var HTMLOptGroupElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "optgroup") { - super(ownerDocument, localName); +// node_modules/telegram/tl/custom/draft.js +var require_draft = __commonJS({ + "node_modules/telegram/tl/custom/draft.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Draft = void 0; + var Utils_1 = require_Utils(); + var api_1 = require_api(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var Draft = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + constructor(client2, entity, draft) { + this._client = client2; + this._peer = (0, Utils_1.getPeer)(entity); + this._entity = entity; + this._inputEntity = entity ? (0, Utils_1.getInputPeer)(entity) : void 0; + if (!draft || !(draft instanceof api_1.Api.DraftMessage)) { + draft = new api_1.Api.DraftMessage({ + message: "", + date: -1 + }); + } + if (!(draft instanceof api_1.Api.DraftMessageEmpty)) { + this.linkPreview = !draft.noWebpage; + this._text = client2.parseMode ? client2.parseMode.unparse(draft.message, draft.entities || []) : draft.message; + this._rawText = draft.message; + this.date = draft.date; + const replyTo = draft.replyTo; + if (replyTo != void 0) { + if ("replyToMsgId" in replyTo) { + this.replyToMsgId = replyTo.replyToMsgId; + } + } + } + } + get entity() { + return this._entity; + } + get inputEntity() { + if (!this._inputEntity) { + this._inputEntity = this._client._entityCache.get(this._peer); + } + return this._inputEntity; + } + }; + exports2.Draft = Draft; } -}; +}); -// node_modules/linkedom/esm/html/d-list-element.js -init_define_import_meta_env(); -var HTMLDListElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "dl") { - super(ownerDocument, localName); +// node_modules/telegram/tl/custom/dialog.js +var require_dialog = __commonJS({ + "node_modules/telegram/tl/custom/dialog.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Dialog = void 0; + var api_1 = require_api(); + var Utils_1 = require_Utils(); + var draft_1 = require_draft(); + var Helpers_1 = require_Helpers(); + var inspect_1 = require_inspect(); + var Dialog = class { + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + constructor(client2, dialog, entities2, message) { + this._client = client2; + this.dialog = dialog; + this.pinned = !!dialog.pinned; + this.folderId = dialog.folderId; + this.archived = dialog.folderId != void 0; + this.message = message; + this.date = this.message.date; + this.entity = entities2.get((0, Utils_1.getPeerId)(dialog.peer)); + this.inputEntity = (0, Utils_1.getInputPeer)(this.entity); + if (this.entity) { + this.id = (0, Helpers_1.returnBigInt)((0, Utils_1.getPeerId)(this.entity)); + this.name = this.title = (0, Utils_1.getDisplayName)(this.entity); + } + this.unreadCount = dialog.unreadCount; + this.unreadMentionsCount = dialog.unreadMentionsCount; + if (!this.entity) { + throw new Error("Entity not found for dialog"); + } + this.draft = new draft_1.Draft(client2, this.entity, this.dialog.draft); + this.isUser = this.entity instanceof api_1.Api.User; + this.isGroup = !!(this.entity instanceof api_1.Api.Chat || this.entity instanceof api_1.Api.ChatForbidden || this.entity instanceof api_1.Api.Channel && this.entity.megagroup); + this.isChannel = this.entity instanceof api_1.Api.Channel; + } + }; + exports2.Dialog = Dialog; } -}; +}); -// node_modules/linkedom/esm/html/text-area-element.js -init_define_import_meta_env(); -var tagName12 = "textarea"; -var HTMLTextAreaElement = class extends TextElement { - constructor(ownerDocument, localName = tagName12) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get disabled() { - return booleanAttribute.get(this, "disabled"); - } - set disabled(value) { - booleanAttribute.set(this, "disabled", value); - } - get name() { - return this.getAttribute("name"); - } - set name(value) { - this.setAttribute("name", value); - } - get placeholder() { - return this.getAttribute("placeholder"); - } - set placeholder(value) { - this.setAttribute("placeholder", value); - } - get type() { - return this.getAttribute("type"); - } - set type(value) { - this.setAttribute("type", value); - } - get value() { - return this.textContent; - } - set value(content) { - this.textContent = content; +// node_modules/telegram/client/dialogs.js +var require_dialogs = __commonJS({ + "node_modules/telegram/client/dialogs.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._DialogsIter = void 0; + exports2.iterDialogs = iterDialogs; + exports2.getDialogs = getDialogs; + var tl_1 = require_tl(); + var requestIter_1 = require_requestIter(); + var index_1 = require_telegram(); + var dialog_1 = require_dialog(); + var big_integer_1 = __importDefault2(require_BigInteger()); + var Logger_1 = require_Logger(); + var _MAX_CHUNK_SIZE = 100; + function _dialogMessageKey(peer, messageId) { + return "" + [ + peer instanceof tl_1.Api.PeerChannel ? peer.channelId : void 0, + messageId + ]; + } + var _DialogsIter = class extends requestIter_1.RequestIter { + async _init({ offsetDate, offsetId, offsetPeer, ignorePinned, ignoreMigrated, folder }) { + this.request = new tl_1.Api.messages.GetDialogs({ + offsetDate, + offsetId, + offsetPeer, + limit: 1, + hash: big_integer_1.default.zero, + excludePinned: ignorePinned, + folderId: folder + }); + if (this.limit <= 0) { + const dialogs = await this.client.invoke(this.request); + if ("count" in dialogs) { + this.total = dialogs.count; + } else { + this.total = dialogs.dialogs.length; + } + return true; + } + this.seen = /* @__PURE__ */ new Set(); + this.offsetDate = offsetDate; + this.ignoreMigrated = ignoreMigrated; + } + [Symbol.asyncIterator]() { + return super[Symbol.asyncIterator](); + } + async _loadNextChunk() { + var _a; + if (!this.request || !this.seen || !this.buffer) { + return; + } + this.request.limit = Math.min(this.left, _MAX_CHUNK_SIZE); + const r = await this.client.invoke(this.request); + if (r instanceof tl_1.Api.messages.DialogsNotModified) { + return; + } + if ("count" in r) { + this.total = r.count; + } else { + this.total = r.dialogs.length; + } + const entities2 = /* @__PURE__ */ new Map(); + const messages = /* @__PURE__ */ new Map(); + for (const entity of [...r.users, ...r.chats]) { + if (entity instanceof tl_1.Api.UserEmpty || entity instanceof tl_1.Api.ChatEmpty) { + continue; + } + entities2.set(index_1.utils.getPeerId(entity), entity); + } + for (const m of r.messages) { + let message = m; + try { + if (message && "_finishInit" in message) { + message._finishInit(this.client, entities2, void 0); + } + } catch (e) { + console.log("msg", message); + this.client._log.error("Got error while trying to finish init message with id " + m.id); + if (this.client._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); + } + if (this.client._errorHandler) { + await this.client._errorHandler(e); + } + } + messages.set(_dialogMessageKey(message.peerId, message.id), message); + } + for (const d of r.dialogs) { + if (d instanceof tl_1.Api.DialogFolder) { + continue; + } + const message = messages.get(_dialogMessageKey(d.peer, d.topMessage)); + if (this.offsetDate != void 0) { + const date = message === null || message === void 0 ? void 0 : message.date; + if (date == void 0 || date > this.offsetDate) { + continue; + } + } + const peerId = index_1.utils.getPeerId(d.peer); + if (!this.seen.has(peerId)) { + this.seen.add(peerId); + if (!entities2.has(peerId)) { + continue; + } + const cd = new dialog_1.Dialog(this.client, d, entities2, message); + if (!this.ignoreMigrated || cd.entity != void 0 && "migratedTo" in cd.entity) { + this.buffer.push(cd); + } + } + } + if (r.dialogs.length < this.request.limit || !(r instanceof tl_1.Api.messages.DialogsSlice)) { + return true; + } + let lastMessage; + for (let dialog of r.dialogs.reverse()) { + lastMessage = messages.get(_dialogMessageKey(dialog.peer, dialog.topMessage)); + if (lastMessage) { + break; + } + } + this.request.excludePinned = true; + this.request.offsetId = lastMessage ? lastMessage.id : 0; + this.request.offsetDate = lastMessage ? lastMessage.date : 0; + this.request.offsetPeer = (_a = this.buffer[this.buffer.length - 1]) === null || _a === void 0 ? void 0 : _a.inputEntity; + } + }; + exports2._DialogsIter = _DialogsIter; + function iterDialogs(client2, { limit = void 0, offsetDate = void 0, offsetId = 0, offsetPeer = new tl_1.Api.InputPeerEmpty(), ignorePinned = false, ignoreMigrated = false, folder = void 0, archived = void 0 }) { + if (archived != void 0) { + folder = archived ? 1 : 0; + } + return new _DialogsIter(client2, limit, {}, { + offsetDate, + offsetId, + offsetPeer, + ignorePinned, + ignoreMigrated, + folder + }); + } + async function getDialogs(client2, params) { + return await client2.iterDialogs(params).collect(); + } } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName12, HTMLTextAreaElement); +}); -// node_modules/linkedom/esm/html/font-element.js -init_define_import_meta_env(); -var HTMLFontElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "font") { - super(ownerDocument, localName); +// node_modules/telegram/client/2fa.js +var require_fa = __commonJS({ + "node_modules/telegram/client/2fa.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.updateTwoFaSettings = updateTwoFaSettings; + var Helpers_1 = require_Helpers(); + var Password_1 = require_Password(); + var tl_1 = require_tl(); + var index_1 = require_telegram(); + async function updateTwoFaSettings(client2, { isCheckPassword, currentPassword, newPassword, hint = "", email, emailCodeCallback, onEmailCodeError }) { + if (!newPassword && !currentPassword) { + throw new Error("Neither `currentPassword` nor `newPassword` is present"); + } + if (email && !(emailCodeCallback && onEmailCodeError)) { + throw new Error("`email` present without `emailCodeCallback` and `onEmailCodeError`"); + } + const pwd = await client2.invoke(new tl_1.Api.account.GetPassword()); + if (!(pwd.newAlgo instanceof tl_1.Api.PasswordKdfAlgoUnknown)) { + pwd.newAlgo.salt1 = Buffer.concat([ + pwd.newAlgo.salt1, + (0, Helpers_1.generateRandomBytes)(32) + ]); + } + if (!pwd.hasPassword && currentPassword) { + currentPassword = void 0; + } + const password = currentPassword ? await (0, Password_1.computeCheck)(pwd, currentPassword) : new tl_1.Api.InputCheckPasswordEmpty(); + if (isCheckPassword) { + await client2.invoke(new tl_1.Api.auth.CheckPassword({ password })); + return; + } + if (pwd.newAlgo instanceof tl_1.Api.PasswordKdfAlgoUnknown) { + throw new Error("Unknown password encryption method"); + } + try { + await client2.invoke(new tl_1.Api.account.UpdatePasswordSettings({ + password, + newSettings: new tl_1.Api.account.PasswordInputSettings({ + newAlgo: pwd.newAlgo, + newPasswordHash: newPassword ? await (0, Password_1.computeDigest)(pwd.newAlgo, newPassword) : Buffer.alloc(0), + hint, + email, + // not explained what it does and it seems to always be set to empty in tdesktop + newSecureSettings: void 0 + }) + })); + } catch (e) { + if (e instanceof index_1.errors.EmailUnconfirmedError) { + while (true) { + try { + const code = await emailCodeCallback(e.codeLength); + if (!code) { + throw new Error("Code is empty"); + } + await client2.invoke(new tl_1.Api.account.ConfirmPasswordEmail({ code })); + break; + } catch (err) { + onEmailCodeError(err); + } + } + } else { + throw e; + } + } + } } -}; +}); -// node_modules/linkedom/esm/html/div-element.js -init_define_import_meta_env(); -var HTMLDivElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "div") { - super(ownerDocument, localName); +// node_modules/telegram/events/NewMessage.js +var require_NewMessage = __commonJS({ + "node_modules/telegram/events/NewMessage.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NewMessageEvent = exports2.NewMessage = void 0; + var common_1 = require_common3(); + var tl_1 = require_tl(); + var Logger_1 = require_Logger(); + var NewMessage = class extends common_1.EventBuilder { + constructor(newMessageParams = {}) { + let { chats, func, incoming, outgoing, fromUsers, forwards, pattern, blacklistChats = false } = newMessageParams; + if (incoming && outgoing) { + incoming = outgoing = void 0; + } else if (incoming != void 0 && outgoing == void 0) { + outgoing = !incoming; + } else if (outgoing != void 0 && incoming == void 0) { + incoming = !outgoing; + } else if (outgoing == false && incoming == false) { + throw new Error("Don't create an event handler if you don't want neither incoming nor outgoing!"); + } + super({ chats, blacklistChats, func }); + this.incoming = incoming; + this.outgoing = outgoing; + this.fromUsers = fromUsers; + this.forwards = forwards; + this.pattern = pattern; + this._noCheck = [ + incoming, + outgoing, + chats, + pattern, + fromUsers, + forwards, + func + ].every((v) => v == void 0); + } + async _resolve(client2) { + await super._resolve(client2); + this.fromUsers = await (0, common_1._intoIdSet)(client2, this.fromUsers); + } + build(update, callback, selfId) { + if (update instanceof tl_1.Api.UpdateNewMessage || update instanceof tl_1.Api.UpdateNewChannelMessage) { + if (!(update.message instanceof tl_1.Api.Message)) { + return void 0; + } + const event = new NewMessageEvent(update.message, update); + this.addAttributes(event); + return event; + } else if (update instanceof tl_1.Api.UpdateShortMessage) { + return new NewMessageEvent(new tl_1.Api.Message({ + out: update.out, + mentioned: update.mentioned, + mediaUnread: update.mediaUnread, + silent: update.silent, + id: update.id, + peerId: new tl_1.Api.PeerUser({ userId: update.userId }), + fromId: new tl_1.Api.PeerUser({ + userId: update.out ? selfId : update.userId + }), + message: update.message, + date: update.date, + fwdFrom: update.fwdFrom, + viaBotId: update.viaBotId, + replyTo: update.replyTo, + entities: update.entities, + ttlPeriod: update.ttlPeriod + }), update); + } else if (update instanceof tl_1.Api.UpdateShortChatMessage) { + return new NewMessageEvent(new tl_1.Api.Message({ + out: update.out, + mentioned: update.mentioned, + mediaUnread: update.mediaUnread, + silent: update.silent, + id: update.id, + peerId: new tl_1.Api.PeerChat({ chatId: update.chatId }), + fromId: new tl_1.Api.PeerUser({ + userId: update.out ? selfId : update.fromId + }), + message: update.message, + date: update.date, + fwdFrom: update.fwdFrom, + viaBotId: update.viaBotId, + replyTo: update.replyTo, + entities: update.entities, + ttlPeriod: update.ttlPeriod + }), update); + } + } + filter(event) { + var _a; + if (this._noCheck) { + return event; + } + if (this.incoming && event.message.out) { + return; + } + if (this.outgoing && !event.message.out) { + return; + } + if (this.forwards != void 0) { + if (this.forwards != !!event.message.fwdFrom) { + return; + } + } + if (this.fromUsers != void 0) { + if (!event.message.senderId || !this.fromUsers.includes(event.message.senderId.toString())) { + return; + } + } + if (this.pattern) { + const match = (_a = event.message.message) === null || _a === void 0 ? void 0 : _a.match(this.pattern); + if (!match) { + return; + } + event.message.patternMatch = match; + } + return super.filter(event); + } + addAttributes(update) { + } + }; + exports2.NewMessage = NewMessage; + var NewMessageEvent = class extends common_1.EventCommon { + constructor(message, originalUpdate) { + super({ + msgId: message.id, + chatPeer: message.peerId, + broadcast: message.post + }); + this.originalUpdate = originalUpdate; + this.message = message; + } + _setClient(client2) { + super._setClient(client2); + const m = this.message; + try { + m._finishInit(client2, this.originalUpdate._entities || /* @__PURE__ */ new Map(), void 0); + } catch (e) { + client2._log.error("Got error while trying to finish init message with id " + m.id); + if (client2._errorHandler) { + client2._errorHandler(e); + } + if (client2._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); + } + } + } + }; + exports2.NewMessageEvent = NewMessageEvent; } -}; +}); -// node_modules/linkedom/esm/html/link-element.js -init_define_import_meta_env(); -var tagName13 = "link"; -var HTMLLinkElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName13) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - // copy paste from img.src, already covered - get disabled() { - return booleanAttribute.get(this, "disabled"); - } - set disabled(value) { - booleanAttribute.set(this, "disabled", value); - } - get href() { - return stringAttribute.get(this, "href").trim(); - } - set href(value) { - stringAttribute.set(this, "href", value); - } - get hreflang() { - return stringAttribute.get(this, "hreflang"); - } - set hreflang(value) { - stringAttribute.set(this, "hreflang", value); - } - get media() { - return stringAttribute.get(this, "media"); - } - set media(value) { - stringAttribute.set(this, "media", value); - } - get rel() { - return stringAttribute.get(this, "rel"); - } - set rel(value) { - stringAttribute.set(this, "rel", value); - } - get type() { - return stringAttribute.get(this, "type"); - } - set type(value) { - stringAttribute.set(this, "type", value); +// node_modules/telegram/events/index.js +var require_events = __commonJS({ + "node_modules/telegram/events/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NewMessageEvent = exports2.NewMessage = exports2.Raw = void 0; + var Raw_1 = require_Raw(); + Object.defineProperty(exports2, "Raw", { enumerable: true, get: function() { + return Raw_1.Raw; + } }); + var NewMessage_1 = require_NewMessage(); + Object.defineProperty(exports2, "NewMessage", { enumerable: true, get: function() { + return NewMessage_1.NewMessage; + } }); + Object.defineProperty(exports2, "NewMessageEvent", { enumerable: true, get: function() { + return NewMessage_1.NewMessageEvent; + } }); } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName13, HTMLLinkElement); +}); -// node_modules/linkedom/esm/html/slot-element.js -init_define_import_meta_env(); -var tagName14 = "slot"; -var HTMLSlotElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName14) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get name() { - return this.getAttribute("name"); - } - set name(value) { - this.setAttribute("name", value); - } - assign() { - } - assignedNodes(options) { - const isNamedSlot = !!this.name; - const hostChildNodes = this.getRootNode().host?.childNodes ?? []; - let slottables; - if (isNamedSlot) { - slottables = [...hostChildNodes].filter((node) => node.slot === this.name); - } else { - slottables = [...hostChildNodes].filter((node) => !node.slot); - } - if (options?.flatten) { - const result = []; - for (let slottable of slottables) { - if (slottable.localName === "slot") { - result.push(...slottable.assignedNodes({ flatten: true })); +// node_modules/telegram/client/TelegramClient.js +var require_TelegramClient = __commonJS({ + "node_modules/telegram/client/TelegramClient.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TelegramClient = void 0; + var telegramBaseClient_1 = require_telegramBaseClient(); + var authMethods = __importStar2(require_auth()); + var botMethods = __importStar2(require_bots()); + var buttonsMethods = __importStar2(require_buttons()); + var downloadMethods = __importStar2(require_downloads()); + var parseMethods = __importStar2(require_messageParse()); + var messageMethods = __importStar2(require_messages2()); + var updateMethods = __importStar2(require_updates()); + var uploadMethods = __importStar2(require_uploads()); + var userMethods = __importStar2(require_users()); + var chatMethods = __importStar2(require_chats()); + var dialogMethods = __importStar2(require_dialogs()); + var twoFA = __importStar2(require_fa()); + var tl_1 = require_tl(); + var Utils_1 = require_Utils(); + var network_1 = require_network(); + var AllTLObjects_1 = require_AllTLObjects(); + var Helpers_1 = require_Helpers(); + var updates_1 = require_updates(); + var Logger_1 = require_Logger(); + var inspect_1 = require_inspect(); + var platform_1 = require_platform(); + var TelegramClient2 = class extends telegramBaseClient_1.TelegramBaseClient { + /** + * @param session - a session to be used to save the connection and auth key to. This can be a custom session that inherits MemorySession. + * @param apiId - The API ID you obtained from https://my.telegram.org. + * @param apiHash - The API hash you obtained from https://my.telegram.org. + * @param clientParams - see {@link TelegramClientParams} + */ + constructor(session2, apiId, apiHash, clientParams) { + super(session2, apiId, apiHash, clientParams); + } + // region auth + /** + * Used to handle all aspects of connecting to telegram.<br/> + * This method will connect to the telegram servers and check if the user is already logged in.<br/> + * in the case of a new connection this will sign in if the phone already exists or sign up otherwise<br/> + * By using this method you are **agreeing to Telegram's Terms of Service** https://core.telegram.org/api/terms.<br/> + * this method also calls {@link getMe} to tell telegram that we want to receive updates.<br/> + * @param authParams - see UserAuthParams and BotAuthParams + * @return nothing + * @example + * ```ts + * // this example assumes you've installed and imported the input package. npm i input. + * // This package uses CLI to receive input from the user. you can use your own callback function. + * import { TelegramClient } from "telegram"; + * import { StringSession } from "telegram/sessions"; + * + * const client = new TelegramClient(new StringSession(''), apiId, apiHash, {}); + * // logging in as a bot account + * await client.start(botToken="123456:abcdfgh123456789); + * // logging in as a user account + * await client.start({ + * phoneNumber: async () => await input.text("number ?"), + * password: async () => await input.text("password?"), + * phoneCode: async () => await input.text("Code ?"), + * onError: (err) => console.log(err), + * }); + * >Number ? +1234567897 + * >Code ? 12345 + * >password ? 111111 + * Logged in as user... + * + * You can now use the client instance to call other api requests. + */ + start(authParams) { + return authMethods.start(this, authParams); + } + /** + * Checks whether the current client is authorized or not. (logged in as a user) + * @example + * ```ts + * await client.connect(); + * if (await client.checkAuthorization()){ + * console.log("I am logged in!"); + * }else{ + * console.log("I am connected to telegram servers but not logged in with any account/bot"); + * } + * ``` + * @return boolean (true of authorized else false) + */ + checkAuthorization() { + return authMethods.checkAuthorization(this); + } + /** + * Logs in as a user. Should only be used when not already logged in.<br/> + * This method will send a code when needed.<br/> + * This will also sign up if needed. + * @example + * ```ts + * await client.connect(); + * // we should only use this when we are not already authorized. + * // This function is very similar to `client.start` + * // The minor difference that start checks if already authorized and supports bots as well. + * if (!await client.checkAuthorization()){ + * const phoneNumber = "+123456789"; + * await client.signIn({ + * apiId:132456, + * apiHash:"132456", + * },{ + * phoneNumber: async () => await input.text("number ?"), + * password: async () => await input.text("password?"), + * phoneCode: async () => await input.text("Code ?"), + * onError: (err) => console.log(err), + * }) + * } + * ``` + * @param apiCredentials - credentials to be used. + * @param authParams - user auth params. + */ + signInUser(apiCredentials, authParams) { + return authMethods.signInUser(this, apiCredentials, authParams); + } + /** + * logs the user using a QR code to be scanned.<br/> + * this function generates the QR code that needs to be scanned by mobile. + * @example + * '''ts + * await client.connect(); + * const user = await client.signInUserWithQrCode({ apiId, apiHash }, + * { + * onError: async function(p1: Error) { + * console.log("error", p1); + * // true = stop the authentication processes + * return true; + * }, + * qrCode: async (code) => { + * console.log("Convert the next string to a QR code and scan it"); + * console.log( + * `tg://login?token=${code.token.toString("base64url")}` + * ); + * }, + * password: async (hint) => { + * // password if needed + * return "1111"; + * } + * } + * ); + * console.log("user is", user); + * + * ''' + * @param apiCredentials - credentials to be used. + * @param authParams - user auth params. + */ + signInUserWithQrCode(apiCredentials, authParams) { + return authMethods.signInUserWithQrCode(this, apiCredentials, authParams); + } + /** + * Sends a telegram authentication code to the phone number. + * @example + * ```ts + * await client.connect(); + * const {phoneCodeHash,isCodeViaApp} = await client.sendCode({ + * apiId:1234, + * apiHash:"123456789abcfghj", + * },"+123456798"}); + * ``` + * @param apiCredentials - credentials to be used. + * @param phoneNumber - the phone number to send the code to + * @param forceSMS - whether to send it as an SMS or a normal in app message + * @return the phone code hash and whether it was sent via app + */ + sendCode(apiCredentials, phoneNumber, forceSMS = false) { + return authMethods.sendCode(this, apiCredentials, phoneNumber, forceSMS); + } + /** + * Uses the 2FA password to sign in the account.<br/> + * This function should be used after the user has signed in with the code they received. + * @param apiCredentials - credentials to be used. + * @param authParams - user auth params. + * @returns the logged in user. + */ + signInWithPassword(apiCredentials, authParams) { + return authMethods.signInWithPassword(this, apiCredentials, authParams); + } + /** + * Used to sign in as a bot. + * @example + * ```ts + * await client.connect(); + * const bot = await client.signInBot({ + * apiId:1234, + * apiHash:"12345", + * },{ + * botToken:"123456:abcdfghae4fg654", + * }); + * // we are now logged in as a bot + * console.log("Logged in",bot); + * ``` + * @param apiCredentials - credentials to be used. + * @param authParams - user auth params. + * @return instance User of the logged in bot. + */ + signInBot(apiCredentials, authParams) { + return authMethods.signInBot(this, apiCredentials, authParams); + } + /** + * Changes the 2FA settings of the logged in user. + Note that this method may be *incredibly* slow depending on the + prime numbers that must be used during the process to make sure + that everything is safe. + + Has no effect if both current and new password are omitted. + + * @param client: The telegram client instance + * @param isCheckPassword: Must be ``true`` if you want to check the current password + * @param currentPassword: The current password, to authorize changing to ``new_password``. + Must be set if changing existing 2FA settings. + Must **not** be set if 2FA is currently disabled. + Passing this by itself will remove 2FA (if correct). + * @param newPassword: The password to set as 2FA. + If 2FA was already enabled, ``currentPassword`` **must** be set. + Leaving this blank or `undefined` will remove the password. + * @param hint: Hint to be displayed by Telegram when it asks for 2FA. + Must be set when changing or creating a new password. + Has no effect if ``newPassword`` is not set. + * @param email: Recovery and verification email. If present, you must also + set `emailCodeCallback`, else it raises an Error. + * @param emailCodeCallback: If an email is provided, a callback that returns the code sent + to it must also be set. This callback may be asynchronous. + It should return a string with the code. The length of the + code will be passed to the callback as an input parameter. + * @param onEmailCodeError: Called when an error happens while sending an email. + + If the callback returns an invalid code, it will raise an rpc error with the message + ``CODE_INVALID`` + + * @returns Promise<void> + * @throws this method can throw: + "PASSWORD_HASH_INVALID" if you entered a wrong password (or set it to undefined). + "EMAIL_INVALID" if the entered email is wrong + "EMAIL_HASH_EXPIRED" if the user took too long to verify their email + */ + async updateTwoFaSettings({ isCheckPassword, currentPassword, newPassword, hint = "", email, emailCodeCallback, onEmailCodeError }) { + return twoFA.updateTwoFaSettings(this, { + isCheckPassword, + currentPassword, + newPassword, + hint, + email, + emailCodeCallback, + onEmailCodeError + }); + } + //endregion auth + //region bot + /** + * Makes an inline query to the specified bot and gets the result list.<br/> + * This is equivalent to writing `@pic something` in clients + * @param bot - the bot entity to which the inline query should be made + * @param query - the query string that should be made for that bot (up to 512 characters). can be empty + * @param entity - The entity where the inline query is being made from.<br/> + * Certain bots use this to display different results depending on where it's used, such as private chats, groups or channels.<br/> + * If specified, it will also be the default entity where the message will be sent after clicked.<br/> + * Otherwise, the “empty peer” will be used, which some bots may not handle correctly. + * @param offset - String offset of the results to be returned. can be empty + * @param geoPoint - The geo point location information to send to the bot for localised results. Available under some bots. + * @return a list of InlineResults + * @example + * ```ts + * // Makes the query to @pic + * const results = await client.inlineQuery("pic", "something"); + * // clicks on the first result + * await results[0].click(); + * ``` + */ + inlineQuery(bot, query, entity, offset, geoPoint) { + return botMethods.inlineQuery(this, bot, query, entity, offset, geoPoint); + } + //endregion + //region buttons + /** + * Builds a ReplyInlineMarkup or ReplyKeyboardMarkup for the given buttons.<br/><br/> + * Does nothing if either no buttons are provided or the provided argument is already a reply markup.<br/><br/> + * this function is called internally when passing an array of buttons. + + * @param buttons - The button, array of buttons, array of array of buttons or markup to convert into a markup. + * @param inlineOnly - Whether the buttons **must** be inline buttons only or not. + * @example + * ```ts + * import {Button} from "telegram/tl/custom/button"; + * // PS this function is not async + * const markup = client.buildReplyMarkup(Button.inline("Hello!")); + * + * await client.sendMessage(chat, { + * message: "click me!", + * buttons: markup, + * } + * + * // The following example can also be used in a simpler way like so + * + * await client.sendMessage(chat, { + * message: "click me!", + * buttons: [Button.inline("Hello!")], + * } + * ``` + */ + buildReplyMarkup(buttons, inlineOnly = false) { + return buttonsMethods.buildReplyMarkup(buttons, inlineOnly); + } + //endregion + //region download + /** + * Low-level method to download files from their input location. + * downloadMedia should generally be used over this. + * @param inputLocation - The file location from which the file will be downloaded. See getInputLocation source for a complete list of supported types. + * @param fileParams - {@link DownloadFileParams} + * @return a Buffer downloaded from the inputFile. + * @example + * ```ts + * const photo = message.photo; + * const buffer = await client.downloadFile( + * new Api.InputPhotoFileLocation({ + * id: photo.id, + * accessHash: photo.accessHash, + * fileReference: photo.fileReference, + * thumbSize: size.type + * }), + * { + * dcId: photo.dcId, + * fileSize: "m", + * } + * ); + * ``` + */ + downloadFile(inputLocation, fileParams = {}) { + return downloadMethods.downloadFileV2(this, inputLocation, fileParams); + } + /** + * Iterates over a file download, yielding chunks of the file. + * This method can be used to stream files in a more convenient way, since it offers more control (pausing, resuming, etc.) + * @param iterFileParams - {@link IterDownloadFunction} + * @return a Buffer downloaded from the inputFile. + * @example + * ```ts + * const photo = message.photo; + * for await (const chunk of client.iterDownload({ + * file: new Api.InputPhotoFileLocation({ + * id: photo.id, + * accessHash: photo.accessHash, + * fileReference: photo.fileReference, + * thumbSize: size.type + * }), + * offset: start, + * limit: end, + * requestSize:2048*1024 + * )){ + * console.log("Downloaded chunk of size",chunk.length); + * }; + * ``` + */ + iterDownload(iterFileParams) { + return downloadMethods.iterDownload(this, iterFileParams); + } + //region download + /** + * Downloads the profile photo from the given user,chat or channel.<br/> + * This method will return an empty buffer in case of no profile photo. + * @param entity - where to download the photo from. + * @param downloadProfilePhotoParams - {@link DownloadProfilePhotoParams} + * @return buffer containing the profile photo. can be empty in case of no profile photo. + * @example + * ```ts + * // Download your own profile photo + * const buffer = await client.downloadProfilePhoto('me') + * console.log("Downloaded image is",buffer); + * // if you want to save it as a file you can use the fs module on node for that. + * import { promises as fs } from 'fs'; + * await fs.writeFile("picture.jpg",buffer); + * ``` + */ + downloadProfilePhoto(entity, downloadProfilePhotoParams = { + isBig: false + }) { + return downloadMethods.downloadProfilePhoto(this, entity, downloadProfilePhotoParams); + } + /** + * Downloads the given media from a message or a media object.<br/> + * this will return an empty Buffer in case of wrong or empty media. + * @param messageOrMedia - instance of a message or a media. + * @param downloadParams {@link DownloadMediaInterface} + * @return a buffer containing the downloaded data if outputFile is undefined else nothing. + * @example ```ts + * const buffer = await client.downloadMedia(message, {}) + * // to save it to a file later on using fs. + * import { promises as fs } from 'fs'; + * await fs.writeFile("file",buffer); + * // to use a progress callback you can pass it like so. + * const buffer = await client.downloadMedia(message, { + * progressCallback : console.log + * }) + * ``` + */ + downloadMedia(messageOrMedia, downloadParams) { + return downloadMethods.downloadMedia(this, messageOrMedia, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.outputFile, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.thumb, downloadParams === null || downloadParams === void 0 ? void 0 : downloadParams.progressCallback); + } + //endregion + //region message parse + /** + * This property is the default parse mode used when sending messages. Defaults to {@link MarkdownParser}.<br/> + * It will always be either undefined or an object with parse and unparse methods.<br/> + * When setting a different value it should be one of:<br/> + *<br/> + * - Object with parse and unparse methods.<br/> + * - A str indicating the parse_mode. For Markdown 'md' or 'markdown' may be used. For HTML, 'html' may be used.<br/> + * The parse method should be a function accepting a single parameter, the text to parse, and returning a tuple consisting of (parsed message str, [MessageEntity instances]).<br/> + * <br/> + * The unparse method should be the inverse of parse such that text == unparse(parse(text)).<br/> + * <br/> + * See {@link Api.TypeMessageEntity} for allowed message entities. + * @example + * ```ts + * // gets the current parse mode. + * console.log("parse mode is :", client.parseMode) + * ``` + */ + get parseMode() { + return this._parseMode; + } + /** Setter for parseMode. + * {@link parseMode} + * @param mode can be md,markdown for Markdown or html for html. can also pass a custom mode. + * pass undefined for no parsing. + * @example + * // sets the mode to HTML + * client.setParseMode("html"); + * await client.sendMessage("me",{message:"<u>This is an underline text</u>"}); + * // disable formatting + * client.setParseMode(undefined); + * await client.sendMessage("me",{message:"<u> this will be sent as it is</u> ** with no formatting **}); + */ + setParseMode(mode) { + if (mode) { + this._parseMode = (0, Utils_1.sanitizeParseMode)(mode); } else { - result.push(slottable); + this._parseMode = void 0; } } - slottables = result; - } - return slottables.length ? slottables : [...this.childNodes]; - } - assignedElements(options) { - const slottables = this.assignedNodes(options).filter((n) => n.nodeType === 1); - return slottables.length ? slottables : [...this.children]; - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName14, HTMLSlotElement); - -// node_modules/linkedom/esm/html/form-element.js -init_define_import_meta_env(); -var HTMLFormElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "form") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/image-element.js -init_define_import_meta_env(); -var tagName15 = "img"; -var HTMLImageElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName15) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get alt() { - return stringAttribute.get(this, "alt"); - } - set alt(value) { - stringAttribute.set(this, "alt", value); - } - get sizes() { - return stringAttribute.get(this, "sizes"); - } - set sizes(value) { - stringAttribute.set(this, "sizes", value); - } - get src() { - return stringAttribute.get(this, "src"); - } - set src(value) { - stringAttribute.set(this, "src", value); - } - get srcset() { - return stringAttribute.get(this, "srcset"); - } - set srcset(value) { - stringAttribute.set(this, "srcset", value); - } - get title() { - return stringAttribute.get(this, "title"); - } - set title(value) { - stringAttribute.set(this, "title", value); - } - get width() { - return numericAttribute.get(this, "width"); - } - set width(value) { - numericAttribute.set(this, "width", value); - } - get height() { - return numericAttribute.get(this, "height"); - } - set height(value) { - numericAttribute.set(this, "height", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName15, HTMLImageElement); - -// node_modules/linkedom/esm/html/pre-element.js -init_define_import_meta_env(); -var HTMLPreElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "pre") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/u-list-element.js -init_define_import_meta_env(); -var HTMLUListElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "ul") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/meta-element.js -init_define_import_meta_env(); -var tagName16 = "meta"; -var HTMLMetaElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName16) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get name() { - return stringAttribute.get(this, "name"); - } - set name(value) { - stringAttribute.set(this, "name", value); - } - get httpEquiv() { - return stringAttribute.get(this, "http-equiv"); - } - set httpEquiv(value) { - stringAttribute.set(this, "http-equiv", value); - } - get content() { - return stringAttribute.get(this, "content"); - } - set content(value) { - stringAttribute.set(this, "content", value); - } - get charset() { - return stringAttribute.get(this, "charset"); - } - set charset(value) { - stringAttribute.set(this, "charset", value); - } - get media() { - return stringAttribute.get(this, "media"); - } - set media(value) { - stringAttribute.set(this, "media", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName16, HTMLMetaElement); - -// node_modules/linkedom/esm/html/picture-element.js -init_define_import_meta_env(); -var HTMLPictureElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "picture") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/area-element.js -init_define_import_meta_env(); -var HTMLAreaElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "area") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/o-list-element.js -init_define_import_meta_env(); -var HTMLOListElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "ol") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/table-caption-element.js -init_define_import_meta_env(); -var HTMLTableCaptionElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "caption") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/anchor-element.js -init_define_import_meta_env(); -var tagName17 = "a"; -var HTMLAnchorElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName17) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - // copy paste from img.src, already covered - get href() { - return encodeURI(decodeURI(stringAttribute.get(this, "href"))).trim(); - } - set href(value) { - stringAttribute.set(this, "href", decodeURI(value)); - } - get download() { - return encodeURI(decodeURI(stringAttribute.get(this, "download"))); - } - set download(value) { - stringAttribute.set(this, "download", decodeURI(value)); - } - get target() { - return stringAttribute.get(this, "target"); - } - set target(value) { - stringAttribute.set(this, "target", value); - } - get type() { - return stringAttribute.get(this, "type"); - } - set type(value) { - stringAttribute.set(this, "type", value); - } - get rel() { - return stringAttribute.get(this, "rel"); - } - set rel(value) { - stringAttribute.set(this, "rel", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName17, HTMLAnchorElement); - -// node_modules/linkedom/esm/html/label-element.js -init_define_import_meta_env(); -var HTMLLabelElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "label") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/unknown-element.js -init_define_import_meta_env(); -var HTMLUnknownElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "unknown") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/mod-element.js -init_define_import_meta_env(); -var HTMLModElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "mod") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/details-element.js -init_define_import_meta_env(); -var HTMLDetailsElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "details") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/source-element.js -init_define_import_meta_env(); -var tagName18 = "source"; -var HTMLSourceElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = tagName18) { - super(ownerDocument, localName); - } - /* c8 ignore start */ - get src() { - return stringAttribute.get(this, "src"); - } - set src(value) { - stringAttribute.set(this, "src", value); - } - get srcset() { - return stringAttribute.get(this, "srcset"); - } - set srcset(value) { - stringAttribute.set(this, "srcset", value); - } - get sizes() { - return stringAttribute.get(this, "sizes"); - } - set sizes(value) { - stringAttribute.set(this, "sizes", value); - } - get type() { - return stringAttribute.get(this, "type"); - } - set type(value) { - stringAttribute.set(this, "type", value); - } - /* c8 ignore stop */ -}; -registerHTMLClass(tagName18, HTMLSourceElement); - -// node_modules/linkedom/esm/html/track-element.js -init_define_import_meta_env(); -var HTMLTrackElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "track") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/html/marquee-element.js -init_define_import_meta_env(); -var HTMLMarqueeElement = class extends HTMLElement2 { - constructor(ownerDocument, localName = "marquee") { - super(ownerDocument, localName); - } -}; - -// node_modules/linkedom/esm/shared/html-classes.js -var HTMLClasses = { - HTMLElement: HTMLElement2, - HTMLTemplateElement, - HTMLHtmlElement, - HTMLScriptElement, - HTMLFrameElement, - HTMLIFrameElement, - HTMLObjectElement, - HTMLHeadElement, - HTMLBodyElement, - HTMLStyleElement, - HTMLTimeElement, - HTMLFieldSetElement, - HTMLEmbedElement, - HTMLHRElement, - HTMLProgressElement, - HTMLParagraphElement, - HTMLTableElement, - HTMLFrameSetElement, - HTMLLIElement, - HTMLBaseElement, - HTMLDataListElement, - HTMLInputElement, - HTMLParamElement, - HTMLMediaElement, - HTMLAudioElement, - HTMLHeadingElement, - HTMLDirectoryElement, - HTMLQuoteElement, - HTMLCanvasElement, - HTMLLegendElement, - HTMLOptionElement, - HTMLSpanElement, - HTMLMeterElement, - HTMLVideoElement, - HTMLTableCellElement, - HTMLTitleElement, - HTMLOutputElement, - HTMLTableRowElement, - HTMLDataElement, - HTMLMenuElement, - HTMLSelectElement, - HTMLBRElement, - HTMLButtonElement, - HTMLMapElement, - HTMLOptGroupElement, - HTMLDListElement, - HTMLTextAreaElement, - HTMLFontElement, - HTMLDivElement, - HTMLLinkElement, - HTMLSlotElement, - HTMLFormElement, - HTMLImageElement, - HTMLPreElement, - HTMLUListElement, - HTMLMetaElement, - HTMLPictureElement, - HTMLAreaElement, - HTMLOListElement, - HTMLTableCaptionElement, - HTMLAnchorElement, - HTMLLabelElement, - HTMLUnknownElement, - HTMLModElement, - HTMLDetailsElement, - HTMLSourceElement, - HTMLTrackElement, - HTMLMarqueeElement -}; - -// node_modules/linkedom/esm/shared/mime.js -init_define_import_meta_env(); -var voidElements3 = { test: () => true }; -var Mime = { - "text/html": { - docType: "<!DOCTYPE html>", - ignoreCase: true, - voidElements: /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i - }, - "image/svg+xml": { - docType: '<?xml version="1.0" encoding="utf-8"?>', - ignoreCase: false, - voidElements: voidElements3 - }, - "text/xml": { - docType: '<?xml version="1.0" encoding="utf-8"?>', - ignoreCase: false, - voidElements: voidElements3 - }, - "application/xml": { - docType: '<?xml version="1.0" encoding="utf-8"?>', - ignoreCase: false, - voidElements: voidElements3 - }, - "application/xhtml+xml": { - docType: '<?xml version="1.0" encoding="utf-8"?>', - ignoreCase: false, - voidElements: voidElements3 - } -}; - -// node_modules/linkedom/esm/interface/custom-event.js -init_define_import_meta_env(); -var CustomEvent2 = class extends GlobalEvent { - constructor(type, eventInitDict = {}) { - super(type, eventInitDict); - this.detail = eventInitDict.detail; - } -}; - -// node_modules/linkedom/esm/interface/input-event.js -init_define_import_meta_env(); -var InputEvent = class extends GlobalEvent { - constructor(type, inputEventInit = {}) { - super(type, inputEventInit); - this.inputType = inputEventInit.inputType; - this.data = inputEventInit.data; - this.dataTransfer = inputEventInit.dataTransfer; - this.isComposing = inputEventInit.isComposing || false; - this.ranges = inputEventInit.ranges; - } -}; - -// node_modules/linkedom/esm/interface/image.js -init_define_import_meta_env(); -var ImageClass = (ownerDocument) => ( - /** - * @implements globalThis.Image - */ - class Image extends HTMLImageElement { - constructor(width, height) { - super(ownerDocument); - switch (arguments.length) { - case 1: - this.height = width; - this.width = width; - break; - case 2: - this.height = height; - this.width = width; - break; + //endregion + // region messages + /** + * Iterates over the messages for a given chat. + * <br/> + * The default order is from newest to oldest but can be changed with the reverse param.<br/> + * If either `search`, `filter` or `fromUser` are provided this will use {@link Api.messages.Search} instead of {@link Api.messages.GetHistory}. + * @remarks + * Telegram limits GetHistory requests every 10 requests (1 000 messages) therefore a sleep of 1 seconds will be the default for this limit. + * @param entity - The entity from whom to retrieve the message history.<br/> + * It may be undefined to perform a global search, or to get messages by their ID from no particular chat<br/> + * **Note** that some of the offsets will not work if this is the case.<br/> + * **Note** that if you want to perform a global search, you must set a non-empty search string, a filter. or fromUser. + * @param iterParams - {@link IterMessagesParams} + * @yield Instances of custom {@link Message} + * @example + * ```ts + * // From most-recent to oldest + * for await (const message of client.iterMessages(chat,{}){ + * console.log(message.id, message.text) + * } + * + * // From oldest to most-recent + * for await (const message of client.iterMessages(chat,{reverse:true}){ + * console.log(message.id, message.text) + * } + * + * // Filter by sender + * for await (const message of client.iterMessages(chat,{fromUser:"me"}){ + * console.log(message.id, message.text) + * } + * + * // Server-side search with fuzzy text + * for await (const message of client.iterMessages(chat,{search:"hello"}){ + * console.log(message.id, message.text) + * } + * + * // Filter by message type: + * import { Api } from "telegram"; + * for await (const message of client.iterMessages(chat,{filter: Api.InputMessagesFilterPhotos}){ + * console.log(message.id, message.photo) + * } + * + * // Getting comments from a post in a channel: + * * for await (const message of client.iterMessages(chat,{replyTo: 123}){ + * console.log(message.chat.title,, message.text) + * } + * ``` + */ + iterMessages(entity, iterParams = {}) { + return messageMethods.iterMessages(this, entity, iterParams); + } + /** + * Same as iterMessages() but returns a TotalList instead.<br/> + * if the `limit` is not set, it will be 1 by default unless both `minId` **and** `maxId` are set. in which case the entire range will be returned.<br/> + * @param entity - The entity from whom to retrieve the message history. see {@link iterMessages}.<br/> + * @param getMessagesParams - see {@link IterMessagesParams}. + * @return {@link TotalList} of messages. + * @example + * ```ts + * // The totalList has a .total attribute which will show the complete number of messages even if none are fetched. + * // Get 0 photos and print the total to show how many photos there are + * import { Api } from "telegram"; + * const photos = await client.getMessages(chat, {limit: 0, filter:Api.InputMessagesFilterPhotos}) + * console.log(photos.total) + * + * // Get all the photos + * const photos = await client.getMessages(chat, {limit: undefined, filter:Api.InputMessagesFilterPhotos}) + * + // Get messages by ID: + * const messages = await client.getMessages(chat, {ids:1337}) + * const message_1337 = messages[0]; + * ``` + */ + getMessages(entity, getMessagesParams = {}) { + return messageMethods.getMessages(this, entity, getMessagesParams); + } + /** + * Sends a message to the specified user, chat or channel.<br/> + * The default parse mode is the same as the official applications (a custom flavour of markdown). **bold**, `code` or __italic__ are available.<br/> + * In addition you can send [links](https://example.com) and [mentions](@username) (or using IDs like in the Bot API: [mention](tg://user?id=123456789)) and pre blocks with three backticks.<br/> + * <br/> + * Sending a /start command with a parameter (like ?start=data) is also done through this method. Simply send '/start data' to the bot.<br/> + * <br/> + * See also Message.respond() and Message.reply(). + * + * @param entity - Who to sent the message to. + * @param sendMessageParams - see {@link SendMessageParams} + * @return + * The sent custom Message. + * @example + * ```ts + * // Markdown is the default. + * await client.sendMessage("me",{message:"Hello **world!**}); + * + * // Defaults to another parse mode. + * client.setParseMode("HTML"); + * + * await client.sendMessage('me', {message:'Some <b>bold</b> and <i>italic</i> text'}) + * await client.sendMessage('me', {message:'An <a href="https://example.com">URL</a>'}) + * await client.sendMessage('me', {message:'<a href="tg://user?id=me">Mentions</a>'}) + * + * // Explicit parse mode. + * // No parse mode by default + * client.setParseMode(undefined); + * //...but here I want markdown + * await client.sendMessage('me', {message:'Hello, **world**!', {parseMode:"md"}}) + * + * // ...and here I need HTML + * await client.sendMessage('me', {message:'Hello, <i>world</i>!', {parseMode='html'}}) + * + * + * // Scheduling a message to be sent after 5 minutes + * + * await client.sendMessage(chat, {message:'Hi, future!', schedule:(60 * 5) + (Date.now() / 1000)}) + * + * ``` + */ + sendMessage(entity, sendMessageParams = {}) { + return messageMethods.sendMessage(this, entity, sendMessageParams); + } + /** + * Forwards the given messages to the specified entity.<br/> + *<br/> + * If you want to "forward" a message without the forward header + * (the "forwarded from" text), you should use `sendMessage` with + * the original message instead. This will send a copy of it. + *<br/> + * See also {@link Message.forwardTo}`. + * @param entity - To which entity the message(s) will be forwarded. + * @param forwardMessagesParams - see {@link ForwardMessagesParams} + * @return The list of forwarded Message, Note.<br/> + * if some messages failed to be forwarded the returned list will have them as undefined. + * @example ```ts + * // a single one + * await client.forwardMessages(chat, {messages: message}); + * // or + * await client.forwardMessages(chat, {messages:messageId,fromPeer:fromChat}); + * // or + * await message.forwardTo(chat) + * + * // multiple + * await client.forwardMessages(chat, {messages:messages}); + * // or + * await client.forwardMessages(chat, {messages:messageIds,fromPeer:fromChat}); + * + * // Forwarding as a copy + * await client.sendMessage(chat, {message:message}); + * ``` + */ + forwardMessages(entity, forwardMessagesParams) { + return messageMethods.forwardMessages(this, entity, forwardMessagesParams); + } + /** + * Used to edit a message by changing it's text or media + * message refers to the message to be edited not what to edit + * text refers to the new text + * See also Message.edit()<br/> + * Notes: It is not possible to edit the media of a message that doesn't contain media. + * @param entity - From which chat to edit the message.<br/> + * This can also be the message to be edited, and the entity will be inferred from it, so the next parameter will be assumed to be the message text.<br/> + * You may also pass a InputBotInlineMessageID, which is the only way to edit messages that were sent after the user selects an inline query result. Not supported yet! + * @param editMessageParams - see {@link EditMessageParams}. + * @return The edited Message. + * @throws + * `MESSAGE_AUTHOR_REQUIRED` if you're not the author of the message but tried editing it anyway. + * `MESSAGE_NOT_MODIFIED` if the contents of the message were not modified at all. + * `MESSAGE_ID_INVALID` if the ID of the message is invalid (the ID itself may be correct, but the message with that ID cannot be edited).<br/> + * For example, when trying to edit messages with a reply markup (or clear markup) this error will be raised. + * @example + * ```ts + * const message = await client.sendMessage(chat,{message:"Hi!"}); + * + * await client.editMessage(chat,{message:message,text:"Hello!"} + * // or + * await client.editMessage(chat,{message:message.id,text:"Hello!"} + * ``` + */ + editMessage(entity, editMessageParams) { + return messageMethods.editMessage(this, entity, editMessageParams); + } + /** + * Deletes the given messages, optionally "for everyone". + * + * See also {@link Message.delete}`. + * + * @remarks This method does **not** validate that the message IDs belong to the chat that you passed! It's possible for the method to delete messages from different private chats and small group chats at once, so make sure to pass the right IDs. + * @param entity - From who the message will be deleted. This can actually be `undefined` for normal chats, but **must** be present for channels and megagroups. + * @param messageIds - The IDs (or ID) or messages to be deleted. + * @param revoke - Whether the message should be deleted for everyone or not. + * By default it has the opposite behaviour of official clients, + * and it will delete the message for everyone. + * Disabling this has no effect on channels or megagroups, + * since it will unconditionally delete the message for everyone. + * @return + * A list of {@link AffectedMessages}, each item being the result for the delete calls of the messages in chunks of 100 each. + * @example + * ```ts + * await client.deleteMessages(chat, messages); + * + * await client.deleteMessages(chat, messages, {revoke:false}); + * ``` + */ + deleteMessages(entity, messageIds, { revoke = true }) { + return messageMethods.deleteMessages(this, entity, messageIds, { + revoke + }); + } + pinMessage(entity, message, pinMessageParams) { + return messageMethods.pinMessage(this, entity, message, pinMessageParams); + } + unpinMessage(entity, message, unpinMessageParams) { + return messageMethods.unpinMessage(this, entity, message, unpinMessageParams); + } + /** + * Marks messages as read and optionally clears mentions. <br/> + * This effectively marks a message as read (or more than one) in the given conversation. <br /> + * If a message or maximum ID is provided, all the messages up to and + * including such ID will be marked as read (for all messages whose ID ≤ max_id). + * + * See also {@link Message.markRead}`. + * + * @remarks If neither message nor maximum ID are provided, all messages will be marked as read by assuming that `max_id = 0`. + * @param entity - The chat where the message should be pinned. + * @param message - The message or the message ID to pin. If it's `undefined`, all messages will be unpinned instead. + * @param markAsReadParams - see {@link MarkAsReadParams}. + * @return boolean + * @example + * ```ts + * // using a Message object + * const message = await client.sendMessage(chat, 'GramJS is awesome!'); + * await client.markAsRead(chat, message) + * // ...or using the int ID of a Message + * await client.markAsRead(chat, message.id); + * + * // ...or passing a list of messages to mark as read + * await client.markAsRead(chat, messages) + * ``` + */ + markAsRead(entity, message, markAsReadParams) { + return messageMethods.markAsRead(this, entity, message, markAsReadParams); + } + //endregion + //region dialogs + /** + * Iterator over the dialogs (open conversations/subscribed channels) sequentially.<br/> + * The order is the same as the one seen in official applications. (dialogs that had recent messages come first) + * @param iterDialogsParams - see {@link IterDialogsParams} + * @yield instances of custom {@link Dialog}. + * @example + * ```ts + * // logs all dialog IDs and their title. + * for await (const dialog of client.iterDialogs({})){ + * console.log(`${dialog.id}: ${dialog.title}`); + * } + * ``` + */ + iterDialogs(iterDialogsParams = {}) { + return dialogMethods.iterDialogs(this, iterDialogsParams); + } + /** + * Same as iterDialogs but returns a TotalList instead of an iterator. + * @param params - {@link IterDialogsParams} + * @example + * ```ts + * // Get all open conversation, print the title of the first + * const dialogs = await client.getDialogs({}); + * const first = dialogs[0]; + * console.log(first.title); + * <br/> + * // Use the dialog somewhere else + * await client.sendMessage(first, {message: "hi"}); + * <br/> + * // Getting only non-archived dialogs (both equivalent) + * non_archived = await client.get_dialogs({folder:0}) + * non_archived = await client.get_dialogs({archived:false}) + * <br/> + * // Getting only archived dialogs (both equivalent) + * archived = await client.get_dialogs({folder:1}) + * archived = await client.get_dialogs({archived:true}) + * ``` + */ + getDialogs(params = {}) { + return dialogMethods.getDialogs(this, params); + } + //endregion + //region chats + /** + * Iterates over the participants belonging to a specified chat , channel or supergroup.<br/> + * <br/> + * Channels can return a maximum of 200 users while supergroups can return up to 10 000.<br/> + * You must be an admin to retrieve users from a channel.<br/> + * @param entity - The entity from which to retrieve the participants list. + * @param params - {@link IterParticipantsParams} + * @remarks + * The filter ChannelParticipantsBanned will return restricted users. If you want banned users you should use ChannelParticipantsKicked instead. + * @yield The User objects returned by GetParticipants with an additional .participant attribute<br/> + * which is the matched ChannelParticipant type for channels/supergroup or ChatParticipants for normal chats. + * @example + * ```ts + * // logs all user IDs in a chat. + * for await (const user of client.iterParticipants(chat)){ + * console.log("User id",user.id); + * } + * + * // Searches by name. + * for await (const user of client.iterParticipants(chat, {search: "name"})){ + * console.log("Username is ",user.username); // Some users don't have a username so this can be undefined. + * } + * + * // Filter by admins. + * import { Api } from "telegram"; + * + * for await (const user of client.iterParticipants(chat, {filter: Api.ChannelParticipantsAdmins})){ + * console.log("admin first name is ",user.firstName); + * } + * ``` + */ + iterParticipants(entity, params = {}) { + return chatMethods.iterParticipants(this, entity, params); + } + /** + * Exact same as iterParticipants but returns a TotalList instead.<br/> + * This can be used if you want to retrieve a list instead of iterating over the users. + * @param entity - entity to get users from. + * @param params - {@link IterParticipantsParams}. + * @return + */ + getParticipants(entity, params = {}) { + return chatMethods.getParticipants(this, entity, params); + } + /** + * Kicks a user from a chat. + * + * Kicking yourself (`'me'`) will result in leaving the chat. + * + * @note + * Attempting to kick someone who was banned will remove their + * restrictions (and thus unbanning them), since kicking is just + * ban + unban. + * + * @example + * // Kick some user from some chat, and deleting the service message + * const msg = await client.kickParticipant(chat, user); + * await msg.delete(); + * + * // Leaving chat + * await client.kickParticipant(chat, 'me'); + */ + kickParticipant(entity, participant) { + return chatMethods.kickParticipant(this, entity, participant); + } + //endregion + //region updates + /** TODO */ + on(event) { + return updateMethods.on(this, event); + } + addEventHandler(callback, event) { + return updateMethods.addEventHandler(this, callback, event); + } + /** + * Inverse operation of addEventHandler().<br> + * + * @param callback - the callback function to be removed. + * @param event - the type of the event. + */ + removeEventHandler(callback, event) { + return updateMethods.removeEventHandler(this, callback, event); + } + /** + * Lists all registered event handlers. + * @return pair of [eventBuilder,CallableFunction] + */ + listEventHandlers() { + return updateMethods.listEventHandlers(this); + } + // region uploads + /** + * Uploads a file to Telegram's servers, without sending it. + * @remarks generally it's better to use {@link sendFile} instead. + * This method returns a handle (an instance of InputFile or InputFileBig, as required) which can be later used before it expires (they are usable during less than a day).<br/> + * Uploading a file will simply return a "handle" to the file stored remotely in the Telegram servers, + * which can be later used on. This will not upload the file to your own chat or any chat at all. + * This also can be used to update profile pictures + * @param fileParams see {@link UploadFileParams} + * @return {@link Api.InputFileBig} if the file size is larger than 10mb otherwise {@link Api.InputFile} + * @example + * ```ts + * import { CustomFile } from "telegram/client/uploads"; + * const toUpload = new CustomFile("photo.jpg", fs.statSync("../photo.jpg").size, "../photo.jpg"); + * const file = await client.uploadFile({ + * file: toUpload, + * workers: 1, + * }); + * await client.invoke(new Api.photos.UploadProfilePhoto({ + * file: file, + * })); + * ``` + */ + uploadFile(fileParams) { + return uploadMethods.uploadFile(this, fileParams); + } + /** + * Sends message with the given file to the specified entity. + * This uses {@link uploadFile} internally so if you want more control over uploads you can use that. + * @param entity - who will receive the file. + * @param sendFileParams - see {@link SendFileInterface} + * @example + * ``` + * // Normal files like photos + * await client.sendFile(chat, {file:'/my/photos/me.jpg', caption:"It's me!"}) + * // or + * await client.sendMessage(chat, {message:"It's me!", file:'/my/photos/me.jpg'}) + * + * Voice notes or round videos + * await client.sendFile(chat, {file: '/my/songs/song.mp3', voiceNote:True}) + * await client.sendFile(chat, {file: '/my/videos/video.mp4', videoNote:True}) + * + * // Custom thumbnails + * await client.sendFile(chat, {file:'/my/documents/doc.txt', thumb:'photo.jpg'}) + * + * // Only documents + * await client.sendFile(chat, {file:'/my/photos/photo.png', forceDocument:True}) + * + * //logging progress + * await client.sendFile(chat, {file: file, progressCallback=console.log}) + * + * // Dices, including dart and other future emoji + * await client.sendFile(chat, {file:new Api.InputMediaDice("")}) + * await client.sendFile(chat, {file:new Api.InputMediaDice("🎯")}) + * + * // Contacts + * await client.sendFile(chat, {file: new Api.InputMediaContact({ + * phoneNumber:'+1 123 456 789', + * firstName:'Example', + * lastName:'', + * vcard:'' + * })) + * ``` + */ + sendFile(entity, sendFileParams) { + return uploadMethods.sendFile(this, entity, sendFileParams); + } + // endregion + //region user methods + /** + * invokes raw Telegram requests.<br/> + * This is a low level method that can be used to call manually any Telegram API method.<br/> + * Generally this should only be used when there isn't a friendly method that does what you need.<br/> + * All available requests and types are found under the `Api.` namespace. + * @param request - The request to send. this should be of type request. + * @param dcId - Optional dc id to use when sending. + * @return The response from Telegram. + * @example + * ```ts + * // + * const result = await client.invoke(new Api.account.CheckUsername({ + * username: 'some string here' + * })); + * console.log("does this username exist?",result); + * + * ``` + */ + invoke(request, dcId) { + return userMethods.invoke(this, request, dcId); + } + invokeWithSender(request, sender) { + return userMethods.invoke(this, request, void 0, sender); + } + getMe(inputPeer = false) { + return userMethods.getMe(this, inputPeer); + } + /** + * Return true if the signed-in user is a bot, false otherwise. + * @example + * ```ts + * if (await client.isBot()){ + * console.log("I am a bot. PI is 3.14159265359); + * } else { + * console.log("I am a human. Pies are delicious); + * } + * ``` + */ + isBot() { + return userMethods.isBot(this); + } + /** + * Returns true if the user is authorized (logged in). + * @example + * if (await client.isUserAuthorized()){ + * console.log("I am authorized. I can call functions and use requests"); + * }else{ + * console.log("I am not logged in. I need to sign in first before being able to call methods"); + * } + */ + isUserAuthorized() { + return userMethods.isUserAuthorized(this); + } + getEntity(entity) { + return userMethods.getEntity(this, entity); } - } - } -); - -// node_modules/linkedom/esm/interface/range.js -init_define_import_meta_env(); -var deleteContents = ({ [START]: start, [END]: end }, fragment = null) => { - setAdjacent(start[PREV], end[NEXT]); - do { - const after2 = getEnd(start); - const next = after2 === end ? after2 : after2[NEXT]; - if (fragment) - fragment.insertBefore(start, fragment[END]); - else - start.remove(); - start = next; - } while (start !== end); -}; -var Range = class _Range { - constructor() { - this[START] = null; - this[END] = null; - this.commonAncestorContainer = null; - } - /* TODO: this is more complicated than it looks - setStart(node, offset) { - this[START] = node.childNodes[offset]; - } - - setEnd(node, offset) { - this[END] = getEnd(node.childNodes[offset]); - } - //*/ - insertNode(newNode) { - this[END].parentNode.insertBefore(newNode, this[START]); - } - selectNode(node) { - this[START] = node; - this[END] = getEnd(node); - } - // TODO: SVG elements should then create contextual fragments - // that return SVG nodes - selectNodeContents(node) { - this.selectNode(node); - this.commonAncestorContainer = node; - } - surroundContents(parentNode) { - parentNode.replaceChildren(this.extractContents()); - } - setStartBefore(node) { - this[START] = node; - } - setStartAfter(node) { - this[START] = node.nextSibling; - } - setEndBefore(node) { - this[END] = getEnd(node.previousSibling); - } - setEndAfter(node) { - this[END] = getEnd(node); - } - cloneContents() { - let { [START]: start, [END]: end } = this; - const fragment = start.ownerDocument.createDocumentFragment(); - while (start !== end) { - fragment.insertBefore(start.cloneNode(true), fragment[END]); - start = getEnd(start); - if (start !== end) - start = start[NEXT]; - } - return fragment; - } - deleteContents() { - deleteContents(this); - } - extractContents() { - const fragment = this[START].ownerDocument.createDocumentFragment(); - deleteContents(this, fragment); - return fragment; - } - createContextualFragment(html) { - const { commonAncestorContainer: doc } = this; - const isSVG = "ownerSVGElement" in doc; - const document2 = isSVG ? doc.ownerDocument : doc; - let content = htmlToFragment(document2, html); - if (isSVG) { - const childNodes = [...content.childNodes]; - content = document2.createDocumentFragment(); - Object.setPrototypeOf(content, SVGElement.prototype); - content.ownerSVGElement = document2; - for (const child of childNodes) { - Object.setPrototypeOf(child, SVGElement.prototype); - child.ownerSVGElement = document2; - content.appendChild(child); - } - } else - this.selectNode(content); - return content; - } - cloneRange() { - const range = new _Range(); - range[START] = this[START]; - range[END] = this[END]; - return range; - } -}; - -// node_modules/linkedom/esm/interface/tree-walker.js -init_define_import_meta_env(); -var isOK = ({ nodeType }, mask) => { - switch (nodeType) { - case ELEMENT_NODE: - return mask & SHOW_ELEMENT; - case TEXT_NODE: - return mask & SHOW_TEXT; - case COMMENT_NODE: - return mask & SHOW_COMMENT; - case CDATA_SECTION_NODE: - return mask & SHOW_CDATA_SECTION; - } - return 0; -}; -var TreeWalker = class { - constructor(root, whatToShow = SHOW_ALL) { - this.root = root; - this.currentNode = root; - this.whatToShow = whatToShow; - let { [NEXT]: next, [END]: end } = root; - if (root.nodeType === DOCUMENT_NODE) { - const { documentElement } = root; - next = documentElement; - end = documentElement[END]; - } - const nodes = []; - while (next && next !== end) { - if (isOK(next, whatToShow)) - nodes.push(next); - next = next[NEXT]; - } - this[PRIVATE] = { i: 0, nodes }; - } - nextNode() { - const $ = this[PRIVATE]; - this.currentNode = $.i < $.nodes.length ? $.nodes[$.i++] : null; - return this.currentNode; - } -}; - -// node_modules/linkedom/esm/interface/document.js -var query = (method, ownerDocument, selectors) => { - let { [NEXT]: next, [END]: end } = ownerDocument; - return method.call({ ownerDocument, [NEXT]: next, [END]: end }, selectors); -}; -var globalExports = assign( - {}, - Facades, - HTMLClasses, - { - CustomEvent: CustomEvent2, - Event: GlobalEvent, - EventTarget: DOMEventTarget, - InputEvent, - NamedNodeMap, - NodeList - } -); -var window2 = /* @__PURE__ */ new WeakMap(); -var Document2 = class extends NonElementParentNode { - constructor(type) { - super(null, "#document", DOCUMENT_NODE); - this[CUSTOM_ELEMENTS] = { active: false, registry: null }; - this[MUTATION_OBSERVER] = { active: false, class: null }; - this[MIME] = Mime[type]; - this[DOCTYPE] = null; - this[DOM_PARSER] = null; - this[GLOBALS] = null; - this[IMAGE] = null; - this[UPGRADE] = null; - } - /** - * @type {globalThis.Document['defaultView']} - */ - get defaultView() { - if (!window2.has(this)) - window2.set(this, new Proxy(globalThis, { - set: (target, name, value) => { - switch (name) { - case "addEventListener": - case "removeEventListener": - case "dispatchEvent": - this[EVENT_TARGET][name] = value; - break; - default: - target[name] = value; - break; + /** + * Turns the given entity into its input entity version.<br/> + * Almost all requests use this kind of InputPeer, so this is the most suitable call to make for those cases.<br/> + * **Generally you should let the library do its job** and don't worry about getting the input entity first, but if you're going to use an entity often, consider making the call. + * @param entity - If a username or invite link is given, the library will use the cache.<br/> + * This means that it's possible to be using a username that changed or an old invite link (this only happens if an invite link for a small group chat is used after it was upgraded to a mega-group). + *<br/> + * - If the username or ID from the invite link is not found in the cache, it will be fetched. The same rules apply to phone numbers ('+34 123456789') from people in your contact list. + *<br/> + * - If an exact name is given, it must be in the cache too. This is not reliable as different people can share the same name and which entity is returned is arbitrary,<br/> + * and should be used only for quick tests. + *<br/> + * - If a positive integer ID is given, the entity will be searched in cached users, chats or channels, without making any call. + *<br/> + * - If a negative integer ID is given, the entity will be searched exactly as either a chat (prefixed with -) or as a channel (prefixed with -100). + *<br/> + * - If a Peer is given, it will be searched exactly in the cache as either a user, chat or channel. + *<br/> + * - If the given object can be turned into an input entity directly, said operation will be done. + *<br/> + * -If the entity can't be found, this will throw an error. + * @return + * {@link Api.InputPeerUser} , {@link Api.InputPeerChat} , {@link Api.InputPeerChannel} or {@link Api.InputPeerSelf} if the parameter is "me" or "self" + * @example + * ```ts + * // If you're going to use "username" often in your code + * // (make a lot of calls), consider getting its input entity + * // once, and then using the "user" everywhere instead. + * user = await client.getInputEntity('username') + * + * // The same applies to IDs, chats or channels. + * chat = await client.getInputEntity(-123456789) + * ``` + */ + getInputEntity(entity) { + return userMethods.getInputEntity(this, entity); + } + /** + * Gets the ID for the given entity.<br/> + * This method needs to be async because peer supports usernames, invite-links, phone numbers (from people in your contact list), etc.<br/> + * <br/> + * If addMark is false, then a positive ID will be returned instead. By default, bot-API style IDs (signed) are returned. + * @param peer + * @param addMark - whether to return a bot api style id. + * @return the ID of the entity. + * @example + * ```ts + * console.log(await client.getPeerId("me")); + * ``` + */ + getPeerId(peer, addMark = true) { + return userMethods.getPeerId(this, peer, addMark); + } + /** @hidden */ + _getInputDialog(peer) { + return userMethods._getInputDialog(this, peer); + } + /** @hidden */ + _getInputNotify(notify) { + return userMethods._getInputNotify(this, notify); + } + //endregion + /** @hidden */ + async _handleReconnect() { + this._log.info("Handling reconnect!"); + try { + const res = await this.getMe(); + } catch (e) { + this._log.error(`Error while trying to reconnect`); + if (this._errorHandler) { + await this._errorHandler(e); } - return true; - }, - get: (globalThis2, name) => { - switch (name) { - case "addEventListener": - case "removeEventListener": - case "dispatchEvent": - if (!this[EVENT_TARGET]) { - const et = this[EVENT_TARGET] = new DOMEventTarget(); - et.dispatchEvent = et.dispatchEvent.bind(et); - et.addEventListener = et.addEventListener.bind(et); - et.removeEventListener = et.removeEventListener.bind(et); - } - return this[EVENT_TARGET][name]; - case "document": - return this; - /* c8 ignore start */ - case "navigator": + if (this._log.canSend(Logger_1.LogLevel.ERROR)) { + console.error(e); + } + } + } + //region base methods + async connect() { + await this._initSession(); + if (this._sender === void 0) { + this._sender = new network_1.MTProtoSender(this.session.getAuthKey(), { + logger: this._log, + dcId: this.session.dcId || 4, + retries: this._connectionRetries, + delay: this._retryDelay, + autoReconnect: this._autoReconnect, + connectTimeout: this._timeout, + authKeyCallback: this._authKeyCallback.bind(this), + updateCallback: updates_1._handleUpdate.bind(this), + isMainSender: true, + client: this, + securityChecks: this._securityChecks, + autoReconnectCallback: this._handleReconnect.bind(this), + _exportedSenderPromises: this._exportedSenderPromises, + reconnectRetries: this._reconnectRetries + }); + } + const connection = new this._connection({ + ip: this.session.serverAddress, + port: this.useWSS ? 443 : 80, + dcId: this.session.dcId, + loggers: this._log, + proxy: this._proxy, + socket: this.networkSocket, + testServers: this.testServers + }); + if (!await this._sender.connect(connection, false)) { + if (!this._loopStarted) { + (0, updates_1._updateLoop)(this); + this._loopStarted = true; + } + return false; + } + this.session.setAuthKey(this._sender.authKey); + this.session.save(); + this._initRequest.query = new tl_1.Api.help.GetConfig(); + this._log.info(`Using LAYER ${AllTLObjects_1.LAYER} for initial connect`); + await this._sender.send(new tl_1.Api.InvokeWithLayer({ + layer: AllTLObjects_1.LAYER, + query: this._initRequest + })); + if (!this._loopStarted) { + (0, updates_1._updateLoop)(this); + this._loopStarted = true; + } + this._connectedDeferred.resolve(); + this._isSwitchingDc = false; + return true; + } + //endregion + // region Working with different connections/Data Centers + /** @hidden */ + async _switchDC(newDc) { + this._log.info(`Reconnecting to new data center ${newDc}`); + const DC = await this.getDC(newDc); + this.session.setDC(newDc, DC.ipAddress, DC.port); + await this._sender.authKey.setKey(void 0); + this.session.setAuthKey(void 0); + this.session.save(); + this._isSwitchingDc = true; + await this._disconnect(); + this._sender = void 0; + return await this.connect(); + } + /** + * Returns the DC ip in case of node or the DC web address in case of browser.<br/> + * This will do an API request to fill the cache if it's the first time it's called. + * @param dcId The DC ID. + * @param downloadDC whether to use -1 DCs or not + * @param web if true this will get the web DCs. + * TODO, hardcode IPs. + * (These only support downloading/uploading and not creating a new AUTH key) + */ + async getDC(dcId, downloadDC = false, web = false) { + this._log.debug(`Getting DC ${dcId}`); + if (!platform_1.isNode || web) { + switch (dcId) { + case 1: + return { + id: 1, + ipAddress: `pluto${downloadDC ? "-1" : ""}.web.telegram.org`, + port: 443 + }; + case 2: + return { + id: 2, + ipAddress: `venus${downloadDC ? "-1" : ""}.web.telegram.org`, + port: 443 + }; + case 3: + return { + id: 3, + ipAddress: `aurora${downloadDC ? "-1" : ""}.web.telegram.org`, + port: 443 + }; + case 4: + return { + id: 4, + ipAddress: `vesta${downloadDC ? "-1" : ""}.web.telegram.org`, + port: 443 + }; + case 5: return { - userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36" + id: 5, + ipAddress: `flora${downloadDC ? "-1" : ""}.web.telegram.org`, + port: 443 }; - /* c8 ignore stop */ - case "window": - return window2.get(this); - case "customElements": - if (!this[CUSTOM_ELEMENTS].registry) - this[CUSTOM_ELEMENTS] = new CustomElementRegistry(this); - return this[CUSTOM_ELEMENTS]; - case "performance": - return globalThis2.performance; - case "DOMParser": - return this[DOM_PARSER]; - case "Image": - if (!this[IMAGE]) - this[IMAGE] = ImageClass(this); - return this[IMAGE]; - case "MutationObserver": - if (!this[MUTATION_OBSERVER].class) - this[MUTATION_OBSERVER] = new MutationObserverClass(this); - return this[MUTATION_OBSERVER].class; - } - return this[GLOBALS] && this[GLOBALS][name] || globalExports[name] || globalThis2[name]; + default: + throw new Error(`Cannot find the DC with the ID of ${dcId}`); + } } - })); - return window2.get(this); - } - get doctype() { - const docType = this[DOCTYPE]; - if (docType) - return docType; - const { firstChild } = this; - if (firstChild && firstChild.nodeType === DOCUMENT_TYPE_NODE) - return this[DOCTYPE] = firstChild; - return null; - } - set doctype(value) { - if (/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(value)) { - const { $1: name, $4: publicId, $6: systemId } = RegExp; - this[DOCTYPE] = new DocumentType(this, name, publicId, systemId); - knownSiblings(this, this[DOCTYPE], this[NEXT]); - } - } - get documentElement() { - return this.firstElementChild; - } - get isConnected() { - return true; - } - /** - * @protected - */ - _getParent() { - return this[EVENT_TARGET]; - } - createAttribute(name) { - return new Attr(this, name); - } - createCDATASection(data) { - return new CDATASection(this, data); - } - createComment(textContent3) { - return new Comment3(this, textContent3); - } - createDocumentFragment() { - return new DocumentFragment(this); - } - createDocumentType(name, publicId, systemId) { - return new DocumentType(this, name, publicId, systemId); - } - createElement(localName) { - return new Element2(this, localName); - } - createRange() { - const range = new Range(); - range.commonAncestorContainer = this; - return range; - } - createTextNode(textContent3) { - return new Text6(this, textContent3); - } - createTreeWalker(root, whatToShow = -1) { - return new TreeWalker(root, whatToShow); - } - createNodeIterator(root, whatToShow = -1) { - return this.createTreeWalker(root, whatToShow); - } - createEvent(name) { - const event = create(name === "Event" ? new GlobalEvent("") : new CustomEvent2("")); - event.initEvent = event.initCustomEvent = (type, canBubble = false, cancelable = false, detail) => { - event.bubbles = !!canBubble; - defineProperties(event, { - type: { value: type }, - canBubble: { value: canBubble }, - cancelable: { value: cancelable }, - detail: { value: detail } - }); - }; - return event; - } - cloneNode(deep = false) { - const { - constructor, - [CUSTOM_ELEMENTS]: customElements2, - [DOCTYPE]: doctype - } = this; - const document2 = new constructor(); - document2[CUSTOM_ELEMENTS] = customElements2; - if (deep) { - const end = document2[END]; - const { childNodes } = this; - for (let { length } = childNodes, i = 0; i < length; i++) - document2.insertBefore(childNodes[i].cloneNode(true), end); - if (doctype) - document2[DOCTYPE] = childNodes[0]; - } - return document2; - } - importNode(externalNode) { - const deep = 1 < arguments.length && !!arguments[1]; - const node = externalNode.cloneNode(deep); - const { [CUSTOM_ELEMENTS]: customElements2 } = this; - const { active } = customElements2; - const upgrade = (element) => { - const { ownerDocument, nodeType } = element; - element.ownerDocument = this; - if (active && ownerDocument !== this && nodeType === ELEMENT_NODE) - customElements2.upgrade(element); - }; - upgrade(node); - if (deep) { - switch (node.nodeType) { - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: { - let { [NEXT]: next, [END]: end } = node; - while (next !== end) { - if (next.nodeType === ELEMENT_NODE) - upgrade(next); - next = next[NEXT]; + if (!this._config) { + this._config = await this.invoke(new tl_1.Api.help.GetConfig()); + } + for (const DC of this._config.dcOptions) { + if (DC.id === dcId && !!DC.ipv6 === this._useIPV6) { + return { + id: DC.id, + ipAddress: DC.ipAddress, + port: 443 + }; } - break; } + throw new Error(`Cannot find the DC with the ID of ${dcId}`); } - } - return node; - } - toString() { - return this.childNodes.join(""); - } - querySelector(selectors) { - return query(super.querySelector, this, selectors); - } - querySelectorAll(selectors) { - return query(super.querySelectorAll, this, selectors); - } - /* c8 ignore start */ - getElementsByTagNameNS(_, name) { - return this.getElementsByTagName(name); - } - createAttributeNS(_, name) { - return this.createAttribute(name); - } - createElementNS(nsp, localName, options) { - return nsp === SVG_NAMESPACE ? new SVGElement(this, localName, null) : this.createElement(localName, options); - } - /* c8 ignore stop */ -}; -setPrototypeOf( - globalExports.Document = function Document3() { - illegalConstructor(); - }, - Document2 -).prototype = Document2.prototype; - -// node_modules/linkedom/esm/html/document.js -var createHTMLElement = (ownerDocument, builtin, localName, options) => { - if (!builtin && htmlClasses.has(localName)) { - const Class = htmlClasses.get(localName); - return new Class(ownerDocument, localName); - } - const { [CUSTOM_ELEMENTS]: { active, registry } } = ownerDocument; - if (active) { - const ce = builtin ? options.is : localName; - if (registry.has(ce)) { - const { Class } = registry.get(ce); - const element = new Class(ownerDocument, localName); - customElements.set(element, { connected: false }); - return element; - } - } - return new HTMLElement2(ownerDocument, localName); -}; -var HTMLDocument = class extends Document2 { - constructor() { - super("text/html"); - } - get all() { - const nodeList = new NodeList(); - let { [NEXT]: next, [END]: end } = this; - while (next !== end) { - switch (next.nodeType) { - case ELEMENT_NODE: - nodeList.push(next); - break; + /** @hidden */ + _removeSender(dcId) { + delete this._borrowedSenderPromises[dcId]; + } + /** @hidden */ + _getResponseMessage(req, result, inputChat) { + return parseMethods._getResponseMessage(this, req, result, inputChat); + } + /** @hidden */ + [inspect_1.inspect.custom]() { + return (0, Helpers_1.betterConsoleLog)(this); + } + /** + * Small hack for using it in browsers + */ + static get events() { + return require_events(); } - next = next[NEXT]; - } - return nodeList; - } - /** - * @type HTMLHeadElement - */ - get head() { - const { documentElement } = this; - let { firstElementChild } = documentElement; - if (!firstElementChild || firstElementChild.tagName !== "HEAD") { - firstElementChild = this.createElement("head"); - documentElement.prepend(firstElementChild); - } - return firstElementChild; - } - /** - * @type HTMLBodyElement - */ - get body() { - const { head } = this; - let { nextElementSibling: nextElementSibling4 } = head; - if (!nextElementSibling4 || nextElementSibling4.tagName !== "BODY") { - nextElementSibling4 = this.createElement("body"); - head.after(nextElementSibling4); - } - return nextElementSibling4; - } - /** - * @type HTMLTitleElement - */ - get title() { - const { head } = this; - return head.getElementsByTagName("title").at(0)?.textContent || ""; - } - set title(textContent3) { - const { head } = this; - let title = head.getElementsByTagName("title").at(0); - if (title) - title.textContent = textContent3; - else { - head.insertBefore( - this.createElement("title"), - head.firstChild - ).textContent = textContent3; - } - } - createElement(localName, options) { - const builtin = !!(options && options.is); - const element = createHTMLElement(this, builtin, localName, options); - if (builtin) - element.setAttribute("is", options.is); - return element; + }; + exports2.TelegramClient = TelegramClient2; } -}; +}); -// node_modules/linkedom/esm/svg/document.js -init_define_import_meta_env(); -var SVGDocument = class extends Document2 { - constructor() { - super("image/svg+xml"); - } - toString() { - return this[MIME].docType + super.toString(); +// node_modules/telegram/Version.js +var require_Version = __commonJS({ + "node_modules/telegram/Version.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "2.26.21"; } -}; +}); -// node_modules/linkedom/esm/xml/document.js -init_define_import_meta_env(); -var XMLDocument = class extends Document2 { - constructor() { - super("text/xml"); - } - toString() { - return this[MIME].docType + super.toString(); +// node_modules/telegram/client/index.js +var require_client = __commonJS({ + "node_modules/telegram/client/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.users = exports2.uploads = exports2.updates = exports2.tgClient = exports2.telegramBaseClient = exports2.message = exports2.messageParse = exports2.downloads = exports2.dialogs = exports2.chats = exports2.buttons = exports2.bots = exports2.auth = exports2.twoFA = void 0; + var twoFA = __importStar2(require_fa()); + exports2.twoFA = twoFA; + var auth = __importStar2(require_auth()); + exports2.auth = auth; + var bots = __importStar2(require_bots()); + exports2.bots = bots; + var buttons = __importStar2(require_buttons()); + exports2.buttons = buttons; + var chats = __importStar2(require_chats()); + exports2.chats = chats; + var dialogs = __importStar2(require_dialogs()); + exports2.dialogs = dialogs; + var downloads = __importStar2(require_downloads()); + exports2.downloads = downloads; + var messageParse = __importStar2(require_messageParse()); + exports2.messageParse = messageParse; + var message = __importStar2(require_messages2()); + exports2.message = message; + var telegramBaseClient = __importStar2(require_telegramBaseClient()); + exports2.telegramBaseClient = telegramBaseClient; + var tgClient = __importStar2(require_TelegramClient()); + exports2.tgClient = tgClient; + var updates = __importStar2(require_updates()); + exports2.updates = updates; + var uploads = __importStar2(require_uploads()); + exports2.uploads = uploads; + var users = __importStar2(require_users()); + exports2.users = users; } -}; +}); -// node_modules/linkedom/esm/dom/parser.js -var DOMParser2 = class _DOMParser { - /** @typedef {{ "text/html": HTMLDocument, "image/svg+xml": SVGDocument, "text/xml": XMLDocument }} MimeToDoc */ - /** - * @template {keyof MimeToDoc} MIME - * @param {string} markupLanguage - * @param {MIME} mimeType - * @returns {MimeToDoc[MIME]} - */ - parseFromString(markupLanguage, mimeType, globals = null) { - let isHTML = false, document2; - if (mimeType === "text/html") { - isHTML = true; - document2 = new HTMLDocument(); - } else if (mimeType === "image/svg+xml") - document2 = new SVGDocument(); - else - document2 = new XMLDocument(); - document2[DOM_PARSER] = _DOMParser; - if (globals) - document2[GLOBALS] = globals; - if (isHTML && markupLanguage === "...") - markupLanguage = "<!doctype html><html><head></head><body></body></html>"; - return markupLanguage ? parseFromString(document2, isHTML, markupLanguage) : document2; +// node_modules/telegram/index.js +var require_telegram = __commonJS({ + "node_modules/telegram/index.js"(exports2) { + "use strict"; + init_define_import_meta_env(); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.client = exports2.password = exports2.tl = exports2.helpers = exports2.extensions = exports2.sessions = exports2.errors = exports2.utils = exports2.Logger = exports2.version = exports2.Connection = exports2.TelegramClient = exports2.Api = void 0; + var tl_1 = require_tl(); + Object.defineProperty(exports2, "Api", { enumerable: true, get: function() { + return tl_1.Api; + } }); + var tl = __importStar2(require_tl()); + exports2.tl = tl; + var TelegramClient_1 = require_TelegramClient(); + Object.defineProperty(exports2, "TelegramClient", { enumerable: true, get: function() { + return TelegramClient_1.TelegramClient; + } }); + var network_1 = require_network(); + Object.defineProperty(exports2, "Connection", { enumerable: true, get: function() { + return network_1.Connection; + } }); + var Version_1 = require_Version(); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return Version_1.version; + } }); + var Logger_1 = require_Logger(); + Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { + return Logger_1.Logger; + } }); + var utils = __importStar2(require_Utils()); + exports2.utils = utils; + var errors = __importStar2(require_errors()); + exports2.errors = errors; + var sessions = __importStar2(require_sessions()); + exports2.sessions = sessions; + var extensions = __importStar2(require_extensions()); + exports2.extensions = extensions; + var helpers = __importStar2(require_Helpers()); + exports2.helpers = helpers; + var client2 = __importStar2(require_client()); + exports2.client = client2; + var password = __importStar2(require_Password()); + exports2.password = password; } -}; - -// node_modules/linkedom/esm/shared/parse-json.js -init_define_import_meta_env(); -var { parse: parse4 } = JSON; +}); -// node_modules/linkedom/esm/interface/node-filter.js +// server.ts init_define_import_meta_env(); - -// node_modules/linkedom/esm/index.js -function Document4() { - illegalConstructor(); -} -setPrototypeOf(Document4, Document2).prototype = Document2.prototype; +var import_express = __toESM(require_express2()); +var import_path = __toESM(require("path")); +var import_crypto2 = __toESM(require("crypto")); +var import_linkedom = __toESM(require_cjs2()); // ../frontend/src/lib/staticApi.ts init_define_import_meta_env(); @@ -79949,10 +82450,10 @@ var AwsV4Signer = class { return hashHeader; } }; -async function hmac(key2, string) { +async function hmac(key, string) { const cryptoKey = await crypto.subtle.importKey( "raw", - typeof key2 === "string" ? encoder.encode(key2) : key2, + typeof key === "string" ? encoder.encode(key) : key, { name: "HMAC", hash: { name: "SHA-256" } }, false, ["sign"] @@ -80055,7 +82556,7 @@ async function unlock(pw) { if (session?.pw === pw) return session; const m = await getMeta(); const base = await crypto.subtle.importKey("raw", new TextEncoder().encode(pw), "PBKDF2", false, ["deriveKey"]); - const key2 = await crypto.subtle.deriveKey( + const key = await crypto.subtle.deriveKey( { name: "PBKDF2", salt: b64(m.salt), iterations: m.iter, hash: "SHA-256" }, base, { name: "AES-GCM", length: 256 }, @@ -80065,7 +82566,7 @@ async function unlock(pw) { const buf = b64(m.cfg); let plain; try { - plain = await crypto.subtle.decrypt({ name: "AES-GCM", iv: buf.slice(0, 12) }, key2, buf.slice(12)); + plain = await crypto.subtle.decrypt({ name: "AES-GCM", iv: buf.slice(0, 12) }, key, buf.slice(12)); } catch { throw new AuthError(); } @@ -80082,9 +82583,9 @@ function need() { if (!session) throw new AuthError(); return session; } -async function r2(method, key2, body, type) { +async function r2(method, key, body, type) { const s = need(); - const req = await s.client.sign(s.base + key2, { + const req = await s.client.sign(s.base + key, { method, body, headers: type ? { "Content-Type": type } : void 0 @@ -80095,21 +82596,21 @@ async function r2(method, key2, body, type) { await new Promise((res) => setTimeout(res, 800 * (i + 1))); } } -async function getJSON(key2, fallback) { - const r = await r2("GET", key2); +async function getJSON(key, fallback) { + const r = await r2("GET", key); if (r.status === 404) return fallback; if (!r.ok) throw new Error(`\u4E91\u7AEF\u8BFB\u53D6\u5931\u8D25 ${r.status}`); - if (key2.endsWith(".gz")) return JSON.parse(await gunzipText(await r.arrayBuffer())); + if (key.endsWith(".gz")) return JSON.parse(await gunzipText(await r.arrayBuffer())); return await r.json(); } -async function putJSON(key2, data) { +async function putJSON(key, data) { const text = JSON.stringify(data); - const r = key2.endsWith(".gz") ? await r2("PUT", key2, await gzip(text), "application/gzip") : await r2("PUT", key2, text, "application/json"); + const r = key.endsWith(".gz") ? await r2("PUT", key, await gzip(text), "application/gzip") : await r2("PUT", key, text, "application/json"); if (!r.ok) throw new Error(`\u4E91\u7AEF\u4FDD\u5B58\u5931\u8D25 ${r.status}`); } -var loadPrivate = (key2, fallback) => getJSON(`private/${key2}`, fallback); -var storePrivate = (key2, data) => putJSON(`private/${key2}`, data); -var deletePrivate = (key2) => r2("DELETE", `private/${key2}`); +var loadPrivate = (key, fallback) => getJSON(`private/${key}`, fallback); +var storePrivate = (key, data) => putJSON(`private/${key}`, data); +var deletePrivate = (key) => r2("DELETE", `private/${key}`); var loadIndex = () => getJSON("index.json", { updated_at: (/* @__PURE__ */ new Date()).toISOString(), channels: [] }); var loadPosts = (ch) => getJSON(`posts/${ch}.json.gz`, []); var loadNotes = (ch) => getJSON(`notes/${ch}.json.gz`, []); @@ -80289,25 +82790,25 @@ function setAccountFetcher(f) { if (!f) accountOnly.clear(); } var hasAccountFetcher = () => accountFetcher != null; -async function fetchPage(channel, before2, f = fetch) { - const key2 = channel.toLowerCase(); - if (accountFetcher && accountOnly.has(key2)) return accountFetcher(channel, before2); +async function fetchPage(channel, before, f = fetch) { + const key = channel.toLowerCase(); + if (accountFetcher && accountOnly.has(key)) return accountFetcher(channel, before); let page = null; try { - page = await fetchWebPage(channel, before2, f); + page = await fetchWebPage(channel, before, f); } catch (e) { if (!accountFetcher) throw e; } - if (accountFetcher && (!page || !page.isChannelPreview || before2 == null && page.posts.length === 0)) { - const viaAccount = await accountFetcher(channel, before2); - accountOnly.add(key2); + if (accountFetcher && (!page || !page.isChannelPreview || before == null && page.posts.length === 0)) { + const viaAccount = await accountFetcher(channel, before); + accountOnly.add(key); return viaAccount; } if (serverSide && page && !page.isChannelPreview) throw new Error("\u8FD9\u4E2A\u9891\u9053\u5173\u95ED\u4E86\u7F51\u9875\u9884\u89C8\u3002\u70B9\u53F3\u4E0A\u89D2\u300CTelegram \u8D26\u53F7\u300D\u767B\u5F55\u540E\u5C31\u80FD\u6293\u53D6"); return page; } -async function fetchWebPage(channel, before2, f = fetch) { - const url = `https://t.me/s/${channel}${before2 ? `?before=${before2}` : ""}`; +async function fetchWebPage(channel, before, f = fetch) { + const url = `https://t.me/s/${channel}${before ? `?before=${before}` : ""}`; let lastErr = ""; for (let round = 0; round < 6; round++) { for (const relay of RELAYS) { @@ -80414,12 +82915,12 @@ async function mutateSaves(fn) { savesAt = Date.now(); return s; } -function withLock(key2, fn) { - const prev = locks.get(key2) || Promise.resolve(); +function withLock(key, fn) { + const prev = locks.get(key) || Promise.resolve(); const next = prev.catch(() => { }).then(fn); - locks.set(key2, next); - next.finally(() => locks.get(key2) === next && locks.delete(key2)).catch(() => { + locks.set(key, next); + next.finally(() => locks.get(key) === next && locks.delete(key)).catch(() => { }); return next; } @@ -80480,19 +82981,19 @@ function persist(ch, fresh, patch = {}) { } function syncNew(ch, pages = 5) { if (syncing.has(ch)) return syncing.get(ch); - const job = (async () => { + const job2 = (async () => { const known = entryOf(ch)?.max_id ?? null; - let before2 = null; + let before = null; const got = []; let meta = null; for (let i = 0; i < pages; i++) { - const page = await fetchPage(ch, before2, getRawFetch()); + const page = await fetchPage(ch, before, getRawFetch()); meta = meta || page; if (!page.posts.length) break; got.push(...page.posts); const minId = Math.min(...page.posts.map((p) => p.post_id)); - if (known != null && minId <= known || minId <= 1 || before2 != null && minId >= before2) break; - before2 = minId; + if (known != null && minId <= known || minId <= 1 || before != null && minId >= before) break; + before = minId; } const patch = { last_synced_at: (/* @__PURE__ */ new Date()).toISOString() }; if (meta) Object.assign(patch, { title: meta.title, description: meta.description, avatar: meta.avatar }); @@ -80500,29 +83001,29 @@ function syncNew(ch, pages = 5) { emit(ch, "done"); return { fetched: got.length, added }; })(); - syncing.set(ch, job); - job.finally(() => syncing.delete(ch)).catch(() => { + syncing.set(ch, job2); + job2.finally(() => syncing.delete(ch)).catch(() => { }); - return job; + return job2; } async function syncOlder(ch, pages) { - let before2 = entryOf(ch)?.min_id ?? null; - if (before2 != null && before2 <= 1) return { fetched: 0, done: true }; + let before = entryOf(ch)?.min_id ?? null; + if (before != null && before <= 1) return { fetched: 0, done: true }; const got = []; let done = false; for (let i = 0; i < pages; i++) { - const page = await fetchPage(ch, before2, getRawFetch()); + const page = await fetchPage(ch, before, getRawFetch()); if (!page.posts.length) { done = true; break; } got.push(...page.posts); const minId = Math.min(...page.posts.map((p) => p.post_id)); - if (minId <= 1 || before2 != null && minId >= before2) { + if (minId <= 1 || before != null && minId >= before) { done = true; break; } - before2 = minId; + before = minId; } await persist(ch, got, done ? { backfill_status: "done" } : {}); emit(ch, "done"); @@ -80539,33 +83040,33 @@ function startBackfill(ch) { const e = entryOf(ch); if (e?.backfill_status === "done") return false; if (e && leaseFresh(e.backfill_lease) && leaseOwner(e.backfill_lease) !== TAB) return false; - const state = { minId: e?.min_id ?? null, stop: false }; - backfills.set(ch, state); + const state2 = { minId: e?.min_id ?? null, stop: false }; + backfills.set(ch, state2); emit(ch, "progress"); (async () => { try { - let before2 = entryOf(ch)?.min_id ?? null; - let done = before2 != null && before2 <= 1; - while (!done && !state.stop) { + let before = entryOf(ch)?.min_id ?? null; + let done = before != null && before <= 1; + while (!done && !state2.stop) { const batch = []; - for (let i = 0; i < 5 && !state.stop; i++) { - const page = await fetchPage(ch, before2, getRawFetch()); + for (let i = 0; i < 5 && !state2.stop; i++) { + const page = await fetchPage(ch, before, getRawFetch()); if (!page.posts.length) { done = true; break; } batch.push(...page.posts); const minId = Math.min(...page.posts.map((p) => p.post_id)); - state.minId = minId; - if (minId <= 1 || before2 != null && minId >= before2) { + state2.minId = minId; + if (minId <= 1 || before != null && minId >= before) { done = true; break; } - before2 = minId; + before = minId; emit(ch, "progress"); } - if (state.stop) break; - if (serverMode) console.log("backfill", ch, "got", batch.length, "min_id", state.minId); + if (state2.stop) break; + if (serverMode) console.log("backfill", ch, "got", batch.length, "min_id", state2.minId); await persist(ch, batch, { backfill_status: done ? "done" : "partial", backfill_lease: done ? null : `${TAB}@${(/* @__PURE__ */ new Date()).toISOString()}` @@ -80574,12 +83075,12 @@ function startBackfill(ch) { } } catch (err) { console.error("backfill", ch, err); - if (entryOf(ch) && !state.stop) + if (entryOf(ch) && !state2.stop) await persist(ch, [], { backfill_status: `error:${err.message}`, backfill_lease: null }).catch(() => { }); } finally { - if (backfills.get(ch) === state) backfills.delete(ch); - if (serverMode) console.log("backfill end", ch, state.stop ? "stopped" : "finished", "min_id", state.minId); + if (backfills.get(ch) === state2) backfills.delete(ch); + if (serverMode) console.log("backfill end", ch, state2.stop ? "stopped" : "finished", "min_id", state2.minId); emit(ch, "done"); } })(); @@ -80675,10 +83176,10 @@ function groupBest(rows) { return groups; } var bestOf = (list) => [...list].sort((a, b) => cmpDesc(a.score, b.score) || cmpDesc(a.char_count, b.char_count) || a.post_id - b.post_id)[0]; -function countBy(items, key2) { +function countBy(items, key) { const m = /* @__PURE__ */ new Map(); for (const it of items) { - const k = key2(it); + const k = key(it); if (k == null) continue; m.set(k, (m.get(k) || 0) + 1); } @@ -80875,8 +83376,8 @@ async function handle(method, path2, qs, body) { const { info, data } = await getChannel(channelParam); const rows = joinRows(info?.channel || channelParam, data, await getSaves()); if (path2 === "inspo/group") { - const key2 = qs.get("key") || ""; - const items = rows.filter((r) => r.plot_group === key2).sort((a, b) => cmpDesc(a.score, b.score) || cmpDesc(a.char_count, b.char_count)); + const key = qs.get("key") || ""; + const items = rows.filter((r) => r.plot_group === key).sort((a, b) => cmpDesc(a.score, b.score) || cmpDesc(a.char_count, b.char_count)); return json({ items }); } if (path2 === "inspo") { @@ -80927,7 +83428,7 @@ async function handleApi(method, path2, qs, body) { } } -// botprobe.ts +// discover.ts init_define_import_meta_env(); var import_telegram2 = __toESM(require_telegram()); @@ -81023,21 +83524,21 @@ function toPost(m) { char_count: [...text].length }; } -async function fetchViaAccount(channel, before2) { +async function fetchViaAccount(channel, before) { const c = client; if (!c) throw new Error("Telegram \u8D26\u53F7\u672A\u767B\u5F55"); try { - const key2 = channel.toLowerCase(); - let peer = entities.get(key2); + const key = channel.toLowerCase(); + let peer = entities.get(key); if (!peer) { await throttle(); peer = await c.getInputEntity(channel); - entities.set(key2, peer); + entities.set(key, peer); } let title = channel; let description = ""; let avatar = ""; - if (before2 == null) { + if (before == null) { await throttle(); const ent = await c.getEntity(peer); if (ent instanceof import_telegram.Api.Channel) { @@ -81058,7 +83559,7 @@ async function fetchViaAccount(channel, before2) { title = ent.title; } } - let offsetId = before2 ?? 0; + let offsetId = before ?? 0; for (let round = 0; round < 10; round++) { await throttle(); const msgs = await c.getMessages(peer, { limit: 100, offsetId }); @@ -81220,60 +83721,347 @@ async function throttled(fn) { return fn(); } -// botprobe.ts +// discover.ts +var FILE2 = "discover.json"; +var BOT = "jisou"; var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms)); -function dump(m) { - return { - id: m.id, - out: m.out, - text: m.message, - entities: (m.entities || []).map((e) => ({ - type: e.className, - url: e.url, - text: m.message.slice(e.offset, e.offset + e.length) - })), - buttons: (m.replyMarkup instanceof import_telegram2.Api.ReplyInlineMarkup ? m.replyMarkup.rows : []).map( - (r) => r.buttons.map((b) => ({ - type: b.className, - text: b.text, - url: b.url, - data: b.data ? Buffer.from(b.data).toString("base64") : void 0 - })) - ) - }; +var state = null; +var job = null; +var saveTimer = null; +async function load() { + if (!state) + state = await loadPrivate(FILE2, { + updated_at: (/* @__PURE__ */ new Date()).toISOString(), + bot: BOT, + keywords: [], + searched: {}, + running: false, + phase: "", + queue: [], + items: [] + }); + return state; +} +async function save(now = false) { + if (!state) return; + state.updated_at = (/* @__PURE__ */ new Date()).toISOString(); + if (saveTimer) clearTimeout(saveTimer); + if (now) return storePrivate(FILE2, state); + saveTimer = setTimeout(() => storePrivate(FILE2, state).catch((e) => console.error("discover save", e)), 3e3); +} +var parseMembers = (s) => { + const m = s.match(/([\d.]+)\s*([kKwW万]?)\s*$/); + if (!m) return null; + let n = parseFloat(m[1]); + if (/k/i.test(m[2])) n *= 1e3; + if (/[wW万]/.test(m[2])) n *= 1e4; + return Math.round(n); +}; +function parseResults(m) { + const text = m.message || ""; + const lines = text.split("\n"); + const out = []; + for (const e of m.entities || []) { + if (!(e instanceof import_telegram2.Api.MessageEntityTextUrl)) continue; + const u = e.url.match(/^https?:\/\/t\.me\/([A-Za-z][A-Za-z0-9_]{3,63})(\?.*)?$/); + if (!u) continue; + const title = text.slice(e.offset, e.offset + e.length).trim(); + let pos = 0; + let line = ""; + for (const l of lines) { + if (e.offset >= pos && e.offset <= pos + l.length) { + line = l; + break; + } + pos += l.length + 1; + } + const kind = line.startsWith("\u{1F465}") ? "group" : line.startsWith("\u{1F4E2}") ? "channel" : "unknown"; + out.push({ username: u[1], title, kind, members: parseMembers(line), ad: /[?&]ad=/.test(u[2] || "") }); + } + return out; } -async function probe(body) { +var hasNext = (m) => m.replyMarkup instanceof import_telegram2.Api.ReplyInlineMarkup && m.replyMarkup.rows.some((r) => r.buttons.some((b) => /下一页/.test(b.text))); +function buttonData(m, emoji) { + if (!(m.replyMarkup instanceof import_telegram2.Api.ReplyInlineMarkup)) return null; + for (const r of m.replyMarkup.rows) + for (const b of r.buttons) if (b instanceof import_telegram2.Api.KeyboardButtonCallback && b.text === emoji) return Buffer.from(b.data).toString(); + return null; +} +async function readMsg(peer, id) { + const c = getClient(); + const [m] = await c.getMessages(peer, { ids: [id] }); + return m; +} +async function searchKeyword(keyword, add, ctl) { const c = getClient(); - if (!c) throw new Error("not logged in"); - const botName = String(body.bot || "jisou"); - const bot = await throttled(() => c.getInputEntity(botName)); - if (body.click) { - const { msgId, data } = body.click; - const ans = await c.invoke(new import_telegram2.Api.messages.GetBotCallbackAnswer({ peer: bot, msgId, data: Buffer.from(data, "base64") })).catch((e) => ({ error: String(e) })); - await sleep3(2500); - const msgs = await c.getMessages(bot, { ids: [msgId] }); - const latest2 = await c.getMessages(bot, { limit: 3 }); - return { ans, msg: msgs.filter(Boolean).map((m) => dump(m)), latest: latest2.map((m) => dump(m)) }; - } - if (body.keyword) { - const sent = await c.sendMessage(bot, { message: String(body.keyword) }); - for (let i = 0; i < 20; i++) { - await sleep3(1500); - const msgs = await c.getMessages(bot, { limit: 5, minId: sent.id }); - if (msgs.some((m) => !m.out)) { + if (!c) throw new Error("\u8BF7\u5148\u767B\u5F55 Telegram \u8D26\u53F7"); + const bot = await throttled(() => c.getInputEntity(BOT)); + const sent = await c.sendMessage(bot, { message: keyword }); + let reply; + for (let i = 0; i < 15 && !reply; i++) { + await sleep3(1500); + const msgs = await c.getMessages(bot, { limit: 5, minId: sent.id }); + reply = msgs.find((m) => !m.out && m.replyMarkup); + } + if (!reply) throw new Error("\u641C\u7D22\u673A\u5668\u4EBA\u6CA1\u6709\u56DE\u590D"); + add(parseResults(reply)); + const template = buttonData(reply, "\u{1F4E2}") || buttonData(reply, "\u{1F465}") || "/s 0 0 channel none 0 18 10"; + for (const [type, maxPages] of [ + ["channel", 6], + ["group", 3] + ]) { + let lastText = ""; + for (let page = 0; page < maxPages && !ctl.stop; page++) { + const parts = template.split(" "); + parts[3] = type; + parts[5] = String(page); + await c.invoke(new import_telegram2.Api.messages.GetBotCallbackAnswer({ peer: bot, msgId: reply.id, data: Buffer.from(parts.join(" ")) })).catch(() => { + }); + let m; + for (let i = 0; i < 6; i++) { await sleep3(2e3); - const again = await c.getMessages(bot, { limit: 5, minId: sent.id }); - return again.map((m) => dump(m)); + m = await readMsg(bot, reply.id); + if (m && m.message !== lastText) break; + } + if (!m || m.message === lastText) break; + lastText = m.message; + const found = parseResults(m); + if (!found.length) break; + add(found.map((f) => ({ ...f, kind: f.kind === "unknown" ? type : f.kind }))); + if (!hasNext(m)) break; + } + } +} +var PROMO = /(t\.me\/|@[A-Za-z][A-Za-z0-9_]{4,}|推广|广告|联系客服|上车|价格|代理|招商|飞机号|加群|进群|入群|频道推荐|互推|资源|福利|下载|点击|优惠)/; +var NARRATIVE = /(那天|后来|当时|之后|那时|有一次|记得|小时候|去年|前几天|昨天|今天|那年|一开始|最后|结果|突然|没想到|第一次)/g; +var ADULT = /(做爱|性爱|性交|约炮|鸡巴|肉棒|阴茎|阴道|小穴|骚逼|内射|口交|自慰|高潮|绿帽|母狗|调教|淫|奶子|乳房|啪啪|开房)/; +function judge(texts) { + const posts = texts.map((t) => t.trim()).filter(Boolean); + const n = posts.length; + const lens = posts.map((t) => [...t].length).sort((a, b) => a - b); + const median = n ? lens[Math.floor(n / 2)] : 0; + const avg = n ? Math.round(lens.reduce((s, x) => s + x, 0) / n) : 0; + const isPromo = (t) => PROMO.test(t) && [...t].length < 250; + const isStory = (t) => { + const len = [...t].length; + if (len < 80 || isPromo(t)) return false; + const me = (t.match(/我/g) || []).length; + const narr = (t.match(NARRATIVE) || []).length; + const people = (t.match(/[他她]/g) || []).length; + return me >= 3 || narr >= 2 || people >= 3 && len >= 150; + }; + const promo = n ? posts.filter(isPromo).length / n : 0; + const story = n ? posts.filter(isStory).length / n : 0; + const long = n ? posts.filter((t) => [...t].length >= 300).length / n : 0; + const adult = n ? posts.filter((t) => ADULT.test(t)).length / n >= 0.2 : false; + let verdict; + if (n < 5) verdict = "\u5185\u5BB9\u592A\u5C11"; + else if (promo >= 0.5) verdict = "\u5E7F\u544A\u5BFC\u822A"; + else if (story >= 0.35 && (median >= 300 || long >= 0.4)) verdict = "\u957F\u6587\u6545\u4E8B"; + else if (story >= 0.3) verdict = "\u77ED\u6587\u6545\u4E8B"; + else if (median < 40) verdict = "\u95F2\u804A\u7FA4"; + else verdict = "\u5176\u4ED6"; + const score = Math.round(100 * (0.6 * story + 0.25 * Math.min(1, median / 400) + 0.15 * (1 - promo))); + const samples = posts.filter((t) => !isPromo(t)).sort((a, b) => [...b].length - [...a].length).slice(0, 3).map((t) => ({ text: [...t].slice(0, 220).join(""), chars: [...t].length })); + return { + verdict, + suitable: verdict === "\u957F\u6587\u6545\u4E8B" || verdict === "\u77ED\u6587\u6545\u4E8B", + score, + adult, + stats: { n, median, avg, long: +long.toFixed(2), story: +story.toFixed(2), promo: +promo.toFixed(2) }, + samples + }; +} +async function recentTexts(c) { + if (c.kind !== "group") { + try { + const p1 = await fetchWebPage(c.username, null); + if (p1.isChannelPreview && p1.posts.length) { + let posts = p1.posts; + if (posts.length < 30) { + const min = Math.min(...posts.map((p) => p.post_id)); + if (min > 1) posts = posts.concat((await fetchWebPage(c.username, min).catch(() => null))?.posts ?? []); + } + posts.sort((a, b) => b.post_id - a.post_id); + return { + texts: posts.slice(0, 30).map((p) => p.text || ""), + title: p1.title, + last: posts[0]?.posted_at ?? null, + kind: "channel" + }; + } + } catch { + } + } + const cl = getClient(); + if (!cl) throw new Error("\u9700\u8981\u767B\u5F55 Telegram \u8D26\u53F7"); + await sleep3(2500); + const ent = await throttled(() => cl.getEntity(c.username)); + if (ent instanceof import_telegram2.Api.User) throw new Error("\u8FD9\u662F\u4E2A\u4EBA\u8D26\u53F7\u6216\u673A\u5668\u4EBA"); + const msgs = await throttled(() => cl.getMessages(ent, { limit: 80 })); + const texts = msgs.filter((m) => m instanceof import_telegram2.Api.Message && !!m.message?.trim()).slice(0, 30).map((m) => m.message); + const kind = ent instanceof import_telegram2.Api.Channel ? ent.megagroup || ent.gigagroup ? "group" : "channel" : "group"; + const first = msgs.find((m) => m instanceof import_telegram2.Api.Message); + return { + texts, + title: ent.title, + last: first ? new Date(first.date * 1e3).toISOString() : null, + kind + }; +} +async function check(c) { + try { + const r = await recentTexts(c); + Object.assign(c, judge(r.texts), { + status: "checked", + title: r.title || c.title, + kind: r.kind || c.kind, + last_post_at: r.last ?? null, + checked_at: (/* @__PURE__ */ new Date()).toISOString(), + error: void 0 + }); + } catch (e) { + const err = e; + if (err.seconds && err.seconds > 60) throw e; + c.status = "error"; + c.error = friendly(e); + c.checked_at = (/* @__PURE__ */ new Date()).toISOString(); + } +} +async function runJob(keywords, ctl) { + const s = await load(); + s.running = true; + try { + const byName = new Map(s.items.map((c) => [c.username.toLowerCase(), c])); + for (const kw of keywords) { + if (ctl.stop) break; + s.phase = `\u6B63\u5728\u7528\u5173\u952E\u8BCD\u300C${kw}\u300D\u641C\u7D22\u2026`; + await save(); + try { + await searchKeyword( + kw, + (found) => { + for (const f of found) { + const key = f.username.toLowerCase(); + const ex = byName.get(key); + if (ex) { + if (!ex.keywords.includes(kw)) ex.keywords.push(kw); + if (ex.members == null) ex.members = f.members; + if (ex.kind === "unknown") ex.kind = f.kind; + continue; + } + const cand = { ...f, keywords: [kw], status: "pending" }; + byName.set(key, cand); + s.items.push(cand); + s.queue.push(f.username); + } + }, + ctl + ); + s.searched[kw] = (/* @__PURE__ */ new Date()).toISOString(); + if (!s.keywords.includes(kw)) s.keywords.push(kw); + } catch (e) { + s.phase = `\u5173\u952E\u8BCD\u300C${kw}\u300D\u641C\u7D22\u5931\u8D25\uFF1A${friendly(e)}`; + console.error("discover search", kw, e); + } + await save(); + } + await checkQueue(ctl); + } finally { + s.running = false; + if (!ctl.stop) s.phase = s.queue.length ? `\u5DF2\u6682\u505C\uFF0C\u8FD8\u6709 ${s.queue.length} \u4E2A\u5F85\u5224\u65AD` : "\u5B8C\u6210"; + await save(true); + } +} +async function checkQueue(ctl) { + const s = await load(); + const byName = new Map(s.items.map((c) => [c.username.toLowerCase(), c])); + const total = s.queue.length; + let done = 0; + while (s.queue.length && !ctl.stop) { + const name = s.queue[0]; + const c = byName.get(name.toLowerCase()); + done++; + if (c && c.status === "pending") { + s.phase = `\u6B63\u5728\u8BFB\u53D6\u9891\u9053\u5185\u5BB9\u5E76\u5224\u65AD\uFF08${done}/${total}\uFF09\uFF1A${c.title}`; + try { + await check(c); + } catch (e) { + const secs = e.seconds || 600; + s.phase = `Telegram \u9650\u5236\u4E86\u9891\u7387\uFF0C${Math.ceil(secs / 60)} \u5206\u949F\u540E\u81EA\u52A8\u7EE7\u7EED`; + await save(true); + if (secs > 3600) { + setTimeout(() => resumeDiscover(), secs * 1e3 + 5e3); + return; + } + await sleep3(secs * 1e3); + continue; } } - return { timeout: true }; + s.queue.shift(); + await save(); } - const latest = await c.getMessages(bot, { limit: Number(body.limit) || 5 }); - return latest.map((m) => dump(m)); +} +function startJob(fn) { + if (job) return false; + const ctl = { stop: false }; + job = ctl; + fn(ctl).catch((e) => { + console.error("discover job", e); + if (state) state.phase = `\u51FA\u9519\uFF1A${friendly(e)}`; + }).finally(() => { + if (job === ctl) job = null; + if (state) state.running = false; + save(true).catch(() => { + }); + }); + return true; +} +async function discoverState() { + const s = await load(); + return { ...s, running: !!job }; +} +async function discoverRun(body) { + if (!getClient()) throw new Error("\u8BF7\u5148\u767B\u5F55 Telegram \u8D26\u53F7"); + const raw = Array.isArray(body.keywords) ? body.keywords : String(body.keywords || "").split(/[,,、\s]+/); + const keywords = [...new Set(raw.map((k) => String(k).trim()).filter(Boolean))].slice(0, 20); + if (!keywords.length) throw new Error("\u8BF7\u81F3\u5C11\u586B\u4E00\u4E2A\u5173\u952E\u8BCD"); + if (!startJob((ctl) => runJob(keywords, ctl))) throw new Error("\u5DF2\u7ECF\u5728\u641C\u7D22\u4E2D\u4E86"); + return { started: true }; +} +async function discoverStop() { + if (job) job.stop = true; + const s = await load(); + s.phase = "\u5DF2\u505C\u6B62"; + await save(true); + return { stopped: true }; +} +async function discoverUpdate(body) { + const s = await load(); + const c = s.items.find((x) => x.username.toLowerCase() === String(body.username || "").toLowerCase()); + if (!c) throw new Error("\u6CA1\u6709\u8FD9\u4E2A\u7ED3\u679C"); + if (typeof body.ignored === "boolean") c.ignored = body.ignored; + if (body.recheck) { + c.status = "pending"; + if (!s.queue.includes(c.username)) s.queue.unshift(c.username); + startJob((ctl) => checkQueue(ctl)); + } + await save(true); + return c; +} +async function discoverClear() { + if (job) throw new Error("\u8BF7\u5148\u505C\u6B62\u641C\u7D22"); + state = { updated_at: (/* @__PURE__ */ new Date()).toISOString(), bot: BOT, keywords: [], searched: {}, running: false, phase: "", queue: [], items: [] }; + await save(true); + return { ok: true }; +} +async function resumeDiscover() { + const s = await load().catch(() => null); + if (s?.queue.length && getClient()) startJob((ctl) => checkQueue(ctl)); } // server.ts -globalThis.DOMParser = DOMParser2; +globalThis.DOMParser = import_linkedom.DOMParser; var PORT = Number(process.env.PORT || 7860); var PASSWORD = process.env.APP_PASSWORD || ""; var PUBLIC = import_path.default.join(process.cwd(), "public"); @@ -81311,7 +84099,11 @@ app.post("/api/tgauth/start", guarded(loginStart)); app.post("/api/tgauth/code", guarded(loginCode)); app.post("/api/tgauth/password", guarded(loginPassword)); app.post("/api/tgauth/logout", guarded(() => logout())); -app.post("/api/botprobe", guarded(probe)); +app.get("/api/discover", guarded(() => discoverState())); +app.post("/api/discover/run", guarded(discoverRun)); +app.post("/api/discover/stop", guarded(() => discoverStop())); +app.post("/api/discover/update", guarded(discoverUpdate)); +app.post("/api/discover/clear", guarded(() => discoverClear())); app.all("/api/*", async (req, res) => { if (!passwordOk(req)) return res.status(401).json({ error: "password required" }); const url = new URL(req.originalUrl, "http://x"); @@ -81333,7 +84125,10 @@ startServerMode({ secretAccessKey: env("R2_SECRET_ACCESS_KEY"), endpoint: env("R2_ENDPOINT"), bucket: env("R2_BUCKET") -}, () => initAccount(`${PASSWORD}:${env("R2_SECRET_ACCESS_KEY")}`)).then(() => console.log("R2 connected, background sync started")).catch((e) => console.error("R2 init failed:", e)); +}, async () => { + await initAccount(`${PASSWORD}:${env("R2_SECRET_ACCESS_KEY")}`); + setTimeout(() => resumeDiscover().catch((e) => console.error("resumeDiscover", e)), 2e4); +}).then(() => console.log("R2 connected, background sync started")).catch((e) => console.error("R2 init failed:", e)); var SPACE_HOST = process.env.SPACE_HOST; if (SPACE_HOST) { const ping = () => fetch(`https://${SPACE_HOST}/api/health`, { signal: AbortSignal.timeout(2e4) }).then((r) => console.log("keep-awake ping", r.status)).catch((e) => console.warn("keep-awake ping failed", String(e)));