diff --git a/.gitignore b/.gitignore index 0eb1867..6b179f5 100755 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ # testing /frontend/coverage +/backend/db/ /backend/db/firegex.db /backend/db/firegex.db-journal /backend/modules/cppqueue diff --git a/Dockerfile b/Dockerfile index fba2f7c..3e3d418 100755 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM python:slim-bullseye RUN apt-get update && apt-get -y install \ - build-essential git iptables libpcre2-dev\ + build-essential git python3-nftables libpcre2-dev\ libnetfilter-queue-dev libtins-dev\ libnfnetlink-dev libmnl-dev diff --git a/backend/app.py b/backend/app.py index 1a4f2f0..de52210 100644 --- a/backend/app.py +++ b/backend/app.py @@ -9,10 +9,9 @@ from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from jose import JWTError, jwt from passlib.context import CryptContext from fastapi_socketio import SocketManager -from ipaddress import ip_interface from modules import SQLite, FirewallManager from modules.firewall import STATUS -from utils import refactor_name, gen_service_id +from utils import ip_parse, refactor_name, gen_service_id ON_DOCKER = len(sys.argv) > 1 and sys.argv[1] == "DOCKER" DEBUG = len(sys.argv) > 1 and sys.argv[1] == "DEBUG" @@ -54,8 +53,10 @@ async def startup_event(): @app.on_event("shutdown") async def shutdown_event(): + db.backup() await firewall.close() db.disconnect() + db.restore() def create_access_token(data: dict): to_encode = data.copy() @@ -350,11 +351,8 @@ class ServiceAddResponse(BaseModel): @app.post('/api/services/add', response_model=ServiceAddResponse) async def add_new_service(form: ServiceAddForm, auth: bool = Depends(is_loggined)): """Add a new service""" - ipv6 = None try: - ip_int = ip_interface(form.ip_int) - ipv6 = ip_int.version == 6 - form.ip_int = str(ip_int) + form.ip_int = ip_parse(form.ip_int) except ValueError: return {"status":"Invalid address"} if form.proto not in ["tcp", "udp"]: @@ -363,7 +361,7 @@ async def add_new_service(form: ServiceAddForm, auth: bool = Depends(is_loggined try: srv_id = gen_service_id(db) db.query("INSERT INTO services (service_id ,name, port, ipv6, status, proto, ip_int) VALUES (?, ?, ?, ?, ?, ?, ?)", - srv_id, refactor_name(form.name), form.port, ipv6, STATUS.STOP, form.proto, form.ip_int) + srv_id, refactor_name(form.name), form.port, True, STATUS.STOP, form.proto, form.ip_int) except sqlite3.IntegrityError: return {'status': 'This type of service already exists'} await firewall.reload() diff --git a/backend/modules/firegex.py b/backend/modules/firegex.py index 22d6162..cb0e778 100644 --- a/backend/modules/firegex.py +++ b/backend/modules/firegex.py @@ -1,113 +1,140 @@ from typing import Dict, List, Set -from ipaddress import ip_interface -from modules.iptables import IPTables +from utils import ip_parse, ip_family from modules.sqlite import Service import re, os, asyncio -import traceback +import traceback, nftables from modules.sqlite import Regex -class FilterTypes: - INPUT = "FIREGEX-INPUT" - OUTPUT = "FIREGEX-OUTPUT" - QUEUE_BASE_NUM = 1000 class FiregexFilter(): - def __init__(self, proto:str, port:int, ip_int:str, queue=None, target=None, id=None): - self.target = target + def __init__(self, proto:str, port:int, ip_int:str, queue=None, target:str=None, id=None): + self.nftables = nftables.Nftables() self.id = int(id) if id else None self.queue = queue + self.target = target self.proto = proto self.port = int(port) self.ip_int = str(ip_int) def __eq__(self, o: object) -> bool: if isinstance(o, FiregexFilter): - return self.port == o.port and self.proto == o.proto and ip_interface(self.ip_int) == ip_interface(o.ip_int) + return self.port == o.port and self.proto == o.proto and ip_parse(self.ip_int) == ip_parse(o.ip_int) return False - - def ipv6(self): - return ip_interface(self.ip_int).version == 6 - def ipv4(self): - return ip_interface(self.ip_int).version == 4 +class FiregexTables: -class FiregexTables(IPTables): + def __init__(self): + self.table_name = "firegex" + self.nft = nftables.Nftables() + + def raw_cmd(self, *cmds): + return self.nft.json_cmd({"nftables": list(cmds)}) - def __init__(self, ipv6=False): - super().__init__(ipv6, "mangle") - self.create_chain(FilterTypes.INPUT) - self.add_chain_to_input(FilterTypes.INPUT) - self.create_chain(FilterTypes.OUTPUT) - self.add_chain_to_output(FilterTypes.OUTPUT) - - def target_in_chain(self, chain, target): - for filter in self.list()[chain]: - if filter.target == target: - return True - return False - - def add_chain_to_input(self, chain): - if not self.target_in_chain("PREROUTING", str(chain)): - self.insert_rule("PREROUTING", str(chain)) - - def add_chain_to_output(self, chain): - if not self.target_in_chain("POSTROUTING", str(chain)): - self.insert_rule("POSTROUTING", str(chain)) + def cmd(self, *cmds): + code, out, err = self.raw_cmd(*cmds) - def add_output(self, queue_range, proto = None, port = None, ip_int = None): + if code == 0: return out + else: raise Exception(err) + + def init(self): + code, out, err = self.raw_cmd({"create":{"table":{"name":self.table_name,"family":"inet"}}}) + if code == 0: + self.cmd( + {"create":{"chain":{ + "family":"inet", + "table":self.table_name, + "name":"input", + "type":"filter", + "hook":"prerouting", + "prio":-150, + "policy":"accept" + }}}, + {"create":{"chain":{ + "family":"inet", + "table":self.table_name, + "name":"output", + "type":"filter", + "hook":"postrouting", + "prio":-150, + "policy":"accept" + }}} + ) + self.reset() + + def reset(self): + self.cmd({"flush":{"table":{"name":"firegex","family":"inet"}}}) + + def list(self): + return self.cmd({"list": {"ruleset": None}})["nftables"] + + def add_output(self, queue_range, proto, port, ip_int): init, end = queue_range if init > end: init, end = end, init - self.append_rule(FilterTypes.OUTPUT,"NFQUEUE", - * (["-p", str(proto)] if proto else []), - * (["-s", str(ip_int)] if ip_int else []), - * (["--sport", str(port)] if port else []), - * (["--queue-num", f"{init}"] if init == end else ["--queue-balance", f"{init}:{end}"]), - "--queue-bypass" - ) + ip_int = ip_parse(ip_int) + ip_addr = str(ip_int).split("/")[0] + ip_addr_cidr = int(str(ip_int).split("/")[1]) + self.cmd({ "insert":{ "rule": { + "family": "inet", + "table": self.table_name, + "chain": "output", + "expr": [ + {'match': {'left': {'payload': {'protocol': ip_family(ip_int), 'field': 'saddr'}}, 'op': '==', 'right': {"prefix": {"addr": ip_addr, "len": ip_addr_cidr}}}}, #ip_int + {'match': {'left': {'meta': {'key': 'l4proto'}}, 'op': '==', 'right': str(proto)}}, + {'match': {"left": { "payload": {"protocol": str(proto), "field": "sport"}}, "op": "==", "right": int(port)}}, + {"queue": {"num": str(init) if init == end else f"{init}-{end}", "flags": ["bypass"]}} + ] + }}}) def add_input(self, queue_range, proto = None, port = None, ip_int = None): init, end = queue_range if init > end: init, end = end, init - self.append_rule(FilterTypes.INPUT, "NFQUEUE", - * (["-p", str(proto)] if proto else []), - * (["-d", str(ip_int)] if ip_int else []), - * (["--dport", str(port)] if port else []), - * (["--queue-num", f"{init}"] if init == end else ["--queue-balance", f"{init}:{end}"]), - "--queue-bypass" - ) + ip_int = ip_parse(ip_int) + ip_addr = str(ip_int).split("/")[0] + ip_addr_cidr = int(str(ip_int).split("/")[1]) + self.cmd({"insert":{"rule":{ + "family": "inet", + "table": self.table_name, + "chain": "input", + "expr": [ + {'match': {'left': {'payload': {'protocol': ip_family(ip_int), 'field': 'daddr'}}, 'op': '==', 'right': {"prefix": {"addr": ip_addr, "len": ip_addr_cidr}}}}, #ip_int + {'match': {"left": { "payload": {"protocol": str(proto), "field": "dport"}}, "op": "==", "right": int(port)}}, + {"queue": {"num": str(init) if init == end else f"{init}-{end}", "flags": ["bypass"]}} + ] + }}}) def get(self) -> List[FiregexFilter]: res = [] - iptables_filters = self.list() - for filter_type in [FilterTypes.INPUT, FilterTypes.OUTPUT]: - for filter in iptables_filters[filter_type]: - port = filter.sport() if filter_type == FilterTypes.OUTPUT else filter.dport() - queue = filter.nfqueue() - if queue and port: - res.append(FiregexFilter( - target=filter_type, - id=filter.id, - queue=queue, - proto=filter.prot, - port=port, - ip_int=filter.source if filter_type == FilterTypes.OUTPUT else filter.destination - )) + for filter in [ele["rule"] for ele in self.list() if "rule" in ele and ele["rule"]["table"] == self.table_name]: + queue_str = str(filter["expr"][2]["queue"]["num"]).split("-") + queue = None + if len(queue_str) == 1: queue = int(queue_str[0]), int(queue_str[0]) + else: queue = int(queue_str[0]), int(queue_str[1]) + ip_int = None + if isinstance(filter["expr"][0]["match"]["right"],str): + ip_int = str(ip_parse(filter["expr"][0]["match"]["right"])) + else: + ip_int = f'{filter["expr"][0]["match"]["right"]["prefix"]["addr"]}/{filter["expr"][0]["match"]["right"]["prefix"]["len"]}' + res.append(FiregexFilter( + target=filter["chain"], + id=int(filter["handle"]), + queue=queue, + proto=filter["expr"][1]["match"]["left"]["payload"]["protocol"], + port=filter["expr"][1]["match"]["right"], + ip_int=ip_int + )) return res async def add(self, filter:FiregexFilter): if filter in self.get(): return None - return await FiregexInterceptor.start( iptables=self, filter=filter, n_queues=int(os.getenv("N_THREADS_NFQUEUE","1"))) - - def delete_all(self): - for filter_type in [FilterTypes.INPUT, FilterTypes.OUTPUT]: - self.flush_chain(filter_type) + return await FiregexInterceptor.start( filter=filter, n_queues=int(os.getenv("N_THREADS_NFQUEUE","1"))) def delete_by_srv(self, srv:Service): for filter in self.get(): - if filter.port == srv.port and filter.proto == srv.proto and ip_interface(filter.ip_int) == ip_interface(srv.ip_int): - self.delete_rule(filter.target, filter.id) + if filter.port == srv.port and filter.proto == srv.proto and ip_parse(filter.ip_int) == ip_parse(srv.ip_int): + print("DELETE CMD", {"delete":{"rule": {"handle": filter.id, "table": self.table_name, "chain": filter.target, "family": "inet"}}}) + self.cmd({"delete":{"rule": {"handle": filter.id, "table": self.table_name, "chain": filter.target, "family": "inet"}}}) class RegexFilter: @@ -159,7 +186,6 @@ class FiregexInterceptor: def __init__(self): self.filter:FiregexFilter - self.ipv6:bool self.filter_map_lock:asyncio.Lock self.filter_map: Dict[str, RegexFilter] self.regex_filters: Set[RegexFilter] @@ -167,21 +193,18 @@ class FiregexInterceptor: self.process:asyncio.subprocess.Process self.n_queues:int self.update_task: asyncio.Task - self.iptables:FiregexTables @classmethod - async def start(cls, iptables: FiregexTables, filter: FiregexFilter, n_queues:int = 1): + async def start(cls, filter: FiregexFilter, n_queues:int = 1): self = cls() self.filter = filter self.n_queues = n_queues - self.iptables = iptables - self.ipv6 = self.filter.ipv6() self.filter_map_lock = asyncio.Lock() self.update_config_lock = asyncio.Lock() input_range, output_range = await self._start_binary() self.update_task = asyncio.create_task(self.update_blocked()) - self.iptables.add_input(queue_range=input_range, proto=self.filter.proto, port=self.filter.port, ip_int=self.filter.ip_int) - self.iptables.add_output(queue_range=output_range, proto=self.filter.proto, port=self.filter.port, ip_int=self.filter.ip_int) + FiregexTables().add_input(queue_range=input_range, proto=self.filter.proto, port=self.filter.port, ip_int=self.filter.ip_int) + FiregexTables().add_output(queue_range=output_range, proto=self.filter.proto, port=self.filter.port, ip_int=self.filter.ip_int) return self async def _start_binary(self): @@ -221,7 +244,8 @@ class FiregexInterceptor: async def stop(self): self.update_task.cancel() - self.process.kill() + if self.process and self.process.returncode is None: + self.process.kill() async def _update_config(self, filters_codes): async with self.update_config_lock: diff --git a/backend/modules/firewall.py b/backend/modules/firewall.py index e12706b..213e42b 100644 --- a/backend/modules/firewall.py +++ b/backend/modules/firewall.py @@ -24,6 +24,7 @@ class FirewallManager: del self.proxy_table[srv_id] async def init(self): + FiregexTables().init() await self.reload() async def reload(self): @@ -47,7 +48,6 @@ class ServiceManager: def __init__(self, srv: Service, db): self.srv = srv self.db = db - self.firegextable = FiregexTables(self.srv.ipv6) self.status = STATUS.STOP self.filters: Dict[int, FiregexFilter] = {} self.lock = asyncio.Lock() @@ -93,13 +93,13 @@ class ServiceManager: async def start(self): if not self.interceptor: - self.firegextable.delete_by_srv(self.srv) - self.interceptor = await self.firegextable.add(FiregexFilter(self.srv.proto,self.srv.port, self.srv.ip_int)) + FiregexTables().delete_by_srv(self.srv) + self.interceptor = await FiregexTables().add(FiregexFilter(self.srv.proto,self.srv.port, self.srv.ip_int)) await self._update_filters_from_db() self._set_status(STATUS.ACTIVE) async def stop(self): - self.firegextable.delete_by_srv(self.srv) + FiregexTables().delete_by_srv(self.srv) if self.interceptor: await self.interceptor.stop() self.interceptor = None diff --git a/backend/modules/iptables.py b/backend/modules/iptables.py deleted file mode 100644 index 0eb7f76..0000000 --- a/backend/modules/iptables.py +++ /dev/null @@ -1,85 +0,0 @@ -import os, re -from subprocess import PIPE, Popen -from typing import Dict, List, Tuple, Union - -class Rule(): - def __init__(self, id, target, prot, opt, source, destination, details): - self.id = id - self.target = target - self.prot = prot - self.opt = opt - self.source = source - self.destination = destination - self.details = details - - def __repr__(self) -> str: - return f"Rule {self.id} : {self.target}, {self.prot}, {self.opt}, {self.source}, {self.destination}, {self.details}" - - def dport(self) -> Union[int, None]: - port = re.findall(r"dpt:([0-9]+)", self.details) - return int(port[0]) if port else None - - def sport(self) -> Union[int, None]: - port = re.findall(r"spt:([0-9]+)", self.details) - return int(port[0]) if port else None - - def nfqueue(self) -> Union[Tuple[int,int], None]: - balanced = re.findall(r"NFQUEUE balance ([0-9]+):([0-9]+)", self.details) - numbered = re.findall(r"NFQUEUE num ([0-9]+)", self.details) - queue_num = None - if balanced: queue_num = (int(balanced[0][0]), int(balanced[0][1])) - if numbered: queue_num = (int(numbered[0]), int(numbered[0])) - return queue_num - -class IPTables: - - def __init__(self, ipv6=False, table="filter"): - self.ipv6 = ipv6 - self.table = table - - def command(self, params) -> Tuple[bytes, bytes]: - params = ["-t", self.table] + params - if os.geteuid() != 0: - exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'. Exiting.") - return Popen(["ip6tables"]+params if self.ipv6 else ["iptables"]+params, stdout=PIPE, stderr=PIPE).communicate() - - def list(self) -> Dict[str, List[Rule]]: - stdout, strerr = self.command(["-L", "--line-number", "-n"]) - lines = stdout.decode().split("\n") - res: Dict[str, List[Rule]] = {} - chain_name = "" - for line in lines: - if line.startswith("Chain"): - chain_name = line.split()[1] - res[chain_name] = [] - elif line and line.split()[0].isnumeric(): - parsed = re.findall(r"([^ ]*)[ ]{,10}([^ ]*)[ ]{,5}([^ ]*)[ ]{,5}([^ ]*)[ ]{,5}([^ ]*)[ ]+([^ ]*)[ ]+(.*)", line) - if len(parsed) > 0: - parsed = parsed[0] - res[chain_name].append(Rule( - id=parsed[0].strip(), - target=parsed[1].strip(), - prot=parsed[2].strip(), - opt=parsed[3].strip(), - source=parsed[4].strip(), - destination=parsed[5].strip(), - details=" ".join(parsed[6:]).strip() if len(parsed) >= 7 else "" - )) - return res - - def delete_rule(self, chain, id) -> None: - self.command(["-D", str(chain), str(id)]) - - def create_chain(self, name) -> None: - self.command(["-N", str(name)]) - - def flush_chain(self, name) -> None: - self.command(["-F", str(name)]) - - def insert_rule(self, chain, rule, *args, rulenum=1) -> None: - self.command(["-I", str(chain), str(rulenum), "-j", str(rule), *args]) - - def append_rule(self, chain, rule, *args) -> None: - self.command(["-A", str(chain), "-j", str(rule), *args]) - - diff --git a/backend/modules/sqlite.py b/backend/modules/sqlite.py index 85e9e86..329fb14 100644 --- a/backend/modules/sqlite.py +++ b/backend/modules/sqlite.py @@ -8,6 +8,7 @@ class SQLite(): self.conn: Union[None, sqlite3.Connection] = None self.cur = None self.db_name = db_name + self.__backup = None self.schema = { 'services': { 'service_id': 'VARCHAR(100) PRIMARY KEY', @@ -49,6 +50,17 @@ class SQLite(): return d self.conn.row_factory = dict_factory + def backup(self): + if self.conn: + with open(self.db_name, "rb") as f: + self.__backup = f.read() + + def restore(self): + if self.__backup: + with open(self.db_name, "wb") as f: + f.write(self.__backup) + self.__backup = None + def disconnect(self) -> None: if self.conn: self.conn.close() @@ -101,18 +113,17 @@ class SQLite(): class Service: - def __init__(self, id: str, status: str, port: int, name: str, ipv6: bool, proto: str, ip_int: str): + def __init__(self, id: str, status: str, port: int, name: str, proto: str, ip_int: str): self.id = id self.status = status self.port = port self.name = name - self.ipv6 = ipv6 self.proto = proto self.ip_int = ip_int @classmethod def from_dict(cls, var: dict): - return cls(id=var["service_id"], status=var["status"], port=var["port"], name=var["name"], ipv6=var["ipv6"], proto=var["proto"], ip_int=var["ip_int"]) + return cls(id=var["service_id"], status=var["status"], port=var["port"], name=var["name"], proto=var["proto"], ip_int=var["ip_int"]) class Regex: diff --git a/backend/nfqueue/nfqueue.cpp b/backend/nfqueue/nfqueue.cpp index ab508d0..788a8a0 100644 --- a/backend/nfqueue/nfqueue.cpp +++ b/backend/nfqueue/nfqueue.cpp @@ -12,11 +12,11 @@ void config_updater (){ while (true){ getline(cin, line); if (cin.eof()){ - cerr << "[fatal] [upfdater] cin.eof()" << endl; + cerr << "[fatal] [updater] cin.eof()" << endl; exit(EXIT_FAILURE); } if (cin.bad()){ - cerr << "[fatal] [upfdater] cin.bad()" << endl; + cerr << "[fatal] [updater] cin.bad()" << endl; exit(EXIT_FAILURE); } cerr << "[info] [updater] Updating configuration with line " << line << endl; diff --git a/backend/requirements.txt b/backend/requirements.txt index cb24aeb..6ce2631 100755 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -4,3 +4,4 @@ uvicorn[standard] passlib[bcrypt] python-jose[cryptography] fastapi-socketio +git+https://salsa.debian.org/pkg-netfilter-team/pkg-nftables#egg=nftables&subdirectory=py diff --git a/backend/utils.py b/backend/utils.py index 43959f5..1dda9ba 100755 --- a/backend/utils.py +++ b/backend/utils.py @@ -1,3 +1,4 @@ +from ipaddress import ip_interface import os, socket, secrets LOCALHOST_IP = socket.gethostbyname(os.getenv("LOCALHOST_IP","127.0.0.1")) @@ -12,4 +13,10 @@ def gen_service_id(db): res = secrets.token_hex(8) if len(db.query('SELECT 1 FROM services WHERE service_id = ?;', res)) == 0: break - return res \ No newline at end of file + return res + +def ip_parse(ip:str): + return str(ip_interface(ip).network) + +def ip_family(ip:str): + return "ip6" if ip_interface(ip).version == 6 else "ip" \ No newline at end of file diff --git a/frontend/build/asset-manifest.json b/frontend/build/asset-manifest.json index 8218ef3..80f40d4 100644 --- a/frontend/build/asset-manifest.json +++ b/frontend/build/asset-manifest.json @@ -1,13 +1,13 @@ { "files": { "main.css": "/static/css/main.08225a85.css", - "main.js": "/static/js/main.0e7d88b5.js", + "main.js": "/static/js/main.70ebb0b2.js", "index.html": "/index.html", "main.08225a85.css.map": "/static/css/main.08225a85.css.map", - "main.0e7d88b5.js.map": "/static/js/main.0e7d88b5.js.map" + "main.70ebb0b2.js.map": "/static/js/main.70ebb0b2.js.map" }, "entrypoints": [ "static/css/main.08225a85.css", - "static/js/main.0e7d88b5.js" + "static/js/main.70ebb0b2.js" ] } \ No newline at end of file diff --git a/frontend/build/index.html b/frontend/build/index.html index 1571b81..cfcc7e3 100644 --- a/frontend/build/index.html +++ b/frontend/build/index.html @@ -1 +1 @@ -Firegex
\ No newline at end of file +Firegex
\ No newline at end of file diff --git a/frontend/build/static/js/main.0e7d88b5.js b/frontend/build/static/js/main.70ebb0b2.js similarity index 96% rename from frontend/build/static/js/main.0e7d88b5.js rename to frontend/build/static/js/main.70ebb0b2.js index 16d023b..73d5581 100644 --- a/frontend/build/static/js/main.0e7d88b5.js +++ b/frontend/build/static/js/main.70ebb0b2.js @@ -1,3 +1,3 @@ -/*! For license information please see main.0e7d88b5.js.LICENSE.txt */ -!function(){var e={506:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},575:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},913:function(e){function t(e,t){for(var n=0;n0?a-4:a;for(n=0;n>16&255,c[u++]=t>>8&255,c[u++]=255&t;2===l&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t);1===l&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t);return c},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,l=0,s=r-o;ls?s:l+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!==typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=i.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var o,i,a=[],l=t;l>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},778:function(e,t,n){"use strict";var r=n(575).default,o=n(913).default,i=n(506).default,a=n(205).default,l=n(842).default,s=n(9),c=n(38),u="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=p,t.h2=50;var f=2147483647;function d(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,p.prototype),t}function p(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return y(e)}return h(e,t,n)}function h(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!p.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|w(e,t),r=d(n),o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(ee(e,Uint8Array)){var t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return v(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(ee(e,ArrayBuffer)||e&&ee(e.buffer,ArrayBuffer))return g(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(ee(e,SharedArrayBuffer)||e&&ee(e.buffer,SharedArrayBuffer)))return g(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return p.from(r,t,n);var o=function(e){if(p.isBuffer(e)){var t=0|b(e.length),n=d(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||te(e.length)?d(0):v(e);if("Buffer"===e.type&&Array.isArray(e.data))return v(e.data)}(e);if(o)return o;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return p.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function m(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function y(e){return m(e),d(e<0?0:0|b(e))}function v(e){for(var t=e.length<0?0:0|b(e.length),n=d(t),r=0;r=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|e}function w(e,t){if(p.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ee(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(o)return r?-1:G(e).length;t=(""+t).toLowerCase(),o=!0}}function x(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return N(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function k(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r,o){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),te(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"===typeof t&&(t=p.from(t,r)),p.isBuffer(t))return 0===t.length?-1:O(e,t,n,r,o);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):O(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function O(e,t,n,r,o){var i,a=1,l=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,l/=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var u=-1;for(i=n;il&&(n=l-s),i=n;i>=0;i--){for(var f=!0,d=0;do&&(r=o):r=o;var i,a=t.length;for(r>a/2&&(r=a/2),i=0;i>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function N(e,t,n){return 0===t&&n===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,n))}function _(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:i>223?3:i>191?2:1;if(o+l<=n){var s=void 0,c=void 0,u=void 0,f=void 0;switch(l){case 1:i<128&&(a=i);break;case 2:128===(192&(s=e[o+1]))&&(f=(31&i)<<6|63&s)>127&&(a=f);break;case 3:s=e[o+1],c=e[o+2],128===(192&s)&&128===(192&c)&&(f=(15&i)<<12|(63&s)<<6|63&c)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:s=e[o+1],c=e[o+2],u=e[o+3],128===(192&s)&&128===(192&c)&&128===(192&u)&&(f=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&u)>65535&&f<1114112&&(a=f)}}null===a?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=l}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rr.length?(p.isBuffer(i)||(i=p.from(i)),i.copy(r,o)):Uint8Array.prototype.set.call(r,i,o);else{if(!p.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o)}o+=i.length}return r},p.byteLength=w,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(e+=" ... "),""},u&&(p.prototype[u]=p.prototype.inspect),p.prototype.compare=function(e,t,n,r,o){if(ee(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),l=Math.min(i,a),s=this.slice(r,o),c=e.slice(t,n),u=0;u>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return j(this,e,t,n);case"ascii":case"latin1":case"binary":return C(this,e,t,n);case"base64":return P(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,o,i){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function F(e,t,n,r,o){Y(t,r,o,e,n,7);var i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;var a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function D(e,t,n,r,o){Y(t,r,o,e,n,7);var i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;var a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function U(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function W(e,t,n,r,o){return t=+t,n>>>=0,o||U(e,0,n,4),c.write(e,t,n,r,23,4),n+4}function H(e,t,n,r,o){return t=+t,n>>>=0,o||U(e,0,n,8),c.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],o=1,i=0;++i>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readBigUInt64LE=re((function(e){Q(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||X(e,this.length-8);var r=t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24),o=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+n*Math.pow(2,24);return BigInt(r)+(BigInt(o)<>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||X(e,this.length-8);var r=t*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e],o=this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n;return(BigInt(r)<>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},p.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},p.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readBigInt64LE=re((function(e){Q(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||X(e,this.length-8);var r=this[e+4]+this[e+5]*Math.pow(2,8)+this[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(r)<>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||X(e,this.length-8);var r=(t<<24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e];return(BigInt(r)<>>=0,t||M(e,4,this.length),c.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),c.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),c.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),c.read(this,e,!1,52,8)},p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigUInt64LE=re((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return F(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeBigUInt64BE=re((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),p.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var o=Math.pow(2,8*n-1);B(this,e,t,n,o-1,-o)}var i=0,a=1,l=0;for(this[t]=255&e;++i>0)-l&255;return t+n},p.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var o=Math.pow(2,8*n-1);B(this,e,t,n,o-1,-o)}var i=n-1,a=1,l=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===l&&0!==this[t+i+1]&&(l=1),this[t+i]=(e/a>>0)-l&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},p.prototype.writeBigInt64LE=re((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return F(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeBigInt64BE=re((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),p.prototype.writeFloatLE=function(e,t,n){return W(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return W(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,r){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function Y(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?">= 0".concat(l," and < 2").concat(l," ** ").concat(8*(i+1)).concat(l):">= -(2".concat(l," ** ").concat(8*(i+1)-1).concat(l,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(l):">= ".concat(t).concat(l," and <= ").concat(n).concat(l),new V.ERR_OUT_OF_RANGE("value",a,e)}!function(e,t,n){Q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||X(t,e.length-(n+1))}(r,o,i)}function Q(e,t){if("number"!==typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function X(e,t,n){if(Math.floor(e)!==e)throw Q(e,n),new V.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(n||"offset",">= ".concat(n?1:0," and <= ").concat(t),e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),$("ERR_OUT_OF_RANGE",(function(e,t,n){var r='The value of "'.concat(e,'" is out of range.'),o=n;return Number.isInteger(n)&&Math.abs(n)>Math.pow(2,32)?o=q(String(n)):"bigint"===typeof n&&(o=String(n),(n>Math.pow(BigInt(2),BigInt(32))||n<-Math.pow(BigInt(2),BigInt(32)))&&(o=q(o)),o+="n"),r+=" It must be ".concat(t,". Received ").concat(o)}),RangeError);var K=/[^+/0-9A-Za-z-_]/g;function G(e,t){var n;t=t||1/0;for(var r=e.length,o=null,i=[],a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Z(e){return s.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function J(e,t,n,r){var o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function ee(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function te(e){return e!==e}var ne=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)t[r+o]=e[n]+e[o];return t}();function re(e){return"undefined"===typeof BigInt?oe:e}function oe(){throw new Error("BigInt not supported")}},110:function(e,t,n){"use strict";var r=n(441),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?a:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=a;var c=Object.defineProperty,u=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,r)}var a=u(n);f&&(a=a.concat(f(n)));for(var l=s(t),m=s(n),y=0;y>1,u=-7,f=n?o-1:0,d=n?-1:1,p=e[t+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=l;u>0;i=256*i+e[t+f],f+=d,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=r;u>0;a=256*a+e[t+f],f+=d,u-=8);if(0===i)i=1-c;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,l,s,c=8*i-o-1,u=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=u?(l=0,a=u):a+f>=1?(l=(t*s-1)*Math.pow(2,o),a+=f):(l=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&l,p+=h,l/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=h,a/=256,c-=8);e[n+p-h]|=128*m}},463:function(e,t,n){"use strict";var r=n(791),o=n(296);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n