{children}
+
+ );
+}
diff --git a/app/page.tsx b/app/page.tsx
new file mode 100644
index 0000000..67e0859
--- /dev/null
+++ b/app/page.tsx
@@ -0,0 +1,3 @@
+export default function Page() {
+ return null;
+}
diff --git a/build.sh b/build.sh
deleted file mode 100644
index 9877362..0000000
--- a/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-set -e
-
-pnpm run docs:build
-
-# Install gopeed-js
-git clone --depth=1 https://github.com/GopeedLab/gopeed-js .gopeed-js
-cd .gopeed-js
-rm -rf .git
-pnpm install
-pnpm run build
diff --git a/docs/dev-api.md b/docs/dev-api.md
deleted file mode 100644
index 620665a..0000000
--- a/docs/dev-api.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# API Integration
-
-Gopeed provides an HTTP API interface for external use, allowing for download management through the API.
-
-## Enable API
-
-First, you need to set the communication protocol to TCP. Go to **Settings -> Advanced -> Communication Protocol** and set the communication protocol to TCP. Then, set the IP and port as shown in the figure below:
-
-
-
-::: info
-You can set any `port`, but be careful not to use ports that are already in use or reserved by the system, as this may cause access failures.
-:::
-
-After that, you can access the API through `http://127.0.0.1:9999`. For security reasons, it is recommended to set a token. Go to **Settings -> Advanced -> API Token** and set a token as shown in the figure below:
-
-
-
-> Note: The above settings take effect after a restart.
-
-## Using JS SDK
-
-Gopeed provides an official js library, which needs to be installed first by running `npm install @gopeed/rest`:
-
-```
-npm install @gopeed/rest
-```
-
-Then you can use it happily, for example:
-
-```js
-import { Client } from "@gopeed/rest";
-
-(async function () {
- // Create a client
- const client = new Client();
- // Create a task
- const res = await client.createTask({
- req: {
- url: "https://example.com/file.zip",
- },
- });
-})();
-```
-
-More usages please refer to [documentation](https://docs.gopeed.com/site/reference/classes/_gopeed_rest.Client.html).
-
-## Using Python SDK
-
-A Python SDK provided by community user [@tick97115115](https://github.com/tick97115115).
-
-```bash
-pip install gospeed_api
-```
-
-- Github:https://github.com/tick97115115/gospeed_api
-- Example:https://github.com/tick97115115/gospeed_api/blob/main/tests/test_index.py
-
-## Using HTTP API
-
-Of course, you can also directly call the API through HTTP requests. For details, please refer to the [API documentation](https://docs.gopeed.com/site/openapi/index.html).
diff --git a/docs/dev-extension.md b/docs/dev-extension.md
deleted file mode 100644
index de02376..0000000
--- a/docs/dev-extension.md
+++ /dev/null
@@ -1,365 +0,0 @@
-# Extension Development
-
-Gopeed supports extension development using `JavaScript`. Extensions can enhance Gopeed's functionality, such as downloading videos or music from a website. You can quickly learn more about it through the [official examples](https://github.com/GopeedLab/gopeed-extension-samples/blob/main/README_zh-CN.md).
-
-Gopeed extensions are based on `git` to achieve decentralized extension management. As long as the extension source code is hosted in a remote git repository, it can be installed and updated through Gopeed. Therefore, whether it is `github`, `gitee`, `gitlab`, or other git hosting platforms, they can all be used as extension repositories.
-
-## Quick Start
-
-### Using scaffolding
-
-Gopeed provides a scaffolding to help you quickly create an extension development project template:
-
-```sh
-npx create-gopeed-ext@latest
-```
-
-In the creation process, you will see the following prompts:
-
-```sh
-√ Project name (gopeed-extension-demo) ...
-√ Choose a template » Webpack
-
-Success! Created gopeed-extension-demo at D:\code\study\js\gopeed-extension-demo
-Inside that directory, you can run several commands:
-
- git init
- Initialize git repository
-
- npm install
- Install dependencies
-
- npm run dev
- Compiles and hot-reloads for development.
-
- npm run build
- Compiles and minifies for production.
-
-We suggest that you begin by typing:
-
- cd gopeed-extension-demo
-
-Happy coding!
-```
-
-### Manual setup
-
-If you are not familiar with the `node.js` peripheral tools, you can also manually create a project, the file structure is as follows:
-
-```sh
-├── index.js
-├── manifest.json
-```
-
-## Local debugging
-
-After the project is built, you need to do local debugging. You can install the local extension project into Gopeed for debugging. The specific steps are as follows:
-
-1. Enable the `Gopeed` developer mode, click the install button `5 times in a row` on the extension page to enable the developer mode.
-
-
-
-2. Click the button to select the extension directory in the directory selector to install.
-
-3. If you use the `webpack` mode in the scaffolding, you can start automatic compilation through `npm run dev`.
-
-4. Create a task to see the extension take effect.
-
-
-
-It can be seen that the example extension created through the scaffolding can parse an `example/index.html` file when creating a task using the `https://github.com/hello` link.
-
-> Note: Developer mode is only valid on the desktop platform.
-
-## Development explanation
-
-In the previous section, we were able to create a basic extension and debug it locally, but what is happening under the hood?
-
-First, let's take a look at the `manifest.json` file, which is the manifest file of the extension. It describes the information of the extension. Each extension project must contain a `manifest.json` file in the root directory. The sample file in this section is as follows:
-
-```json
-{
- "name": "gopeed-extention-demo",
- "author": "",
- "title": "gopeed extention demo title",
- "description": "gopeed extention demo description",
- "icon": "",
- "version": "1.0.0",
- "homepage": "",
- "repository": {
- "url": ""
- },
- "scripts": [
- {
- "event": "onResolve",
- "match": {
- "urls": ["*://github.com/*"]
- },
- "entry": "dist/index.js"
- }
- ],
- "settings": []
-}
-```
-
-Next, let's introduce the meaning of each field one by one:
-
-- `name` and `author`: Gopeed will use `@` as the ID of the extension. After filling in the `author`, it can ensure that it is not easy to be overwritten and installed with other extensions, so it is strongly recommended to fill in the `author` field.
-- `title` and `description`: The title and description of the extension.
-- `icon`: Extension icon, fill in the relative path, for example: `icon.png`.
-- `version`: Extension version, using semver specification, when the extension is updated, it is compared based on this field, so please make sure that the version number is in compliance with the specification.
-- `homepage`: Extension homepage, for example: `https://gopeed.com`.
-- `repository`: The git repository address to which the extension belongs. Gopeed extensions rely on `git` to achieve decentralized extension management. Therefore, if your extension needs to be installed and updated by users, you must host the extension source code in a remote git repository and configure this field.
-
- For example:
-
- ```json
- {
- "url": "https://github.com/gopeed/gopeed-extension-demo"
- }
- ```
-
- If a git repository contains multiple extension projects, you can specify a subdirectory through the `directory` attribute, for example:
-
- ```json
- {
- "url": "https://github.com/GopeedLab/gopeed-extension-samples",
- "directory": "github-contributor-avatars-sample"
- }
- ```
-
- In Gopeed installation, you need to use `#` to separate, e.g. `https://github.com/GopeedLab/gopeed-extension-samples#github-contributor-avatars-sample`.
-
-- `scripts`: `Pay attention!` This is the configuration of the Gopeed extension activation event.
-
- The `onResolve` event configured in the sample project will be triggered when parsing tasks. The `match.urls` field is used to match the URL created by the task. If the match is successful, the script file specified in the `entry` field will be executed. In the example of the scaffolding project above, it is configured to match `*://github.com/*` and then run the `dist/index.js` file. Therefore, when we enter a `https://github.com/hello` link, it is matched and then triggers the execution of the extension script. The content of the script will be explained in detail later.
-
- > The matching rules are consistent with the matching rules of Chrome extensions, which can be referred to [here](https://developer.chrome.com/docs/extensions/mv3/match_patterns/)
- >
- > Currently, the extension only supports the `onResolve` activation event, and more events will be supported in the future.
-
-- `settings`: Extension settings, through the configuration declaration, the corresponding settings page can be generated in Gopeed to provide user-defined settings, such as custom `Cookie`, custom `User-Agent`, etc., for example:
-
- ```json
- [
- {
- "name": "cookie",
- "title": "网站 Cookie",
- "description": "Cookie 可以通过浏览器开发者工具获取",
- "type": "string"
- },
- {
- "name": "quality",
- "title": "默认画质",
- "type": "number",
- "value": "1080",
- "options": [
- {
- "label": "1080P",
- "value": "1080"
- },
- {
- "label": "720P",
- "value": "720"
- },
- {
- "label": "480P",
- "value": "480"
- }
- ]
- }
- ]
- ```
-
- - `name`: Setting item name, required.
- - `title`: Setting item title, required.
- - `description`: Setting item description, optional.
- - `type`: Setting item type, optional values: `string`, `number`, `boolean`.
- - `value`: Setting item default value, optional.
-
-## Script writing
-
-In the previous section, we have learned how to configure the manifest, and now let's introduce how to write the extension script.
-
-### Runtime environment
-
-Gopeed extension script engine is implemented by [goja](https://github.com/dop251/goja) which is a JavaScript interpreter written in pure Go. However, since goja is only a pure js runtime, the APIs of `browser` and `node.js` are not supported. Currently, `Gopeed` implements `XMLHttpRequest` and `fetch` APIs, which means you can use these two APIs or third-party libraries based on them to implement network requests, such as `axios`, `superagent`, etc.
-
-Another thing to note is that goja natively supports most of the `es6+` syntax, but a few syntaxes are not supported, such as `async generator`, but it doesn't matter, the project created by the scaffolding has been configured with `bable`, you can use the latest es syntax happily, and the script will eventually be compiled into `es5` syntax.
-
-### Demo script explanation
-
-When an event is triggered, the script file specified in the `entry` field will be executed. The script file in the sample project is as follows:
-
-```js
-gopeed.events.onResolve((ctx) => {
- ctx.res = {
- name: "example",
- files: [
- {
- name: "index.html",
- req: {
- url: "https://example.com",
- },
- },
- ],
- };
-});
-```
-
-Next, let's introduce the meaning of each field one by one:
-
-- `gopeed.events.onResolve`: Here, the `onResolve` event is registered, and the method inside is the specific logic of the extension.
-- `ctx`: Event context, which contains some information about the current event. In the `onResolve` event, `ctx` contains the following fields:
- - `req`: Request information, including the url and headers of the resource.
- - `res`: Response information, the script needs to assign the parsed file list to `ctx.res`, and Gopeed will download according to the file list returned in it.
-
-In short, it is necessary to parse the list of files that need to be downloaded based on the request information in `ctx.req` in the `onResolve` callback function and assign it to `ctx.res`. The script above is easy to understand. It parses an `index.html` file and its corresponding download address, and then assigns it to `ctx.res`.
-
-> About `ctx`'s detailed explanation can be found in [documentation](https://docs.gopeed.com/site/reference/interfaces/gopeed.OnResovleContext.html).
-
-## Extension settings
-
-For the sake of making the extension more dynamic, Gopeed provides a set of standard configuration items. By declaring the `settings` attribute, the corresponding extension settings page can be generated in Gopeed to provide user-defined settings, such as custom `Cookie`, custom `User-Agent`, etc., for example:
-
-```json
-{
- "settings": [
- {
- "name": "cookie",
- "title": "网站 Cookie",
- "description": "Cookie 可以通过浏览器开发者工具获取",
- "type": "string"
- },
- {
- "name": "quality",
- "title": "默认画质",
- "type": "number",
- "value": "1080",
- "options": [
- {
- "label": "1080P",
- "value": "1080"
- },
- {
- "label": "720P",
- "value": "720"
- },
- {
- "label": "480P",
- "value": "480"
- }
- ]
- }
- ]
-}
-```
-
-This declares two setting items, one is `cookie`, the other is `quality`, let's take a look at their effects:
-
-
-
-Cookie is an input box, and `quality` is a drop-down box. It should be noted that the `type` field determines the type of the setting item. Currently, three types are supported:
-
-- `string`
-- `number`
-- `boolean`
-
-If the `options` option is configured, it will be rendered as a drop-down box for users to choose.
-
-Then you can get the value of the setting through `gopeed.settings` in the extension script, for example:
-
-```js
-gopeed.events.onResolve((ctx) => {
- // Access cookie setting
- console.log(gopeed.settings.cookie);
- // Access quality setting
- console.log(gopeed.settings.quality);
-});
-```
-
-## Extension storage
-
-Gopeed provides a set of storage APIs to support extension persistence storage of data such as `login token`, for example:
-
-```js
-gopeed.events.onResolve((ctx) => {
- // Get the token, if it not exists, then login
- const token = gopeed.storage.get("token");
- if(!token){
- const token = await login();
- gopeed.storage.set("token",token)
- }
-
- // Then do something with the token
- // ...
-});
-```
-
-> Note: For detailed API, please refer to [documentation](https://docs.gopeed.com/site/reference/interfaces/gopeed.Storage.html).
-
-## Extension debugging
-
-In the script, you can output logs through the `gopeed.logger` object, which supports three levels: `debug`, `info`, `warn`, `error`, for example:
-
-```js
-gopeed.logger.debug("debug");
-gopeed.logger.info("info");
-gopeed.logger.warn("warn");
-gopeed.logger.error("error");
-```
-
-Log files are in the `logs` directory in the Gopeed installation directory, and the file name is `extension.log`, which can be viewed in real time through the `tail -f extension.log` command.
-
-> Note: The debug level log is only valid in the extension installed in developer mode.
-
-## Extension publishing
-
-When the extension development is completed, if it is a `webpack` project created by the scaffolding, you need to compile it:
-
-```sh
-npm run build
-```
-
-Then we need to create a `remote repository`, for example, create a `https://github.com/xxx/gopeed-extension-demo` repository on `github`, and then modify the `repository` field in `manifest.json` accordingly:
-
-```json
-{
- "repository": {
- "url": "https://github.com/xxx/gopeed-extension-demo"
- }
-}
-```
-
-> Correctly configuring `repository` can allow the extension to obtain remote update capabilities. If the extension is a subdirectory under the git repository, you can specify the subdirectory through the `directory` attribute, for example:
->
-> ```json
-> {
-> "repository": {
-> "url": "https://github.com/xxx/gopeed-extension-demo",
-> "directory": "path"
-> }
-> }
-> ```
-
-After that, remember to configure the `author` and `name` fields of the extension to reduce the risk of duplicate names with other extensions.
-
-Finally, push the project to the remote repository to complete the release. In order to make it easier for users to search for Gopeed extensions on `github`, it is recommended that the project name be uniformly prefixed with `gopeed-extension-`, for example, `gopeed-extension-demo`, and add the `gopeed-extension` tag to the project on `github`.
-
-## Extension installation
-
-After publishing to the remote repository, you can install it in Gopeed. Open the extension page, enter the `git clone` address of the extension's HTTP protocol (you can omit the `.git` suffix at the end), and click the `Install` button to install it.
-
-> Note: If the extension directory is a subdirectory, you need to add `#` after the address, and then add the subdirectory name, for example `https://github.com/xxx/gopeed-extension-demo#path`.
-
-## Official examples
-
-The official provides two representative sample extensions for reference, which are:
-
-- [github-contributor-avatars-sample](https://github.com/GopeedLab/gopeed-extension-samples/tree/main/github-contributor-avatars-sample)
-
- This extension is a project that depends on node.js and is suitable for complex development requirements. It uses the cheerio library to parse webpage DOM to obtain the list of files that need to be downloaded.
-
-- [github-release-sample](https://github.com/GopeedLab/gopeed-extension-samples/tree/main/github-release-sample)
-
- This extension is a `pure js` project without any dependencies, suitable for simple development requirements. It uses `fetch` to implement network requests to obtain the list of files that need to be downloaded.
diff --git a/docs/dev.md b/docs/dev.md
deleted file mode 100644
index 41686f7..0000000
--- a/docs/dev.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Development
-
-GoPeed currently provides two ways to extend externally, one is to connect to HTTP API, and the other is to enhance through JavaScript script development extension.
-
-## API Integration
-
-Please refer to [documentation](dev-api.html)
-
-## Extension Development
-
-Please refer to [documentation](dev-extension.html)
diff --git a/docs/donate.md b/docs/donate.md
deleted file mode 100644
index 1964420..0000000
--- a/docs/donate.md
+++ /dev/null
@@ -1,17 +0,0 @@
-## Donate
-
-🙏 Thank you for considering a donation to Gopeed project! Your support helps us continue to develop and maintain our software.
-
-[](https://ko-fi.com/R6R6IJGN6)
-
-| Wechat | Alipay | PayPal |
-| :--------------------------------------------------------------------: | :--------------------------------------------------------------: | :-------------------------------------: |
-| | | [Click Me](https://paypal.me/monkeyWie) |
-
-### Cryptocurrency
-
-- **BTC**: 35jYkPN8bgkh7AWjt3B1VgMQHqtGYcvF6p
-- **ETH:** 0x928a7fd2398c941Ac6713704e606Fa414595e3A0
-- **Matic:** 0x928a7fd2398c941Ac6713704e606Fa414595e3A0
-- **BNB:** 0x928a7fd2398c941Ac6713704e606Fa414595e3A0
-- **USDT(ERC20)**: 0x928a7fd2398c941Ac6713704e606Fa414595e3A0
diff --git a/docs/index.md b/docs/index.md
deleted file mode 100644
index 0dd13aa..0000000
--- a/docs/index.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# Introduction
-
-Gopeed (full name Go Speed) is a high-speed downloader developed by `Golang` + `Flutter`, which supports (HTTP, BitTorrent, Magnet) protocol download, and supports all platforms, including:
-
-- [x] **Windows**
-- [x] **Macos**
-- [x] **Linux**
-- [x] **Android**
-- [x] **iOS**
-- [x] **Web**
-- [x] **Docker**
-- [x] **Command Tool**
-
-## Features
-
-As a modern downloader, Gopeed has many features, here is a brief introduction.
-
-### Basic
-
-- Support HTTP & HTTPS
-- Support BitTorrent & Magnet
-- Seed, DHT, PEX, uTP, Webtorrent, Upnp
-- Update tracker list every day automatically
-- Internationalization
-- Dark mode
-
-### Advanced
-
-In addition to basic download functions, there are many advanced features that make Gopeed more playable.
-
-- **Open HTTP API**
-
- Through the RESTFul API, you can easily interact with Gopeed, for example, you can control Gopeed's download, pause, delete, etc. through the API.
-
-- **Decentralized extension**
-
- You can write extensions through `JavaScript` to enhance Gopeed's download capabilities, such as downloading videos from a website, or downloading music from a website, etc.
-
-## Why not...?
-
-Here is a comparison with popular downloaders on the market, which shows the advantages of Gopeed intuitively.
-
-| Function | Gopeed | Motrix | IDM |
-| ---------------------- | ------ | --------------------------- | ----------------- |
-| HTTP | ✔️ | ✔️ | ✔️ |
-| BitTorrent | ✔️ | ✔️ | ❌ |
-| Magnet | ✔️ | ✔️ | ❌ |
-| Cross-platform support | ✔️ | ❌ (only desktop platforms) | ❌ (only Windows) |
-| Free | ✔️ | ✔️ | ❌ |
-| Open source | ✔️ | ✔️ | ❌ |
-| Non-Electron | ✔️ | ❌ | ✔️ |
-| Open API | ✔️ | ✔️ | ❌ |
-| Extension support | ✔️ | ❌ | ❌ |
-
-Of course, Gopeed may also have many shortcomings, but we will continue to improve it.
-
-Moreover, Gopeed is open source, you can propose your ideas anytime, anywhere, or directly contribute code to make Gopeed better.
diff --git a/docs/install.md b/docs/install.md
deleted file mode 100644
index eb30ddb..0000000
--- a/docs/install.md
+++ /dev/null
@@ -1,272 +0,0 @@
-# Installation Instructions
-
-## General Installation Instructions
-
-The following methods work on all platforms for quickly downloading Gopeed:
-
-1. Go to the [official website](https://gopeed.com) to download, which will automatically select the corresponding version according to your operating system.
-2. Go to [GitHub](https://github.com/GopeedLab/gopeed/releases) to download, and you can choose the corresponding version to download by yourself.
-
-## Platform-Specific Installation Guide
-
-### Windows
-
-Windows has two distributions, one is a portable version, and the other is an installer version. The portable version does not need to be installed, just unzip it and run it. The installer version needs to be installed, and the installation process is the same as other software. You can choose according to your own preferences.
-
-> The file name of the portable version is: Gopeed-v1.x.x-windows-amd64-portable.zip
-
-In addition to downloading directly, you can also install or upgrade Gopeed through package managers:
-
-- [Scoop](https://github.com/ScoopInstaller/Scoop): A community-maintained command-line package manager for Windows. It’s lightweight and flexible, doesn’t require administrator privileges to install, and makes managing and updating software easy.
-
- ```powershell
- scoop bucket add extras
- scoop install extras/gopeed
- ```
-
-- [Winget](https://learn.microsoft.com/en-us/windows/package-manager/winget): Microsoft's official package manager, deeply integrated with the Windows operating system.
-
- ```powershell
- winget install -e --id monkeyWie.Gopeed
- ```
-
-#### Firewall False Positive
-
-In the Windows system, some antivirus software may falsely report Gopeed's two core components: `host.exe` for browser extension communication and `updater.exe` for application updates. To ensure that the browser extension can properly intercept download tasks and the application can update automatically, please add the `Gopeed installation directory` to the whitelist of your firewall or antivirus software.
-
-::: tip Note
-
-**Safe Download**: Be sure to download Gopeed using the methods described in this document—either from the [official website](https://gopeed.com), the [official GitHub repository](https://github.com/GopeedLab/gopeed/releases), or through Scoop or Winget. Avoid using third-party sources to ensure the security of the software.
-
-**About False Positives**: This may be related to the characteristics of applications compiled with Go language, and there is currently no good solution. In the future, we will consider migrating the components to Rust development to improve this issue.
-
-:::
-
-### Linux
-
-In the Linux system, we provide both `.deb` and `.AppImage` packages for installation, so you can choose whichever works best for you. In addition, you can also install quickly using the following commands:
-
-- Flatpak
-
- ```sh
- flatpak install flathub com.gopeed.Gopeed
- ```
-
-- Snap
-
- ```sh
- sudo snap install gopeed
- ```
-
-### macOS
-
-The macOS version provides a `.dmg` file, which can be installed by double-clicking. The installation package supports two architectures: `intel` and `apple silicon`.
-
-> Tips: If the macOS open failed, please execute the `xattr -d com.apple.quarantine /Applications/Gopeed.app` command in the terminal
-
-### Android
-
-The Android version provides a `.apk` file, which can be downloaded and installed directly, and supports all CPU architectures.
-
-### iOS
-
-Currently, only the `.ipa` file is provided for the iOS platform, which needs to be signed and installed by itself. It is recommended to use [TrollStore](https://github.com/opa334/TrollStore) for installation.
-
-> Why is it not listed on the App Store?
->
-> Because of Apple's review mechanism, BitTorrent protocol-related apps are not allowed to be listed.
->
-> Why is it not listed on TestFlight?
->
-> Because there is no money! The project is purely for love and power generation. If enough sponsorship can be obtained, it will be listed on TestFlight immediately. So please support us more. Open source is not easy. Thank you!
-
-### Web
-
-If you need a remote download service, you can consider using the Web version. Gopeed provides Web versions for various platforms. You can download them according to your system and CPU architecture.
-
-
-
-Here is an example of how to use the Web version on the Windows platform, and the usage on other platforms is similar.
-
-1. Download the Web version, and after decompression, you will get a folder. Put it where you want.
-2. Open the terminal in the root directory of the folder and execute `./gopeed.exe`. If it runs successfully, you will see the following output:
-
- ```bash
-
- _______ ______ .______ _______ _______ _______
- / _____| / __ \ | _ \ | ____|| ____|| \
- | | __ | | | | | |_) | | |__ | |__ | .--. |
- | | |_ | | | | | | ___/ | __| | __| | | | |
- | |__| | | `--' | | | | |____ | |____ | '--' |
- \______| \______/ | _| |_______||_______||_______/
-
- Server start success on http://[::]:9999
- ```
-
-3. Open the browser and visit `http://localhost:9999`.
-
-#### Web Configuration
-
-The Web version supports configuration through command line parameters or configuration files. Command line parameters can be viewed through `./gopeed.exe -h`:
-
-```sh
-$ ./gopeed.exe -h
-Usage of C:\Users\levi\Downloads\gopeed-web-v1.3.13-windows-amd64\gopeed.exe:
- -A string
- Bind Address (default "0.0.0.0")
- -P int
- Bind Port (default 9999)
- -T string
- API token, that can only be used when basic authentication is enabled.
- -c string
- Config file path (default "./config.json")
- -d string
- Storage directory
- -p string
- HTTP Basic Auth Password
- -u string
- HTTP Basic Auth Username (default "gopeed")
-```
-
-It also supports configuration through configuration files. Create a `config.json` file in the root directory with the following content:
-
-```json
-{
- "address": "", // Bind address (default "0.0.0.0")
- "port": 0, // Bind port (default 9999)
- "username": "", // HTTP Basic Auth Username (default "gopeed")
- "password": "", // HTTP Basic Auth Password, used with username. If both are empty, authentication is disabled
- "apiToken": "", // HTTP API token, when using API token without authentication enabled, the web UI is inaccessible and can only be accessed through the API
- "storageDir": "", // Storage directory
- "whiteDownloadDirs": ["/root/downloads", "/root/dir/*", "/root/dir?abc"] // Download directory whitelist, when this option is configured, all tasks downloaded to non-whitelisted folders will fail, support wildcard, rules refer to https://pkg.go.dev/path/filepath#Match
-}
-```
-
-It also supports configuration through environment variables, with the rule `GOPEED_ConfigKey`, for example:
-
-```sh
-export GOPEED_ADDRESS="0.0.0.0"
-export GOPEED_PORT="9999"
-export GOPEED_USERNAME="gopeed"
-export GOPEED_PASSWORD="xxx"
-export GOPEED_APITOKEN=""
-export GOPEED_STORAGEDIR=""
-export GOPEED_WHITEDOWNLOADDIRS="/root/downloads,/root/dir/*,/root/dir?abc"
-```
-
-> Note: If you are deploying on a public IP, please ensure to enable identity authentication, otherwise there will be security risks.
-
-#### Default Download Configuration
-
-If you need to set the default download configuration when the server starts for the first time, you can add the `downloadConfig` field in `config.json`. For configuration details, please refer to [DownloaderStoreConfig](https://pkg.go.dev/github.com/GopeedLab/gopeed/pkg/base#DownloaderStoreConfig). Here is an example:
-
-```json
-{
- "address": "127.0.0.1",
- "port": 9999,
- "downloadConfig": {
- "downloadDir": "d:/test" // Set the default download directory
- }
-}
-```
-
-### Docker
-
-One line of command:
-
-```sh
-docker run --name gopeed -d -p 9999:9999 liwei2633/gopeed
-```
-
-Mount the download directory
-
-```sh
-docker run --name gopeed -d -p 9999:9999 \
- -v /path/to/download:/app/Downloads \
- liwei2633/gopeed
-```
-
-Mount the data directory
-
-```sh
-docker run --name gopeed -d -p 9999:9999 \
- -v /path/to/download:/app/Downloads \
- -v /path/to/storage:/app/storage liwei2633/gopeed
-```
-
-Specify container group ID and user ID
-
-```sh
-docker run --name gopeed -d -p 9999:9999 \
- -e PGID=100 \
- -e PUID=1000 \
- liwei2633/gopeed
-```
-
-If you need to enable identity authentication, you can pass environment variable parameters (refer to the previous section `Web Configuration`):
-
-```sh
-docker run --name gopeed -d -p 9999:9999 \
- -e GOPEED_USERNAME="admin" \
- -e GOPEED_PASSWORD="123" \
- -v /path/to/download:/app/Downloads \
- -v /path/to/storage:/app/storage \
- liwei2633/gopeed
-```
-
-### BT Panel (for version 9.2.0 and above) Deployment Guide
-
-1. Install BT Panel, go to [BT Panel Official Website](https://www.bt.cn/new/download.html), select the official version script to download and install.
-
-2. After installation, log in to the BT Panel, click Docker in the left navigation bar. First, it will prompt to install Docker service, click Install Now and complete the installation according to the prompts.
-
-3. After completing the installation, find Gopeed in the App Store, click Install, configure domain name, port and other basic information to complete the installation.
-
- ::: tip Note
-
- Domain name is optional. If a domain name is filled in, it will be managed through [Website] --> [Reverse Proxy]. After filling in the domain name, you don't need to check [Allow External Access], otherwise you need to check it to access through the port.
-
- :::
-
-4. After installation, enter the domain name or IP+port set in the previous step in the browser to access.
-
-### Command Line
-
-The command line version depends on the `Golang` environment. If you do not have the `Golang` environment installed, you can refer to [here](https://golang.org/doc/install) for installation.
-
-Installation command:
-
-```sh
-go install github.com/GopeedLab/gopeed/cmd/gopeed@latest
-```
-
-After the installation is complete, you can use the `gopeed` command to download. You can view the specific usage method through `gopeed -h`:
-
-```sh
-$ gopeed -h
-Usage of gopeed:
- -C int
- Concurrent connections. (default 16)
- -D string
- Store directory. (default "C:\\Users\\levi")
-```
-
-#### Command Line Usage Example
-
-Download an HTTP resource:
-
-```sh
-gopeed https://example.com/file.zip
-```
-
-Download a torrent file:
-
-```sh
-gopeed D:/Downloads/file.torrent
-```
-
-Download a magnet link:
-
-```sh
-gopeed magnet:?xt=urn:btih:xxxx
-```
diff --git a/docs/public/favicon.ico b/docs/public/favicon.ico
deleted file mode 100644
index 8775716..0000000
Binary files a/docs/public/favicon.ico and /dev/null differ
diff --git a/docs/public/images/dev/extension/demo-settings.gif b/docs/public/images/dev/extension/demo-settings.gif
deleted file mode 100644
index ceca735..0000000
Binary files a/docs/public/images/dev/extension/demo-settings.gif and /dev/null differ
diff --git a/docs/public/images/dev/extension/demo.gif b/docs/public/images/dev/extension/demo.gif
deleted file mode 100644
index e0df325..0000000
Binary files a/docs/public/images/dev/extension/demo.gif and /dev/null differ
diff --git a/docs/public/images/dev/extension/dev-mode.gif b/docs/public/images/dev/extension/dev-mode.gif
deleted file mode 100644
index 6ccdecd..0000000
Binary files a/docs/public/images/dev/extension/dev-mode.gif and /dev/null differ
diff --git a/docs/public/images/dev/set-port.png b/docs/public/images/dev/set-port.png
deleted file mode 100644
index 1ffbb34..0000000
Binary files a/docs/public/images/dev/set-port.png and /dev/null differ
diff --git a/docs/public/images/dev/set-token.png b/docs/public/images/dev/set-token.png
deleted file mode 100644
index 652d3b6..0000000
Binary files a/docs/public/images/dev/set-token.png and /dev/null differ
diff --git a/docs/public/images/donate/alipay.jpg b/docs/public/images/donate/alipay.jpg
deleted file mode 100644
index d7d0fd6..0000000
Binary files a/docs/public/images/donate/alipay.jpg and /dev/null differ
diff --git a/docs/public/images/donate/wechatpay.jpg b/docs/public/images/donate/wechatpay.jpg
deleted file mode 100644
index b8bc54c..0000000
Binary files a/docs/public/images/donate/wechatpay.jpg and /dev/null differ
diff --git a/docs/public/images/guide/install/web.png b/docs/public/images/guide/install/web.png
deleted file mode 100644
index fa27ce0..0000000
Binary files a/docs/public/images/guide/install/web.png and /dev/null differ
diff --git a/docs/public/images/guide/showcase.png b/docs/public/images/guide/showcase.png
deleted file mode 100644
index 6620a45..0000000
Binary files a/docs/public/images/guide/showcase.png and /dev/null differ
diff --git a/docs/public/images/logo.png b/docs/public/images/logo.png
deleted file mode 100644
index cb5383e..0000000
Binary files a/docs/public/images/logo.png and /dev/null differ
diff --git a/docs/public/js/firebase-analytics_9.23.0.js b/docs/public/js/firebase-analytics_9.23.0.js
deleted file mode 100644
index 38a7f67..0000000
--- a/docs/public/js/firebase-analytics_9.23.0.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as a}from"/js/firebase-app_9.23.0.js";var i;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));const r={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},o=i.INFO,s={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},c=(e,t,...n)=>{if(t{try{let n=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(a),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}function f(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class p extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,h.prototype.create)}}class h{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],r=i?function(e,t){return e.replace(g,((e,n)=>{const a=t[n];return null!=a?String(a):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${r} (${a}).`;return new p(a,o,n)}}const g=/\{\$([^}]+)}/g;function m(e,t){if(e===t)return!0;const n=Object.keys(e),a=Object.keys(t);for(const i of n){if(!a.includes(i))return!1;const n=e[i],r=t[i];if(w(n)&&w(r)){if(!m(n,r))return!1}else if(n!==r)return!1}for(const e of a)if(!n.includes(e))return!1;return!0}function w(e){return null!==e&&"object"==typeof e}function y(e,t=1e3,n=2){const a=t*Math.pow(n,e),i=Math.round(.5*a*(Math.random()-.5)*2);return Math.min(144e5,a+i)}function v(e){return e&&e._delegate?e._delegate:e}class I{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let b,E;const T=new WeakMap,S=new WeakMap,D=new WeakMap,k=new WeakMap,L=new WeakMap;let j={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return S.get(e);if("objectStoreNames"===t)return e.objectStoreNames||D.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function C(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(E||(E=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(P(this),t),$(T.get(this))}:function(...t){return $(e.apply(P(this),t))}:function(t,...n){const a=e.call(P(this),t,...n);return D.set(a,t.sort?t.sort():[t]),$(a)}}function O(e){return"function"==typeof e?C(e):(e instanceof IDBTransaction&&function(e){if(S.has(e))return;const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",r),e.removeEventListener("abort",r)},i=()=>{t(),a()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",i),e.addEventListener("error",r),e.addEventListener("abort",r)}));S.set(e,t)}(e),t=e,(b||(b=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,j):e);var t}function $(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("success",i),e.removeEventListener("error",r)},i=()=>{t($(e.result)),a()},r=()=>{n(e.error),a()};e.addEventListener("success",i),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&T.set(t,e)})).catch((()=>{})),L.set(t,e),t}(e);if(k.has(e))return k.get(e);const t=O(e);return t!==e&&(k.set(e,t),L.set(t,e)),t}const P=e=>L.get(e);const _=["get","getKey","getAll","getAllKeys","count"],M=["put","add","delete","clear"],A=new Map;function B(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(A.get(t))return A.get(t);const n=t.replace(/FromIndex$/,""),a=t!==n,i=M.includes(n);if(!(n in(a?IDBIndex:IDBObjectStore).prototype)||!i&&!_.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,i?"readwrite":"readonly");let o=r.store;return a&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&r.done]))[0]};return A.set(t,r),r}j=(e=>({...e,get:(t,n,a)=>B(t,n)||e.get(t,n,a),has:(t,n)=>!!B(t,n)||e.has(t,n)}))(j);const N="@firebase/installations",F=new h("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function R(e){return e instanceof p&&e.code.includes("request-failed")}function x({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function H(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function q(e,t){const n=(await t.json()).error;return F.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function V({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function z(e,{refreshToken:t}){const n=V(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function U(e){const t=await e();return t.status>=500&&t.status<600?e():t}function W(e){return new Promise((t=>{setTimeout(t,e)}))}const K=/^[cdef][\w-]{21}$/;function G(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return K.test(t)?t:""}catch(e){return""}}function J(e){return`${e.appName}!${e.appId}`}const Y=new Map;function Z(e,t){const n=J(e);Q(n,t),function(e,t){const n=function(){!X&&"BroadcastChannel"in self&&(X=new BroadcastChannel("[Firebase] FID Change"),X.onmessage=e=>{Q(e.data.key,e.data.fid)});return X}();n&&n.postMessage({key:e,fid:t});0===Y.size&&X&&(X.close(),X=null)}(n,t)}function Q(e,t){const n=Y.get(e);if(n)for(const e of n)e(t)}let X=null;const ee="firebase-installations-store";let te=null;function ne(){return te||(te=function(e,t,{blocked:n,upgrade:a,blocking:i,terminated:r}={}){const o=indexedDB.open(e,t),s=$(o);return a&&o.addEventListener("upgradeneeded",(e=>{a($(o.result),e.oldVersion,e.newVersion,$(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{r&&e.addEventListener("close",(()=>r())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(ee)}})),te}async function ae(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n);return await i.put(t,n),await a.done,r&&r.fid===t.fid||Z(e,t.fid),t}async function ie(e){const t=J(e),n=(await ne()).transaction(ee,"readwrite");await n.objectStore(ee).delete(t),await n.done}async function re(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n),o=t(r);return void 0===o?await i.delete(n):await i.put(o,n),await a.done,!o||r&&r.fid===o.fid||Z(e,o.fid),o}async function oe(e){let t;const n=await re(e.appConfig,(n=>{const a=function(e){return le(e||{fid:G(),registrationStatus:0})}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(F.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},a=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const a=x(e),i=V(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:i,body:JSON.stringify(o)},c=await U((()=>fetch(a,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:H(e.authToken)}}throw await q("Create Installation",c)}(e,t);return ae(e.appConfig,n)}catch(n){throw R(n)&&409===n.customData.serverCode?await ie(e.appConfig):await ae(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:a}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:se(e)}:{installationEntry:t}}(e,a);return t=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function se(e){let t=await ce(e.appConfig);for(;1===t.registrationStatus;)await W(100),t=await ce(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await oe(e);return n||t}return t}function ce(e){return re(e,(e=>{if(!e)throw F.create("installation-not-found");return le(e)}))}function le(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4fetch(a,s)));if(c.ok){return H(await c.json())}throw await q("Generate Auth Token",c)}async function de(e,t=!1){let n;const a=await re(e.appConfig,(a=>{if(!pe(a))throw F.create("not-registered");const i=a.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t{if(!pe(e))throw F.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4{const t=e.getProvider("app").getImmediate(),a=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:a}=await oe(t);return a?a.catch(console.error):de(t).catch(console.error),n.fid}(a),getToken:e=>he(a,e)}};t(new I("installations",(e=>{const t=e.getProvider("app").getImmediate(),a=function(e){if(!e||!e.options)throw ge("App Configuration");if(!e.name)throw ge("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ge(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:a,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new I("installations-internal",me,"PRIVATE")),e(N,"0.6.4"),e(N,"0.6.4","esm2017");const we="https://www.googletagmanager.com/gtag/js",ye=new class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}("@firebase/analytics"),ve=new h("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-intialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function Ie(e){if(!e.startsWith(we)){const t=ve.create("invalid-gtag-resource",{gtagURL:e});return ye.warn(t.message),""}return e}function be(e){return Promise.all(e.map((e=>e.catch((e=>e)))))}function Ee(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Ie}),a=document.createElement("script"),i=`${we}?l=${e}&id=${t}`;a.src=n?null==n?void 0:n.createScriptURL(i):i,a.async=!0,document.head.appendChild(a)}function Te(e,t,n,a){return async function(i,...r){try{if("event"===i){const[a,i]=r;await async function(e,t,n,a,i){try{let r=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const a=await be(n);for(const n of e){const e=a.find((e=>e.measurementId===n)),i=e&&t[e.appId];if(!i){r=[];break}r.push(i)}}0===r.length&&(r=Object.values(t)),await Promise.all(r),e("event",a,i||{})}catch(e){ye.error(e)}}(e,t,n,a,i)}else if("config"===i){const[i,o]=r;await async function(e,t,n,a,i,r){const o=a[i];try{if(o)await t[o];else{const e=(await be(n)).find((e=>e.measurementId===i));e&&await t[e.appId]}}catch(e){ye.error(e)}e("config",i,r)}(e,t,n,a,i,o)}else if("consent"===i){const[t]=r;e("consent","update",t)}else if("get"===i){const[t,n,a]=r;e("get",t,n,a)}else if("set"===i){const[t]=r;e("set",t)}else e(i,...r)}catch(e){ye.error(e)}}}const Se=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function De(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function ke(e,t=Se,n){const{appId:a,apiKey:i,measurementId:r}=e.options;if(!a)throw ve.create("no-app-id");if(!i){if(r)return{measurementId:r,appId:a};throw ve.create("no-api-key")}const o=t.getThrottleMetadata(a)||{backoffCount:0,throttleEndTimeMillis:Date.now()},s=new je;return setTimeout((async()=>{s.abort()}),void 0!==n?n:6e4),Le({appId:a,apiKey:i,measurementId:r},o,s,t)}async function Le(e,{throttleEndTimeMillis:t,backoffCount:n},a,i=Se){var r;const{appId:o,measurementId:s}=e;try{await function(e,t){return new Promise(((n,a)=>{const i=Math.max(t-Date.now(),0),r=setTimeout(n,i);e.addEventListener((()=>{clearTimeout(r),a(ve.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(a,t)}catch(e){if(s)return ye.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:o,measurementId:s};throw e}try{const t=await async function(e){var t;const{appId:n,apiKey:a}=e,i={method:"GET",headers:De(a)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",n),o=await fetch(r,i);if(200!==o.status&&304!==o.status){let e="";try{const n=await o.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}throw ve.create("config-fetch-failed",{httpStatus:o.status,responseMessage:e})}return o.json()}(e);return i.deleteThrottleMetadata(o),t}catch(t){const c=t;if(!function(e){if(!(e instanceof p&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(c)){if(i.deleteThrottleMetadata(o),s)return ye.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:o,measurementId:s};throw t}const l=503===Number(null===(r=null==c?void 0:c.customData)||void 0===r?void 0:r.httpStatus)?y(n,i.intervalMillis,30):y(n,i.intervalMillis),u={throttleEndTimeMillis:Date.now()+l,backoffCount:n+1};return i.setThrottleMetadata(o,u),ye.debug(`Calling attemptFetch again in ${l} millis`),Le(e,u,a,i)}}class je{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let Ce,Oe;function $e(e){Oe=e}function Pe(e){Ce=e}async function _e(e,t,n,a,i,r,o){var s;const c=ke(e);c.then((t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&ye.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)})).catch((e=>ye.error(e))),t.push(c);const l=async function(){if(!u())return ye.warn(ve.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await d()}catch(e){return ye.warn(ve.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?a.getId():void 0)),[f,p]=await Promise.all([c,l]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(we)&&n.src.includes(e))return n;return null})(r)||Ee(r,f.measurementId),Oe&&(i("consent","default",Oe),$e(void 0)),i("js",new Date);const h=null!==(s=null==o?void 0:o.config)&&void 0!==s?s:{};return h.origin="firebase",h.update=!0,null!=p&&(h.firebase_id=p),i("config",f.measurementId,h),Ce&&(i("set",Ce),Pe(void 0)),f.measurementId}class Me{constructor(e){this.app=e}_delete(){return delete Ae[this.app.options.appId],Promise.resolve()}}let Ae={},Be=[];const Ne={};let Fe,Re,xe="dataLayer",He="gtag",qe=!1;function Ve(e){if(qe)throw ve.create("already-initialized");e.dataLayerName&&(xe=e.dataLayerName),e.gtagName&&(He=e.gtagName)}function ze(e,t,n){!function(){const e=[];if(l()&&e.push("This is a browser extension environment."),f()||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=ve.create("invalid-analytics-context",{errorInfo:t});ye.warn(n.message)}}();const a=e.options.appId;if(!a)throw ve.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw ve.create("no-api-key");ye.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=Ae[a])throw ve.create("already-exists",{id:a});if(!qe){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(xe);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,a,i){let r=function(...e){window[a].push(arguments)};return window[i]&&"function"==typeof window[i]&&(r=window[i]),window[i]=Te(r,e,t,n),{gtagCore:r,wrappedGtag:window[i]}}(Ae,Be,Ne,xe,He);Re=e,Fe=t,qe=!0}Ae[a]=_e(e,Be,Ne,t,Fe,xe,n);return new Me(e)}function Ue(e=a()){e=v(e);const t=n(e,"analytics");return t.isInitialized()?t.getImmediate():We(e)}function We(e,t={}){const a=n(e,"analytics");if(a.isInitialized()){const e=a.getImmediate();if(m(t,a.getOptions()))return e;throw ve.create("already-initialized")}return a.initialize({options:t})}async function Ke(){if(l())return!1;if(!f())return!1;if(!u())return!1;try{return await d()}catch(e){return!1}}function Ge(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{screen_name:n}),Promise.resolve();e("config",await t,{update:!0,screen_name:n})}(Re,Ae[e.app.options.appId],t,n).catch((e=>ye.error(e)))}async function Je(e){return e=v(e),async function(e,t){const n=await t;return new Promise(((t,a)=>{e("get",n,"client_id",(e=>{e||a(ve.create("no-client-id")),t(e)}))}))}(Re,Ae[e.app.options.appId])}function Ye(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{user_id:n}),Promise.resolve();e("config",await t,{update:!0,user_id:n})}(Re,Ae[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Ze(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(Re,Ae[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Qe(e,t){e=v(e),async function(e,t){const n=await e;window[`ga-disable-${n}`]=!t}(Ae[e.app.options.appId],t).catch((e=>ye.error(e)))}function Xe(e){Re?Re("set",e):Pe(e)}function et(e,t,n,a){e=v(e),async function(e,t,n,a,i){if(i&&i.global)e("event",n,a);else{const i=await t;e("event",n,Object.assign(Object.assign({},a),{send_to:i}))}}(Re,Ae[e.app.options.appId],t,n,a).catch((e=>ye.error(e)))}function tt(e){Re?Re("consent","update",e):$e(e)}const nt="@firebase/analytics";t(new I("analytics",((e,{options:t})=>ze(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),t(new I("analytics-internal",(function(e){try{const t=e.getProvider("analytics").getImmediate();return{logEvent:(e,n,a)=>et(t,e,n,a)}}catch(e){throw ve.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),e(nt,"0.10.0"),e(nt,"0.10.0","esm2017");export{Ue as getAnalytics,Je as getGoogleAnalyticsClientId,We as initializeAnalytics,Ke as isSupported,et as logEvent,Qe as setAnalyticsCollectionEnabled,tt as setConsent,Ge as setCurrentScreen,Xe as setDefaultEventParameters,Ye as setUserId,Ze as setUserProperties,Ve as settings};
-
-//# sourceMappingURL=firebase-analytics.js.map
diff --git a/docs/public/js/firebase-app_9.23.0.js b/docs/public/js/firebase-app_9.23.0.js
deleted file mode 100644
index e460c50..0000000
--- a/docs/public/js/firebase-app_9.23.0.js
+++ /dev/null
@@ -1,2522 +0,0 @@
-/**
- * @license
- * Copyright 2017 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @license
- * Copyright 2017 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const stringToByteArray$1 = function (str) {
- // TODO(user): Use native implementations if/when available
- const out = [];
- let p = 0;
- for (let i = 0; i < str.length; i++) {
- let c = str.charCodeAt(i);
- if (c < 128) {
- out[p++] = c;
- }
- else if (c < 2048) {
- out[p++] = (c >> 6) | 192;
- out[p++] = (c & 63) | 128;
- }
- else if ((c & 0xfc00) === 0xd800 &&
- i + 1 < str.length &&
- (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
- // Surrogate Pair
- c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);
- out[p++] = (c >> 18) | 240;
- out[p++] = ((c >> 12) & 63) | 128;
- out[p++] = ((c >> 6) & 63) | 128;
- out[p++] = (c & 63) | 128;
- }
- else {
- out[p++] = (c >> 12) | 224;
- out[p++] = ((c >> 6) & 63) | 128;
- out[p++] = (c & 63) | 128;
- }
- }
- return out;
-};
-/**
- * Turns an array of numbers into the string given by the concatenation of the
- * characters to which the numbers correspond.
- * @param bytes Array of numbers representing characters.
- * @return Stringification of the array.
- */
-const byteArrayToString = function (bytes) {
- // TODO(user): Use native implementations if/when available
- const out = [];
- let pos = 0, c = 0;
- while (pos < bytes.length) {
- const c1 = bytes[pos++];
- if (c1 < 128) {
- out[c++] = String.fromCharCode(c1);
- }
- else if (c1 > 191 && c1 < 224) {
- const c2 = bytes[pos++];
- out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
- }
- else if (c1 > 239 && c1 < 365) {
- // Surrogate Pair
- const c2 = bytes[pos++];
- const c3 = bytes[pos++];
- const c4 = bytes[pos++];
- const u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) -
- 0x10000;
- out[c++] = String.fromCharCode(0xd800 + (u >> 10));
- out[c++] = String.fromCharCode(0xdc00 + (u & 1023));
- }
- else {
- const c2 = bytes[pos++];
- const c3 = bytes[pos++];
- out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- }
- }
- return out.join('');
-};
-// We define it as an object literal instead of a class because a class compiled down to es5 can't
-// be treeshaked. https://github.com/rollup/rollup/issues/1691
-// Static lookup maps, lazily populated by init_()
-const base64 = {
- /**
- * Maps bytes to characters.
- */
- byteToCharMap_: null,
- /**
- * Maps characters to bytes.
- */
- charToByteMap_: null,
- /**
- * Maps bytes to websafe characters.
- * @private
- */
- byteToCharMapWebSafe_: null,
- /**
- * Maps websafe characters to bytes.
- * @private
- */
- charToByteMapWebSafe_: null,
- /**
- * Our default alphabet, shared between
- * ENCODED_VALS and ENCODED_VALS_WEBSAFE
- */
- ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',
- /**
- * Our default alphabet. Value 64 (=) is special; it means "nothing."
- */
- get ENCODED_VALS() {
- return this.ENCODED_VALS_BASE + '+/=';
- },
- /**
- * Our websafe alphabet.
- */
- get ENCODED_VALS_WEBSAFE() {
- return this.ENCODED_VALS_BASE + '-_.';
- },
- /**
- * Whether this browser supports the atob and btoa functions. This extension
- * started at Mozilla but is now implemented by many browsers. We use the
- * ASSUME_* variables to avoid pulling in the full useragent detection library
- * but still allowing the standard per-browser compilations.
- *
- */
- HAS_NATIVE_SUPPORT: typeof atob === 'function',
- /**
- * Base64-encode an array of bytes.
- *
- * @param input An array of bytes (numbers with
- * value in [0, 255]) to encode.
- * @param webSafe Boolean indicating we should use the
- * alternative alphabet.
- * @return The base64 encoded string.
- */
- encodeByteArray(input, webSafe) {
- if (!Array.isArray(input)) {
- throw Error('encodeByteArray takes an array as a parameter');
- }
- this.init_();
- const byteToCharMap = webSafe
- ? this.byteToCharMapWebSafe_
- : this.byteToCharMap_;
- const output = [];
- for (let i = 0; i < input.length; i += 3) {
- const byte1 = input[i];
- const haveByte2 = i + 1 < input.length;
- const byte2 = haveByte2 ? input[i + 1] : 0;
- const haveByte3 = i + 2 < input.length;
- const byte3 = haveByte3 ? input[i + 2] : 0;
- const outByte1 = byte1 >> 2;
- const outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);
- let outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6);
- let outByte4 = byte3 & 0x3f;
- if (!haveByte3) {
- outByte4 = 64;
- if (!haveByte2) {
- outByte3 = 64;
- }
- }
- output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);
- }
- return output.join('');
- },
- /**
- * Base64-encode a string.
- *
- * @param input A string to encode.
- * @param webSafe If true, we should use the
- * alternative alphabet.
- * @return The base64 encoded string.
- */
- encodeString(input, webSafe) {
- // Shortcut for Mozilla browsers that implement
- // a native base64 encoder in the form of "btoa/atob"
- if (this.HAS_NATIVE_SUPPORT && !webSafe) {
- return btoa(input);
- }
- return this.encodeByteArray(stringToByteArray$1(input), webSafe);
- },
- /**
- * Base64-decode a string.
- *
- * @param input to decode.
- * @param webSafe True if we should use the
- * alternative alphabet.
- * @return string representing the decoded value.
- */
- decodeString(input, webSafe) {
- // Shortcut for Mozilla browsers that implement
- // a native base64 encoder in the form of "btoa/atob"
- if (this.HAS_NATIVE_SUPPORT && !webSafe) {
- return atob(input);
- }
- return byteArrayToString(this.decodeStringToByteArray(input, webSafe));
- },
- /**
- * Base64-decode a string.
- *
- * In base-64 decoding, groups of four characters are converted into three
- * bytes. If the encoder did not apply padding, the input length may not
- * be a multiple of 4.
- *
- * In this case, the last group will have fewer than 4 characters, and
- * padding will be inferred. If the group has one or two characters, it decodes
- * to one byte. If the group has three characters, it decodes to two bytes.
- *
- * @param input Input to decode.
- * @param webSafe True if we should use the web-safe alphabet.
- * @return bytes representing the decoded value.
- */
- decodeStringToByteArray(input, webSafe) {
- this.init_();
- const charToByteMap = webSafe
- ? this.charToByteMapWebSafe_
- : this.charToByteMap_;
- const output = [];
- for (let i = 0; i < input.length;) {
- const byte1 = charToByteMap[input.charAt(i++)];
- const haveByte2 = i < input.length;
- const byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;
- ++i;
- const haveByte3 = i < input.length;
- const byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;
- ++i;
- const haveByte4 = i < input.length;
- const byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;
- ++i;
- if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {
- throw new DecodeBase64StringError();
- }
- const outByte1 = (byte1 << 2) | (byte2 >> 4);
- output.push(outByte1);
- if (byte3 !== 64) {
- const outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2);
- output.push(outByte2);
- if (byte4 !== 64) {
- const outByte3 = ((byte3 << 6) & 0xc0) | byte4;
- output.push(outByte3);
- }
- }
- }
- return output;
- },
- /**
- * Lazy static initialization function. Called before
- * accessing any of the static map variables.
- * @private
- */
- init_() {
- if (!this.byteToCharMap_) {
- this.byteToCharMap_ = {};
- this.charToByteMap_ = {};
- this.byteToCharMapWebSafe_ = {};
- this.charToByteMapWebSafe_ = {};
- // We want quick mappings back and forth, so we precompute two maps.
- for (let i = 0; i < this.ENCODED_VALS.length; i++) {
- this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);
- this.charToByteMap_[this.byteToCharMap_[i]] = i;
- this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);
- this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;
- // Be forgiving when decoding and correctly decode both encodings.
- if (i >= this.ENCODED_VALS_BASE.length) {
- this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;
- this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;
- }
- }
- }
- }
-};
-/**
- * An error encountered while decoding base64 string.
- */
-class DecodeBase64StringError extends Error {
- constructor() {
- super(...arguments);
- this.name = 'DecodeBase64StringError';
- }
-}
-/**
- * URL-safe base64 encoding
- */
-const base64Encode = function (str) {
- const utf8Bytes = stringToByteArray$1(str);
- return base64.encodeByteArray(utf8Bytes, true);
-};
-/**
- * URL-safe base64 encoding (without "." padding in the end).
- * e.g. Used in JSON Web Token (JWT) parts.
- */
-const base64urlEncodeWithoutPadding = function (str) {
- // Use base64url encoding and remove padding in the end (dot characters).
- return base64Encode(str).replace(/\./g, '');
-};
-/**
- * URL-safe base64 decoding
- *
- * NOTE: DO NOT use the global atob() function - it does NOT support the
- * base64Url variant encoding.
- *
- * @param str To be decoded
- * @return Decoded result, if possible
- */
-const base64Decode = function (str) {
- try {
- return base64.decodeString(str, true);
- }
- catch (e) {
- console.error('base64Decode failed: ', e);
- }
- return null;
-};
-
-/**
- * @license
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Polyfill for `globalThis` object.
- * @returns the `globalThis` object for the given environment.
- * @public
- */
-function getGlobal() {
- if (typeof self !== 'undefined') {
- return self;
- }
- if (typeof window !== 'undefined') {
- return window;
- }
- if (typeof global !== 'undefined') {
- return global;
- }
- throw new Error('Unable to locate global object.');
-}
-
-/**
- * @license
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
-/**
- * Attempt to read defaults from a JSON string provided to
- * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
- * process(.)env(.)__FIREBASE_DEFAULTS_PATH__
- * The dots are in parens because certain compilers (Vite?) cannot
- * handle seeing that variable in comments.
- * See https://github.com/firebase/firebase-js-sdk/issues/6838
- */
-const getDefaultsFromEnvVariable = () => {
- if (typeof process === 'undefined' || typeof process.env === 'undefined') {
- return;
- }
- const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__;
- if (defaultsJsonString) {
- return JSON.parse(defaultsJsonString);
- }
-};
-const getDefaultsFromCookie = () => {
- if (typeof document === 'undefined') {
- return;
- }
- let match;
- try {
- match = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
- }
- catch (e) {
- // Some environments such as Angular Universal SSR have a
- // `document` object but error on accessing `document.cookie`.
- return;
- }
- const decoded = match && base64Decode(match[1]);
- return decoded && JSON.parse(decoded);
-};
-/**
- * Get the __FIREBASE_DEFAULTS__ object. It checks in order:
- * (1) if such an object exists as a property of `globalThis`
- * (2) if such an object was provided on a shell environment variable
- * (3) if such an object exists in a cookie
- * @public
- */
-const getDefaults = () => {
- try {
- return (getDefaultsFromGlobal() ||
- getDefaultsFromEnvVariable() ||
- getDefaultsFromCookie());
- }
- catch (e) {
- /**
- * Catch-all for being unable to get __FIREBASE_DEFAULTS__ due
- * to any environment case we have not accounted for. Log to
- * info instead of swallowing so we can find these unknown cases
- * and add paths for them if needed.
- */
- console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);
- return;
- }
-};
-/**
- * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
- * @public
- */
-const getDefaultAppConfig = () => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.config; };
-
-/**
- * @license
- * Copyright 2017 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-class Deferred {
- constructor() {
- this.reject = () => { };
- this.resolve = () => { };
- this.promise = new Promise((resolve, reject) => {
- this.resolve = resolve;
- this.reject = reject;
- });
- }
- /**
- * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around
- * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback
- * and returns a node-style callback which will resolve or reject the Deferred's promise.
- */
- wrapCallback(callback) {
- return (error, value) => {
- if (error) {
- this.reject(error);
- }
- else {
- this.resolve(value);
- }
- if (typeof callback === 'function') {
- // Attaching noop handler just in case developer wasn't expecting
- // promises
- this.promise.catch(() => { });
- // Some of our callbacks don't expect a value and our own tests
- // assert that the parameter length is 1
- if (callback.length === 1) {
- callback(error);
- }
- else {
- callback(error, value);
- }
- }
- };
- }
-}
-/**
- * This method checks if indexedDB is supported by current browser/service worker context
- * @return true if indexedDB is supported by current browser/service worker context
- */
-function isIndexedDBAvailable() {
- try {
- return typeof indexedDB === 'object';
- }
- catch (e) {
- return false;
- }
-}
-/**
- * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
- * if errors occur during the database open operation.
- *
- * @throws exception if current browser/sw context can't run idb.open (ex: Safari iframe, Firefox
- * private browsing)
- */
-function validateIndexedDBOpenable() {
- return new Promise((resolve, reject) => {
- try {
- let preExist = true;
- const DB_CHECK_NAME = 'validate-browser-context-for-indexeddb-analytics-module';
- const request = self.indexedDB.open(DB_CHECK_NAME);
- request.onsuccess = () => {
- request.result.close();
- // delete database only when it doesn't pre-exist
- if (!preExist) {
- self.indexedDB.deleteDatabase(DB_CHECK_NAME);
- }
- resolve(true);
- };
- request.onupgradeneeded = () => {
- preExist = false;
- };
- request.onerror = () => {
- var _a;
- reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || '');
- };
- }
- catch (error) {
- reject(error);
- }
- });
-}
-
-/**
- * @license
- * Copyright 2017 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @fileoverview Standardized Firebase Error.
- *
- * Usage:
- *
- * // Typescript string literals for type-safe codes
- * type Err =
- * 'unknown' |
- * 'object-not-found'
- * ;
- *
- * // Closure enum for type-safe error codes
- * // at-enum {string}
- * var Err = {
- * UNKNOWN: 'unknown',
- * OBJECT_NOT_FOUND: 'object-not-found',
- * }
- *
- * let errors: Map = {
- * 'generic-error': "Unknown error",
- * 'file-not-found': "Could not find file: {$file}",
- * };
- *
- * // Type-safe function - must pass a valid error code as param.
- * let error = new ErrorFactory('service', 'Service', errors);
- *
- * ...
- * throw error.create(Err.GENERIC);
- * ...
- * throw error.create(Err.FILE_NOT_FOUND, {'file': fileName});
- * ...
- * // Service: Could not file file: foo.txt (service/file-not-found).
- *
- * catch (e) {
- * assert(e.message === "Could not find file: foo.txt.");
- * if ((e as FirebaseError)?.code === 'service/file-not-found') {
- * console.log("Could not read file: " + e['file']);
- * }
- * }
- */
-const ERROR_NAME = 'FirebaseError';
-// Based on code from:
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types
-class FirebaseError extends Error {
- constructor(
- /** The error code for this error. */
- code, message,
- /** Custom data for this error. */
- customData) {
- super(message);
- this.code = code;
- this.customData = customData;
- /** The custom name for all FirebaseErrors. */
- this.name = ERROR_NAME;
- // Fix For ES5
- // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
- Object.setPrototypeOf(this, FirebaseError.prototype);
- // Maintains proper stack trace for where our error was thrown.
- // Only available on V8.
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, ErrorFactory.prototype.create);
- }
- }
-}
-class ErrorFactory {
- constructor(service, serviceName, errors) {
- this.service = service;
- this.serviceName = serviceName;
- this.errors = errors;
- }
- create(code, ...data) {
- const customData = data[0] || {};
- const fullCode = `${this.service}/${code}`;
- const template = this.errors[code];
- const message = template ? replaceTemplate(template, customData) : 'Error';
- // Service Name: Error message (service/code).
- const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`;
- const error = new FirebaseError(fullCode, fullMessage, customData);
- return error;
- }
-}
-function replaceTemplate(template, data) {
- return template.replace(PATTERN, (_, key) => {
- const value = data[key];
- return value != null ? String(value) : `<${key}?>`;
- });
-}
-const PATTERN = /\{\$([^}]+)}/g;
-/**
- * Deep equal two objects. Support Arrays and Objects.
- */
-function deepEqual(a, b) {
- if (a === b) {
- return true;
- }
- const aKeys = Object.keys(a);
- const bKeys = Object.keys(b);
- for (const k of aKeys) {
- if (!bKeys.includes(k)) {
- return false;
- }
- const aProp = a[k];
- const bProp = b[k];
- if (isObject(aProp) && isObject(bProp)) {
- if (!deepEqual(aProp, bProp)) {
- return false;
- }
- }
- else if (aProp !== bProp) {
- return false;
- }
- }
- for (const k of bKeys) {
- if (!aKeys.includes(k)) {
- return false;
- }
- }
- return true;
-}
-function isObject(thing) {
- return thing !== null && typeof thing === 'object';
-}
-
-/**
- * Component for service name T, e.g. `auth`, `auth-internal`
- */
-class Component {
- /**
- *
- * @param name The public service name, e.g. app, auth, firestore, database
- * @param instanceFactory Service factory responsible for creating the public interface
- * @param type whether the service provided by the component is public or private
- */
- constructor(name, instanceFactory, type) {
- this.name = name;
- this.instanceFactory = instanceFactory;
- this.type = type;
- this.multipleInstances = false;
- /**
- * Properties to be added to the service namespace
- */
- this.serviceProps = {};
- this.instantiationMode = "LAZY" /* InstantiationMode.LAZY */;
- this.onInstanceCreated = null;
- }
- setInstantiationMode(mode) {
- this.instantiationMode = mode;
- return this;
- }
- setMultipleInstances(multipleInstances) {
- this.multipleInstances = multipleInstances;
- return this;
- }
- setServiceProps(props) {
- this.serviceProps = props;
- return this;
- }
- setInstanceCreatedCallback(callback) {
- this.onInstanceCreated = callback;
- return this;
- }
-}
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const DEFAULT_ENTRY_NAME$1 = '[DEFAULT]';
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Provider for instance for service name T, e.g. 'auth', 'auth-internal'
- * NameServiceMapping[T] is an alias for the type of the instance
- */
-class Provider {
- constructor(name, container) {
- this.name = name;
- this.container = container;
- this.component = null;
- this.instances = new Map();
- this.instancesDeferred = new Map();
- this.instancesOptions = new Map();
- this.onInitCallbacks = new Map();
- }
- /**
- * @param identifier A provider can provide mulitple instances of a service
- * if this.component.multipleInstances is true.
- */
- get(identifier) {
- // if multipleInstances is not supported, use the default name
- const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
- if (!this.instancesDeferred.has(normalizedIdentifier)) {
- const deferred = new Deferred();
- this.instancesDeferred.set(normalizedIdentifier, deferred);
- if (this.isInitialized(normalizedIdentifier) ||
- this.shouldAutoInitialize()) {
- // initialize the service if it can be auto-initialized
- try {
- const instance = this.getOrInitializeService({
- instanceIdentifier: normalizedIdentifier
- });
- if (instance) {
- deferred.resolve(instance);
- }
- }
- catch (e) {
- // when the instance factory throws an exception during get(), it should not cause
- // a fatal error. We just return the unresolved promise in this case.
- }
- }
- }
- return this.instancesDeferred.get(normalizedIdentifier).promise;
- }
- getImmediate(options) {
- var _a;
- // if multipleInstances is not supported, use the default name
- const normalizedIdentifier = this.normalizeInstanceIdentifier(options === null || options === void 0 ? void 0 : options.identifier);
- const optional = (_a = options === null || options === void 0 ? void 0 : options.optional) !== null && _a !== void 0 ? _a : false;
- if (this.isInitialized(normalizedIdentifier) ||
- this.shouldAutoInitialize()) {
- try {
- return this.getOrInitializeService({
- instanceIdentifier: normalizedIdentifier
- });
- }
- catch (e) {
- if (optional) {
- return null;
- }
- else {
- throw e;
- }
- }
- }
- else {
- // In case a component is not initialized and should/can not be auto-initialized at the moment, return null if the optional flag is set, or throw
- if (optional) {
- return null;
- }
- else {
- throw Error(`Service ${this.name} is not available`);
- }
- }
- }
- getComponent() {
- return this.component;
- }
- setComponent(component) {
- if (component.name !== this.name) {
- throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);
- }
- if (this.component) {
- throw Error(`Component for ${this.name} has already been provided`);
- }
- this.component = component;
- // return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)
- if (!this.shouldAutoInitialize()) {
- return;
- }
- // if the service is eager, initialize the default instance
- if (isComponentEager(component)) {
- try {
- this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME$1 });
- }
- catch (e) {
- // when the instance factory for an eager Component throws an exception during the eager
- // initialization, it should not cause a fatal error.
- // TODO: Investigate if we need to make it configurable, because some component may want to cause
- // a fatal error in this case?
- }
- }
- // Create service instances for the pending promises and resolve them
- // NOTE: if this.multipleInstances is false, only the default instance will be created
- // and all promises with resolve with it regardless of the identifier.
- for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {
- const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
- try {
- // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.
- const instance = this.getOrInitializeService({
- instanceIdentifier: normalizedIdentifier
- });
- instanceDeferred.resolve(instance);
- }
- catch (e) {
- // when the instance factory throws an exception, it should not cause
- // a fatal error. We just leave the promise unresolved.
- }
- }
- }
- clearInstance(identifier = DEFAULT_ENTRY_NAME$1) {
- this.instancesDeferred.delete(identifier);
- this.instancesOptions.delete(identifier);
- this.instances.delete(identifier);
- }
- // app.delete() will call this method on every provider to delete the services
- // TODO: should we mark the provider as deleted?
- async delete() {
- const services = Array.from(this.instances.values());
- await Promise.all([
- ...services
- .filter(service => 'INTERNAL' in service) // legacy services
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- .map(service => service.INTERNAL.delete()),
- ...services
- .filter(service => '_delete' in service) // modularized services
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- .map(service => service._delete())
- ]);
- }
- isComponentSet() {
- return this.component != null;
- }
- isInitialized(identifier = DEFAULT_ENTRY_NAME$1) {
- return this.instances.has(identifier);
- }
- getOptions(identifier = DEFAULT_ENTRY_NAME$1) {
- return this.instancesOptions.get(identifier) || {};
- }
- initialize(opts = {}) {
- const { options = {} } = opts;
- const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);
- if (this.isInitialized(normalizedIdentifier)) {
- throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);
- }
- if (!this.isComponentSet()) {
- throw Error(`Component ${this.name} has not been registered yet`);
- }
- const instance = this.getOrInitializeService({
- instanceIdentifier: normalizedIdentifier,
- options
- });
- // resolve any pending promise waiting for the service instance
- for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {
- const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
- if (normalizedIdentifier === normalizedDeferredIdentifier) {
- instanceDeferred.resolve(instance);
- }
- }
- return instance;
- }
- /**
- *
- * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
- * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
- *
- * @param identifier An optional instance identifier
- * @returns a function to unregister the callback
- */
- onInit(callback, identifier) {
- var _a;
- const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
- const existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) !== null && _a !== void 0 ? _a : new Set();
- existingCallbacks.add(callback);
- this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);
- const existingInstance = this.instances.get(normalizedIdentifier);
- if (existingInstance) {
- callback(existingInstance, normalizedIdentifier);
- }
- return () => {
- existingCallbacks.delete(callback);
- };
- }
- /**
- * Invoke onInit callbacks synchronously
- * @param instance the service instance`
- */
- invokeOnInitCallbacks(instance, identifier) {
- const callbacks = this.onInitCallbacks.get(identifier);
- if (!callbacks) {
- return;
- }
- for (const callback of callbacks) {
- try {
- callback(instance, identifier);
- }
- catch (_a) {
- // ignore errors in the onInit callback
- }
- }
- }
- getOrInitializeService({ instanceIdentifier, options = {} }) {
- let instance = this.instances.get(instanceIdentifier);
- if (!instance && this.component) {
- instance = this.component.instanceFactory(this.container, {
- instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),
- options
- });
- this.instances.set(instanceIdentifier, instance);
- this.instancesOptions.set(instanceIdentifier, options);
- /**
- * Invoke onInit listeners.
- * Note this.component.onInstanceCreated is different, which is used by the component creator,
- * while onInit listeners are registered by consumers of the provider.
- */
- this.invokeOnInitCallbacks(instance, instanceIdentifier);
- /**
- * Order is important
- * onInstanceCreated() should be called after this.instances.set(instanceIdentifier, instance); which
- * makes `isInitialized()` return true.
- */
- if (this.component.onInstanceCreated) {
- try {
- this.component.onInstanceCreated(this.container, instanceIdentifier, instance);
- }
- catch (_a) {
- // ignore errors in the onInstanceCreatedCallback
- }
- }
- }
- return instance || null;
- }
- normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME$1) {
- if (this.component) {
- return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME$1;
- }
- else {
- return identifier; // assume multiple instances are supported before the component is provided.
- }
- }
- shouldAutoInitialize() {
- return (!!this.component &&
- this.component.instantiationMode !== "EXPLICIT" /* InstantiationMode.EXPLICIT */);
- }
-}
-// undefined should be passed to the service factory for the default instance
-function normalizeIdentifierForFactory(identifier) {
- return identifier === DEFAULT_ENTRY_NAME$1 ? undefined : identifier;
-}
-function isComponentEager(component) {
- return component.instantiationMode === "EAGER" /* InstantiationMode.EAGER */;
-}
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`
- */
-class ComponentContainer {
- constructor(name) {
- this.name = name;
- this.providers = new Map();
- }
- /**
- *
- * @param component Component being added
- * @param overwrite When a component with the same name has already been registered,
- * if overwrite is true: overwrite the existing component with the new component and create a new
- * provider with the new component. It can be useful in tests where you want to use different mocks
- * for different tests.
- * if overwrite is false: throw an exception
- */
- addComponent(component) {
- const provider = this.getProvider(component.name);
- if (provider.isComponentSet()) {
- throw new Error(`Component ${component.name} has already been registered with ${this.name}`);
- }
- provider.setComponent(component);
- }
- addOrOverwriteComponent(component) {
- const provider = this.getProvider(component.name);
- if (provider.isComponentSet()) {
- // delete the existing provider from the container, so we can register the new component
- this.providers.delete(component.name);
- }
- this.addComponent(component);
- }
- /**
- * getProvider provides a type safe interface where it can only be called with a field name
- * present in NameServiceMapping interface.
- *
- * Firebase SDKs providing services should extend NameServiceMapping interface to register
- * themselves.
- */
- getProvider(name) {
- if (this.providers.has(name)) {
- return this.providers.get(name);
- }
- // create a Provider for a service that hasn't registered with Firebase
- const provider = new Provider(name, this);
- this.providers.set(name, provider);
- return provider;
- }
- getProviders() {
- return Array.from(this.providers.values());
- }
-}
-
-/**
- * @license
- * Copyright 2017 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * A container for all of the Logger instances
- */
-const instances = [];
-/**
- * The JS SDK supports 5 log levels and also allows a user the ability to
- * silence the logs altogether.
- *
- * The order is a follows:
- * DEBUG < VERBOSE < INFO < WARN < ERROR
- *
- * All of the log types above the current log level will be captured (i.e. if
- * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and
- * `VERBOSE` logs will not)
- */
-var LogLevel;
-(function (LogLevel) {
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
- LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE";
- LogLevel[LogLevel["INFO"] = 2] = "INFO";
- LogLevel[LogLevel["WARN"] = 3] = "WARN";
- LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
- LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
-})(LogLevel || (LogLevel = {}));
-const levelStringToEnum = {
- 'debug': LogLevel.DEBUG,
- 'verbose': LogLevel.VERBOSE,
- 'info': LogLevel.INFO,
- 'warn': LogLevel.WARN,
- 'error': LogLevel.ERROR,
- 'silent': LogLevel.SILENT
-};
-/**
- * The default log level
- */
-const defaultLogLevel = LogLevel.INFO;
-/**
- * By default, `console.debug` is not displayed in the developer console (in
- * chrome). To avoid forcing users to have to opt-in to these logs twice
- * (i.e. once for firebase, and once in the console), we are sending `DEBUG`
- * logs to the `console.log` function.
- */
-const ConsoleMethod = {
- [LogLevel.DEBUG]: 'log',
- [LogLevel.VERBOSE]: 'log',
- [LogLevel.INFO]: 'info',
- [LogLevel.WARN]: 'warn',
- [LogLevel.ERROR]: 'error'
-};
-/**
- * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR
- * messages on to their corresponding console counterparts (if the log method
- * is supported by the current log level)
- */
-const defaultLogHandler = (instance, logType, ...args) => {
- if (logType < instance.logLevel) {
- return;
- }
- const now = new Date().toISOString();
- const method = ConsoleMethod[logType];
- if (method) {
- console[method](`[${now}] ${instance.name}:`, ...args);
- }
- else {
- throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);
- }
-};
-class Logger {
- /**
- * Gives you an instance of a Logger to capture messages according to
- * Firebase's logging scheme.
- *
- * @param name The name that the logs will be associated with
- */
- constructor(name) {
- this.name = name;
- /**
- * The log level of the given Logger instance.
- */
- this._logLevel = defaultLogLevel;
- /**
- * The main (internal) log handler for the Logger instance.
- * Can be set to a new function in internal package code but not by user.
- */
- this._logHandler = defaultLogHandler;
- /**
- * The optional, additional, user-defined log handler for the Logger instance.
- */
- this._userLogHandler = null;
- /**
- * Capture the current instance for later use
- */
- instances.push(this);
- }
- get logLevel() {
- return this._logLevel;
- }
- set logLevel(val) {
- if (!(val in LogLevel)) {
- throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``);
- }
- this._logLevel = val;
- }
- // Workaround for setter/getter having to be the same type.
- setLogLevel(val) {
- this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;
- }
- get logHandler() {
- return this._logHandler;
- }
- set logHandler(val) {
- if (typeof val !== 'function') {
- throw new TypeError('Value assigned to `logHandler` must be a function');
- }
- this._logHandler = val;
- }
- get userLogHandler() {
- return this._userLogHandler;
- }
- set userLogHandler(val) {
- this._userLogHandler = val;
- }
- /**
- * The functions below are all based on the `console` interface
- */
- debug(...args) {
- this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);
- this._logHandler(this, LogLevel.DEBUG, ...args);
- }
- log(...args) {
- this._userLogHandler &&
- this._userLogHandler(this, LogLevel.VERBOSE, ...args);
- this._logHandler(this, LogLevel.VERBOSE, ...args);
- }
- info(...args) {
- this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);
- this._logHandler(this, LogLevel.INFO, ...args);
- }
- warn(...args) {
- this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);
- this._logHandler(this, LogLevel.WARN, ...args);
- }
- error(...args) {
- this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);
- this._logHandler(this, LogLevel.ERROR, ...args);
- }
-}
-function setLogLevel$1(level) {
- instances.forEach(inst => {
- inst.setLogLevel(level);
- });
-}
-function setUserLogHandler(logCallback, options) {
- for (const instance of instances) {
- let customLogLevel = null;
- if (options && options.level) {
- customLogLevel = levelStringToEnum[options.level];
- }
- if (logCallback === null) {
- instance.userLogHandler = null;
- }
- else {
- instance.userLogHandler = (instance, level, ...args) => {
- const message = args
- .map(arg => {
- if (arg == null) {
- return null;
- }
- else if (typeof arg === 'string') {
- return arg;
- }
- else if (typeof arg === 'number' || typeof arg === 'boolean') {
- return arg.toString();
- }
- else if (arg instanceof Error) {
- return arg.message;
- }
- else {
- try {
- return JSON.stringify(arg);
- }
- catch (ignored) {
- return null;
- }
- }
- })
- .filter(arg => arg)
- .join(' ');
- if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {
- logCallback({
- level: LogLevel[level].toLowerCase(),
- message,
- args,
- type: instance.name
- });
- }
- };
- }
- }
-}
-
-const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
-
-let idbProxyableTypes;
-let cursorAdvanceMethods;
-// This is a function to prevent it throwing up in node environments.
-function getIdbProxyableTypes() {
- return (idbProxyableTypes ||
- (idbProxyableTypes = [
- IDBDatabase,
- IDBObjectStore,
- IDBIndex,
- IDBCursor,
- IDBTransaction,
- ]));
-}
-// This is a function to prevent it throwing up in node environments.
-function getCursorAdvanceMethods() {
- return (cursorAdvanceMethods ||
- (cursorAdvanceMethods = [
- IDBCursor.prototype.advance,
- IDBCursor.prototype.continue,
- IDBCursor.prototype.continuePrimaryKey,
- ]));
-}
-const cursorRequestMap = new WeakMap();
-const transactionDoneMap = new WeakMap();
-const transactionStoreNamesMap = new WeakMap();
-const transformCache = new WeakMap();
-const reverseTransformCache = new WeakMap();
-function promisifyRequest(request) {
- const promise = new Promise((resolve, reject) => {
- const unlisten = () => {
- request.removeEventListener('success', success);
- request.removeEventListener('error', error);
- };
- const success = () => {
- resolve(wrap(request.result));
- unlisten();
- };
- const error = () => {
- reject(request.error);
- unlisten();
- };
- request.addEventListener('success', success);
- request.addEventListener('error', error);
- });
- promise
- .then((value) => {
- // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval
- // (see wrapFunction).
- if (value instanceof IDBCursor) {
- cursorRequestMap.set(value, request);
- }
- // Catching to avoid "Uncaught Promise exceptions"
- })
- .catch(() => { });
- // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This
- // is because we create many promises from a single IDBRequest.
- reverseTransformCache.set(promise, request);
- return promise;
-}
-function cacheDonePromiseForTransaction(tx) {
- // Early bail if we've already created a done promise for this transaction.
- if (transactionDoneMap.has(tx))
- return;
- const done = new Promise((resolve, reject) => {
- const unlisten = () => {
- tx.removeEventListener('complete', complete);
- tx.removeEventListener('error', error);
- tx.removeEventListener('abort', error);
- };
- const complete = () => {
- resolve();
- unlisten();
- };
- const error = () => {
- reject(tx.error || new DOMException('AbortError', 'AbortError'));
- unlisten();
- };
- tx.addEventListener('complete', complete);
- tx.addEventListener('error', error);
- tx.addEventListener('abort', error);
- });
- // Cache it for later retrieval.
- transactionDoneMap.set(tx, done);
-}
-let idbProxyTraps = {
- get(target, prop, receiver) {
- if (target instanceof IDBTransaction) {
- // Special handling for transaction.done.
- if (prop === 'done')
- return transactionDoneMap.get(target);
- // Polyfill for objectStoreNames because of Edge.
- if (prop === 'objectStoreNames') {
- return target.objectStoreNames || transactionStoreNamesMap.get(target);
- }
- // Make tx.store return the only store in the transaction, or undefined if there are many.
- if (prop === 'store') {
- return receiver.objectStoreNames[1]
- ? undefined
- : receiver.objectStore(receiver.objectStoreNames[0]);
- }
- }
- // Else transform whatever we get back.
- return wrap(target[prop]);
- },
- set(target, prop, value) {
- target[prop] = value;
- return true;
- },
- has(target, prop) {
- if (target instanceof IDBTransaction &&
- (prop === 'done' || prop === 'store')) {
- return true;
- }
- return prop in target;
- },
-};
-function replaceTraps(callback) {
- idbProxyTraps = callback(idbProxyTraps);
-}
-function wrapFunction(func) {
- // Due to expected object equality (which is enforced by the caching in `wrap`), we
- // only create one new func per func.
- // Edge doesn't support objectStoreNames (booo), so we polyfill it here.
- if (func === IDBDatabase.prototype.transaction &&
- !('objectStoreNames' in IDBTransaction.prototype)) {
- return function (storeNames, ...args) {
- const tx = func.call(unwrap(this), storeNames, ...args);
- transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);
- return wrap(tx);
- };
- }
- // Cursor methods are special, as the behaviour is a little more different to standard IDB. In
- // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the
- // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense
- // with real promises, so each advance methods returns a new promise for the cursor object, or
- // undefined if the end of the cursor has been reached.
- if (getCursorAdvanceMethods().includes(func)) {
- return function (...args) {
- // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use
- // the original object.
- func.apply(unwrap(this), args);
- return wrap(cursorRequestMap.get(this));
- };
- }
- return function (...args) {
- // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use
- // the original object.
- return wrap(func.apply(unwrap(this), args));
- };
-}
-function transformCachableValue(value) {
- if (typeof value === 'function')
- return wrapFunction(value);
- // This doesn't return, it just creates a 'done' promise for the transaction,
- // which is later returned for transaction.done (see idbObjectHandler).
- if (value instanceof IDBTransaction)
- cacheDonePromiseForTransaction(value);
- if (instanceOfAny(value, getIdbProxyableTypes()))
- return new Proxy(value, idbProxyTraps);
- // Return the same value back if we're not going to transform it.
- return value;
-}
-function wrap(value) {
- // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because
- // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.
- if (value instanceof IDBRequest)
- return promisifyRequest(value);
- // If we've already transformed this value before, reuse the transformed value.
- // This is faster, but it also provides object equality.
- if (transformCache.has(value))
- return transformCache.get(value);
- const newValue = transformCachableValue(value);
- // Not all types are transformed.
- // These may be primitive types, so they can't be WeakMap keys.
- if (newValue !== value) {
- transformCache.set(value, newValue);
- reverseTransformCache.set(newValue, value);
- }
- return newValue;
-}
-const unwrap = (value) => reverseTransformCache.get(value);
-
-/**
- * Open a database.
- *
- * @param name Name of the database.
- * @param version Schema version.
- * @param callbacks Additional callbacks.
- */
-function openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {
- const request = indexedDB.open(name, version);
- const openPromise = wrap(request);
- if (upgrade) {
- request.addEventListener('upgradeneeded', (event) => {
- upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);
- });
- }
- if (blocked) {
- request.addEventListener('blocked', (event) => blocked(
- // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
- event.oldVersion, event.newVersion, event));
- }
- openPromise
- .then((db) => {
- if (terminated)
- db.addEventListener('close', () => terminated());
- if (blocking) {
- db.addEventListener('versionchange', (event) => blocking(event.oldVersion, event.newVersion, event));
- }
- })
- .catch(() => { });
- return openPromise;
-}
-
-const readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];
-const writeMethods = ['put', 'add', 'delete', 'clear'];
-const cachedMethods = new Map();
-function getMethod(target, prop) {
- if (!(target instanceof IDBDatabase &&
- !(prop in target) &&
- typeof prop === 'string')) {
- return;
- }
- if (cachedMethods.get(prop))
- return cachedMethods.get(prop);
- const targetFuncName = prop.replace(/FromIndex$/, '');
- const useIndex = prop !== targetFuncName;
- const isWrite = writeMethods.includes(targetFuncName);
- if (
- // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
- !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||
- !(isWrite || readMethods.includes(targetFuncName))) {
- return;
- }
- const method = async function (storeName, ...args) {
- // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(
- const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');
- let target = tx.store;
- if (useIndex)
- target = target.index(args.shift());
- // Must reject if op rejects.
- // If it's a write operation, must reject if tx.done rejects.
- // Must reject with op rejection first.
- // Must resolve with op value.
- // Must handle both promises (no unhandled rejections)
- return (await Promise.all([
- target[targetFuncName](...args),
- isWrite && tx.done,
- ]))[0];
- };
- cachedMethods.set(prop, method);
- return method;
-}
-replaceTraps((oldTraps) => ({
- ...oldTraps,
- get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),
- has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),
-}));
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-class PlatformLoggerServiceImpl {
- constructor(container) {
- this.container = container;
- }
- // In initial implementation, this will be called by installations on
- // auth token refresh, and installations will send this string.
- getPlatformInfoString() {
- const providers = this.container.getProviders();
- // Loop through providers and get library/version pairs from any that are
- // version components.
- return providers
- .map(provider => {
- if (isVersionServiceProvider(provider)) {
- const service = provider.getImmediate();
- return `${service.library}/${service.version}`;
- }
- else {
- return null;
- }
- })
- .filter(logString => logString)
- .join(' ');
- }
-}
-/**
- *
- * @param provider check if this provider provides a VersionService
- *
- * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider
- * provides VersionService. The provider is not necessarily a 'app-version'
- * provider.
- */
-function isVersionServiceProvider(provider) {
- const component = provider.getComponent();
- return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* ComponentType.VERSION */;
-}
-
-const name$o = "https://www.gstatic.com/firebasejs/9.23.0/firebase-app.js";
-const version$1 = "0.9.13";
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const logger = new Logger('https://www.gstatic.com/firebasejs/9.23.0/firebase-app.js');
-
-const name$n = "@firebase/app-compat";
-
-const name$m = "@firebase/analytics-compat";
-
-const name$l = "@firebase/analytics";
-
-const name$k = "@firebase/app-check-compat";
-
-const name$j = "@firebase/app-check";
-
-const name$i = "@firebase/auth";
-
-const name$h = "@firebase/auth-compat";
-
-const name$g = "@firebase/database";
-
-const name$f = "@firebase/database-compat";
-
-const name$e = "@firebase/functions";
-
-const name$d = "@firebase/functions-compat";
-
-const name$c = "@firebase/installations";
-
-const name$b = "@firebase/installations-compat";
-
-const name$a = "@firebase/messaging";
-
-const name$9 = "@firebase/messaging-compat";
-
-const name$8 = "@firebase/performance";
-
-const name$7 = "@firebase/performance-compat";
-
-const name$6 = "@firebase/remote-config";
-
-const name$5 = "@firebase/remote-config-compat";
-
-const name$4 = "@firebase/storage";
-
-const name$3 = "@firebase/storage-compat";
-
-const name$2 = "@firebase/firestore";
-
-const name$1 = "@firebase/firestore-compat";
-
-const name$p = "firebase";
-const version$2 = "9.23.0";
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * The default app name
- *
- * @internal
- */
-const DEFAULT_ENTRY_NAME = '[DEFAULT]';
-const PLATFORM_LOG_STRING = {
- [name$o]: 'fire-core',
- [name$n]: 'fire-core-compat',
- [name$l]: 'fire-analytics',
- [name$m]: 'fire-analytics-compat',
- [name$j]: 'fire-app-check',
- [name$k]: 'fire-app-check-compat',
- [name$i]: 'fire-auth',
- [name$h]: 'fire-auth-compat',
- [name$g]: 'fire-rtdb',
- [name$f]: 'fire-rtdb-compat',
- [name$e]: 'fire-fn',
- [name$d]: 'fire-fn-compat',
- [name$c]: 'fire-iid',
- [name$b]: 'fire-iid-compat',
- [name$a]: 'fire-fcm',
- [name$9]: 'fire-fcm-compat',
- [name$8]: 'fire-perf',
- [name$7]: 'fire-perf-compat',
- [name$6]: 'fire-rc',
- [name$5]: 'fire-rc-compat',
- [name$4]: 'fire-gcs',
- [name$3]: 'fire-gcs-compat',
- [name$2]: 'fire-fst',
- [name$1]: 'fire-fst-compat',
- 'fire-js': 'fire-js',
- [name$p]: 'fire-js-all'
-};
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @internal
- */
-const _apps = new Map();
-/**
- * Registered components.
- *
- * @internal
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const _components = new Map();
-/**
- * @param component - the component being added to this app's container
- *
- * @internal
- */
-function _addComponent(app, component) {
- try {
- app.container.addComponent(component);
- }
- catch (e) {
- logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
- }
-}
-/**
- *
- * @internal
- */
-function _addOrOverwriteComponent(app, component) {
- app.container.addOrOverwriteComponent(component);
-}
-/**
- *
- * @param component - the component to register
- * @returns whether or not the component is registered successfully
- *
- * @internal
- */
-function _registerComponent(component) {
- const componentName = component.name;
- if (_components.has(componentName)) {
- logger.debug(`There were multiple attempts to register component ${componentName}.`);
- return false;
- }
- _components.set(componentName, component);
- // add the component to existing app instances
- for (const app of _apps.values()) {
- _addComponent(app, component);
- }
- return true;
-}
-/**
- *
- * @param app - FirebaseApp instance
- * @param name - service name
- *
- * @returns the provider for the service with the matching name
- *
- * @internal
- */
-function _getProvider(app, name) {
- const heartbeatController = app.container
- .getProvider('heartbeat')
- .getImmediate({ optional: true });
- if (heartbeatController) {
- void heartbeatController.triggerHeartbeat();
- }
- return app.container.getProvider(name);
-}
-/**
- *
- * @param app - FirebaseApp instance
- * @param name - service name
- * @param instanceIdentifier - service instance identifier in case the service supports multiple instances
- *
- * @internal
- */
-function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {
- _getProvider(app, name).clearInstance(instanceIdentifier);
-}
-/**
- * Test only
- *
- * @internal
- */
-function _clearComponents() {
- _components.clear();
-}
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const ERRORS = {
- ["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
- 'call initializeApp() first',
- ["bad-app-name" /* AppError.BAD_APP_NAME */]: "Illegal App name: '{$appName}",
- ["duplicate-app" /* AppError.DUPLICATE_APP */]: "Firebase App named '{$appName}' already exists with different options or config",
- ["app-deleted" /* AppError.APP_DELETED */]: "Firebase App named '{$appName}' already deleted",
- ["no-options" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',
- ["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
- 'Firebase App instance.',
- ["invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',
- ["idb-open" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',
- ["idb-get" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',
- ["idb-set" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',
- ["idb-delete" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.'
-};
-const ERROR_FACTORY = new ErrorFactory('app', 'Firebase', ERRORS);
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-class FirebaseAppImpl {
- constructor(options, config, container) {
- this._isDeleted = false;
- this._options = Object.assign({}, options);
- this._config = Object.assign({}, config);
- this._name = config.name;
- this._automaticDataCollectionEnabled =
- config.automaticDataCollectionEnabled;
- this._container = container;
- this.container.addComponent(new Component('app', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
- }
- get automaticDataCollectionEnabled() {
- this.checkDestroyed();
- return this._automaticDataCollectionEnabled;
- }
- set automaticDataCollectionEnabled(val) {
- this.checkDestroyed();
- this._automaticDataCollectionEnabled = val;
- }
- get name() {
- this.checkDestroyed();
- return this._name;
- }
- get options() {
- this.checkDestroyed();
- return this._options;
- }
- get config() {
- this.checkDestroyed();
- return this._config;
- }
- get container() {
- return this._container;
- }
- get isDeleted() {
- return this._isDeleted;
- }
- set isDeleted(val) {
- this._isDeleted = val;
- }
- /**
- * This function will throw an Error if the App has already been deleted -
- * use before performing API actions on the App.
- */
- checkDestroyed() {
- if (this.isDeleted) {
- throw ERROR_FACTORY.create("app-deleted" /* AppError.APP_DELETED */, { appName: this._name });
- }
- }
-}
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * The current SDK version.
- *
- * @public
- */
-const SDK_VERSION = version$2;
-function initializeApp(_options, rawConfig = {}) {
- let options = _options;
- if (typeof rawConfig !== 'object') {
- const name = rawConfig;
- rawConfig = { name };
- }
- const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
- const name = config.name;
- if (typeof name !== 'string' || !name) {
- throw ERROR_FACTORY.create("bad-app-name" /* AppError.BAD_APP_NAME */, {
- appName: String(name)
- });
- }
- options || (options = getDefaultAppConfig());
- if (!options) {
- throw ERROR_FACTORY.create("no-options" /* AppError.NO_OPTIONS */);
- }
- const existingApp = _apps.get(name);
- if (existingApp) {
- // return the existing app if options and config deep equal the ones in the existing app.
- if (deepEqual(options, existingApp.options) &&
- deepEqual(config, existingApp.config)) {
- return existingApp;
- }
- else {
- throw ERROR_FACTORY.create("duplicate-app" /* AppError.DUPLICATE_APP */, { appName: name });
- }
- }
- const container = new ComponentContainer(name);
- for (const component of _components.values()) {
- container.addComponent(component);
- }
- const newApp = new FirebaseAppImpl(options, config, container);
- _apps.set(name, newApp);
- return newApp;
-}
-/**
- * Retrieves a {@link @firebase/app#FirebaseApp} instance.
- *
- * When called with no arguments, the default app is returned. When an app name
- * is provided, the app corresponding to that name is returned.
- *
- * An exception is thrown if the app being retrieved has not yet been
- * initialized.
- *
- * @example
- * ```javascript
- * // Return the default app
- * const app = getApp();
- * ```
- *
- * @example
- * ```javascript
- * // Return a named app
- * const otherApp = getApp("otherApp");
- * ```
- *
- * @param name - Optional name of the app to return. If no name is
- * provided, the default is `"[DEFAULT]"`.
- *
- * @returns The app corresponding to the provided app name.
- * If no app name is provided, the default app is returned.
- *
- * @public
- */
-function getApp(name = DEFAULT_ENTRY_NAME) {
- const app = _apps.get(name);
- if (!app && name === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {
- return initializeApp();
- }
- if (!app) {
- throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
- }
- return app;
-}
-/**
- * A (read-only) array of all initialized apps.
- * @public
- */
-function getApps() {
- return Array.from(_apps.values());
-}
-/**
- * Renders this app unusable and frees the resources of all associated
- * services.
- *
- * @example
- * ```javascript
- * deleteApp(app)
- * .then(function() {
- * console.log("App deleted successfully");
- * })
- * .catch(function(error) {
- * console.log("Error deleting app:", error);
- * });
- * ```
- *
- * @public
- */
-async function deleteApp(app) {
- const name = app.name;
- if (_apps.has(name)) {
- _apps.delete(name);
- await Promise.all(app.container
- .getProviders()
- .map(provider => provider.delete()));
- app.isDeleted = true;
- }
-}
-/**
- * Registers a library's name and version for platform logging purposes.
- * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
- * @param version - Current version of that library.
- * @param variant - Bundle variant, e.g., node, rn, etc.
- *
- * @public
- */
-function registerVersion(libraryKeyOrName, version, variant) {
- var _a;
- // TODO: We can use this check to whitelist strings when/if we set up
- // a good whitelist system.
- let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
- if (variant) {
- library += `-${variant}`;
- }
- const libraryMismatch = library.match(/\s|\//);
- const versionMismatch = version.match(/\s|\//);
- if (libraryMismatch || versionMismatch) {
- const warning = [
- `Unable to register library "${library}" with version "${version}":`
- ];
- if (libraryMismatch) {
- warning.push(`library name "${library}" contains illegal characters (whitespace or "/")`);
- }
- if (libraryMismatch && versionMismatch) {
- warning.push('and');
- }
- if (versionMismatch) {
- warning.push(`version name "${version}" contains illegal characters (whitespace or "/")`);
- }
- logger.warn(warning.join(' '));
- return;
- }
- _registerComponent(new Component(`${library}-version`, () => ({ library, version }), "VERSION" /* ComponentType.VERSION */));
-}
-/**
- * Sets log handler for all Firebase SDKs.
- * @param logCallback - An optional custom log handler that executes user code whenever
- * the Firebase SDK makes a logging call.
- *
- * @public
- */
-function onLog(logCallback, options) {
- if (logCallback !== null && typeof logCallback !== 'function') {
- throw ERROR_FACTORY.create("invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */);
- }
- setUserLogHandler(logCallback, options);
-}
-/**
- * Sets log level for all Firebase SDKs.
- *
- * All of the log types above the current log level are captured (i.e. if
- * you set the log level to `info`, errors are logged, but `debug` and
- * `verbose` logs are not).
- *
- * @public
- */
-function setLogLevel(logLevel) {
- setLogLevel$1(logLevel);
-}
-
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const DB_NAME = 'firebase-heartbeat-database';
-const DB_VERSION = 1;
-const STORE_NAME = 'firebase-heartbeat-store';
-let dbPromise = null;
-function getDbPromise() {
- if (!dbPromise) {
- dbPromise = openDB(DB_NAME, DB_VERSION, {
- upgrade: (db, oldVersion) => {
- // We don't use 'break' in this switch statement, the fall-through
- // behavior is what we want, because if there are multiple versions between
- // the old version and the current version, we want ALL the migrations
- // that correspond to those versions to run, not only the last one.
- // eslint-disable-next-line default-case
- switch (oldVersion) {
- case 0:
- db.createObjectStore(STORE_NAME);
- }
- }
- }).catch(e => {
- throw ERROR_FACTORY.create("idb-open" /* AppError.IDB_OPEN */, {
- originalErrorMessage: e.message
- });
- });
- }
- return dbPromise;
-}
-async function readHeartbeatsFromIndexedDB(app) {
- try {
- const db = await getDbPromise();
- const result = await db
- .transaction(STORE_NAME)
- .objectStore(STORE_NAME)
- .get(computeKey(app));
- return result;
- }
- catch (e) {
- if (e instanceof FirebaseError) {
- logger.warn(e.message);
- }
- else {
- const idbGetError = ERROR_FACTORY.create("idb-get" /* AppError.IDB_GET */, {
- originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
- });
- logger.warn(idbGetError.message);
- }
- }
-}
-async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
- try {
- const db = await getDbPromise();
- const tx = db.transaction(STORE_NAME, 'readwrite');
- const objectStore = tx.objectStore(STORE_NAME);
- await objectStore.put(heartbeatObject, computeKey(app));
- await tx.done;
- }
- catch (e) {
- if (e instanceof FirebaseError) {
- logger.warn(e.message);
- }
- else {
- const idbGetError = ERROR_FACTORY.create("idb-set" /* AppError.IDB_WRITE */, {
- originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
- });
- logger.warn(idbGetError.message);
- }
- }
-}
-function computeKey(app) {
- return `${app.name}!${app.options.appId}`;
-}
-
-/**
- * @license
- * Copyright 2021 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-const MAX_HEADER_BYTES = 1024;
-// 30 days
-const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
-class HeartbeatServiceImpl {
- constructor(container) {
- this.container = container;
- /**
- * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate
- * the header string.
- * Stores one record per date. This will be consolidated into the standard
- * format of one record per user agent string before being sent as a header.
- * Populated from indexedDB when the controller is instantiated and should
- * be kept in sync with indexedDB.
- * Leave public for easier testing.
- */
- this._heartbeatsCache = null;
- const app = this.container.getProvider('app').getImmediate();
- this._storage = new HeartbeatStorageImpl(app);
- this._heartbeatsCachePromise = this._storage.read().then(result => {
- this._heartbeatsCache = result;
- return result;
- });
- }
- /**
- * Called to report a heartbeat. The function will generate
- * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
- * to IndexedDB.
- * Note that we only store one heartbeat per day. So if a heartbeat for today is
- * already logged, subsequent calls to this function in the same day will be ignored.
- */
- async triggerHeartbeat() {
- const platformLogger = this.container
- .getProvider('platform-logger')
- .getImmediate();
- // This is the "Firebase user agent" string from the platform logger
- // service, not the browser user agent.
- const agent = platformLogger.getPlatformInfoString();
- const date = getUTCDateString();
- if (this._heartbeatsCache === null) {
- this._heartbeatsCache = await this._heartbeatsCachePromise;
- }
- // Do not store a heartbeat if one is already stored for this day
- // or if a header has already been sent today.
- if (this._heartbeatsCache.lastSentHeartbeatDate === date ||
- this._heartbeatsCache.heartbeats.some(singleDateHeartbeat => singleDateHeartbeat.date === date)) {
- return;
- }
- else {
- // There is no entry for this date. Create one.
- this._heartbeatsCache.heartbeats.push({ date, agent });
- }
- // Remove entries older than 30 days.
- this._heartbeatsCache.heartbeats = this._heartbeatsCache.heartbeats.filter(singleDateHeartbeat => {
- const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
- const now = Date.now();
- return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
- });
- return this._storage.overwrite(this._heartbeatsCache);
- }
- /**
- * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
- * It also clears all heartbeats from memory as well as in IndexedDB.
- *
- * NOTE: Consuming product SDKs should not send the header if this method
- * returns an empty string.
- */
- async getHeartbeatsHeader() {
- if (this._heartbeatsCache === null) {
- await this._heartbeatsCachePromise;
- }
- // If it's still null or the array is empty, there is no data to send.
- if (this._heartbeatsCache === null ||
- this._heartbeatsCache.heartbeats.length === 0) {
- return '';
- }
- const date = getUTCDateString();
- // Extract as many heartbeats from the cache as will fit under the size limit.
- const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);
- const headerString = base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));
- // Store last sent date to prevent another being logged/sent for the same day.
- this._heartbeatsCache.lastSentHeartbeatDate = date;
- if (unsentEntries.length > 0) {
- // Store any unsent entries if they exist.
- this._heartbeatsCache.heartbeats = unsentEntries;
- // This seems more likely than emptying the array (below) to lead to some odd state
- // since the cache isn't empty and this will be called again on the next request,
- // and is probably safest if we await it.
- await this._storage.overwrite(this._heartbeatsCache);
- }
- else {
- this._heartbeatsCache.heartbeats = [];
- // Do not wait for this, to reduce latency.
- void this._storage.overwrite(this._heartbeatsCache);
- }
- return headerString;
- }
-}
-function getUTCDateString() {
- const today = new Date();
- // Returns date format 'YYYY-MM-DD'
- return today.toISOString().substring(0, 10);
-}
-function extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {
- // Heartbeats grouped by user agent in the standard format to be sent in
- // the header.
- const heartbeatsToSend = [];
- // Single date format heartbeats that are not sent.
- let unsentEntries = heartbeatsCache.slice();
- for (const singleDateHeartbeat of heartbeatsCache) {
- // Look for an existing entry with the same user agent.
- const heartbeatEntry = heartbeatsToSend.find(hb => hb.agent === singleDateHeartbeat.agent);
- if (!heartbeatEntry) {
- // If no entry for this user agent exists, create one.
- heartbeatsToSend.push({
- agent: singleDateHeartbeat.agent,
- dates: [singleDateHeartbeat.date]
- });
- if (countBytes(heartbeatsToSend) > maxSize) {
- // If the header would exceed max size, remove the added heartbeat
- // entry and stop adding to the header.
- heartbeatsToSend.pop();
- break;
- }
- }
- else {
- heartbeatEntry.dates.push(singleDateHeartbeat.date);
- // If the header would exceed max size, remove the added date
- // and stop adding to the header.
- if (countBytes(heartbeatsToSend) > maxSize) {
- heartbeatEntry.dates.pop();
- break;
- }
- }
- // Pop unsent entry from queue. (Skipped if adding the entry exceeded
- // quota and the loop breaks early.)
- unsentEntries = unsentEntries.slice(1);
- }
- return {
- heartbeatsToSend,
- unsentEntries
- };
-}
-class HeartbeatStorageImpl {
- constructor(app) {
- this.app = app;
- this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
- }
- async runIndexedDBEnvironmentCheck() {
- if (!isIndexedDBAvailable()) {
- return false;
- }
- else {
- return validateIndexedDBOpenable()
- .then(() => true)
- .catch(() => false);
- }
- }
- /**
- * Read all heartbeats.
- */
- async read() {
- const canUseIndexedDB = await this._canUseIndexedDBPromise;
- if (!canUseIndexedDB) {
- return { heartbeats: [] };
- }
- else {
- const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);
- return idbHeartbeatObject || { heartbeats: [] };
- }
- }
- // overwrite the storage with the provided heartbeats
- async overwrite(heartbeatsObject) {
- var _a;
- const canUseIndexedDB = await this._canUseIndexedDBPromise;
- if (!canUseIndexedDB) {
- return;
- }
- else {
- const existingHeartbeatsObject = await this.read();
- return writeHeartbeatsToIndexedDB(this.app, {
- lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
- heartbeats: heartbeatsObject.heartbeats
- });
- }
- }
- // add heartbeats
- async add(heartbeatsObject) {
- var _a;
- const canUseIndexedDB = await this._canUseIndexedDBPromise;
- if (!canUseIndexedDB) {
- return;
- }
- else {
- const existingHeartbeatsObject = await this.read();
- return writeHeartbeatsToIndexedDB(this.app, {
- lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
- heartbeats: [
- ...existingHeartbeatsObject.heartbeats,
- ...heartbeatsObject.heartbeats
- ]
- });
- }
- }
-}
-/**
- * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped
- * in a platform logging header JSON object, stringified, and converted
- * to base 64.
- */
-function countBytes(heartbeatsCache) {
- // base64 has a restricted set of characters, all of which should be 1 byte.
- return base64urlEncodeWithoutPadding(
- // heartbeatsCache wrapper properties
- JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;
-}
-
-/**
- * @license
- * Copyright 2019 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-function registerCoreComponents(variant) {
- _registerComponent(new Component('platform-logger', container => new PlatformLoggerServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
- _registerComponent(new Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
- // Register `app` package.
- registerVersion(name$o, version$1, variant);
- // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
- registerVersion(name$o, version$1, 'esm2017');
- // Register platform SDK identifier (no version).
- registerVersion('fire-js', '');
-}
-
-/**
- * Firebase App
- *
- * @remarks This package coordinates the communication between the different Firebase components
- * @packageDocumentation
- */
-registerCoreComponents('');
-
-var name = "firebase";
-var version = "9.23.0";
-
-/**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-registerVersion(name, version, 'cdn');
-
-export { FirebaseError, SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _registerComponent, _removeServiceInstance, deleteApp, getApp, getApps, initializeApp, onLog, registerVersion, setLogLevel };
-
-//# sourceMappingURL=firebase-app.js.map
diff --git a/docs/public/site/openapi/index.html b/docs/public/site/openapi/index.html
deleted file mode 100644
index 233fad9..0000000
--- a/docs/public/site/openapi/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/public/site/openapi/rapidoc-min.js b/docs/public/site/openapi/rapidoc-min.js
deleted file mode 100644
index 0104e90..0000000
--- a/docs/public/site/openapi/rapidoc-min.js
+++ /dev/null
@@ -1,3895 +0,0 @@
-/*! RapiDoc 9.3.4 | Author - Mrinmoy Majumdar | License information can be found in rapidoc-min.js.LICENSE.txt */
-(()=>{var e,t,r={656:(e,t,r)=>{"use strict";const n=window,o=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;class s{constructor(e,t,r){if(this._$cssResult$=!0,r!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(t,e))}return e}toString(){return this.cssText}}const l=e=>new s("string"==typeof e?e:e+"",void 0,a),c=(e,...t)=>{const r=1===e.length?e[0]:t.reduce(((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1]),e[0]);return new s(r,e,a)},p=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return l(t)})(e):e;var d;const u=window,h=u.trustedTypes,f=h?h.emptyScript:"",m=u.reactiveElementPolyfillSupport,y={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},g=(e,t)=>t!==e&&(t==t||e==e),v={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:g};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,r)=>{const n=this._$Ep(r,t);void 0!==n&&(this._$Ev.set(n,r),e.push(n))})),e}static createProperty(e,t=v){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const r="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){const o=this[e];this[t]=n,this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||v}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of t)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(p(e))}else void 0!==e&&t.push(p(e));return t}static _$Ep(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,r;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(r=e.hostConnected)||void 0===r||r.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{o?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),o=n.litNonce;void 0!==o&&r.setAttribute("nonce",o),r.textContent=t.cssText,e.appendChild(r)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=v){var n;const o=this.constructor._$Ep(e,r);if(void 0!==o&&!0===r.reflect){const a=(void 0!==(null===(n=r.converter)||void 0===n?void 0:n.toAttribute)?r.converter:y).toAttribute(t,r.type);this._$El=e,null==a?this.removeAttribute(o):this.setAttribute(o,a),this._$El=null}}_$AK(e,t){var r;const n=this.constructor,o=n._$Ev.get(e);if(void 0!==o&&this._$El!==o){const e=n.getPropertyOptions(o),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(r=e.converter)||void 0===r?void 0:r.fromAttribute)?e.converter:y;this._$El=o,this[o]=a.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;void 0!==e&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||g)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(r)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var x;b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==m||m({ReactiveElement:b}),(null!==(d=u.reactiveElementVersions)&&void 0!==d?d:u.reactiveElementVersions=[]).push("1.6.1");const w=window,$=w.trustedTypes,k=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,S=`lit$${(Math.random()+"").slice(9)}$`,A="?"+S,E=`<${A}>`,O=document,T=(e="")=>O.createComment(e),C=e=>null===e||"object"!=typeof e&&"function"!=typeof e,j=Array.isArray,I=e=>j(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),_=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,R=/>/g,L=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),F=/'/g,D=/"/g,B=/^(?:script|style|textarea|title)$/i,N=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),q=N(1),U=(N(2),Symbol.for("lit-noChange")),z=Symbol.for("lit-nothing"),M=new WeakMap,H=O.createTreeWalker(O,129,null,!1),W=(e,t)=>{const r=e.length-1,n=[];let o,a=2===t?"":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==k?k.createHTML(s):s,n]};class V{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let o=0,a=0;const i=e.length-1,s=this.parts,[l,c]=W(e,t);if(this.el=V.createElement(l,r),H.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=H.nextNode())&&s.length0){n.textContent=$?$.emptyScript:"";for(let r=0;r2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){const o=this.strings;let a=!1;if(void 0===o)e=G(this,e,t,0),a=!C(e)||e!==this._$AH&&e!==U,a&&(this._$AH=e);else{const n=e;let i,s;for(e=o[0],i=0;i{var n,o;const a=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:t;let i=a._$litPart$;if(void 0===i){const e=null!==(o=null==r?void 0:r.renderBefore)&&void 0!==o?o:null;a._$litPart$=i=new J(t.insertBefore(T(),e),e,void 0,null!=r?r:{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!1)}render(){return U}}ie.finalized=!0,ie._$litElement$=!0,null===(oe=globalThis.litElementHydrateSupport)||void 0===oe||oe.call(globalThis,{LitElement:ie});const se=globalThis.litElementPolyfillSupport;null==se||se({LitElement:ie});function le(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}(null!==(ae=globalThis.litElementVersions)&&void 0!==ae?ae:globalThis.litElementVersions=[]).push("3.2.0");let ce={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const pe=/[&<>"']/,de=new RegExp(pe.source,"g"),ue=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,he=new RegExp(ue.source,"g"),fe={"&":"&","<":"<",">":">",'"':""","'":"'"},me=e=>fe[e];function ye(e,t){if(t){if(pe.test(e))return e.replace(de,me)}else if(ue.test(e))return e.replace(he,me);return e}const ge=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function ve(e){return e.replace(ge,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const be=/(^|[^\[])\^/g;function xe(e,t){e="string"==typeof e?e:e.source,t=t||"";const r={replace:(t,n)=>(n=(n=n.source||n).replace(be,"$1"),e=e.replace(t,n),r),getRegex:()=>new RegExp(e,t)};return r}const we=/[^\w:]/g,$e=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function ke(e,t,r){if(e){let e;try{e=decodeURIComponent(ve(r)).replace(we,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!$e.test(r)&&(r=function(e,t){Se[" "+e]||(Ae.test(e)?Se[" "+e]=e+"/":Se[" "+e]=Ie(e,"/",!0));const r=-1===(e=Se[" "+e]).indexOf(":");return"//"===t.substring(0,2)?r?t:e.replace(Ee,"$1")+t:"/"===t.charAt(0)?r?t:e.replace(Oe,"$1")+t:e+t}(t,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r}const Se={},Ae=/^[^:]+:\/*[^/]*$/,Ee=/^([^:]+:)[\s\S]*$/,Oe=/^([^:]+:\/*[^/]*)[\s\S]*$/;const Te={exec:function(){}};function Ce(e){let t,r,n=1;for(;n{let n=!1,o=t;for(;--o>=0&&"\\"===r[o];)n=!n;return n?"|":" |"})).split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>t)r.splice(t);else for(;r.length1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function Re(e,t,r,n){const o=t.href,a=t.title?ye(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){n.state.inLink=!0;const e={type:"link",raw:r,href:o,title:a,text:i,tokens:n.inlineTokens(i)};return n.state.inLink=!1,e}return{type:"image",raw:r,href:o,title:a,text:ye(i)}}class Le{constructor(e){this.options=e||ce}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Ie(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],r=function(e,t){const r=e.match(/^(\s+)(?:```)/);if(null===r)return t;const n=r[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[r]=t;return r.length>=n.length?e.slice(n.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Ie(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),r=this.lexer.state.top;this.lexer.state.top=!0;const n=this.lexer.blockTokens(e);return this.lexer.state.top=r,{type:"blockquote",raw:t[0],tokens:n,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r,n,o,a,i,s,l,c,p,d,u,h,f=t[1].trim();const m=f.length>1,y={type:"list",raw:"",ordered:m,start:m?+f.slice(0,-1):"",loose:!1,items:[]};f=m?`\\d{1,9}\\${f.slice(-1)}`:`\\${f}`,this.options.pedantic&&(f=m?f:"[*+-]");const g=new RegExp(`^( {0,3}${f})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;e&&(h=!1,t=g.exec(e))&&!this.rules.block.hr.test(e);){if(r=t[0],e=e.substring(r.length),c=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),p=e.split("\n",1)[0],this.options.pedantic?(a=2,u=c.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,u=c.slice(a),a+=t[1].length),s=!1,!c&&/^ *$/.test(p)&&(r+=p+"\n",e=e.substring(p.length+1),h=!0),!h){const t=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),o=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(d=e.split("\n",1)[0],p=d,this.options.pedantic&&(p=p.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!o.test(p))&&!i.test(p)&&!t.test(p)&&!n.test(e);){if(p.search(/[^ ]/)>=a||!p.trim())u+="\n"+p.slice(a);else{if(s)break;if(c.search(/[^ ]/)>=4)break;if(o.test(c))break;if(i.test(c))break;if(n.test(c))break;u+="\n"+p}s||p.trim()||(s=!0),r+=d+"\n",e=e.substring(d.length+1),c=p.slice(a)}}y.loose||(l?y.loose=!0:/\n *\n *$/.test(r)&&(l=!0)),this.options.gfm&&(n=/^\[[ xX]\] /.exec(u),n&&(o="[ ] "!==n[0],u=u.replace(/^\[[ xX]\] +/,""))),y.items.push({type:"list_item",raw:r,task:!!n,checked:o,loose:!1,text:u}),y.raw+=r}y.items[y.items.length-1].raw=r.trimRight(),y.items[y.items.length-1].text=u.trimRight(),y.raw=y.raw.trimRight();const v=y.items.length;for(i=0;i"space"===e.type)),t=e.length>0&&e.some((e=>/\n.*\n/.test(e.raw)));y.loose=t}if(y.loose)for(i=0;i$/,"$1").replace(this.rules.inline._escapes,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:n}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:je(t[1]).map((e=>({text:e}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let r,n,o,a,i=e.align.length;for(r=0;r({text:e})));for(i=e.header.length,n=0;n/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):ye(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=Ie(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const r=e.length;let n=0,o=0;for(;o-1){const r=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let r=t[2],n="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);e&&(r=e[1],n=e[3])}else n=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^$/.test(e)?r.slice(1):r.slice(1,-1)),Re(t,{href:r?r.replace(this.rules.inline._escapes,"$1"):r,title:n?n.replace(this.rules.inline._escapes,"$1"):n},t[0],this.lexer)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let e=(r[2]||r[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=r[0].charAt(0);return{type:"text",raw:e,text:e}}return Re(r,e,r[0],this.lexer)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrong.lDelim.exec(e);if(!n)return;if(n[3]&&r.match(/[\p{L}\p{N}]/u))return;const o=n[1]||n[2]||"";if(!o||o&&(""===r||this.rules.inline.punctuation.exec(r))){const r=n[0].length-1;let o,a,i=r,s=0;const l="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+r);null!=(n=l.exec(t));){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=o.length,n[3]||n[4]){i+=a;continue}if((n[5]||n[6])&&r%3&&!((r+a)%3)){s+=a;continue}if(i-=a,i>0)continue;a=Math.min(a,a+i+s);const t=e.slice(0,r+n.index+(n[0].length-o.length)+a);if(Math.min(r,a)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const l=t.slice(2,-2);return{type:"strong",raw:t,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const r=/[^ ]/.test(e),n=/^ /.test(e)&&/ $/.test(e);return r&&n&&(e=e.substring(1,e.length-1)),e=ye(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const r=this.rules.inline.autolink.exec(e);if(r){let e,n;return"@"===r[2]?(e=ye(this.options.mangle?t(r[1]):r[1]),n="mailto:"+e):(e=ye(r[1]),n=e),{type:"link",raw:r[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let r;if(r=this.rules.inline.url.exec(e)){let e,n;if("@"===r[2])e=ye(this.options.mangle?t(r[0]):r[0]),n="mailto:"+e;else{let t;do{t=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0]}while(t!==r[0]);e=ye(r[0]),n="www."===r[1]?"http://"+r[0]:r[0]}return{type:"link",raw:r[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const r=this.rules.inline.text.exec(e);if(r){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):ye(r[0]):r[0]:ye(this.options.smartypants?t(r[0]):r[0]),{type:"text",raw:r[0],text:e}}}}const Fe={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Te,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Fe.def=xe(Fe.def).replace("label",Fe._label).replace("title",Fe._title).getRegex(),Fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,Fe.listItemStart=xe(/^( *)(bull) */).replace("bull",Fe.bullet).getRegex(),Fe.list=xe(Fe.list).replace(/bull/g,Fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Fe.def.source+")").getRegex(),Fe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Fe._comment=/|$)/,Fe.html=xe(Fe.html,"i").replace("comment",Fe._comment).replace("tag",Fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Fe.paragraph=xe(Fe._paragraph).replace("hr",Fe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe._tag).getRegex(),Fe.blockquote=xe(Fe.blockquote).replace("paragraph",Fe.paragraph).getRegex(),Fe.normal=Ce({},Fe),Fe.gfm=Ce({},Fe.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Fe.gfm.table=xe(Fe.gfm.table).replace("hr",Fe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe._tag).getRegex(),Fe.gfm.paragraph=xe(Fe._paragraph).replace("hr",Fe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Fe.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe._tag).getRegex(),Fe.pedantic=Ce({},Fe.normal,{html:xe("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Fe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Te,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xe(Fe.normal._paragraph).replace("hr",Fe.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const De={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Te,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(r="x"+r.toString(16)),n+=""+r+";";return n}De._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",De.punctuation=xe(De.punctuation).replace(/punctuation/g,De._punctuation).getRegex(),De.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,De.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,De._comment=xe(Fe._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),De.emStrong.lDelim=xe(De.emStrong.lDelim).replace(/punct/g,De._punctuation).getRegex(),De.emStrong.rDelimAst=xe(De.emStrong.rDelimAst,"g").replace(/punct/g,De._punctuation).getRegex(),De.emStrong.rDelimUnd=xe(De.emStrong.rDelimUnd,"g").replace(/punct/g,De._punctuation).getRegex(),De._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,De._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,De._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,De.autolink=xe(De.autolink).replace("scheme",De._scheme).replace("email",De._email).getRegex(),De._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,De.tag=xe(De.tag).replace("comment",De._comment).replace("attribute",De._attribute).getRegex(),De._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,De._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,De._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,De.link=xe(De.link).replace("label",De._label).replace("href",De._href).replace("title",De._title).getRegex(),De.reflink=xe(De.reflink).replace("label",De._label).replace("ref",Fe._label).getRegex(),De.nolink=xe(De.nolink).replace("ref",Fe._label).getRegex(),De.reflinkSearch=xe(De.reflinkSearch,"g").replace("reflink",De.reflink).replace("nolink",De.nolink).getRegex(),De.normal=Ce({},De),De.pedantic=Ce({},De.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:xe(/^!?\[(label)\]\((.*?)\)/).replace("label",De._label).getRegex(),reflink:xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",De._label).getRegex()}),De.gfm=Ce({},De.normal,{escape:xe(De.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(r.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))))if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),1===r.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(r);else if(r=this.tokenizer.code(e))e=e.substring(r.raw.length),n=t[t.length-1],!n||"paragraph"!==n.type&&"text"!==n.type?t.push(r):(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.list(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.html(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.def(e))e=e.substring(r.raw.length),n=t[t.length-1],!n||"paragraph"!==n.type&&"text"!==n.type?this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}):(n.raw+="\n"+r.raw,n.text+="\n"+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(r=this.tokenizer.table(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.lheading(e))e=e.substring(r.raw.length),t.push(r);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startBlock.forEach((function(e){n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o)))n=t[t.length-1],a&&"paragraph"===n.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(r),a=o.length!==e.length,e=e.substring(r.raw.length);else if(r=this.tokenizer.text(e))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===n.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(r);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r,n,o,a,i,s,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(a=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+Pe("a",a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(a=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,a.index)+"["+Pe("a",a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(a=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,a.index+a[0].length-2)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(i||(s=""),i=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))))if(r=this.tokenizer.escape(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.tag(e))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.link(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.emStrong(e,l,s))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.codespan(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.br(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.del(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.autolink(e,Ne))e=e.substring(r.raw.length),t.push(r);else if(this.state.inLink||!(r=this.tokenizer.url(e,Ne))){if(o=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startInline.forEach((function(e){n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o,Be))e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=r.raw.slice(-1)),i=!0,n=t[t.length-1],n&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(r.raw.length),t.push(r);return t}}class Ue{constructor(e){this.options=e||ce}code(e,t,r){const n=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,n);null!=t&&t!==e&&(r=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",n?'