diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..645b114b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.multiRootWorkspaceName": "developer-portal" +} \ No newline at end of file diff --git a/components/osx/01-how-it-works/02-framework/index.md b/components/osx/01-how-it-works/02-framework/index.md deleted file mode 100644 index 92630172..00000000 --- a/components/osx/01-how-it-works/02-framework/index.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Framework - How Everything Connects -sidebar_label: Framework ---- - -## The Infrastructure Running the Aragon OSx Protocol - -The Aragon OSx protocol is composed of **framework-related contracts** creating and managing the **core contracts**. This includes the - -- [Creation of DAOs](01-dao-creation/index.md) and initial plugin configuration -- [Management of plugins](02-plugin-management/index.md), which includes the - - - The setup in existing DAOs - - The versioning of different implementations and respective setup contracts, UI, and related metadata - -- [Assignment of ENS Names](./03-ens-names.md) to `Plugin` and `DAO` contracts created through the framework - -An overview of the involved contracts and their interactions is shown below: - -
- -![](/optimized-svg/framework/aragon-os-infrastructure-core-overview.drawio.svg) - -

- Overview of the framework and core contracts of the Aragon OSx protocol. -

- -
- -In the following sections, you will learn more about the framework-related contracts of the Aragon OSx protocol. diff --git a/components/osx/01-how-it-works/index.md b/components/osx/01-how-it-works/index.md deleted file mode 100644 index 6d5f1eee..00000000 --- a/components/osx/01-how-it-works/index.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: How It Works ---- - -## The Aragon OSx DAO Framework - -The Aragon OSx protocol is a DAO framework structured as follows: - -
- ![](/optimized-svg/framework/aragon-os-framework-overview.drawio.svg) -

- Overview of the Aragon OSx protocol with its structural components and their responsibilities: the governance layer constituted by the framework DAO, the code layer including the framework and core contracts, which depends on external libraries and services -

-
- -### Code Layer - -The foundation of the Aragon OSx protocol is the **code layer** constituted by the core and framework related contracts. -The [core contracts](./01-core/index.md) provide the core primitives intended to be used by users and implemented by developers of the DAO framework. -The [framework contracts](./02-framework/index.md) provide the infrastructure to easily create and manage your DAOs and plugins easy. -Both are built on top of external dependencies, most notably the [OpenZeppelin](https://www.openzeppelin.com/contracts) and the [Ethereum Name Service (ENS)](https://docs.ens.domains/) contracts. - -The core and framework contracts are free to use, and no additional fees are charged. - -### Governance Layer - -To govern the framework infrastructure, an Aragon OSx [Framework DAO](./03-framwork-dao.md) is deployed constituting the **governance layer** of the Aragon OSx protocol. - -In the next sections, you will learn more about the individual components of the framework. diff --git a/components/osx/antora.yml b/components/osx/antora.yml index bbd625bf..59f58514 100644 --- a/components/osx/antora.yml +++ b/components/osx/antora.yml @@ -1,3 +1,5 @@ -name: ROOT -title: Home +name: osx +title: OSX version: ~ +nav: + - modules/ROOT/nav.adoc \ No newline at end of file diff --git a/components/osx/modules/ROOT/nav.adoc b/components/osx/modules/ROOT/nav.adoc new file mode 100644 index 00000000..01d50a6b --- /dev/null +++ b/components/osx/modules/ROOT/nav.adoc @@ -0,0 +1,51 @@ +* xref:index.adoc[Overview] +* xref:how-it-works/index.adoc[How it works] +** xref:how-it-works/core/index.adoc[Smart Contracts] +*** xref:how-it-works/core/dao/index.adoc[DAO] +**** xref:how-it-works/core/dao/actions.adoc[Advanced DAO Actions] +*** xref:how-it-works/core/permissions/index.adoc[Permissions] +**** xref:how-it-works/core/permissions/conditions.adoc[Permission Conditions] +*** xref:how-it-works/core/plugins/index.adoc[Plugins] + +** xref:how-it-works/framework/index.adoc[Framework] + +*** xref:how-it-works/framework/dao-creation/index.adoc[Creating a DAO] + +*** xref:how-it-works/framework/plugin-management/index.adoc[Plugins] +**** xref:how-it-works/framework/plugin-management/plugin-repo/index.adoc[Plugin Repositories] +***** xref:how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc[Publishing a Plugin] +**** xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[Installing Plugins] +***** xref:how-it-works/framework/plugin-management/plugin-setup/security-risk-mitigation.adoc[Plugin Security and Risks] + +*** xref:how-it-works/framework/ens-names.adoc[ENS Names] + +** xref:how-it-works/framework-dao.adoc[Protocol Governance] + +* xref:how-to-guides/index.adoc[Tutorials] +** xref:how-to-guides/dao/index.adoc[Operating a DAO] +*** xref:how-to-guides/dao/best-practices.adoc[Best Practices] +*** xref:how-to-guides/dao/action-execution.adoc[Executing Actions on behalf of the DAO] +*** xref:how-to-guides/dao/protocol-upgrades.adoc[Upgrade your DAO to future Aragon OSX versions] +*** xref:how-to-guides/dao/managing-plugins.adoc[Managing your DAO's Plugins] + +** xref:how-to-guides/plugin-development/index.adoc[Developing a Plugin] +*** xref:how-to-guides/plugin-development/best-practices.adoc[Before Starting] +*** xref:how-to-guides/plugin-development/plugin-types.adoc[Choosing The Plugin Type] +*** xref:how-to-guides/plugin-development/non-upgradeable-plugin/index.adoc[Non-Upgradeable Plugins] +**** xref:how-to-guides/plugin-development/non-upgradeable-plugin/initialization.adoc[Initialization] +**** xref:how-to-guides/plugin-development/non-upgradeable-plugin/implementation.adoc[Plugin Implementation Contract] +**** xref:how-to-guides/plugin-development/non-upgradeable-plugin/setup.adoc[Plugin Setup Contract] +*** xref:how-to-guides/plugin-development/upgradeable-plugin/index.adoc[Upgradeable Plugins] +**** xref:how-to-guides/plugin-development/upgradeable-plugin/initialization.adoc[Initialization] +**** xref:how-to-guides/plugin-development/upgradeable-plugin/implementation.adoc[Plugin Implementation Contract] +**** xref:how-to-guides/plugin-development/upgradeable-plugin/setup.adoc[Plugin Setup Contract] +**** xref:how-to-guides/plugin-development/upgradeable-plugin/subsequent-builds.adoc[Subsequent Builds] +**** xref:how-to-guides/plugin-development/upgradeable-plugin/updating-versions.adoc[Upgrade a DAO Plugin] +*** xref:how-to-guides/plugin-development/governance-plugins/index.adoc[Governance Plugins] +**** xref:how-to-guides/plugin-development/governance-plugins/proposals.adoc[Proposal] +**** xref:how-to-guides/plugin-development/governance-plugins/membership.adoc[Membership] +*** xref:how-to-guides/plugin-development/meta-tx-plugins.adoc[Meta Transactions] +*** xref:how-to-guides/plugin-development/publication/index.adoc[Publication of your plugin into Aragon OSx] +**** xref:how-to-guides/plugin-development/publication/versioning.adoc[New Plugin Version] +**** xref:how-to-guides/plugin-development/publication/metadata.adoc[Plugin Metadata] + diff --git a/components/osx/01-how-it-works/01-core/01-dao/01-actions.md b/components/osx/modules/ROOT/pages/how-it-works/core/dao/actions.adoc similarity index 86% rename from components/osx/01-how-it-works/01-core/01-dao/01-actions.md rename to components/osx/modules/ROOT/pages/how-it-works/core/dao/actions.adoc index b9d83de3..4e46d745 100644 --- a/components/osx/01-how-it-works/01-core/01-dao/01-actions.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/dao/actions.adoc @@ -1,21 +1,19 @@ ---- -title: Advanced DAO Actions ---- += Advanced DAO Actions -## A Deep Dive into Actions and Execution +=== A Deep Dive into Actions and Execution The DAO's `execute` function is part of the `DAO.sol` contract and has the following function header: -```solidity title="@aragon/osx/core/dao/DAO.sol" +```solidity function execute( - bytes32 _callId, - Action[] calldata _actions, - uint256 _allowFailureMap - ) - external - override - auth(address(this), EXECUTE_PERMISSION_ID) - returns (bytes[] memory execResults, uint256 failureMap) + bytes32 _callId, + Action[] calldata _actions, + uint256 _allowFailureMap +) +external +override +auth(address(this), EXECUTE_PERMISSION_ID) +returns (bytes[] memory execResults, uint256 failureMap) ``` It offers two features that we will dive into in this article: @@ -46,13 +44,13 @@ Actions can be - external services (e.g. Uniswap, Compound, etc.) - Aragon OSx plugins (e.g., the DAO can be a member of a multisig installed in another DAO), - - Aragon OSx protocol infrastructure (e.g., to [setup a plugin](../../02-framework/02-plugin-management/02-plugin-setup/index.md)) + - Aragon OSx protocol infrastructure (e.g., to xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[setup a plugin]). - transfers of native tokens #### Example: Calling the wETH Contract -We have an Aragon DAO deployed on the Goerli testnet. Now, we want to wrap `0.1 ETH` from the DAO treasury into `wETH` by depositing it into the [Goerli WETH contract](https://goerli.etherscan.io/token/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6#writeContract) deployed on the address `0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6`. The corresponding `Action` and `execute` function call look as follows: +We have an Aragon DAO deployed on the Goerli testnet. Now, we want to wrap `0.1 ETH` from the DAO treasury into `wETH` by depositing it into the link:https://goerli.etherscan.io/token/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6#writeContract[Goerli WETH contract] deployed on the address `0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6`. The corresponding `Action` and `execute` function call look as follows: ```solidity @@ -68,7 +66,7 @@ dao().execute({_callId: '', _actions: actions, _allowFailureMap: 0}); ``` -For the `execute` call to work, the caller must have the required [`EXECUTE_PERMISSION_ID` permission](../02-permissions/index.md) on the DAO contract. +For the `execute` call to work, the caller must have the required xref:how-it-works/core/permissions/index.adoc[`EXECUTE_PERMISSION_ID` permission] on the DAO contract. ### The Action Array diff --git a/components/osx/01-how-it-works/01-core/01-dao/index.md b/components/osx/modules/ROOT/pages/how-it-works/core/dao/index.adoc similarity index 61% rename from components/osx/01-how-it-works/01-core/01-dao/index.md rename to components/osx/modules/ROOT/pages/how-it-works/core/dao/index.adoc index 2938a7b1..2e646904 100644 --- a/components/osx/01-how-it-works/01-core/01-dao/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/dao/index.adoc @@ -1,8 +1,6 @@ ---- -title: DAO ---- += DAO -## The DAO Contract: The Identity and Basis of Your Organization +=== The DAO Contract: The Identity and Basis of Your Organization In this section, you will learn about the core functionality of every Aragon OSx DAO. @@ -12,51 +10,44 @@ The `DAO` contract is the identity and basis of your organization. It is the add The most important and basic functionality of your DAO is the **execution of arbitrary actions**, which allows you to execute the DAO's own functions as well as interacting with the rest of the world, i.e., calling methods in other contracts and sending assets to other addresses. -:::note -Typically, actions are scheduled in a proposal in a governance [plugin installed to your DAO](../03-plugins/index.md). -::: +NOTE: Typically, actions are scheduled in a proposal in a governance - xref:how-it-works/core/plugins/index.adoc[plugin installed to your DAO] -Multiple `Action` structs can be put into one `Action[]` array and executed in a single transaction via the `execute` function. To learn more about actions and advanced features of the DAO executor, visit the [A Deep Dive Into Actions](./01-actions.md) section. +Multiple `Action` structs can be put into one `Action[]` array and executed in a single transaction via the `execute` function. To learn more about actions and advanced features of the DAO executor, visit the xref:how-it-works/core/dao/actions.adoc[A Deep Dive Into Actions]. ### 2. Asset Management The DAO provides basic **asset management** functionality to deposit, withdraw, and keep track of - native -- [ERC-20 (Token Standard)](https://eips.ethereum.org/EIPS/eip-20), -- [ERC-721 (NFT Standard)](https://eips.ethereum.org/EIPS/eip-721), and -- [ERC-1155 (Multi Token Standard)](https://eips.ethereum.org/EIPS/eip-1155) +- link:https://eips.ethereum.org/EIPS/eip-20[ERC-20 (Token Standard)] +- link:https://eips.ethereum.org/EIPS/eip-721[ERC-721 (NFT Standard)], and +- link:https://eips.ethereum.org/EIPS/eip-1155[ERC-1155 (Multi Token Standard)] tokens in the treasury. -In the future, more advanced asset management and finance functionality can be added to your DAO in the form of [plugins](../03-plugins/index.md). +In the future, more advanced asset management and finance functionality can be added to your DAO in the form of xref:how-it-works/core/plugins/index.adoc[plugins]. ### 3. Upgradeability -Your DAO contract has the ability to be upgraded to a newer version (see [Upgrade your DAO](../../../02-how-to-guides/01-dao/03-protocol-upgrades.md)) if a new version of Aragon OSx is released in the future. These upgrades allow your DAO to smoothly transition to a new protocol version unlocking new features. +Your DAO contract has the ability to be upgraded to a newer version (see xref:how-to-guides/dao/protocol-upgrades.adoc[Upgrade your DAO]) if a new version of Aragon OSx is released in the future. These upgrades allow your DAO to smoothly transition to a new protocol version unlocking new features. - ### 4. Callback Handling To interact with the DAO, external contracts might require certain callback functions to be present. -Examples are the `onERC721Received` and `onERC1155Received` / `onERC1155BatchReceived` functions required by the [ERC-721 (NFT Standard)](https://eips.ethereum.org/EIPS/eip-721) and [ERC-1155 (Multi Token Standard)](https://eips.ethereum.org/EIPS/eip-1155) tokens. +Examples are the `onERC721Received` and `onERC1155Received` / `onERC1155BatchReceived` functions required by the link:https://eips.ethereum.org/EIPS/eip-721[ERC-721 (NFT Standard)] and link:https://eips.ethereum.org/EIPS/eip-1155[ERC-1155 (Multi Token Standard)] tokens. Our `CallbackHandler` allows to register the required callback responses dynamically so that the DAO contract does not need to be upgraded. - - ### 5. Signature Validation Currently, externally owned accounts (EOAs) can sign messages with their associated private keys, but contracts cannot. An exemplary use case is a decentralized exchange with an off-chain order book, where buy/sell orders are signed messages. To accept such a request, both, the external service provider and caller need to follow a standard with which the signed message of the caller can be validated. -By supporting the [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) standard, your DAO can validate signatures via its `isValidSignature` function that forwards the call to a signature validator contract. - - +By supporting the link:https://eips.ethereum.org/EIPS/eip-721[ERC-721 (NFT Standard)], your DAO can validate signatures via its `isValidSignature` function that forwards the call to a signature validator contract. ### 6. Permission Management Lastly, it is essential that only the right entities (e.g., the DAO itself or trusted addresses) have permission to use the above-mentioned functionalities. This is why Aragon OSx DAOs contain a flexible and battle-tested **permission manager** being able to assign permissions for the above functionalities to specific addresses. -Although possible, the permissions to execute arbitrary actions or upgrade the DAO should not be given to EOAs as this poses a security risk to the organization if the account is compromised or acts adversarial. Instead, the permissions for the above-mentioned functionalities are better restricted to the `DAO` contract itself and triggered through governance [plugins](../03-plugins/index.md) that you can install on your DAO. +Although possible, the permissions to execute arbitrary actions or upgrade the DAO should not be given to EOAs as this poses a security risk to the organization if the account is compromised or acts adversarial. Instead, the permissions for the above-mentioned functionalities are better restricted to the `DAO` contract itself and triggered through governance xref:how-it-works/core/plugins/index.adoc[plugins] that you can install on your DAO. -To learn more, visit the [permission manager](../02-permissions/index.md) section. +To learn more, visit the xref:how-it-works/core/permissions/index.adoc[permission manager] section. \ No newline at end of file diff --git a/components/osx/01-how-it-works/01-core/index.md b/components/osx/modules/ROOT/pages/how-it-works/core/index.adoc similarity index 54% rename from components/osx/01-how-it-works/01-core/index.md rename to components/osx/modules/ROOT/pages/how-it-works/core/index.adoc index 009ca1b5..80ceeb3a 100644 --- a/components/osx/01-how-it-works/01-core/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/index.adoc @@ -1,9 +1,6 @@ ---- -title: The Smart Contracts behind DAOs -sidebar_label: Smart Contracts ---- += The Smart Contracts behind DAOs -## The Contracts Constituting Your DAO +=== The Contracts Constituting Your DAO In a nutshell, your Aragon OSx DAO consists of three pieces: @@ -27,19 +24,13 @@ In a nutshell, your Aragon OSx DAO consists of three pieces: The underlying smart contracts constitute **the core contracts** of the Aragon OSx DAO framework. -
+image::../../../_/images/optimized-svg/plugins/dao-plugin.drawio.svg[align="center"] -![Schematic depiction of the interaction between the DAO, the PermissionManager, and a Plugin contract.](/optimized-svg/plugins/dao-plugin.drawio.svg) - -

- An exemplary DAO setup showing interactions between the three core contract pieces triggered by different user groups: The DAO contract in blue containing the PermissionManager in red, respectively, as well as two Plugin contracts in green. - Function calls are visualized as black arrows and require permission checks (red, dashed arrow). In this example, the permission manager determines whether the token voting plugin can execute actions on the DAO, a member can change its settings, or if a DeFi-related plugin is allowed to invest in a certain, external contract. -

- -
+An exemplary DAO setup showing interactions between the three core contract pieces triggered by different user groups: The `DAO` contract in blue containing the `PermissionManager` in red, respectively, as well as two `Plugin` contracts in green. +Function calls are visualized as black arrows and require permission checks (red, dashed arrow). In this example, the permission manager determines whether the token voting plugin can execute actions on the DAO, a member can change its settings, or if a DeFi-related plugin is allowed to invest in a certain, external contract. In the upcoming sections, you will learn about each of them in more depth. -- [The DAO Contract: The Identity and Basis of Your Organization](./01-dao/index.md) -- [Permissions: Managing Your DAO](./02-permissions/index.md) -- [Plugins: Customizing your DAO](./03-plugins/index.md) +- xref:how-it-works/core/dao/index.adoc[The DAO Contract: The Identity and Basis of Your Organization] +- xref:how-it-works/core/permissions/index.adoc[Permissions: Managing Your DAO] +- xref:how-it-works/core/plugins/index.adoc[Plugins: Customizing your DAO] diff --git a/components/osx/01-how-it-works/01-core/02-permissions/01-conditions.md b/components/osx/modules/ROOT/pages/how-it-works/core/permissions/conditions.adoc similarity index 84% rename from components/osx/01-how-it-works/01-core/02-permissions/01-conditions.md rename to components/osx/modules/ROOT/pages/how-it-works/core/permissions/conditions.adoc index 8c38623d..b9e75c00 100644 --- a/components/osx/01-how-it-works/01-core/02-permissions/01-conditions.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/permissions/conditions.adoc @@ -1,13 +1,11 @@ ---- -title: Permission Conditions ---- += Permission Conditions -## Permission Conditions +=== Permission Conditions Permission conditions relay the decision if an authorized call is permitted to another contract. This contract must inherit from `PermissionCondition` and implement the `IPermissionCondition` interface. -```solidity title="@aragon/osx/core/permission/IPermissionCondition.sol" +```solidity interface IPermissionCondition { /// @notice This method is used to check if a call is permitted. /// @param _where The address of the target contract. @@ -54,13 +52,11 @@ The following examples illustrate ## Examples -:::caution -The following code examples serve educational purposes and are not intended to be used in production. -::: +CAUTION: The following code examples serve educational purposes and are not intended to be used in production. Let’s assume we have an `Example` contract managed by a DAO `_dao` containing a `sendCoins` function allowing you to send an `_amount` to an address `_to` and being permissioned through the `auth` modifier: -```solidity title="Example.sol" +```solidity contract Example is Plugin { constructor(IDAO _dao) Plugin(_dao) {} @@ -83,26 +79,28 @@ Let’s imagine that we want to make sure that `_amount` is not more than `1 ETH We can realize this requirement by deploying a `ParameterConstraintCondition` condition. -```solidity title="ParameterConstraintCondition.sol" +```solidity contract ParameterConstraintCondition is PermissionCondition { - uint256 internal maxValue; - - constructor(uint256 _maxValue) { - maxValue = _maxValue; - } - - function isGranted( - address _where, - address _who, - bytes32 _permissionId, - bytes calldata _data - ) external view returns (bool) { + uint256 internal maxValue; + + constructor(uint256 _maxValue) { + maxValue = _maxValue; + } + + function isGranted( + address _where, + address _who, + bytes32 _permissionId, + bytes calldata _data + ) external view returns (bool) { (_where, _who, _permissionId); // Prevent compiler warnings resulting from unused arguments. (address _to, uint256 _amount) = abi.decode(_data, (address, uint256)); - return _amount <= _maxValue; + return _amount <= _maxValue; + } } + ``` Now, after granting the `SEND_COINS_PERMISSION_ID` permission to `_where` and `_who` via the `grantWithCondition` function and pointing to the `ParameterConstraintCondition` condition contract, the `_who` address can only call the `sendCoins` of the `Example` contract deployed at address `_where` successfully if `_amount` is not larger than `_maxValue` stored in the condition contract. @@ -111,7 +109,7 @@ Now, after granting the `SEND_COINS_PERMISSION_ID` permission to `_where` and `_ In another use-case, we might want to make sure that the `sendCoins` can only be called after a certain date. This would look as following: -```solidity title="TimeCondition.sol" +```solidity contract TimeCondition is PermissionCondition { uint256 internal date; @@ -136,9 +134,9 @@ Here, the permission condition will only allow the call the `_date` specified in ### Condition 3: Using Curated Registries -In another use-case, we might want to make sure that the `sendCoins` function can only be called by real humans to prevent sybil attacks. For this, let's say we use the [Proof of Humanity (PoH)](https://www.proofofhumanity.id/) registry providing a curated list of humans: +In another use-case, we might want to make sure that the `sendCoins` function can only be called by real humans to prevent sybil attacks. For this, let's say we use the link:https://www.proofofhumanity.id/[Proof of Humanity (PoH)] registry providing a curated list of humans: -```solidity title="IProofOfHumanity.sol" +```solidity interface IProofOfHumanity { function isRegistered(address _submissionID) external view returns (bool); } @@ -170,7 +168,7 @@ Here, the permission condition will only allow the call if the PoH registry conf In another use-case, we might want to make sure that the `sendCoins` function can only be called if the ETH price in USD is above a certain threshold: -```solidity title="PriceOracleCondition.sol" +```solidity import '@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol'; contract PriceOracleCondition is PermissionCondition { @@ -205,6 +203,6 @@ contract PriceOracleCondition is PermissionCondition { } } -Here, we use [a data feed from a Chainlink oracle](https://docs.chain.link/docs/data-feeds/) providing us with the latest ETH/USD price on the Goerli testnet and require that the call is only allowed if the ETH price is over $9000. +Here, we use https://docs.chain.link/docs/data-feeds/ providing us with the latest ETH/USD price on the Goerli testnet and require that the call is only allowed if the ETH price is over $9000. ```` diff --git a/components/osx/01-how-it-works/01-core/02-permissions/index.md b/components/osx/modules/ROOT/pages/how-it-works/core/permissions/index.adoc similarity index 73% rename from components/osx/01-how-it-works/01-core/02-permissions/index.md rename to components/osx/modules/ROOT/pages/how-it-works/core/permissions/index.adoc index 8efec6b0..4e970b0f 100644 --- a/components/osx/01-how-it-works/01-core/02-permissions/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/permissions/index.adoc @@ -1,15 +1,13 @@ ---- -title: Permissions ---- += Permissions -## Managing Your DAO +=== Managing Your DAO At Aragon, we believe that **DAOs are permission management systems**. Permissions between contracts and wallets allow a DAO to manage and govern its actions. Here, you will learn how the permissions in Aragon OSx work, how they can be granted and revoked from wallets and contracts, and how they are managed through the DAO. -As we mentioned earlier, it is essential that only the right person or contract can execute a certain action. As a developer, you might have seen or used [modifiers such as `onlyOwner`](https://docs.openzeppelin.com/contracts/2.x/api/ownership#Ownable) in contracts. This `onlyOwner` modifier provides basic access control to your DAO: only the `owner` address is permitted to execute the function to which the modifier is attached. +As we mentioned earlier, it is essential that only the right person or contract can execute a certain action. As a developer, you might have seen or used link:https://docs.openzeppelin.com/contracts/2.x/api/ownership#Ownable[modifiers such as onlyOwner] in contracts. This `onlyOwner` modifier provides basic access control to your DAO: only the `owner` address is permitted to execute the function to which the modifier is attached. In Aragon OSx, we follow the same approach but provide more advanced functionality: Each `DAO` contracts includes a `PermissionManager` contract allowing to flexibly, securely, and collectively manage permissions through the DAO and, thus, govern its actions. @@ -21,7 +19,7 @@ Identifiers, permissions, and modifiers link everything together. To differentiate between different permissions, permission **identifiers** are used that you will frequently find at the top of Aragon OSx contracts. They look something like this: -```solidity title="@aragon/osx/core/dao/DAO.sol" +```solidity bytes32 public constant EXECUTE_PERMISSION_ID = keccak256("EXECUTE_PERMISSION"); ``` @@ -29,7 +27,7 @@ bytes32 public constant EXECUTE_PERMISSION_ID = keccak256("EXECUTE_PERMISSION"); A permission specifies an address `who` being allowed to call certain functions on a contract address `where`. In the `PermissionManager` contract, permissions are defined as the concatenation of the word `"PERMISSION"` with the `who` and `where` address, as well as the `bytes32` permission identifier `permissionId`. -```solidity title="@aragon/osx/core/permission/PermissionManager.sol" +```solidity function permissionHash( address _where, address _who, @@ -84,14 +82,13 @@ function grant( To prevent these functions from being called by any address, they are themselves permissioned via the `auth` modifier and require the caller to have the `ROOT_PERMISSION_ID` permission in order to call them. -:::note -Typically, the `ROOT_PERMISSION_ID` permission is granted only to the `DAO` contract itself. Contracts related to the Aragon infrastructure temporarily require it during the [DAO creation](../../02-framework/01-dao-creation/index.md) and [plugin setup ](../../02-framework/02-plugin-management/02-plugin-setup/index.md) processes. + +NOTE: Typically, the `ROOT_PERMISSION_ID` permission is granted only to the `DAO` contract itself. Contracts related to the Aragon infrastructure temporarily require it during the xref:how-it-works/framework/dao-creation/index.adoc[DAO creation] and xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[plugin setup] processes. This means, that these functions can only be called through the DAO’s `execute` function that, in turn, requires the calling address to have the `EXECUTE_PERMISSION_ID` permission. Typically, the `EXECUTE_PERMISSION_ID` permission is granted to governance contracts (such as a majority voting plugin owned by the DAO or a multi-sig). Accordingly, a proposal is often required to change permissions. -Exceptions are, again, the [DAO creation](../../02-framework/01-dao-creation/index.md) and [plugin setup ](../../02-framework/02-plugin-management/02-plugin-setup/index.md) processes. -::: +Exceptions are, again, the xref:how-it-works/framework/dao-creation/index.adoc[DAO creation] and xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[plugin setup] processes. #### Granting Permission with Conditions @@ -108,9 +105,9 @@ function grantWithCondition( and specifying the `_condition` contract address. This provides full flexibility to customize the conditions under which the function call is allowed. -Typically, conditions are written specifically for and installed together with [plugins](../../01-core/03-plugins/index.md). +Typically, conditions are written specifically for and installed together with xref:how-it-works/core/plugins/index.adoc[plugins] -To learn more about this advanced topic and possible applications, visit the [permission conditions](./01-conditions.md) section. +To learn more about this advanced topic and possible applications, visit the xref:how-it-works/core/permissions/conditions.adoc[permission conditions]. #### Granting Permission to `ANY_ADDR` @@ -141,14 +138,34 @@ Moreover, if a condition is set, we return its `isGranted` result and do not fal The following functions in the DAO are permissioned: -| Functions | Permission Identifier | Description | -| --------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | -| `grant`, `grantWithCondition`, `revoke` | `ROOT_PERMISSION_ID` | Required to manage permissions of the DAO and associated plugins. | -| `execute` | `EXECUTE_PERMISSION_ID` | Required to execute arbitrary actions. | -| `_authorizeUpgrade` | `UPGRADE_DAO_PERMISSION_ID` | Required to upgrade the DAO (via the [UUPS](https://eips.ethereum.org/EIPS/eip-1822)). | -| `setMetadata` | `SET_METADATA_PERMISSION_ID` | Required to set the DAO’s metadata and [DAOstar.one DAO URI](https://eips.ethereum.org/EIPS/eip-4824). | -| `setTrustedForwarder` | `SET_TRUSTED_FORWARDER_PERMISSION_ID` | Required to set the DAO’s trusted forwarder for meta transactions. | -| `registerStandardCallback` | `REGISTER_STANDARD_CALLBACK_PERMISSION_ID` | Required to register a standard callback for an [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID. | +|=== +|Functions |Permission Identifier |Description + +|`grant`, `grantWithCondition`, `revoke` +|`ROOT_PERMISSION_ID` +| Required to manage permissions of the DAO and associated plugins. + +|`execute` +|`EXECUTE_PERMISSION_ID` +|Required to execute arbitrary actions. + +| `_authorizeUpgrade` +| `UPGRADE_DAO_PERMISSION_ID` +| Required to upgrade the DAO (via the link:https://eips.ethereum.org/EIPS/eip-1822[UUPS]). + +| `setMetadata` +| `SET_METADATA_PERMISSION_ID` +| Required to set the DAO’s metadata and link:https://eips.ethereum.org/EIPS/eip-4824[DAOstar.one DAO URI] + +| `setTrustedForwarder` +| `SET_TRUSTED_FORWARDER_PERMISSION_ID` +| Required to set the DAO’s trusted forwarder for meta transactions. + +| `registerStandardCallback` +| `REGISTER_STANDARD_CALLBACK_PERMISSION_ID` +| Required to register a standard callback for an link:https://eips.ethereum.org/EIPS/eip-165[ERC-165] interface ID + +|=== Plugins installed on the DAO might introduce other permissions and associated permission identifiers. diff --git a/components/osx/01-how-it-works/01-core/03-plugins/index.md b/components/osx/modules/ROOT/pages/how-it-works/core/plugins/index.adoc similarity index 63% rename from components/osx/01-how-it-works/01-core/03-plugins/index.md rename to components/osx/modules/ROOT/pages/how-it-works/core/plugins/index.adoc index 1040de56..024afe3e 100644 --- a/components/osx/01-how-it-works/01-core/03-plugins/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/core/plugins/index.adoc @@ -1,8 +1,6 @@ ---- -title: Plugins ---- += Plugins -## Customizing your DAO +=== Customizing your DAO To add features beyond the base functionality available, you can customize your Aragon OSx DAO by installing a wide variety of plugins. @@ -13,7 +11,7 @@ Plugins can be related to: - **Asset Management:** allows the DAO to manage its **treasury** or use it to invest (e.g., in lending, staking, or NFT mints). -- **Membership:** determines **who** will be a part of the DAO and what role they have. This can mean minting governance tokens like [ERC-20](https://eips.ethereum.org/EIPS/eip-20), NFTs, or any other token standard. Typically, membership-related plugins grant permissions based on token ownership or maintenance of a curated list of addresses. +- **Membership:** determines **who** will be a part of the DAO and what role they have. This can mean minting governance tokens like link:https://eips.ethereum.org/EIPS/eip-20[ERC-20], NFTs, or any other token standard. Typically, membership-related plugins grant permissions based on token ownership or maintenance of a curated list of addresses. - And **anything** else that comes to mind! @@ -23,9 +21,7 @@ Whenever a DAO installs a plugin, an instance of that plugin's base template is Each instance of a plugin is installed to a DAO through the granting of permissions. -:::info -Learn more about the different [plugin types](../../../02-how-to-guides/02-plugin-development/02-plugin-types.md) in our How-to guide. -::: +TIP: Learn more about the different xref:how-to-guides/plugin-development/plugin-types.adoc[plugin types] in our How-to guide. This raises questions on how the DAO manages plugins and who actually owns plugins. @@ -37,15 +33,12 @@ A DAO manages plugins and interactions between them. In more detail, its permiss - authorizes calls to plugin functions carrying the `auth` modifier - authorizes calls to DAO functions, for example the `execute` function, allowing to act as the DAO -
+image::../../../../_/images/optimized-svg/plugins/dao-plugin.drawio.svg[align="center"] -![Schematic depiction of the interaction between the DAO, the PermissionManager, and a Plugin contract.](/optimized-svg/plugins/dao-plugin.drawio.svg) -

- An exemplary DAO setup showing interactions between the three core contract pieces triggered by different user groups: The DAO contract in blue containing the PermissionManager in red, respectively, as well as two Plugin contracts in green. +An exemplary DAO setup showing interactions between the three core contract pieces triggered by different user groups: The `DAO` contract in blue containing the `PermissionManager` in red, respectively, as well as two `Plugin` contracts in green. Function calls are visualized as black arrows and require permission checks (red, dashed arrow). In this example, the permission manager determines whether the token voting plugin can execute actions on the DAO, a member can change its settings, or if a DeFi-related plugin is allowed to invest in a certain, external contract. -

-
- -Whereas deployed plugin instances belong to the DAO, the developer of the original plugin implementation owns the implementation and setup contract of the plugin. The plugin developer is the maintainer of an Aragon OSx [plugin repo](../../02-framework/02-plugin-management/01-plugin-repo/index.md). Finally, the Aragon OSx protocol manages the registry in which the plugin repositories are listed, which is required to install a plugin using the Aragon OSx framework infrastructure to your DAO. +Whereas deployed plugin instances belong to the DAO, the developer of the original plugin implementation owns the implementation +and setup contract of the plugin. The plugin developer is the maintainer of an Aragon OSx xref:how-it-works/framework/plugin-management/plugin-repo/index.adoc[plugin repo]. +Finally, the Aragon OSx protocol manages the registry in which the plugin repositories are listed, which is required to install a plugin using the Aragon OSx framework infrastructure to your DAO. diff --git a/components/osx/01-how-it-works/03-framwork-dao.md b/components/osx/modules/ROOT/pages/how-it-works/framework-dao.adoc similarity index 100% rename from components/osx/01-how-it-works/03-framwork-dao.md rename to components/osx/modules/ROOT/pages/how-it-works/framework-dao.adoc diff --git a/components/osx/01-how-it-works/02-framework/01-dao-creation/index.md b/components/osx/modules/ROOT/pages/how-it-works/framework/dao-creation/index.adoc similarity index 51% rename from components/osx/01-how-it-works/02-framework/01-dao-creation/index.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/dao-creation/index.adoc index 32f8dbd6..ce3776e8 100644 --- a/components/osx/01-how-it-works/02-framework/01-dao-creation/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/dao-creation/index.adoc @@ -1,44 +1,41 @@ ---- -title: Creating a DAO ---- += Creating a DAO -## The DAO Creation Process +=== The DAO Creation Process Two framework contracts manage the `DAO` contract creation process: -- The [`DAOFactory`](../../../03-reference-guide/framework/dao/DAOFactory.md) -- The [`DAORegistry`](../../../03-reference-guide/framework/dao/DAORegistry.md). +- The TODO:GIORGI [`DAOFactory`](../../../03-reference-guide/framework/dao/DAOFactory.md) +- The TODO:GIORGI [`DAORegistry`](../../../03-reference-guide/framework/dao/DAORegistry.md). - ### `DAOFactory` The `DAOFactory` creates and sets up a `DAO` for you in four steps with the `createDao` function. The function requires the `DAOSettings` including -- The trusted forwarder address for future [ERC-2771 (Meta Transaction)](https://eips.ethereum.org/EIPS/eip-2771) compatibility that is set to `address(0)` for now +- The trusted forwarder address for future link:https://eips.ethereum.org/EIPS/eip-2771[ERC-2771 (Meta Transaction)] compatibility that is set to `address(0)` for now - The ENS name (to be registered under the `dao.eth` domain) -- The [ERC-4824 (Common Interfaces for DAOs)](https://eips.ethereum.org/EIPS/eip-4824) `daoURI` +- The link:https://eips.ethereum.org/EIPS/eip-4824[ERC-4824 (Common Interfaces for DAOs)] `daoURI` - Optional metadata as well as an array of `PluginSettings` containing `PluginSetup` contract references and respective setup data for the initial set of plugins to be installed on the DAO. The `DAOFactory` create the `DAO` in four steps and interacts with the `DAORegistry` and being also part of the Aragon OSx framework: -1. Creates a new DAO by deploying an [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy pointing to the latest Aragon OSx `DAO` implementation and becomes the initial owner. +1. Creates a new DAO by deploying an link:https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] proxy pointing to the latest Aragon OSx `DAO` implementation and becomes the initial owner. -2. Registers the new contract in the [`DAORegistry`](#daoregistry). +2. Registers the new contract in the [`DAORegistry`](#daoregistry). TODO:GIORGI -3. Installs the plugins using the `PluginSetupProcessor` (see also the section about [the plugin setup process](../02-plugin-management/02-plugin-setup/index.md)). +3. Installs the plugins using the `PluginSetupProcessor` (see also the section about xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[the plugin setup process]). -4. Sets the [native permissions](../../01-core/02-permissions/index.md#permissions-native-to-the-dao-contract) of the `DAO` and revokes its own ownership. +4. Sets the xref:how-it-works/core/permissions/index.adoc##permissions-native-to-the-dao-contract[native permissions] of the `DAO` and revokes its own ownership. -For more details visit the [`DAOFactory` reference guide entry](../../../03-reference-guide/framework/dao/DAOFactory.md). +For more details visit the [`DAOFactory` reference guide entry](../../../03-reference-guide/framework/dao/DAOFactory.md). TODO: GIORGI ### `DAORegistry` The `DAORegistry` is used by the `DAOFactory` and contains the `register` function -```solidity title="@aragon/framework/dao/DAORegistry.sol" +```solidity" function register( IDAO dao, address creator, @@ -48,8 +45,8 @@ function register( requiring the `REGISTER_DAO_PERMISSION_ID` permission currently held only by the `DAOFactory`. -If the requested ENS `subdomain` name [is valid](../03-ens-names.md) and not taken, the `DAORegistry` registers the subdomain and adds the `DAO` contract address to the `DAORegistry`. +If the requested ENS `subdomain` name xref:how-it-works/framework/ens-names.md[is valid] and not taken, the `DAORegistry` registers the subdomain and adds the `DAO` contract address to the `DAORegistry`. If the `subdomain` parameter is non-empty (not `""`) and still available, the ENS name will be registered. If the registration was successful, the DAO name, contract and creator addresses are emitted in an event. -For more details visit the [`DAORegistry` reference guide entry](../../../03-reference-guide/framework/dao/DAORegistry.md). +For more details visit the [`DAORegistry` reference guide entry](../../../03-reference-guide/framework/dao/DAORegistry.md). TODO:GIORGI diff --git a/components/osx/01-how-it-works/02-framework/03-ens-names.md b/components/osx/modules/ROOT/pages/how-it-works/framework/ens-names.adoc similarity index 100% rename from components/osx/01-how-it-works/02-framework/03-ens-names.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/ens-names.adoc diff --git a/components/osx/modules/ROOT/pages/how-it-works/framework/index.adoc b/components/osx/modules/ROOT/pages/how-it-works/framework/index.adoc new file mode 100644 index 00000000..9343596f --- /dev/null +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/index.adoc @@ -0,0 +1,19 @@ += Framework - How Everything Connects + +=== The Infrastructure Running the Aragon OSx Protocol + +The Aragon OSx protocol is composed of **framework-related contracts** creating and managing the **core contracts**. This includes the + +- xref:how-it-works/framework/dao-creation/index.adoc[Creation of DAOs] and initial plugin configuration +- xref:how-it-works/framework/plugin-management/index.adoc[Management of plugins] which includes the + + - The setup in existing DAOs + - The versioning of different implementations and respective setup contracts, UI, and related metadata + +- xref:how-it-works/framework/ens-names.adoc[Assignment of ENS Names] to `Plugin` and `DAO` contracts created through the framework + +An overview of the involved contracts and their interactions is shown below: + +image::../../../_/images/optimized-svg/framework/aragon-os-infrastructure-core-overview.drawio.svg[align="center"] + +In the following sections, you will learn more about the framework-related contracts of the Aragon OSx protocol. diff --git a/components/osx/01-how-it-works/02-framework/02-plugin-management/index.md b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/index.adoc similarity index 56% rename from components/osx/01-how-it-works/02-framework/02-plugin-management/index.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/index.adoc index 61e5e63e..6b5c9789 100644 --- a/components/osx/01-how-it-works/02-framework/02-plugin-management/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/index.adoc @@ -1,8 +1,6 @@ ---- -title: Plugins ---- += Plugins -## Plugins +=== Plugins As mentioned earlier, plugins built by Aragon and third-party developers can be added and removed from your DAO to adapt it to your needs. @@ -15,8 +13,6 @@ becomes as streamlined as possible. In the following, we learn what a plugin consists of. - - ### What Does a Plugin Consist Of? An Aragon OSx Plugin consists of: @@ -36,18 +32,13 @@ An Aragon OSx Plugin consists of: - Release number - Build number -A detailed explanation of the [build and release versioning](../../../02-how-to-guides/02-plugin-development/07-publication/01-versioning.md) is found in the How-to sections in our developer portal. - -
- -![](/optimized-svg/plugins/plugin-version.drawio.svg) - -

- A schematic depiction of a plugin bundle consisting of a version tag, the plugin setup contract pointing to the plugin implementation contract, and a metadata URI. -

+A detailed explanation of the xref:how-to-guides/plugin-development/publication/versioning.adoc[build and release versioning] is found in the How-to sections in our developer portal. -
+image::../../../../_/images/optimized-svg/plugins/plugin-version.drawio.svg[align="center"] -The `PluginSetup` is written by you, the plugin developer. The processing of the setup is managed by the `PluginSetupProcessor`, the central component of the setup process in the Aragon OSx framework, which is explained in the section [The Plugin Setup Process](./02-plugin-setup/index.md). +The `PluginSetup` is written by you, the plugin developer. The processing of the setup is managed by the `PluginSetupProcessor`, +the central component of the setup process in the Aragon OSx framework, which is explained +in the section xref:how-it-works/framework/plugin-management/plugin-setup/index.adoc[The Plugin Setup Process]. -Each plugin with its different builds and releases is versioned inside its own plugin repositories in a `PluginRepo` contract, which is explained in the next section. +Each plugin with its different builds and releases is versioned inside its own plugin repositories in a `PluginRepo` contract, +which is explained in the next section. diff --git a/components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/index.md b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/index.adoc similarity index 60% rename from components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/index.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/index.adoc index a8eb9f55..a9cff02e 100644 --- a/components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/index.adoc @@ -1,8 +1,6 @@ ---- -title: Plugin Repositories ---- += Plugin Repositories -## What are Plugin Repositories? +=== What are Plugin Repositories? Each plugin has its own Plugin Repository, unique ENS name, and on-chain repository contract, the `PluginRepo`, in which different versions of the plugin are stored for reference using version tags constituted by a **release** and **build** number. @@ -12,26 +10,24 @@ Different versions might contain: - new features - breaking changes -`PluginRepo` contracts themselves, each associated with a different plugin, are registered in the Aragon OSx [`PluginRepoRegistry`](./01-plugin-repo-creation.md#the-pluginreporegistry-contract) and carry their own [ENS name](../../03-ens-names.md) that the creator chooses. The [`PluginRepoRegistry` contract](./01-plugin-repo-creation.md#the-pluginreporegistry-contract) is described in the upcoming subsection. +`PluginRepo` contracts themselves, each associated with a different plugin, are registered in the Aragon +OSx xref:how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc#the_pluginreporegistry_contract[PluginRepoRegistry] +and carry their own xrex:how-it-works/framework/ens-names.adoc[ENS name] that the creator chooses. +The xref:how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc#the_pluginreporegistry_contract[PluginRepoRegistry] is described in the upcoming subsection. -
+image::../../../../../_/images/optimized-svg/plugins/plugin-repo-overview.drawio.svg[align="center"] -![Schematic depiction of the versioning taking place in the PluginRepoRegistry.](/optimized-svg/plugins/plugin-repo-overview.drawio.svg) - -

- Overview of the plugin versioning and registry in the Aragon OSx protocol. The `PluginRepoRegistry` contract, which is a curated list of ENS named `PluginRepo` contracts, is shown on the left. Each `PluginRepo` contract maintains a list of versions of the `PluginSetup` contract (internally referencing the `Plugin` implementation contract) and the associated UI building blocks as a URI, exemplarily shown on the right. -

- -
### The `PluginRepo` Contract The `PluginRepo` contract versions the releases of a `Plugin`. The first version of a plugin is always published as release 1 and build 1 (version tag `1.1`). -When you publish the first plugin version, a new plugin repository is automatically created for you by the Aragon OSx protocol in which you are the maintainer. The creation process is described in the [plugin repo creation process](./01-plugin-repo-creation.md) section. +When you publish the first plugin version, a new plugin repository is automatically created for you by the Aragon OSx protocol in which you are the maintainer. +The creation process is described in the xref:how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc[plugin repo creation process] section. -The `PluginRepo` contract is [UUPS upgradeable](https://eips.ethereum.org/EIPS/eip-1822), inherits from the [`PermissionManager`](../../../01-core/02-permissions/index.md) and allows the maintainer of the repository to create new versions with the `createVersion` function: +The `PluginRepo` contract is link:https://eips.ethereum.org/EIPS/eip-1822[UUPS upgradeable], inherits from the xref:how-it-works/core/permissions/index.adoc[PermissionManager] +and allows the maintainer of the repository to create new versions with the `createVersion` function: -```solidity title="@aragon/framework/repo/PluginRepo.sol" +```solidity" /// @notice Creates a new plugin version as the latest build for an existing release number or the first build for a new release number for the provided `PluginSetup` contract address and metadata. /// @param _release The release number. /// @param _pluginSetupAddress The address of the plugin setup contract. @@ -52,6 +48,6 @@ The function receives four input arguments: 3. The `_buildMetadata` URI pointing to a JSON file containing the UI data, setup data, and change description for this specific version. 4. The `_releaseMetadata` URI pointing to a JSON file containing the plugin name, description, as well as optional data such as images to be shown in the aragonApp frontend. -Other functions present in the contract allow you to query previous versions and to update the release metadata. For more details visit the [`PluginRepo` reference guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepo.md). +Other functions present in the contract allow you to query previous versions and to update the release metadata. For more details visit the [`PluginRepo` reference guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepo.md). TODO:GIORGI -The `PluginRepo` is created for you when you publish the `PluginSetup` contract of your first version to the Aragon OSx protocol, which is explained in the next section: [The Plugin Repo Creation Process](01-plugin-repo-creation.md). +The `PluginRepo` is created for you when you publish the `PluginSetup` contract of your first version to the Aragon OSx protocol. \ No newline at end of file diff --git a/components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/01-plugin-repo-creation.md b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc similarity index 57% rename from components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/01-plugin-repo-creation.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc index dcb875a8..25539e13 100644 --- a/components/osx/01-how-it-works/02-framework/02-plugin-management/01-plugin-repo/01-plugin-repo-creation.md +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc @@ -1,26 +1,19 @@ ---- -title: Publishing a Plugin ---- += Publishing a Plugin -## Start publishing your Plugin by creating a PluginRepo +=== Start publishing your Plugin by creating a PluginRepo To be available for installation in the Aragon OSx framework, a `PluginRepo` must be created for each plugin. The `PluginRepo` creation process is handled by: -- The [`PluginRepoFactory`](../../../../03-reference-guide/framework/plugin/repo/PluginRepoFactory.md): who creates the `PluginRepo` instance for each plugin to hold all plugin versions -- The [`PluginRepoRegistry`](../../../../03-reference-guide/framework/plugin/repo/PluginRepoRegistry.md): who registers the Plugin into the Protocol for DAOs to install. - - +- The TODO:GIORGI [`PluginRepoFactory`](../../../../03-reference-guide/framework/plugin/repo/PluginRepoFactory.md): who creates the `PluginRepo` instance for each plugin to hold all plugin versions +- The TODO:GIORGI [`PluginRepoRegistry`](../../../../03-reference-guide/framework/plugin/repo/PluginRepoRegistry.md): who registers the Plugin into the Protocol for DAOs to install. ### The `PluginRepoFactory` Contract -The `PluginRepoFactory` is the contract in charge of creating the first version of a plugin. It does this through the `createPluginRepoWithFirstVersion` function which creates a `PluginRepo` instance for the plugin with the first release and first build (`v1.1`). +The `PluginRepoFactory` is the contract in charge of creating the first version of a plugin. It does this through +the `createPluginRepoWithFirstVersion` function which creates a `PluginRepo` instance for the plugin with the first release +and first build (`v1.1`). -```solidity title="@aragon/framework/repo/PluginRepoFactory.sol" +```solidity" /// @notice Creates and registers a `PluginRepo` with an ENS subdomain and publishes an initial version `1.1`. /// @param _subdomain The plugin repository subdomain. /// @param _pluginSetup The plugin factory contract associated with the plugin version. @@ -37,20 +30,20 @@ function createPluginRepoWithFirstVersion( ) external returns (PluginRepo pluginRepo); ``` -It also registers the plugin in the Aragon OSx `PluginRepoRegistry`contract with an [ENS subdomain](../../03-ens-names.md) under the `plugin.dao.eth` domain managed by Aragon. +It also registers the plugin in the Aragon OSx `PluginRepoRegistry`contract with an xref:how-it-works/framework/ens-names.adoc[ENS subdomain] under the `plugin.dao.eth` domain managed by Aragon. -Additional to the information required by the [`createVersion` function discussed earlier](./index.md#the-pluginrepo-contract), it receives: +Additional to the information required by the xref:how-it-works/framework/plugin-management/plugin-repo/plugin-repo-creation.adoc#the-pluginrepo-contract[`createVersion` function discussed earlier], it receives: - A valid ENS `_subdomain` unique name composed of letters from a-z, all in lower caps, separated by a `-`. For ex: `token-voting-plugin`. - The address of the plugin repo maintainer who ends up having the `ROOT_PERMISSION_ID`, `MAINTAINER_PERMISSION_ID`, and `UPGRADE_REPO_PERMISSION_ID` permissions. These permissions enable the maintainer to call the internal `PermissionManager`, the `createVersion` and `updateReleaseMetadata` functions as well as upgrading the plugin contract. -For more details visit the [`PluginRepoFactory` Reference Guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepoFactory.md). +For more details visit the TODO:GIORGI [`PluginRepoFactory` Reference Guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepoFactory.md). ### The `PluginRepoRegistry` Contract The `PluginRepoRegistry` contract is the central contract listing all the plugins managed through the Aragon OSx protocol. The `PluginRepoFactory` calls on the `PluginRepoRegistry` to register the plugin in the Aragon OSx protocol. -```solidity title="@aragon/framework/PluginRepoRegistry.sol" +```solidity" /// @notice Registers a plugin repository with a subdomain and address. /// @param subdomain The subdomain of the PluginRepo. /// @param pluginRepo The address of the PluginRepo contract. @@ -62,4 +55,4 @@ address pluginRepo } ``` -For more details visit the [`PluginRepoRegistry` reference guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepoRegistry.md). +For more details visit the TODO:GIORGI [`PluginRepoRegistry` reference guide entry](../../../../03-reference-guide/framework/plugin/repo/PluginRepoRegistry.md). diff --git a/components/osx/01-how-it-works/02-framework/02-plugin-management/02-plugin-setup/index.md b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-setup/index.adoc similarity index 59% rename from components/osx/01-how-it-works/02-framework/02-plugin-management/02-plugin-setup/index.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-setup/index.adoc index c8d164e9..c0b4c921 100644 --- a/components/osx/01-how-it-works/02-framework/02-plugin-management/02-plugin-setup/index.md +++ b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-setup/index.adoc @@ -1,36 +1,45 @@ ---- -title: Installing Plugins ---- += Installing Plugins -## The Smart Contracts Behind Plugins +=== The Smart Contracts Behind Plugins A DAO can be set up and customized by the **installation, update, and uninstallation** of plugins. Plugins are composed of two key contracts: - **Plugin contract:** contains the plugin's implementation logic; everything needed to extend the functionality for DAOs. - **Plugin Setup contract:** contains the instructions needed to install, update, and uninstall the plugin into the DAO. This is done through granting or revoking permissions, enabling plugins to perform actions within the scope of the DAO. -![Aragon OSx Plugins](/img/plugins/what_is_a_plugin.png) + +image::../../../../../_/images/img/plugins/what_is_a_plugin.png[align="center"] + How this works: - Although a Plugin is composed by the `Plugin` and `PluginSetup` contracts, the Aragon OSx protocol only knows of the `PluginSetup` contract. -- Since the `PluginSetup` contract is the one containing the plugin installation instructions, it is the one in charge of deploying the Plugin instance. Each plugin instance is specific to that DAO, deployed with its own unique parameters. You can review how to build a `PluginSetup` contract [here](../../../../02-how-to-guides/02-plugin-development/index.md). +- Since the `PluginSetup` contract is the one containing the plugin installation instructions, it is the one in charge of deploying the Plugin instance. Each plugin instance is specific to that DAO, deployed with its own unique parameters. +You can review how to build a `PluginSetup` contract xref:how-to-guides/plugin-development/index.adoc[here]. - The `PluginSetup` contract then interacts with the Aragon OSx framework's `PluginSetupProcessor` contract, which is in charge of applying the installation, update, or uninstallation of a plugin into a DAO. -- Publishing a Plugin into the Aragon OSx protocol is done through creating the first version of the plugin's `PluginRepo`. The plugin's `PluginRepo` instance stores all plugin versions. You can read more about that [here](../../../../02-how-to-guides/02-plugin-development/07-publication/index.md). +- Publishing a Plugin into the Aragon OSx protocol is done through creating the first version of the plugin's `PluginRepo`. The plugin's `PluginRepo` instance stores all plugin versions. +You can read more about that xref:how-to-guides/plugin-development/publication/index.adoc[here]. - Except for the gas costs required, plugins are completely free to install, unless decided otherwise by the developer. ### How are Plugins installed in DAOs? The `PluginSetup` processing is **security critical** because the permissions it handles are granted to third-party contracts. -**Safety is our top priority in the design of the whole protocol.** We want to make sure that the DAO members know exactly what permissions are granted to whom before any processing takes place. +**Safety is our top priority in the design of the whole protocol.** We want to make sure that the DAO members know exactly what +permissions are granted to whom before any processing takes place. This is why we see the installation process in two phases: -1. **Preparation:** Defining the parameters to be set on the new plugin instance and helpers, as well as requesting the permissions needed for it to work properly. The `PluginSetup` contains the setup script where developers can perform any unprivileged operations. These will need a privileged confirmation in the next step. -2. **Application:** The granting or revoking of the plugin's requested permissions (based on the preparation step above). This is a privileged action performed by Aragon's `PluginSetupProcessor` (you can understand it as the "installer"), so that the plugin becomes effectively installed or uninstalled. It gets executed whenever someone with `ROOT` privileges on the DAO applies it (most likely through a proposal). +1. **Preparation:** Defining the parameters to be set on the new plugin instance and helpers, as well as requesting the permissions needed for it to work properly. +The `PluginSetup` contains the setup script where developers can perform any unprivileged operations. These will need a privileged +confirmation in the next step. +2. **Application:** The granting or revoking of the plugin's requested permissions (based on the preparation step above). +This is a privileged action performed by Aragon's `PluginSetupProcessor` (you can understand it as the "installer"), +so that the plugin becomes effectively installed or uninstalled. It gets executed whenever someone with `ROOT` privileges on +the DAO applies it (most likely through a proposal). -The `PluginSetupProcessor` is the Aragon contract in charge of invoking the `prepareInstallation()` function from your plugin's `PluginSetup` contract and use it to prepare the installation and (eventually) apply it once it has been approved by the DAO. +The `PluginSetupProcessor` is the Aragon contract in charge of invoking the `prepareInstallation()` function from your plugin's `PluginSetup` +contract and use it to prepare the installation and (eventually) apply it once it has been approved by the DAO. #### What happens during the Plugin Preparation? @@ -40,7 +49,8 @@ The preparation of a `PluginSetup` contract proceeds as follows: 2. The DAO builder defines the parameters and settings that he/she wants for their DAO. Depending on the case, the `prepareInstallation`, `prepareUpdate`, or `prepareUninstallation` method in the `PluginSetup` contract is called through the `PluginSetupProcessor` (and creates a unique setup ID). -3. The [`PluginSetup`](https://github.com/aragon/osx/blob/e24d9fa3bd6d5a4c9f5936c14ccda1fe9886c2b0/packages/contracts/src/framework/plugin/setup/PluginSetup.sol) contract deploys all the contracts and gathers addresses and other input arguments required for the installation/uninstallation/upgrade instructions. This can include: +3. The link:https://github.com/aragon/osx/blob/e24d9fa3bd6d5a4c9f5936c14ccda1fe9886c2b0/packages/contracts/src/framework/plugin/setup/PluginSetup.sol[[`PluginSetup`]] contract deploys all the contracts +and gathers addresses and other input arguments required for the installation/uninstallation/upgrade instructions. This can include: - deployment of new contracts - initialization of new storage variables @@ -48,22 +58,17 @@ The preparation of a `PluginSetup` contract proceeds as follows: - governance settings or other attributes - ... - Because the addresses of all associated contracts are now known, a static permission list can be emitted, hashed, and stored on-chain. +Because the addresses of all associated contracts are now known, a static permission list can be emitted, hashed, and stored on-chain. 4. Once the Plugin installation has been prepared, we use it as the parameter of the `applyInstallation()` action. Once encoded, this action is what must be added to the `Action[]` array of the installation proposal. That way, when the proposal passes, the action becomes executable and the plugin can be installed in the DAO using the parameters defined in the prepare installation process. For a plugin to be installed, it needs to be approved by the governance mechanism (plugin) of the organization, passed as the encoded action of a proposal, and executed by a signer. -:::info -The governance plugin can be a simple majority vote, an optimistic process or an admin governance plugin that does not involve a waiting period. It can be any governance mechanism existing within the DAO which has access to the DAO's `execute` permission. -::: +TIP: The governance plugin can be a simple majority vote, an optimistic process or an admin governance plugin that does not involve a waiting period. It can be any governance mechanism existing within the DAO which has access to the DAO's `execute` permission. This gives the DAO members the opportunity to check which permissions the `PluginSetup` contract request before granting/revoking them. -Plugin setup proposals must be carefully examined as they can be a potential security risk if the `PluginSetup` contract comes from an untrusted source. To learn more visit the [Security](./01-security-risk-mitigation.md) section. - - #### What happens during the Preparation Application? @@ -79,20 +84,15 @@ This is processed as follows: 3. If the hash is valid, the list is processed and `PluginSetupProcessor` conducts the requested sequence of `grant`, `grantWithCondition` and `revoke` calls on the owning DAO. Finally, the `PluginSetupProcessor` asks the DAO to revoke the `ROOT_PERMISSION_ID` permission from itself. -:::info -The two-step setup procedure in Aragon OSx is not limited to the setup of only one plugin — you can **setup multiple plugins at once** by first preparing them in a single proposal and then processing the entire setup sequence in one transaction. This is powerful and allows you to **transform your entire DAO in one proposal**, for example, to install a new governance plugin (e.g., a gasless ZK-vote) and finance plugin (e.g., to stream loans to your members), while uninstalling your old ERC20 token vote in one go. -::: +TIP: The two-step setup procedure in Aragon OSx is not limited to the setup of only one plugin — you can **setup multiple plugins at once** +by first preparing them in a single proposal and then processing the entire setup sequence in one transaction. This is powerful and +allows you to **transform your entire DAO in one proposal**, for example, to install a new governance plugin (e.g., a gasless ZK-vote) and finance plugin (e.g., to stream loans to your members), while uninstalling your old ERC20 token vote in one go. In the next sections, you will learn about how plugins are curated on Aragon's repository. -
-**a.** ![Schematic depiction of the plugin installation process.](/optimized-svg/plugins/plugin-installation.drawio.svg) -**b.** ![Schematic depiction of the plugin update process.](/optimized-svg/plugins/plugin-update.drawio.svg) -**c.** ![Schematic depiction of the plugin uninstallation process.](/optimized-svg/plugins/plugin-uninstallation.drawio.svg) +image::../../../../../_/images/optimized-svg/plugins/plugin-installation.drawio.svg[align="center"] +image::../../../../../_/images/optimized-svg/plugins/plugin-update.drawio.svg[align="center"] +image::../../../../../_/images/optimized-svg/plugins/plugin-uninstallation.drawio.svg[align="center"] -

- Simplified overview of the two-transaction plugin a. installation, b. update, and c. uninstallation process with the involved contracts as rounded rectangles, interactions between them as arrows, and relations as dashed lines. The first and second transaction are distinguished by numbering as well as solid and dotted lines, respectively. -

-
diff --git a/components/osx/01-how-it-works/02-framework/02-plugin-management/02-plugin-setup/01-security-risk-mitigation.md b/components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-setup/security-risk-mitigation.adoc similarity index 100% rename from components/osx/01-how-it-works/02-framework/02-plugin-management/02-plugin-setup/01-security-risk-mitigation.md rename to components/osx/modules/ROOT/pages/how-it-works/framework/plugin-management/plugin-setup/security-risk-mitigation.adoc diff --git a/components/osx/modules/ROOT/pages/how-it-works/index.adoc b/components/osx/modules/ROOT/pages/how-it-works/index.adoc new file mode 100644 index 00000000..0cb242eb --- /dev/null +++ b/components/osx/modules/ROOT/pages/how-it-works/index.adoc @@ -0,0 +1,25 @@ +== How It Works + + +## The Aragon OSx DAO Framework + +The Aragon OSx protocol is a DAO framework structured as follows: + +image::../../_/images/aragon-os-framework-overview.drawio.svg[align="center"] + +Overview of the Aragon OSx protocol with its structural components and their responsibilities: the governance layer constituted by the framework DAO, the code layer including the framework and core contracts, which depends on external libraries and services + +### Code Layer + +The foundation of the Aragon OSx protocol is the **code layer** constituted by the core and framework related contracts. +The xref:how-it-works/core/index.adoc[core contracts] provide the core primitives intended to be used by users and implemented by developers of the DAO framework. +The xref:how-it-works/framework/index.adoc[framework contracts] provide the infrastructure to easily create and manage your DAOs and plugins easy. +Both are built on top of external dependencies, most notably the link:https://www.openzeppelin.com/contracts[OpenZeppelin] and the link:https://docs.ens.domains/[Ethereum Name Service (ENS)] contracts. + +The core and framework contracts are free to use, and no additional fees are charged. + +### Governance Layer + +To govern the framework infrastructure, an Aragon OSx [Framework DAO](./03-framwork-dao.md) is deployed constituting the **governance layer** of the Aragon OSx protocol. + +In the next sections, you will learn more about the individual components of the framework. diff --git a/components/osx/02-how-to-guides/01-dao/02-action-execution.md b/components/osx/modules/ROOT/pages/how-to-guides/dao/action-execution.adoc similarity index 100% rename from components/osx/02-how-to-guides/01-dao/02-action-execution.md rename to components/osx/modules/ROOT/pages/how-to-guides/dao/action-execution.adoc diff --git a/components/osx/02-how-to-guides/01-dao/01-best-practices.md b/components/osx/modules/ROOT/pages/how-to-guides/dao/best-practices.adoc similarity index 100% rename from components/osx/02-how-to-guides/01-dao/01-best-practices.md rename to components/osx/modules/ROOT/pages/how-to-guides/dao/best-practices.adoc diff --git a/components/osx/02-how-to-guides/01-dao/index.md b/components/osx/modules/ROOT/pages/how-to-guides/dao/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/01-dao/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/dao/index.adoc diff --git a/components/osx/02-how-to-guides/01-dao/04-managing-plugins/index.md b/components/osx/modules/ROOT/pages/how-to-guides/dao/managing-plugins.adoc similarity index 100% rename from components/osx/02-how-to-guides/01-dao/04-managing-plugins/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/dao/managing-plugins.adoc diff --git a/components/osx/02-how-to-guides/01-dao/03-protocol-upgrades.md b/components/osx/modules/ROOT/pages/how-to-guides/dao/protocol-upgrades.adoc similarity index 100% rename from components/osx/02-how-to-guides/01-dao/03-protocol-upgrades.md rename to components/osx/modules/ROOT/pages/how-to-guides/dao/protocol-upgrades.adoc diff --git a/components/osx/02-how-to-guides/index.md b/components/osx/modules/ROOT/pages/how-to-guides/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/01-best-practices.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/best-practices.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/01-best-practices.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/best-practices.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/index.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/02-membership.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/membership.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/02-membership.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/membership.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/01-proposals.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/proposals.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/05-governance-plugins/01-proposals.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/governance-plugins/proposals.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/index.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/06-meta-tx-plugins.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/meta-tx-plugins.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/06-meta-tx-plugins.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/meta-tx-plugins.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/02-implementation.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/implementation.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/02-implementation.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/implementation.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/index.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/01-initialization.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/initialization.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/01-initialization.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/initialization.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/03-setup.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/setup.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/03-non-upgradeable-plugin/03-setup.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/non-upgradeable-plugin/setup.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/02-plugin-types.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/plugin-types.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/02-plugin-types.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/plugin-types.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/07-publication/index.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/07-publication/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/07-publication/02-metadata.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/metadata.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/07-publication/02-metadata.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/metadata.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/07-publication/01-versioning.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/versioning.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/07-publication/01-versioning.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/publication/versioning.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/02-implementation.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/implementation.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/02-implementation.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/implementation.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/index.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/index.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/index.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/index.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/01-initialization.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/initialization.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/01-initialization.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/initialization.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/03-setup.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/setup.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/03-setup.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/setup.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/04-subsequent-builds.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/subsequent-builds.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/04-subsequent-builds.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/subsequent-builds.adoc diff --git a/components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/05-updating-versions.md b/components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/updating-versions.adoc similarity index 100% rename from components/osx/02-how-to-guides/02-plugin-development/04-upgradeable-plugin/05-updating-versions.md rename to components/osx/modules/ROOT/pages/how-to-guides/plugin-development/upgradeable-plugin/updating-versions.adoc diff --git a/components/osx/index.md b/components/osx/modules/ROOT/pages/index.adoc similarity index 56% rename from components/osx/index.md rename to components/osx/modules/ROOT/pages/index.adoc index 29ce22a1..0ce79046 100644 --- a/components/osx/index.md +++ b/components/osx/modules/ROOT/pages/index.adoc @@ -1,8 +1,4 @@ ---- -title: Aragon OSx -sidebar_label: Introduction -sidebar_position: 0 ---- += Aragon OSx ## The Contracts Behind the Protocol @@ -26,7 +22,7 @@ To facilitate this, Aragon OSx runs a set of **framework contracts**: ## Getting Started -Users interact with the Aragon OSx protocol through the [Aragon App](https://app.aragon.org), the [Aragon SDK](https://devs.aragon.org/docs/sdk), or directly calling on the [protocol contracts](https://github.com/aragon/osx) - as well as through any third-party projects built using our stack. +Users interact with the Aragon OSx protocol through the link:https://app.aragon.org[Aragon App], link:https://devs.aragon.org/docs/sdk[Aragon SDK] or directly calling on the link:https://github.com/aragon/osx[protocol contracts] - as well as through any third-party projects built using our stack. To **add the contracts to your project**, open a terminal in the root folder of your Solidity project and run: @@ -36,16 +32,35 @@ yarn add @aragon/osx Then, to use the contracts within your project, **import the contracts** through something like: - +```solidity +// contracts/Box.sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; -```solidity title="MyCoolPlugin.sol" -// SPDX-License-Identifier: AGPL-3.0-or-later -pragma solidity 0.8.21; +// Import Auth from the access-control subdirectory +import "./access-control/Auth.sol"; -import {Plugin, IDAO} from '@aragon/osx/core/plugin/Plugin.sol'; +contract Box { + uint256 private _value; + Auth private _auth; -contract MyCoolPlugin is Plugin { - // ... + event ValueChanged(uint256 value); + + constructor() { + _auth = new Auth(msg.sender); + } + + function store(uint256 value) public { + // Require that the caller is registered as an administrator in Auth + require(_auth.isAdministrator(msg.sender), "Unauthorized"); + + _value = value; + emit ValueChanged(value); + } + + function retrieve() public view returns (uint256) { + return _value; + } } ``` @@ -53,12 +68,12 @@ contract MyCoolPlugin is Plugin { DAO Plugins are the best way to customize your DAO. These are modular extendable pieces of software which you can install or uninstall from your DAO as it evolves and grows. -To learn more about plugins, check out our guide [here](./02-how-to-guides/02-plugin-development/index.md). +To learn more about plugins, check out our guide xref:how-to-guides/plugin-development/index.adoc[here]. ### Walkthrough This documentation is divided into conceptual and practical sections as well as the reference guide. -- Conceptual [How It Works articles](01-how-it-works/index.md) explain the architecture behind our protocol. -- Practical [How-to Guides](02-how-to-guides/index.md) explain how to use and leverage our protocol. -- The [Reference Guide](03-reference-guide/index.md) generated from the NatSpec comments of the latest `@aragon/osx` release documents each individual Solidity contract, function, and variable. +- Conceptual xref:how-it-works/index.adoc[How It Works articles] explain the architecture behind our protocol. +- Practical xref:how-to-guides/index.adoc[How-to Guides] explain how to use and leverage our protocol. +- The TODO:GIORGI [Reference Guide](03-reference-guide/index.md) generated from the NatSpec comments of the latest `@aragon/osx` release documents each individual Solidity contract, function, and variable. diff --git a/package.json b/package.json index 0df444ef..4c47cd92 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,6 @@ "version": "0.0.0", "private": true, "scripts": { - "docusaurus": "docusaurus", - "start": "docusaurus start", - "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy", - "clear": "docusaurus clear", - "serve": "docusaurus serve", "build": "bash scripts/build.sh --fetch playbook.yml", "build:no-fetch": "bash scripts/build.sh playbook.yml", "build:local": "bash scripts/build.sh playbook-local-only.yml", @@ -20,29 +14,6 @@ "lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix" }, "dependencies": { - "@aragon/ui-components": "0.1.3", - "@cmfcmf/docusaurus-search-local": "^1.1.0", - "@docusaurus/core": "^3.1.1", - "@docusaurus/plugin-google-gtag": "^3.1.1", - "@docusaurus/plugin-google-tag-manager": "^3.1.1", - "@docusaurus/preset-classic": "^3.1.1", - "@mantine/hooks": "^7.5.2", - "@mdx-js/react": "^3.0.1", - "autoprefixer": "^10.4.7", - "clsx": "^2.1.0", - "docusaurus-tailwindcss": "^0.1.0", - "dotenv": "^16.4.5", - "ethers": "^5.6.9", - "hast-util-is-element": "3.0.0", - "postcss": "^8.4.14", - "prism-react-renderer": "^2.3.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "rehype-katex": "^7.0.0", - "remark-math": "^6.0.0", - "styled-components": "^6.1.9", - "svgo": "^3.2.0", - "tailwindcss": "^3.4.1", "@antora/lunr-extension": "^1.0.0-alpha.8", "antora": "^3.0.0", "glob": "^7.1.4", @@ -52,17 +23,6 @@ "yarn": "^1.19.1" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.1.1", - "@docusaurus/tsconfig": "3.1.1", - "@typescript-eslint/eslint-plugin": "^5.48.1", - "@typescript-eslint/parser": "^5.48.1", - "eslint": "^8.24.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.31.8", - "prettier": "^3.2.5", - "prettier-plugin-solidity": "^1.3.1", - "typescript": "^5.3.3", "fgbg": "^0.1.5", "live-server": "^1.2.1", "nodemon": "^2.0.6", diff --git a/playbook.yml b/playbook.yml index 3561505e..dcacdaa2 100644 --- a/playbook.yml +++ b/playbook.yml @@ -7,6 +7,9 @@ site: gtm: 'GTM-W9X5Q6F' content: sources: + - url: . + branches: feature/new-way + start_path: components/home - url: . branches: feature/new-way start_path: components/osx diff --git a/ui/node_modules/.yarn-integrity b/ui/node_modules/.yarn-integrity index 320e991b..45fc9cf7 100644 --- a/ui/node_modules/.yarn-integrity +++ b/ui/node_modules/.yarn-integrity @@ -27,9 +27,9 @@ "fromentries@^1.3.2", "glob@^7.1.7", "handlebars@^4.7.7", - "highlight.js@^11.6.0", + "highlight.js@^11.10.0", "highlightjs-cairo@^0.4.0", - "highlightjs-solidity@^2.0.5", + "highlightjs-solidity@^2.0.6", "live-server@^1.2.2", "lodash.debounce@^4.0.8", "rimraf@^3.0.2", @@ -367,9 +367,9 @@ "has-values@^1.0.0": "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f", "hasown@^2.0.0": "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003", "hasown@^2.0.2": "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003", - "highlight.js@^11.6.0": "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.10.0.tgz#6e3600dc4b33d6dc23d5bd94fbf72405f5892b92", + "highlight.js@^11.10.0": "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.10.0.tgz#6e3600dc4b33d6dc23d5bd94fbf72405f5892b92", "highlightjs-cairo@^0.4.0": "https://registry.yarnpkg.com/highlightjs-cairo/-/highlightjs-cairo-0.4.0.tgz#c7b0e45b8c3f61a77a2235ecb00b55c3cb3b9be1", - "highlightjs-solidity@^2.0.5": "https://registry.yarnpkg.com/highlightjs-solidity/-/highlightjs-solidity-2.0.6.tgz#e7a702a2b05e0a97f185e6ba39fd4846ad23a990", + "highlightjs-solidity@^2.0.6": "https://registry.yarnpkg.com/highlightjs-solidity/-/highlightjs-solidity-2.0.6.tgz#e7a702a2b05e0a97f185e6ba39fd4846ad23a990", "http-auth@3.1.x": "https://registry.yarnpkg.com/http-auth/-/http-auth-3.1.3.tgz#945cfadd66521eaf8f7c84913d377d7b15f24e31", "http-errors@^2.0.0": "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3", "http-errors@~1.6.2": "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d", diff --git a/ui/package.json b/ui/package.json index 3263fc52..3111fd56 100644 --- a/ui/package.json +++ b/ui/package.json @@ -30,8 +30,6 @@ "fromentries": "^1.3.2", "glob": "^7.1.7", "handlebars": "^4.7.7", - "highlight.js": "^11.6.0", - "highlightjs-solidity": "^2.0.5", "highlightjs-cairo": "^0.4.0", "live-server": "^1.2.2", "lodash.debounce": "^4.0.8", @@ -42,5 +40,9 @@ "sass": "^1.34.1", "server-destroy": "^1.0.1", "yaml": "^2.2.2" + }, + "dependencies": { + "highlight.js": "^11.10.0", + "highlightjs-solidity": "^2.0.6" } } diff --git a/ui/src/js/04-page.js b/ui/src/js/04-page.js index 62a0eaed..051d6fe7 100644 --- a/ui/src/js/04-page.js +++ b/ui/src/js/04-page.js @@ -67,7 +67,7 @@ title.classList.add('toc-title'); // title.textContent = 'On This Page'; var elTitle = document.querySelector('main .article-wrapper h1'); - title.textContent = elTitle.textContent; + title.textContent = elTitle?.textContent || 'On This Page' menu.appendChild(title); menu.appendChild(list); diff --git a/ui/src/js/highlight.js b/ui/src/js/highlight.js index d398db3b..b3eda484 100644 --- a/ui/src/js/highlight.js +++ b/ui/src/js/highlight.js @@ -10,4 +10,4 @@ hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell')); hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')); require('highlightjs-solidity')(hljs); require('highlightjs-cairo')(hljs); -hljs.initHighlightingOnLoad(); +hljs.highlightAll(); \ No newline at end of file diff --git a/ui/theme/dist/index.js b/ui/theme/dist/index.js index acd21a84..138baef2 100644 --- a/ui/theme/dist/index.js +++ b/ui/theme/dist/index.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach((t=>{const a=n[t],s=typeof a;"object"!==s&&"function"!==s||Object.isFrozen(a)||e(a)})),n}(()=>{const e=document.querySelectorAll(".js-version");for(let n=0;ne.stopPropagation())),e[n].addEventListener("change",(e=>window.location.href=e.target.value))})(),function(){var e,n,t=document.querySelector("main .article-wrapper > .toc-sidebar");if(t)if(!document.querySelector(".body.ui-toc")&&(n=g("h1[id].sect0, .sect1 > h2[id]",e=document.querySelector(".article"))).length){var a,s,i={},r=n.reduce((function(e,n){var t=b(g("h3",n.parentNode)),a=document.createElement("ul");function s(e){const n=b(e.childNodes).reduce((function(e,n){return"A"!==n.nodeName&&e.appendChild(n.cloneNode(!0)),e}),document.createElement("a"));return i[n.href="#"+e.id]=n,n}a.classList.add("subheading-list"),t.map((e=>{var n=document.createElement("li");n.classList.add("subheading-item");var t=s(e);n.appendChild(t),a.appendChild(n)}));var r=s(n),o=document.createElement("li");return o.appendChild(r),t.length&&o.appendChild(a),e.appendChild(o),e}),document.createElement("ul"));(s=t&&t.querySelector(".toc-menu"))||((s=document.createElement("div")).className="toc-menu");var o=document.createElement("h3");o.classList.add("toc-title");var c=document.querySelector("main .article-wrapper h1");o.textContent=c.textContent,s.appendChild(o),s.appendChild(r),t&&window.addEventListener("load",(function(){u(),window.addEventListener("scroll",u)}));var l=e.querySelector("h1.page ~ :not(.labels)");if(l){var d=document.createElement("div");d.className="toc embedded",d.appendChild(s.cloneNode(!0)),e.insertBefore(d,l)}}else t.parentNode.removeChild(t);function u(){var n,t=g("h1[id].sect0, .sect1 > h2[id], .sect2 > h3[id]",e=document.querySelector(".article"));if(t.some((function(e){if(!(Math.floor(e.getBoundingClientRect().top)<=0))return!0;n="#"+e.id})),n){if(n!==a){a&&i[a].classList.remove("toc-active");var r=i[n];r.classList.add("toc-active"),s.scrollHeight>s.offsetHeight&&(s.scrollTop=Math.max(0,r.offsetTop+r.offsetHeight-s.offsetHeight)),a=n}}else a&&(i[a].classList.remove("toc-active"),a=void 0)}function g(e,n){return b((n||document).querySelectorAll(e))}function b(e){return[].slice.call(e)}}(),function(){const e=document.querySelector(".sidr-toggle"),n=document.querySelector("#sidr"),t=document.querySelector(".close-menu-btn");e.addEventListener("click",(function(e){n.classList.toggle("toggled")})),t.addEventListener("click",(function(e){n.classList.toggle("toggled")}));document.querySelectorAll(".collapse-toggle").forEach((function(e){const n=()=>e.classList.toggle("toggled");e.addEventListener("click",n);const t=[...e.parentElement.children].find((e=>e.matches("span.nav-link")));t?.addEventListener("click",n)}))}(),function(){window.addEventListener("click",(e=>{event.target.classList.contains("hardhat-truffle-toggle")&&(!function(){const e=s(),n="hardhat"===e?"truffle":"hardhat";document.body.classList.replace(`preference-${e}`,`preference-${n}`),a(n),function(e){const n=new URL(document.location),t=new URLSearchParams(n.search);t.set("pref",e),n.search=t.toString(),history.replaceState(null,"",[n])}(n)}(),e.preventDefault())}));const e="hardhat_truffle_preference",n="pref",t="hardhat";function a(n){document.cookie=`${e}=${n};path=/;max-age=31536000`}function s(){const a=new URLSearchParams(document.location.search).get(n)||function(){const n=document.cookie.split("; ").find((n=>n.startsWith(`${e}=`)));return n&&n.split("=")[1]}();return"hardhat"===a||"truffle"===a?a:t}const i=s();a(i),document.body.classList.add(`preference-${i}`)}(),function(){const e=["console","shell","sh","bash"];function n(n){let t=n.target.parentElement.innerText;const a=n.target.parentElement.querySelector("[data-lang]"),s=a?.dataset?.lang;e.includes(s)&&(t=t.replace(/\$ /gm,"")),navigator.clipboard.writeText(t)}var t;t=()=>{for(const e of document.querySelectorAll(".listingblock")){const t=document.createElement("button");t.classList.add("btn-icon","btn-copy","hljs"),t.setAttribute("aria-label","Copy"),t.innerHTML='',t.addEventListener("click",n),e.prepend(t)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}();class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}const s=e=>!!e.scope;class i{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!s(e))return;const n=((e,{prefix:n})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const t=e.split(".");return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")}return`${n}${e}`})(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}const r=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class o{constructor(){this.rootNode=r(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=r({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{o._collapse(e)})))}}class c extends o{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const t=e.root;n&&(t.scope=`language:${n}`),this.add(t)}toHTML(){return new i(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function l(e){return e?"string"==typeof e?e:e.source:null}function d(e){return b("(?=",e,")")}function u(e){return b("(?:",e,")*")}function g(e){return b("(?:",e,")?")}function b(...e){return e.map((e=>l(e))).join("")}function m(...e){const n=function(e){const n=e[e.length-1];return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}(e);return"("+(n.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"}function h(e){return new RegExp(e.toString()+"|").exec("").length-1}const f=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function p(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t;let a=l(e),s="";for(;a.length>0;){const e=f.exec(a);if(!e){s+=a;break}s+=a.substring(0,e.index),a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+String(Number(e[1])+n):(s+=e[0],"("===e[0]&&t++)}return s})).map((e=>`(${e})`)).join(n)}const E="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",w={begin:"\\\\[\\s\\S]",relevance:0},x={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[w]},S={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[w]},O=function(e,n,t={}){const s=a({scope:"comment",begin:e,end:n,contains:[]},t);s.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return s.contains.push({begin:b(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},A=O("//","$"),M=O("/\\*","\\*/"),k=O("#","$"),C={scope:"number",begin:y,relevance:0},R={scope:"number",begin:N,relevance:0},T={scope:"number",begin:v,relevance:0},L={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[w,{begin:/\[/,end:/\]/,relevance:0,contains:[w]}]},I={scope:"title",begin:E,relevance:0},D={scope:"title",begin:_,relevance:0},B={begin:"\\.\\s*"+_,relevance:0};var $=Object.freeze({__proto__:null,APOS_STRING_MODE:x,BACKSLASH_ESCAPE:w,BINARY_NUMBER_MODE:T,BINARY_NUMBER_RE:v,COMMENT:O,C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:A,C_NUMBER_MODE:R,C_NUMBER_RE:N,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:k,IDENT_RE:E,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:B,NUMBER_MODE:C,NUMBER_RE:y,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:S,REGEXP_MODE:L,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=b(n,/.*\b/,e.binary,/\b.*/)),a({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},TITLE_MODE:I,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:D});function j(e,n){"."===e.input[e.index-1]&&n.ignoreMatch()}function z(e,n){void 0!==e.className&&(e.scope=e.className,delete e.className)}function P(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=j,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,n){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function H(e,n){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Z(e,n){void 0===e.relevance&&(e.relevance=1)}const F=(e,n)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]})),e.keywords=t.keywords,e.begin=b(t.beforeMatch,d(t.begin)),e.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},e.relevance=0,delete t.beforeMatch},K=["of","and","for","in","not","or","if","then","parent","list","value"];function G(e,n,t="keyword"){const a=Object.create(null);return"string"==typeof e?s(t,e.split(" ")):Array.isArray(e)?s(t,e):Object.keys(e).forEach((function(t){Object.assign(a,G(e[t],n,t))})),a;function s(e,t){n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((function(n){const t=n.split("|");a[t[0]]=[e,q(t[0],t[1])]}))}}function q(e,n){return n?Number(n):function(e){return K.includes(e.toLowerCase())}(e)?0:1}const W={},X=e=>{console.error(e)},Q=(e,...n)=>{console.log(`WARN: ${e}`,...n)},J=(e,n)=>{W[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),W[`${e}/${n}`]=!0)},V=new Error;function Y(e,n,{key:t}){let a=0;const s=e[t],i={},r={};for(let e=1;e<=n.length;e++)r[e+a]=s[e],i[e+a]=!0,a+=h(n[e-1]);e[t]=r,e[t]._emit=i,e[t]._multi=!0}function ee(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw X("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),V;if("object"!=typeof e.beginScope||null===e.beginScope)throw X("beginScope must be object"),V;Y(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw X("skip, excludeEnd, returnEnd not compatible with endScope: {}"),V;if("object"!=typeof e.endScope||null===e.endScope)throw X("endScope must be object"),V;Y(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}}(e)}function ne(e){function n(n,t){return new RegExp(l(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,n){n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),this.matchAt+=h(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=n(p(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const n=this.matcherRe.exec(e);if(!n)return null;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t];return n.splice(0,t),Object.assign(n,a)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex;let t=n.exec(e);if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}return t&&(this.regexIndex+=t.position+1,this.regexIndex===this.count&&this.considerAll()),t}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),function t(i,r){const o=i;if(i.isCompiled)return o;[z,H,ee,F].forEach((e=>e(i,r))),e.compilerExtensions.forEach((e=>e(i,r))),i.__beforeBegin=null,[P,U,Z].forEach((e=>e(i,r))),i.isCompiled=!0;let c=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),c=i.keywords.$pattern,delete i.keywords.$pattern),c=c||/\w+/,i.keywords&&(i.keywords=G(i.keywords,e.case_insensitive)),o.keywordPatternRe=n(c,!0),r&&(i.begin||(i.begin=/\B|\b/),o.beginRe=n(o.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(o.endRe=n(o.end)),o.terminatorEnd=l(o.end)||"",i.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(i.end?"|":"")+r.terminatorEnd)),i.illegal&&(o.illegalRe=n(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(n){return a(e,{variants:null},n)})));if(e.cachedVariants)return e.cachedVariants;if(te(e))return a(e,{starts:e.starts?a(e.starts):null});if(Object.isFrozen(e))return a(e);return e}("self"===e?i:e)}))),i.contains.forEach((function(e){t(e,o)})),i.starts&&t(i.starts,r),o.matcher=function(e){const n=new s;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n}(o),o}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}class ae extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const se=t,ie=a,re=Symbol("nomatch"),oe=function(t){const a=Object.create(null),s=Object.create(null),i=[];let r=!0;const o="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let h={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function f(e){return h.noHighlightRe.test(e)}function p(e,n,t){let a="",s="";"object"==typeof n?(a=e,t=n.ignoreIllegals,s=n.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),s=e,a=n),void 0===t&&(t=!0);const i={code:a,language:s};O("before:highlight",i);const r=i.result?i.result:E(i.language,i.code,t);return r.code=i.code,O("after:highlight",r),r}function E(e,t,s,i){const c=Object.create(null);function l(){if(!O.keywords)return void M.addText(k);let e=0;O.keywordPatternRe.lastIndex=0;let n=O.keywordPatternRe.exec(k),t="";for(;n;){t+=k.substring(e,n.index);const s=v.case_insensitive?n[0].toLowerCase():n[0],i=(a=s,O.keywords[a]);if(i){const[e,a]=i;if(M.addText(t),t="",c[s]=(c[s]||0)+1,c[s]<=7&&(C+=a),e.startsWith("_"))t+=n[0];else{const t=v.classNameAliases[e]||e;u(n[0],t)}}else t+=n[0];e=O.keywordPatternRe.lastIndex,n=O.keywordPatternRe.exec(k)}var a;t+=k.substring(e),M.addText(t)}function d(){null!=O.subLanguage?function(){if(""===k)return;let e=null;if("string"==typeof O.subLanguage){if(!a[O.subLanguage])return void M.addText(k);e=E(O.subLanguage,k,!0,A[O.subLanguage]),A[O.subLanguage]=e._top}else e=_(k,O.subLanguage.length?O.subLanguage:null);O.relevance>0&&(C+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():l(),k=""}function u(e,n){""!==e&&(M.startScope(n),M.addText(e),M.endScope())}function g(e,n){let t=1;const a=n.length-1;for(;t<=a;){if(!e._emit[t]){t++;continue}const a=v.classNameAliases[e[t]]||e[t],s=n[t];a?u(s,a):(k=s,l(),k=""),t++}}function b(e,n){return e.scope&&"string"==typeof e.scope&&M.openNode(v.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(u(k,v.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),k=""):e.beginScope._multi&&(g(e.beginScope,n),k="")),O=Object.create(e,{parent:{value:O}}),O}function m(e,t,a){let s=function(e,n){const t=e&&e.exec(n);return t&&0===t.index}(e.endRe,a);if(s){if(e["on:end"]){const a=new n(e);e["on:end"](t,a),a.isMatchIgnored&&(s=!1)}if(s){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,a)}function f(e){return 0===O.matcher.regexIndex?(k+=e[0],1):(L=!0,0)}function p(e){const n=e[0],a=t.substring(e.index),s=m(O,e,a);if(!s)return re;const i=O;O.endScope&&O.endScope._wrap?(d(),u(n,O.endScope._wrap)):O.endScope&&O.endScope._multi?(d(),g(O.endScope,e)):i.skip?k+=n:(i.returnEnd||i.excludeEnd||(k+=n),d(),i.excludeEnd&&(k=n));do{O.scope&&M.closeNode(),O.skip||O.subLanguage||(C+=O.relevance),O=O.parent}while(O!==s.parent);return s.starts&&b(s.starts,e),i.returnEnd?0:n.length}let y={};function N(a,i){const o=i&&i[0];if(k+=a,null==o)return d(),0;if("begin"===y.type&&"end"===i.type&&y.index===i.index&&""===o){if(k+=t.slice(i.index,i.index+1),!r){const n=new Error(`0 width match regex (${e})`);throw n.languageName=e,n.badRule=y.rule,n}return 1}if(y=i,"begin"===i.type)return function(e){const t=e[0],a=e.rule,s=new n(a),i=[a.__beforeBegin,a["on:begin"]];for(const n of i)if(n&&(n(e,s),s.isMatchIgnored))return f(t);return a.skip?k+=t:(a.excludeBegin&&(k+=t),d(),a.returnBegin||a.excludeBegin||(k=t)),b(a,e),a.returnBegin?0:t.length}(i);if("illegal"===i.type&&!s){const e=new Error('Illegal lexeme "'+o+'" for mode "'+(O.scope||"")+'"');throw e.mode=O,e}if("end"===i.type){const e=p(i);if(e!==re)return e}if("illegal"===i.type&&""===o)return 1;if(T>1e5&&T>3*i.index){throw new Error("potential infinite loop, way more iterations than matches")}return k+=o,o.length}const v=w(e);if(!v)throw X(o.replace("{}",e)),new Error('Unknown language: "'+e+'"');const x=ne(v);let S="",O=i||x;const A={},M=new h.__emitter(h);!function(){const e=[];for(let n=O;n!==v;n=n.parent)n.scope&&e.unshift(n.scope);e.forEach((e=>M.openNode(e)))}();let k="",C=0,R=0,T=0,L=!1;try{if(v.__emitTokens)v.__emitTokens(t,M);else{for(O.matcher.considerAll();;){T++,L?L=!1:O.matcher.considerAll(),O.matcher.lastIndex=R;const e=O.matcher.exec(t);if(!e)break;const n=N(t.substring(R,e.index),e);R=e.index+n}N(t.substring(R))}return M.finalize(),S=M.toHTML(),{language:e,value:S,relevance:C,illegal:!1,_emitter:M,_top:O}}catch(n){if(n.message&&n.message.includes("Illegal"))return{language:e,value:se(t),illegal:!0,relevance:0,_illegalBy:{message:n.message,index:R,context:t.slice(R-100,R+100),mode:n.mode,resultSoFar:S},_emitter:M};if(r)return{language:e,value:se(t),illegal:!1,relevance:0,errorRaised:n,_emitter:M,_top:O};throw n}}function _(e,n){n=n||h.languages||Object.keys(a);const t=function(e){const n={value:se(e),illegal:!1,relevance:0,_top:l,_emitter:new h.__emitter(h)};return n._emitter.addText(e),n}(e),s=n.filter(w).filter(S).map((n=>E(n,e,!1)));s.unshift(t);const i=s.sort(((e,n)=>{if(e.relevance!==n.relevance)return n.relevance-e.relevance;if(e.language&&n.language){if(w(e.language).supersetOf===n.language)return 1;if(w(n.language).supersetOf===e.language)return-1}return 0})),[r,o]=i,c=r;return c.secondBest=o,c}function y(e){let n=null;const t=function(e){let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"";const t=h.languageDetectRe.exec(n);if(t){const n=w(t[1]);return n||(Q(o.replace("{}",t[1])),Q("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}return n.split(/\s+/).find((e=>f(e)||w(e)))}(e);if(f(t))return;if(O("before:highlightElement",{el:e,language:t}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(h.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),h.throwUnescapedHTML)){throw new ae("One of your code blocks includes unescaped HTML.",e.innerHTML)}n=e;const a=n.textContent,i=t?p(a,{language:t,ignoreIllegals:!0}):_(a);e.innerHTML=i.value,e.dataset.highlighted="yes",function(e,n,t){const a=n&&s[n]||t;e.classList.add("hljs"),e.classList.add(`language-${a}`)}(e,t,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),O("after:highlightElement",{el:e,result:i,text:a})}let N=!1;function v(){if("loading"===document.readyState)return void(N=!0);document.querySelectorAll(h.cssSelector).forEach(y)}function w(e){return e=(e||"").toLowerCase(),a[e]||a[s[e]]}function x(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{s[e.toLowerCase()]=n}))}function S(e){const n=w(e);return n&&!n.disableAutodetect}function O(e,n){const t=e;i.forEach((function(e){e[t]&&e[t](n)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){N&&v()}),!1),Object.assign(t,{highlight:p,highlightAuto:_,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){h=ie(h,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(e,n){let s=null;try{s=n(t)}catch(n){if(X("Language definition for '{}' could not be registered.".replace("{}",e)),!r)throw n;X(n),s=l}s.name||(s.name=e),a[e]=s,s.rawDefinition=n.bind(null,t),s.aliases&&x(s.aliases,{languageName:e})},unregisterLanguage:function(e){delete a[e];for(const n of Object.keys(s))s[n]===e&&delete s[n]},listLanguages:function(){return Object.keys(a)},getLanguage:w,registerAliases:x,autoDetection:S,inherit:ie,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{e["before:highlightBlock"](Object.assign({block:n.el},n))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{e["after:highlightBlock"](Object.assign({block:n.el},n))})}(e),i.push(e)},removePlugin:function(e){const n=i.indexOf(e);-1!==n&&i.splice(n,1)}}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString="11.10.0",t.regex={concat:b,lookahead:d,either:m,optional:g,anyNumberOfTimes:u};for(const n in $)"object"==typeof $[n]&&e($[n]);return Object.assign(t,$),t},ce=oe({});ce.newInstance=()=>oe({});var le=ce;ce.HighlightJS=ce,ce.default=ce;var de=function(e){const n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},t={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},s={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},i=e.inherit(a,{contains:[]}),r=e.inherit(s,{contains:[]});a.contains.push(r),s.contains.push(i);let o=[n,t];return[a,s,i,r].forEach((e=>{e.contains=e.contains.concat(o)})),o=o.concat(a,s),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:o},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:o}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a,s,{className:"quote",begin:"^>\\s+",contains:o,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},t,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}};const ue="[A-Za-z$_][0-9A-Za-z$_]*",ge=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],be=["true","false","null","undefined","NaN","Infinity"],me=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],he=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],pe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ee=[].concat(fe,me,he);var _e=function(e){const n=e.regex,t=ue,a="<>",s="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const t=e[0].length+e.index,a=e.input[t];if("<"===a||","===a)return void n.ignoreMatch();let s;">"===a&&(((e,{after:n})=>{const t="`${e}\\s*\\(`)),n.concat("(?!",S.join("|"),")")),t,n.lookahead(/\s*\(/)),className:"title.function",relevance:0};var S;const O={begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},y]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[y]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,b,m,h,f,{match:/\$\d+/},d,v,{className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:M,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:s},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[y,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[y]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},N,A,{match:/\$[(.]/}]}};const ye="[A-Za-z$_][0-9A-Za-z$_]*",Ne=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],ve=["true","false","null","undefined","NaN","Infinity"],we=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],xe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Se=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Oe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ae=[].concat(Se,we,xe);function Me(e){const n=e.regex,t=ye,a="<>",s="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const t=e[0].length+e.index,a=e.input[t];if("<"===a||","===a)return void n.ignoreMatch();let s;">"===a&&(((e,{after:n})=>{const t="`${e}\\s*\\(`)),n.concat("(?!",S.join("|"),")")),t,n.lookahead(/\s*\(/)),className:"title.function",relevance:0};var S;const O={begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},y]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[y]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,b,m,h,f,{match:/\$\d+/},d,v,{className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:M,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:s},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[y,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[y]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},N,A,{match:/\$[(.]/}]}}var ke=function(e){const n=Me(e),t=ye,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[n.exports.CLASS_REFERENCE]},r={$pattern:ye,keyword:Ne.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:ve,built_in:Ae.concat(a),"variable.language":Oe},o={className:"meta",begin:"@"+t},c=(e,n,t)=>{const a=e.contains.findIndex((e=>e.label===n));if(-1===a)throw new Error("can not find mode to replace");e.contains.splice(a,1,t)};Object.assign(n.keywords,r),n.exports.PARAMS_CONTAINS.push(o);const l=n.contains.find((e=>"attr"===e.className));return n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,l]),n.contains=n.contains.concat([o,s,i]),c(n,"shebang",e.SHEBANG()),c(n,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n};var Ce=function(e){const n=["true","false","null"],t={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}};var Re=function(e){const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}};var Te=function(e){const n=e.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},i={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},o={begin:/\{\{/,relevance:0},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i,o,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i,o,r]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,o,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,o,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l="[0-9](_?[0-9])*",d=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,u=`\\b|${a.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${l})|(${d}))[eE][+-]?(${l})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${l})[jJ](?=${u})`}]},b={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",i,g,c,e.HASH_COMMENT_MODE]}]};return r.contains=[c,g,i],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[i,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},c,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,c]}]}};var Le=function(e){const n=e.regex,t=/(r#)?/,a=n.concat(t,e.UNDERSCORE_IDENT_RE),s=n.concat(t,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,n.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",o=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:c,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:o},illegal:""},i]}};var Ie=function(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}};var De=function(e){const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(s,{begin:/\(/,end:/\)/}),r=e.inherit(e.APOS_STRING_MODE,{className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,o,r,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,i,o,r]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}},Be={exports:{}};function $e(){try{return new RegExp("(?/};return{keywords:Pe,lexemes:a,contains:[n,t,Ue,He,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,ze,r,{className:"function",lexemes:a,beginKeywords:"function",end:"{",excludeEnd:!0,contains:[s,i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,r]}]}},solAposStringMode:Ze,solQuoteStringMode:Fe,HEX_APOS_STRING_MODE:Ue,HEX_QUOTE_STRING_MODE:He,SOL_NUMBER:ze,isNegativeLookbehindAvailable:$e};const{baseAssembly:Ge,solAposStringMode:qe,solQuoteStringMode:We,HEX_APOS_STRING_MODE:Xe,HEX_QUOTE_STRING_MODE:Qe,SOL_NUMBER:Je,isNegativeLookbehindAvailable:Ve}=Ke;var Ye=function(e){for(var n=qe(e),t=We(e),a=[],s=0;s<32;s++)a[s]=s+1;var i=a.map((function(e){return 8*e})),r=[];for(s=0;s<=80;s++)r[s]=s;var o=a.map((function(e){return"bytes"+e})).join(" ")+" ",c=i.map((function(e){return"uint"+e})).join(" ")+" ",l=i.map((function(e){return"int"+e})).join(" ")+" ",d=[].concat.apply([],i.map((function(e){return r.map((function(n){return e+"x"+n}))}))),u={keyword:"var bool string int uint "+l+c+"byte bytes "+o+"fixed ufixed "+(d.map((function(e){return"fixed"+e})).join(" ")+" ")+(d.map((function(e){return"ufixed"+e})).join(" ")+" ")+"enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using global pragma contract interface library is abstract type assembly",literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years",built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4"},g={className:"operator",begin:/[+\-!~*\/%<>&^|=]/},b=/[A-Za-z_$][A-Za-z_$0-9]*/,m={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:b,keywords:u,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n,t,Je,"self"]},h={begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max"},relevance:2},f=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:b,keywords:u}),p="("+["gas","value","salt"].join("|")+")(?=:)",E={className:"built_in",begin:(Ve()?"(?"}]}};var ln=function(e){const n=cn(e);if("object"!=typeof n.keywords)throw Error("Expected object");const t={keyword:["break","const","continue","else","enum","false","for","fn","hint","if","impl","in","match","pub","return","struct","trait","true","type","use","as","assert","do","dyn","extern","let","macro","mod","move","ref","static_assert","static","super","try","typeof","unsafe","where","while","with","yield"].join(" "),literal:["true","false"].join(" "),type:["bool","u8","u16","u32","u64","u128","u256","usize"].join(" ")};return Object.assign(n.keywords,t),Object.assign(n.contains,[...n.contains,{className:"built_in",begin:"selector!"},{className:"built_in",begin:"component!"},{className:"class",beginKeywords:"mod",end:"{",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})]},{className:"class",beginKeywords:"impl",end:";",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})]},{beginKeywords:"let",end:";",contains:[e.inherit({className:"variable",begin:e.UNDERSCORE_IDENT_RE,relevance:0},{endsParent:!0})]}]),Object.assign(n,{name:"Cairo",aliases:["cairo"]}),n};const dn=ln;on.exports=function(e){e.registerLanguage("cairo",dn)},on.exports.cairo=dn;const un=le;un.registerLanguage("markdown",de),un.registerLanguage("javascript",_e),un.registerLanguage("typescript",ke),un.registerLanguage("json",Ce),un.registerLanguage("diff",Re),un.registerLanguage("python",Te),un.registerLanguage("rust",Le),un.registerLanguage("shell",Ie),un.registerLanguage("xml",De),Be.exports(un),on.exports(un),un.initHighlightingOnLoad(),window.addEventListener("load",(function(){const e=document.getElementById("version-selector");e?.addEventListener("click",(function(){e.focus()}))})),window.addEventListener("load",(function(){document.getElementById("copyright-date").innerHTML=(new Date).getFullYear()}))}(); +!function(){"use strict";function e(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach((t=>{const a=n[t],s=typeof a;"object"!==s&&"function"!==s||Object.isFrozen(a)||e(a)})),n}(()=>{const e=document.querySelectorAll(".js-version");for(let n=0;ne.stopPropagation())),e[n].addEventListener("change",(e=>window.location.href=e.target.value))})(),function(){var e,n,t=document.querySelector("main .article-wrapper > .toc-sidebar");if(t)if(!document.querySelector(".body.ui-toc")&&(n=g("h1[id].sect0, .sect1 > h2[id]",e=document.querySelector(".article"))).length){var a,s,i={},r=n.reduce((function(e,n){var t=b(g("h3",n.parentNode)),a=document.createElement("ul");function s(e){const n=b(e.childNodes).reduce((function(e,n){return"A"!==n.nodeName&&e.appendChild(n.cloneNode(!0)),e}),document.createElement("a"));return i[n.href="#"+e.id]=n,n}a.classList.add("subheading-list"),t.map((e=>{var n=document.createElement("li");n.classList.add("subheading-item");var t=s(e);n.appendChild(t),a.appendChild(n)}));var r=s(n),o=document.createElement("li");return o.appendChild(r),t.length&&o.appendChild(a),e.appendChild(o),e}),document.createElement("ul"));(s=t&&t.querySelector(".toc-menu"))||((s=document.createElement("div")).className="toc-menu");var o=document.createElement("h3");o.classList.add("toc-title");var c=document.querySelector("main .article-wrapper h1");o.textContent=c?.textContent||"On This Page",s.appendChild(o),s.appendChild(r),t&&window.addEventListener("load",(function(){u(),window.addEventListener("scroll",u)}));var l=e.querySelector("h1.page ~ :not(.labels)");if(l){var d=document.createElement("div");d.className="toc embedded",d.appendChild(s.cloneNode(!0)),e.insertBefore(d,l)}}else t.parentNode.removeChild(t);function u(){var n,t=g("h1[id].sect0, .sect1 > h2[id], .sect2 > h3[id]",e=document.querySelector(".article"));if(t.some((function(e){if(!(Math.floor(e.getBoundingClientRect().top)<=0))return!0;n="#"+e.id})),n){if(n!==a){a&&i[a].classList.remove("toc-active");var r=i[n];r.classList.add("toc-active"),s.scrollHeight>s.offsetHeight&&(s.scrollTop=Math.max(0,r.offsetTop+r.offsetHeight-s.offsetHeight)),a=n}}else a&&(i[a].classList.remove("toc-active"),a=void 0)}function g(e,n){return b((n||document).querySelectorAll(e))}function b(e){return[].slice.call(e)}}(),function(){const e=document.querySelector(".sidr-toggle"),n=document.querySelector("#sidr"),t=document.querySelector(".close-menu-btn");e.addEventListener("click",(function(e){n.classList.toggle("toggled")})),t.addEventListener("click",(function(e){n.classList.toggle("toggled")}));document.querySelectorAll(".collapse-toggle").forEach((function(e){const n=()=>e.classList.toggle("toggled");e.addEventListener("click",n);const t=[...e.parentElement.children].find((e=>e.matches("span.nav-link")));t?.addEventListener("click",n)}))}(),function(){window.addEventListener("click",(e=>{event.target.classList.contains("hardhat-truffle-toggle")&&(!function(){const e=s(),n="hardhat"===e?"truffle":"hardhat";document.body.classList.replace(`preference-${e}`,`preference-${n}`),a(n),function(e){const n=new URL(document.location),t=new URLSearchParams(n.search);t.set("pref",e),n.search=t.toString(),history.replaceState(null,"",[n])}(n)}(),e.preventDefault())}));const e="hardhat_truffle_preference",n="pref",t="hardhat";function a(n){document.cookie=`${e}=${n};path=/;max-age=31536000`}function s(){const a=new URLSearchParams(document.location.search).get(n)||function(){const n=document.cookie.split("; ").find((n=>n.startsWith(`${e}=`)));return n&&n.split("=")[1]}();return"hardhat"===a||"truffle"===a?a:t}const i=s();a(i),document.body.classList.add(`preference-${i}`)}(),function(){const e=["console","shell","sh","bash"];function n(n){let t=n.target.parentElement.innerText;const a=n.target.parentElement.querySelector("[data-lang]"),s=a?.dataset?.lang;e.includes(s)&&(t=t.replace(/\$ /gm,"")),navigator.clipboard.writeText(t)}var t;t=()=>{for(const e of document.querySelectorAll(".listingblock")){const t=document.createElement("button");t.classList.add("btn-icon","btn-copy","hljs"),t.setAttribute("aria-label","Copy"),t.innerHTML='',t.addEventListener("click",n),e.prepend(t)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}();class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}const s=e=>!!e.scope;class i{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!s(e))return;const n=((e,{prefix:n})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const t=e.split(".");return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")}return`${n}${e}`})(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}const r=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class o{constructor(){this.rootNode=r(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=r({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{o._collapse(e)})))}}class c extends o{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const t=e.root;n&&(t.scope=`language:${n}`),this.add(t)}toHTML(){return new i(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function l(e){return e?"string"==typeof e?e:e.source:null}function d(e){return b("(?=",e,")")}function u(e){return b("(?:",e,")*")}function g(e){return b("(?:",e,")?")}function b(...e){return e.map((e=>l(e))).join("")}function m(...e){const n=function(e){const n=e[e.length-1];return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}(e);return"("+(n.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"}function h(e){return new RegExp(e.toString()+"|").exec("").length-1}const f=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function p(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t;let a=l(e),s="";for(;a.length>0;){const e=f.exec(a);if(!e){s+=a;break}s+=a.substring(0,e.index),a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+String(Number(e[1])+n):(s+=e[0],"("===e[0]&&t++)}return s})).map((e=>`(${e})`)).join(n)}const E="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",w={begin:"\\\\[\\s\\S]",relevance:0},x={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[w]},S={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[w]},O=function(e,n,t={}){const s=a({scope:"comment",begin:e,end:n,contains:[]},t);s.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return s.contains.push({begin:b(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},A=O("//","$"),M=O("/\\*","\\*/"),k=O("#","$"),C={scope:"number",begin:y,relevance:0},R={scope:"number",begin:N,relevance:0},T={scope:"number",begin:v,relevance:0},L={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[w,{begin:/\[/,end:/\]/,relevance:0,contains:[w]}]},I={scope:"title",begin:E,relevance:0},D={scope:"title",begin:_,relevance:0},B={begin:"\\.\\s*"+_,relevance:0};var $=Object.freeze({__proto__:null,APOS_STRING_MODE:x,BACKSLASH_ESCAPE:w,BINARY_NUMBER_MODE:T,BINARY_NUMBER_RE:v,COMMENT:O,C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:A,C_NUMBER_MODE:R,C_NUMBER_RE:N,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:k,IDENT_RE:E,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:B,NUMBER_MODE:C,NUMBER_RE:y,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:S,REGEXP_MODE:L,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=b(n,/.*\b/,e.binary,/\b.*/)),a({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},TITLE_MODE:I,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:D});function j(e,n){"."===e.input[e.index-1]&&n.ignoreMatch()}function z(e,n){void 0!==e.className&&(e.scope=e.className,delete e.className)}function P(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=j,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,n){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function Z(e,n){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function H(e,n){void 0===e.relevance&&(e.relevance=1)}const F=(e,n)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]})),e.keywords=t.keywords,e.begin=b(t.beforeMatch,d(t.begin)),e.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},e.relevance=0,delete t.beforeMatch},K=["of","and","for","in","not","or","if","then","parent","list","value"];function G(e,n,t="keyword"){const a=Object.create(null);return"string"==typeof e?s(t,e.split(" ")):Array.isArray(e)?s(t,e):Object.keys(e).forEach((function(t){Object.assign(a,G(e[t],n,t))})),a;function s(e,t){n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((function(n){const t=n.split("|");a[t[0]]=[e,q(t[0],t[1])]}))}}function q(e,n){return n?Number(n):function(e){return K.includes(e.toLowerCase())}(e)?0:1}const W={},X=e=>{console.error(e)},Q=(e,...n)=>{console.log(`WARN: ${e}`,...n)},J=(e,n)=>{W[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),W[`${e}/${n}`]=!0)},V=new Error;function Y(e,n,{key:t}){let a=0;const s=e[t],i={},r={};for(let e=1;e<=n.length;e++)r[e+a]=s[e],i[e+a]=!0,a+=h(n[e-1]);e[t]=r,e[t]._emit=i,e[t]._multi=!0}function ee(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw X("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),V;if("object"!=typeof e.beginScope||null===e.beginScope)throw X("beginScope must be object"),V;Y(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw X("skip, excludeEnd, returnEnd not compatible with endScope: {}"),V;if("object"!=typeof e.endScope||null===e.endScope)throw X("endScope must be object"),V;Y(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}}(e)}function ne(e){function n(n,t){return new RegExp(l(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,n){n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),this.matchAt+=h(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=n(p(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const n=this.matcherRe.exec(e);if(!n)return null;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t];return n.splice(0,t),Object.assign(n,a)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex;let t=n.exec(e);if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}return t&&(this.regexIndex+=t.position+1,this.regexIndex===this.count&&this.considerAll()),t}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),function t(i,r){const o=i;if(i.isCompiled)return o;[z,Z,ee,F].forEach((e=>e(i,r))),e.compilerExtensions.forEach((e=>e(i,r))),i.__beforeBegin=null,[P,U,H].forEach((e=>e(i,r))),i.isCompiled=!0;let c=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),c=i.keywords.$pattern,delete i.keywords.$pattern),c=c||/\w+/,i.keywords&&(i.keywords=G(i.keywords,e.case_insensitive)),o.keywordPatternRe=n(c,!0),r&&(i.begin||(i.begin=/\B|\b/),o.beginRe=n(o.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(o.endRe=n(o.end)),o.terminatorEnd=l(o.end)||"",i.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(i.end?"|":"")+r.terminatorEnd)),i.illegal&&(o.illegalRe=n(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(n){return a(e,{variants:null},n)})));if(e.cachedVariants)return e.cachedVariants;if(te(e))return a(e,{starts:e.starts?a(e.starts):null});if(Object.isFrozen(e))return a(e);return e}("self"===e?i:e)}))),i.contains.forEach((function(e){t(e,o)})),i.starts&&t(i.starts,r),o.matcher=function(e){const n=new s;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n}(o),o}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}class ae extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const se=t,ie=a,re=Symbol("nomatch"),oe=function(t){const a=Object.create(null),s=Object.create(null),i=[];let r=!0;const o="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let h={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function f(e){return h.noHighlightRe.test(e)}function p(e,n,t){let a="",s="";"object"==typeof n?(a=e,t=n.ignoreIllegals,s=n.language):(J("10.7.0","highlight(lang, code, ...args) has been deprecated."),J("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),s=e,a=n),void 0===t&&(t=!0);const i={code:a,language:s};O("before:highlight",i);const r=i.result?i.result:E(i.language,i.code,t);return r.code=i.code,O("after:highlight",r),r}function E(e,t,s,i){const c=Object.create(null);function l(){if(!O.keywords)return void M.addText(k);let e=0;O.keywordPatternRe.lastIndex=0;let n=O.keywordPatternRe.exec(k),t="";for(;n;){t+=k.substring(e,n.index);const s=v.case_insensitive?n[0].toLowerCase():n[0],i=(a=s,O.keywords[a]);if(i){const[e,a]=i;if(M.addText(t),t="",c[s]=(c[s]||0)+1,c[s]<=7&&(C+=a),e.startsWith("_"))t+=n[0];else{const t=v.classNameAliases[e]||e;u(n[0],t)}}else t+=n[0];e=O.keywordPatternRe.lastIndex,n=O.keywordPatternRe.exec(k)}var a;t+=k.substring(e),M.addText(t)}function d(){null!=O.subLanguage?function(){if(""===k)return;let e=null;if("string"==typeof O.subLanguage){if(!a[O.subLanguage])return void M.addText(k);e=E(O.subLanguage,k,!0,A[O.subLanguage]),A[O.subLanguage]=e._top}else e=_(k,O.subLanguage.length?O.subLanguage:null);O.relevance>0&&(C+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():l(),k=""}function u(e,n){""!==e&&(M.startScope(n),M.addText(e),M.endScope())}function g(e,n){let t=1;const a=n.length-1;for(;t<=a;){if(!e._emit[t]){t++;continue}const a=v.classNameAliases[e[t]]||e[t],s=n[t];a?u(s,a):(k=s,l(),k=""),t++}}function b(e,n){return e.scope&&"string"==typeof e.scope&&M.openNode(v.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(u(k,v.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),k=""):e.beginScope._multi&&(g(e.beginScope,n),k="")),O=Object.create(e,{parent:{value:O}}),O}function m(e,t,a){let s=function(e,n){const t=e&&e.exec(n);return t&&0===t.index}(e.endRe,a);if(s){if(e["on:end"]){const a=new n(e);e["on:end"](t,a),a.isMatchIgnored&&(s=!1)}if(s){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,a)}function f(e){return 0===O.matcher.regexIndex?(k+=e[0],1):(L=!0,0)}function p(e){const n=e[0],a=t.substring(e.index),s=m(O,e,a);if(!s)return re;const i=O;O.endScope&&O.endScope._wrap?(d(),u(n,O.endScope._wrap)):O.endScope&&O.endScope._multi?(d(),g(O.endScope,e)):i.skip?k+=n:(i.returnEnd||i.excludeEnd||(k+=n),d(),i.excludeEnd&&(k=n));do{O.scope&&M.closeNode(),O.skip||O.subLanguage||(C+=O.relevance),O=O.parent}while(O!==s.parent);return s.starts&&b(s.starts,e),i.returnEnd?0:n.length}let y={};function N(a,i){const o=i&&i[0];if(k+=a,null==o)return d(),0;if("begin"===y.type&&"end"===i.type&&y.index===i.index&&""===o){if(k+=t.slice(i.index,i.index+1),!r){const n=new Error(`0 width match regex (${e})`);throw n.languageName=e,n.badRule=y.rule,n}return 1}if(y=i,"begin"===i.type)return function(e){const t=e[0],a=e.rule,s=new n(a),i=[a.__beforeBegin,a["on:begin"]];for(const n of i)if(n&&(n(e,s),s.isMatchIgnored))return f(t);return a.skip?k+=t:(a.excludeBegin&&(k+=t),d(),a.returnBegin||a.excludeBegin||(k=t)),b(a,e),a.returnBegin?0:t.length}(i);if("illegal"===i.type&&!s){const e=new Error('Illegal lexeme "'+o+'" for mode "'+(O.scope||"")+'"');throw e.mode=O,e}if("end"===i.type){const e=p(i);if(e!==re)return e}if("illegal"===i.type&&""===o)return 1;if(T>1e5&&T>3*i.index){throw new Error("potential infinite loop, way more iterations than matches")}return k+=o,o.length}const v=w(e);if(!v)throw X(o.replace("{}",e)),new Error('Unknown language: "'+e+'"');const x=ne(v);let S="",O=i||x;const A={},M=new h.__emitter(h);!function(){const e=[];for(let n=O;n!==v;n=n.parent)n.scope&&e.unshift(n.scope);e.forEach((e=>M.openNode(e)))}();let k="",C=0,R=0,T=0,L=!1;try{if(v.__emitTokens)v.__emitTokens(t,M);else{for(O.matcher.considerAll();;){T++,L?L=!1:O.matcher.considerAll(),O.matcher.lastIndex=R;const e=O.matcher.exec(t);if(!e)break;const n=N(t.substring(R,e.index),e);R=e.index+n}N(t.substring(R))}return M.finalize(),S=M.toHTML(),{language:e,value:S,relevance:C,illegal:!1,_emitter:M,_top:O}}catch(n){if(n.message&&n.message.includes("Illegal"))return{language:e,value:se(t),illegal:!0,relevance:0,_illegalBy:{message:n.message,index:R,context:t.slice(R-100,R+100),mode:n.mode,resultSoFar:S},_emitter:M};if(r)return{language:e,value:se(t),illegal:!1,relevance:0,errorRaised:n,_emitter:M,_top:O};throw n}}function _(e,n){n=n||h.languages||Object.keys(a);const t=function(e){const n={value:se(e),illegal:!1,relevance:0,_top:l,_emitter:new h.__emitter(h)};return n._emitter.addText(e),n}(e),s=n.filter(w).filter(S).map((n=>E(n,e,!1)));s.unshift(t);const i=s.sort(((e,n)=>{if(e.relevance!==n.relevance)return n.relevance-e.relevance;if(e.language&&n.language){if(w(e.language).supersetOf===n.language)return 1;if(w(n.language).supersetOf===e.language)return-1}return 0})),[r,o]=i,c=r;return c.secondBest=o,c}function y(e){let n=null;const t=function(e){let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"";const t=h.languageDetectRe.exec(n);if(t){const n=w(t[1]);return n||(Q(o.replace("{}",t[1])),Q("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}return n.split(/\s+/).find((e=>f(e)||w(e)))}(e);if(f(t))return;if(O("before:highlightElement",{el:e,language:t}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(h.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),h.throwUnescapedHTML)){throw new ae("One of your code blocks includes unescaped HTML.",e.innerHTML)}n=e;const a=n.textContent,i=t?p(a,{language:t,ignoreIllegals:!0}):_(a);e.innerHTML=i.value,e.dataset.highlighted="yes",function(e,n,t){const a=n&&s[n]||t;e.classList.add("hljs"),e.classList.add(`language-${a}`)}(e,t,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),O("after:highlightElement",{el:e,result:i,text:a})}let N=!1;function v(){if("loading"===document.readyState)return void(N=!0);document.querySelectorAll(h.cssSelector).forEach(y)}function w(e){return e=(e||"").toLowerCase(),a[e]||a[s[e]]}function x(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{s[e.toLowerCase()]=n}))}function S(e){const n=w(e);return n&&!n.disableAutodetect}function O(e,n){const t=e;i.forEach((function(e){e[t]&&e[t](n)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){N&&v()}),!1),Object.assign(t,{highlight:p,highlightAuto:_,highlightAll:v,highlightElement:y,highlightBlock:function(e){return J("10.7.0","highlightBlock will be removed entirely in v12.0"),J("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){h=ie(h,e)},initHighlighting:()=>{v(),J("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),J("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(e,n){let s=null;try{s=n(t)}catch(n){if(X("Language definition for '{}' could not be registered.".replace("{}",e)),!r)throw n;X(n),s=l}s.name||(s.name=e),a[e]=s,s.rawDefinition=n.bind(null,t),s.aliases&&x(s.aliases,{languageName:e})},unregisterLanguage:function(e){delete a[e];for(const n of Object.keys(s))s[n]===e&&delete s[n]},listLanguages:function(){return Object.keys(a)},getLanguage:w,registerAliases:x,autoDetection:S,inherit:ie,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{e["before:highlightBlock"](Object.assign({block:n.el},n))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{e["after:highlightBlock"](Object.assign({block:n.el},n))})}(e),i.push(e)},removePlugin:function(e){const n=i.indexOf(e);-1!==n&&i.splice(n,1)}}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString="11.10.0",t.regex={concat:b,lookahead:d,either:m,optional:g,anyNumberOfTimes:u};for(const n in $)"object"==typeof $[n]&&e($[n]);return Object.assign(t,$),t},ce=oe({});ce.newInstance=()=>oe({});var le=ce;ce.HighlightJS=ce,ce.default=ce;var de=function(e){const n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},t={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},s={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},i=e.inherit(a,{contains:[]}),r=e.inherit(s,{contains:[]});a.contains.push(r),s.contains.push(i);let o=[n,t];return[a,s,i,r].forEach((e=>{e.contains=e.contains.concat(o)})),o=o.concat(a,s),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:o},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:o}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a,s,{className:"quote",begin:"^>\\s+",contains:o,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},t,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}};const ue="[A-Za-z$_][0-9A-Za-z$_]*",ge=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],be=["true","false","null","undefined","NaN","Infinity"],me=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],he=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],pe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ee=[].concat(fe,me,he);var _e=function(e){const n=e.regex,t=ue,a="<>",s="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const t=e[0].length+e.index,a=e.input[t];if("<"===a||","===a)return void n.ignoreMatch();let s;">"===a&&(((e,{after:n})=>{const t="`${e}\\s*\\(`)),n.concat("(?!",S.join("|"),")")),t,n.lookahead(/\s*\(/)),className:"title.function",relevance:0};var S;const O={begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},y]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[y]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,b,m,h,f,{match:/\$\d+/},d,v,{className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:M,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:s},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[y,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[y]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},N,A,{match:/\$[(.]/}]}};const ye="[A-Za-z$_][0-9A-Za-z$_]*",Ne=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],ve=["true","false","null","undefined","NaN","Infinity"],we=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],xe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Se=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Oe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ae=[].concat(Se,we,xe);function Me(e){const n=e.regex,t=ye,a="<>",s="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const t=e[0].length+e.index,a=e.input[t];if("<"===a||","===a)return void n.ignoreMatch();let s;">"===a&&(((e,{after:n})=>{const t="`${e}\\s*\\(`)),n.concat("(?!",S.join("|"),")")),t,n.lookahead(/\s*\(/)),className:"title.function",relevance:0};var S;const O={begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},A={match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},y]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[y]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:r,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,b,m,h,f,{match:/\$\d+/},d,v,{className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:M,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a,end:s},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[y,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[y]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},N,A,{match:/\$[(.]/}]}}var ke=function(e){const n=Me(e),t=ye,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[n.exports.CLASS_REFERENCE]},r={$pattern:ye,keyword:Ne.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:ve,built_in:Ae.concat(a),"variable.language":Oe},o={className:"meta",begin:"@"+t},c=(e,n,t)=>{const a=e.contains.findIndex((e=>e.label===n));if(-1===a)throw new Error("can not find mode to replace");e.contains.splice(a,1,t)};Object.assign(n.keywords,r),n.exports.PARAMS_CONTAINS.push(o);const l=n.contains.find((e=>"attr"===e.className));return n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,l]),n.contains=n.contains.concat([o,s,i]),c(n,"shebang",e.SHEBANG()),c(n,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n};var Ce=function(e){const n=["true","false","null"],t={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}};var Re=function(e){const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}};var Te=function(e){const n=e.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},i={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},o={begin:/\{\{/,relevance:0},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i,o,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i,o,r]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,o,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,o,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l="[0-9](_?[0-9])*",d=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,u=`\\b|${a.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${l})|(${d}))[eE][+-]?(${l})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${l})[jJ](?=${u})`}]},b={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",i,g,c,e.HASH_COMMENT_MODE]}]};return r.contains=[c,g,i],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[i,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},c,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,c]}]}};var Le=function(e){const n=e.regex,t=/(r#)?/,a=n.concat(t,e.UNDERSCORE_IDENT_RE),s=n.concat(t,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,n.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",o=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:c,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:o},illegal:""},i]}};var Ie=function(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}};var De=function(e){const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(s,{begin:/\(/,end:/\)/}),r=e.inherit(e.APOS_STRING_MODE,{className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,o,r,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,i,o,r]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}},Be={exports:{}};function $e(){try{return new RegExp("(?/};return{keywords:Pe,lexemes:a,contains:[n,t,Ue,Ze,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,ze,r,{className:"function",lexemes:a,beginKeywords:"function",end:"{",excludeEnd:!0,contains:[s,i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,r]}]}},solAposStringMode:He,solQuoteStringMode:Fe,HEX_APOS_STRING_MODE:Ue,HEX_QUOTE_STRING_MODE:Ze,SOL_NUMBER:ze,isNegativeLookbehindAvailable:$e};const{baseAssembly:Ge,solAposStringMode:qe,solQuoteStringMode:We,HEX_APOS_STRING_MODE:Xe,HEX_QUOTE_STRING_MODE:Qe,SOL_NUMBER:Je,isNegativeLookbehindAvailable:Ve}=Ke;var Ye=function(e){for(var n=qe(e),t=We(e),a=[],s=0;s<32;s++)a[s]=s+1;var i=a.map((function(e){return 8*e})),r=[];for(s=0;s<=80;s++)r[s]=s;var o=a.map((function(e){return"bytes"+e})).join(" ")+" ",c=i.map((function(e){return"uint"+e})).join(" ")+" ",l=i.map((function(e){return"int"+e})).join(" ")+" ",d=[].concat.apply([],i.map((function(e){return r.map((function(n){return e+"x"+n}))}))),u={keyword:"var bool string int uint "+l+c+"byte bytes "+o+"fixed ufixed "+(d.map((function(e){return"fixed"+e})).join(" ")+" ")+(d.map((function(e){return"ufixed"+e})).join(" ")+" ")+"enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using global pragma contract interface library is abstract type assembly",literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years",built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4"},g={className:"operator",begin:/[+\-!~*\/%<>&^|=]/},b=/[A-Za-z_$][A-Za-z_$0-9]*/,m={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:b,keywords:u,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n,t,Je,"self"]},h={begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max"},relevance:2},f=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:b,keywords:u}),p="("+["gas","value","salt"].join("|")+")(?=:)",E={className:"built_in",begin:(Ve()?"(?"}]}};var ln=function(e){const n=cn(e);if("object"!=typeof n.keywords)throw Error("Expected object");const t={keyword:["break","const","continue","else","enum","false","for","fn","hint","if","impl","in","match","pub","return","struct","trait","true","type","use","as","assert","do","dyn","extern","let","macro","mod","move","ref","static_assert","static","super","try","typeof","unsafe","where","while","with","yield"].join(" "),literal:["true","false"].join(" "),type:["bool","u8","u16","u32","u64","u128","u256","usize"].join(" ")};return Object.assign(n.keywords,t),Object.assign(n.contains,[...n.contains,{className:"built_in",begin:"selector!"},{className:"built_in",begin:"component!"},{className:"class",beginKeywords:"mod",end:"{",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})]},{className:"class",beginKeywords:"impl",end:";",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})]},{beginKeywords:"let",end:";",contains:[e.inherit({className:"variable",begin:e.UNDERSCORE_IDENT_RE,relevance:0},{endsParent:!0})]}]),Object.assign(n,{name:"Cairo",aliases:["cairo"]}),n};const dn=ln;on.exports=function(e){e.registerLanguage("cairo",dn)},on.exports.cairo=dn;const un=le;un.registerLanguage("markdown",de),un.registerLanguage("javascript",_e),un.registerLanguage("typescript",ke),un.registerLanguage("json",Ce),un.registerLanguage("diff",Re),un.registerLanguage("python",Te),un.registerLanguage("rust",Le),un.registerLanguage("shell",Ie),un.registerLanguage("xml",De),Be.exports(un),on.exports(un),un.highlightAll(),window.addEventListener("load",(function(){const e=document.getElementById("version-selector");e?.addEventListener("click",(function(){e.focus()}))})),window.addEventListener("load",(function(){document.getElementById("copyright-date").innerHTML=(new Date).getFullYear()}))}(); //# sourceMappingURL=index.js.map diff --git a/ui/theme/dist/index.js.map b/ui/theme/dist/index.js.map index e47c649a..d9324824 100644 --- a/ui/theme/dist/index.js.map +++ b/ui/theme/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../node_modules/highlight.js/lib/core.js","../../src/js/03-page-version-selector.js","../../src/js/04-page.js","../../src/js/05-sidr-menu.js","../../src/js/06-hardhat-truffle-toggle.js","../../src/js/07-copy-code.js","../../node_modules/highlight.js/lib/languages/markdown.js","../../node_modules/highlight.js/lib/languages/javascript.js","../../node_modules/highlight.js/lib/languages/typescript.js","../../node_modules/highlight.js/lib/languages/json.js","../../node_modules/highlight.js/lib/languages/diff.js","../../node_modules/highlight.js/lib/languages/python.js","../../node_modules/highlight.js/lib/languages/rust.js","../../node_modules/highlight.js/lib/languages/shell.js","../../node_modules/highlight.js/lib/languages/xml.js","../../node_modules/highlightjs-solidity/src/common.js","../../node_modules/highlightjs-solidity/src/languages/solidity.js","../../node_modules/highlightjs-solidity/src/languages/yul.js","../../node_modules/highlightjs-solidity/src/index.js","../../node_modules/highlightjs-cairo/src/languages/cairo.js","../../node_modules/highlightjs-cairo/src/languages/vendored/rust.js","../../node_modules/highlightjs-cairo/src/index.js","../../src/js/highlight.js","../../src/js/version-selector.js","../../src/js/copyright-date.js"],"sourcesContent":["/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.10.0\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n","(() => {\n 'use strict';\n\n const toggles = document.querySelectorAll('.js-version');\n for (let i = 0; i < toggles.length; i++) {\n toggles[i].addEventListener('click', (e) => e.stopPropagation());\n toggles[i].addEventListener('change', (e) => window.location.href = e.target.value);\n };\n})();\n","(function() {\n 'use strict';\n\n var sidebar = document.querySelector(\n 'main .article-wrapper > .toc-sidebar'\n );\n\n if (!sidebar) return;\n var doc;\n var headings;\n if (\n document.querySelector('.body.ui-toc') ||\n !(headings = find(\n 'h1[id].sect0, .sect1 > h2[id]',\n (doc = document.querySelector('.article'))\n )).length\n ) {\n sidebar.parentNode.removeChild(sidebar);\n return;\n }\n var lastActiveFragment;\n var links = {};\n var menu;\n\n var list = headings.reduce(function(accum, heading) {\n var shds = toArray(find('h3', heading.parentNode));\n var $shdsList = document.createElement('ul');\n $shdsList.classList.add('subheading-list');\n\n function createLink(heading) {\n const link = toArray(heading.childNodes).reduce(function(target, child) {\n if (child.nodeName !== 'A') target.appendChild(child.cloneNode(true));\n return target;\n }, document.createElement('a'));\n\n links[(link.href = '#' + heading.id)] = link;\n return link;\n }\n\n shds.map((n) => {\n var $shdItem = document.createElement('li');\n $shdItem.classList.add('subheading-item');\n var $shdLink = createLink(n);\n $shdItem.appendChild($shdLink);\n $shdsList.appendChild($shdItem);\n });\n\n var link = createLink(heading);\n\n var listItem = document.createElement('li');\n listItem.appendChild(link);\n\n if (shds.length) {\n listItem.appendChild($shdsList);\n }\n\n accum.appendChild(listItem);\n return accum;\n }, document.createElement('ul'));\n\n if (!(menu = sidebar && sidebar.querySelector('.toc-menu'))) {\n menu = document.createElement('div');\n menu.className = 'toc-menu';\n }\n\n var title = document.createElement('h3');\n title.classList.add('toc-title');\n // title.textContent = 'On This Page';\n var elTitle = document.querySelector('main .article-wrapper h1');\n title.textContent = elTitle.textContent;\n menu.appendChild(title);\n menu.appendChild(list);\n\n if (sidebar) {\n window.addEventListener('load', function() {\n onScroll();\n window.addEventListener('scroll', onScroll);\n });\n }\n\n var startOfContent = doc.querySelector('h1.page ~ :not(.labels)');\n if (startOfContent) {\n var embeddedToc = document.createElement('div');\n embeddedToc.className = 'toc embedded';\n embeddedToc.appendChild(menu.cloneNode(true));\n doc.insertBefore(embeddedToc, startOfContent);\n }\n\n function onScroll() {\n // NOTE doc.parentNode.offsetTop ~= doc.parentNode.getBoundingClientRect().top + window.pageYOffset\n //var targetPosition = doc.parentNode.offsetTop\n // NOTE no need to compensate wheen using spacer above [id] elements\n\n var headings = find(\n 'h1[id].sect0, .sect1 > h2[id], .sect2 > h3[id]',\n (doc = document.querySelector('.article'))\n );\n\n var targetPosition = 0;\n var activeFragment;\n headings.some(function(heading) {\n if (Math.floor(heading.getBoundingClientRect().top) <= targetPosition) {\n activeFragment = '#' + heading.id;\n } else {\n return true;\n }\n });\n if (activeFragment) {\n if (activeFragment !== lastActiveFragment) {\n if (lastActiveFragment) {\n links[lastActiveFragment].classList.remove('toc-active');\n }\n var activeLink = links[activeFragment];\n activeLink.classList.add('toc-active');\n if (menu.scrollHeight > menu.offsetHeight) {\n menu.scrollTop = Math.max(\n 0,\n activeLink.offsetTop + activeLink.offsetHeight - menu.offsetHeight\n );\n }\n lastActiveFragment = activeFragment;\n }\n } else if (lastActiveFragment) {\n links[lastActiveFragment].classList.remove('toc-active');\n lastActiveFragment = undefined;\n }\n }\n\n function find(selector, from) {\n return toArray((from || document).querySelectorAll(selector));\n }\n\n function toArray(collection) {\n return [].slice.call(collection);\n }\n})();\n","(function () {\n 'use strict';\n\n const sidrToggle = document.querySelector('.sidr-toggle');\n const sidrPanel = document.querySelector('#sidr');\n const closeMenuButton = document.querySelector('.close-menu-btn');\n\n sidrToggle.addEventListener('click', function (e) {\n sidrPanel.classList.toggle('toggled');\n });\n\n closeMenuButton.addEventListener('click', function (e) {\n sidrPanel.classList.toggle('toggled');\n });\n\n const collapseToggles = document.querySelectorAll('.collapse-toggle');\n\n collapseToggles.forEach(function (o) {\n const toggle = () => o.classList.toggle('toggled');\n o.addEventListener('click', toggle);\n const span = [...o.parentElement.children].find(c => c.matches('span.nav-link'));\n span?.addEventListener('click', toggle);\n });\n})();\n","(function () {\n window.addEventListener('click', e => {\n if (!event.target.classList.contains('hardhat-truffle-toggle')) {\n return;\n }\n\n togglePreference();\n e.preventDefault();\n });\n\n const cookieName = 'hardhat_truffle_preference';\n const paramName = 'pref';\n const defaultPreference = 'hardhat';\n\n function getCookie() {\n const cookie = document.cookie.split('; ').find(c => c.startsWith(`${cookieName}=`));\n return cookie && cookie.split('=')[1];\n }\n\n function setCookie(preference) {\n document.cookie = `${cookieName}=${preference};path=/;max-age=31536000`;\n }\n\n function getURLParam() {\n return new URLSearchParams(document.location.search).get(paramName);\n }\n\n function setURLParam(preference) {\n const url = new URL(document.location);\n const params = new URLSearchParams(url.search);\n params.set('pref', preference);\n url.search = params.toString();\n history.replaceState(null, '', [url]);\n }\n\n function getPreference() {\n const current = getURLParam() || getCookie();\n if (current === 'hardhat' || current === 'truffle') {\n return current;\n } else {\n return defaultPreference;\n }\n }\n\n function togglePreference() {\n const current = getPreference();\n const other = current === 'hardhat' ? 'truffle' : 'hardhat';\n document.body.classList.replace(`preference-${current}`, `preference-${other}`);\n setCookie(other);\n setURLParam(other);\n }\n\n const current = getPreference();\n setCookie(current);\n document.body.classList.add(`preference-${current}`);\n})();\n","(function () {\n const codeElementSelector = '[data-lang]';\n const shellAliases = ['console', 'shell', 'sh', 'bash'];\n\n function onDOMContentLoaded(callback) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', callback);\n } else {\n callback();\n }\n }\n\n function copyClick(e) {\n let code = e.target.parentElement.innerText;\n const codeParentElement = e.target.parentElement;\n const codeElement = codeParentElement.querySelector(codeElementSelector);\n const codeLanguage = codeElement?.dataset?.lang;\n const isShellLanguage = shellAliases.includes(codeLanguage);\n\n if (isShellLanguage) {\n code = code.replace(/\\$ /gm, '');\n }\n\n navigator.clipboard.writeText(code);\n }\n\n onDOMContentLoaded(() => {\n for (const elem of document.querySelectorAll('.listingblock')) {\n const btn = document.createElement('button');\n btn.classList.add('btn-icon', 'btn-copy', 'hljs');\n btn.setAttribute('aria-label', 'Copy');\n btn.innerHTML = '';\n btn.addEventListener('click', copyClick);\n elem.prepend(btn);\n }\n });\n})();\n","/*\nLanguage: Markdown\nRequires: xml.js\nAuthor: John Crepezzi \nWebsite: https://daringfireball.net/projects/markdown/\nCategory: common, markup\n*/\n\nfunction markdown(hljs) {\n const regex = hljs.regex;\n const INLINE_HTML = {\n begin: /<\\/?[A-Za-z_]/,\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}',\n end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n { begin: '(`{3,})[^`](.|\\\\n)*?\\\\1`*[ ]*' },\n { begin: '(~{3,})[^~](.|\\\\n)*?\\\\1~*[ ]*' },\n // needed to allow markdown as a sublanguage to work\n {\n begin: '```',\n end: '```+[ ]*$'\n },\n {\n begin: '~~~',\n end: '~~~+[ ]*$'\n },\n { begin: '`.+?`' },\n {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n {\n begin: '^( {4}|\\\\t)',\n end: '(\\\\n)$'\n }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: 'symbol',\n begin: /\\[/,\n end: /\\]/,\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'link',\n begin: /:\\s*/,\n end: /$/,\n excludeBegin: true\n }\n ]\n };\n const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;\n const LINK = {\n variants: [\n // too much like nested array access in so many languages\n // to have any real relevance\n {\n begin: /\\[.+?\\]\\[.*?\\]/,\n relevance: 0\n },\n // popular internet URLs\n {\n begin: /\\[.+?\\]\\(((data|javascript|mailto):|(?:http|ftp)s?:\\/\\/).*?\\)/,\n relevance: 2\n },\n {\n begin: regex.concat(/\\[.+?\\]\\(/, URL_SCHEME, /:\\/\\/.*?\\)/),\n relevance: 2\n },\n // relative urls\n {\n begin: /\\[.+?\\]\\([./?&#].*?\\)/,\n relevance: 1\n },\n // whatever else, lower relevance (might not be a link at all)\n {\n begin: /\\[.*?\\]\\(.*?\\)/,\n relevance: 0\n }\n ],\n returnBegin: true,\n contains: [\n {\n // empty strings for alt or link text\n match: /\\[(?=\\])/ },\n {\n className: 'string',\n relevance: 0,\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n returnEnd: true\n },\n {\n className: 'link',\n relevance: 0,\n begin: '\\\\]\\\\(',\n end: '\\\\)',\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'symbol',\n relevance: 0,\n begin: '\\\\]\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true\n }\n ]\n };\n const BOLD = {\n className: 'strong',\n contains: [], // defined later\n variants: [\n {\n begin: /_{2}(?!\\s)/,\n end: /_{2}/\n },\n {\n begin: /\\*{2}(?!\\s)/,\n end: /\\*{2}/\n }\n ]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [], // defined later\n variants: [\n {\n begin: /\\*(?![*\\s])/,\n end: /\\*/\n },\n {\n begin: /_(?![_\\s])/,\n end: /_/,\n relevance: 0\n }\n ]\n };\n\n // 3 level deep nesting is not allowed because it would create confusion\n // in cases like `***testing***` because where we don't know if the last\n // `***` is starting a new bold/italic or finishing the last one\n const BOLD_WITHOUT_ITALIC = hljs.inherit(BOLD, { contains: [] });\n const ITALIC_WITHOUT_BOLD = hljs.inherit(ITALIC, { contains: [] });\n BOLD.contains.push(ITALIC_WITHOUT_BOLD);\n ITALIC.contains.push(BOLD_WITHOUT_ITALIC);\n\n let CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n\n [\n BOLD,\n ITALIC,\n BOLD_WITHOUT_ITALIC,\n ITALIC_WITHOUT_BOLD\n ].forEach(m => {\n m.contains = m.contains.concat(CONTAINABLE);\n });\n\n CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);\n\n const HEADER = {\n className: 'section',\n variants: [\n {\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n },\n {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [\n { begin: '^[=-]*$' },\n {\n begin: '^',\n end: \"\\\\n\",\n contains: CONTAINABLE\n }\n ]\n }\n ]\n };\n\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$'\n };\n\n const ENTITY = {\n //https://spec.commonmark.org/0.31.2/#entity-references\n scope: 'literal',\n match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/\n };\n\n return {\n name: 'Markdown',\n aliases: [\n 'md',\n 'mkdown',\n 'mkd'\n ],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE,\n ENTITY\n ]\n };\n}\n\nmodule.exports = markdown;\n","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: '\\.?html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: '\\.?css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: '\\.?gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n // convert this to negative lookbehind in v12\n begin: /(\\s*)\\(/, // to match the parms with \n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ].map(x => `${x}\\\\s*\\\\(`)),\n IDENT_RE$1, regex.lookahead(/\\s*\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\nmodule.exports = javascript;\n","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: '\\.?html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: '\\.?css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: '\\.?gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n // convert this to negative lookbehind in v12\n begin: /(\\s*)\\(/, // to match the parms with \n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ].map(x => `${x}\\\\s*\\\\(`)),\n IDENT_RE$1, regex.lookahead(/\\s*\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\n/*\nLanguage: TypeScript\nAuthor: Panu Horsmalahti \nContributors: Ike Ku \nDescription: TypeScript is a strict superset of JavaScript\nWebsite: https://www.typescriptlang.org\nCategory: common, scripting\n*/\n\n\n/** @type LanguageFn */\nfunction typescript(hljs) {\n const tsLanguage = javascript(hljs);\n\n const IDENT_RE$1 = IDENT_RE;\n const TYPES = [\n \"any\",\n \"void\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n \"never\",\n \"symbol\",\n \"bigint\",\n \"unknown\"\n ];\n const NAMESPACE = {\n begin: [\n /namespace/,\n /\\s+/,\n hljs.IDENT_RE\n ],\n beginScope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n };\n const INTERFACE = {\n beginKeywords: 'interface',\n end: /\\{/,\n excludeEnd: true,\n keywords: {\n keyword: 'interface extends',\n built_in: TYPES\n },\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const USE_STRICT = {\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use strict['\"]/\n };\n const TS_SPECIFIC_KEYWORDS = [\n \"type\",\n // \"namespace\",\n \"interface\",\n \"public\",\n \"private\",\n \"protected\",\n \"implements\",\n \"declare\",\n \"abstract\",\n \"readonly\",\n \"enum\",\n \"override\",\n \"satisfies\"\n ];\n\n /*\n namespace is a TS keyword but it's fine to use it as a variable name too.\n const message = 'foo';\n const namespace = 'bar';\n */\n\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),\n literal: LITERALS,\n built_in: BUILT_INS.concat(TYPES),\n \"variable.language\": BUILT_IN_VARIABLES\n };\n const DECORATOR = {\n className: 'meta',\n begin: '@' + IDENT_RE$1,\n };\n\n const swapMode = (mode, label, replacement) => {\n const indx = mode.contains.findIndex(m => m.label === label);\n if (indx === -1) { throw new Error(\"can not find mode to replace\"); }\n\n mode.contains.splice(indx, 1, replacement);\n };\n\n\n // this should update anywhere keywords is used since\n // it will be the same actual JS object\n Object.assign(tsLanguage.keywords, KEYWORDS$1);\n\n tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);\n\n // highlight the function params\n const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find(c => c.className === \"attr\");\n tsLanguage.exports.PARAMS_CONTAINS.push([\n tsLanguage.exports.CLASS_REFERENCE, // class reference for highlighting the params types\n ATTRIBUTE_HIGHLIGHT, // highlight the params key\n ]);\n tsLanguage.contains = tsLanguage.contains.concat([\n DECORATOR,\n NAMESPACE,\n INTERFACE,\n ]);\n\n // TS gets a simpler shebang rule than JS\n swapMode(tsLanguage, \"shebang\", hljs.SHEBANG());\n // JS use strict rule purposely excludes `asm` which makes no sense\n swapMode(tsLanguage, \"use_strict\", USE_STRICT);\n\n const functionDeclaration = tsLanguage.contains.find(m => m.label === \"func.def\");\n functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript\n\n Object.assign(tsLanguage, {\n name: 'TypeScript',\n aliases: [\n 'ts',\n 'tsx',\n 'mts',\n 'cts'\n ]\n });\n\n return tsLanguage;\n}\n\nmodule.exports = typescript;\n","/*\nLanguage: JSON\nDescription: JSON (JavaScript Object Notation) is a lightweight data-interchange format.\nAuthor: Ivan Sagalaev \nWebsite: http://www.json.org\nCategory: common, protocols, web\n*/\n\nfunction json(hljs) {\n const ATTRIBUTE = {\n className: 'attr',\n begin: /\"(\\\\.|[^\\\\\"\\r\\n])*\"(?=\\s*:)/,\n relevance: 1.01\n };\n const PUNCTUATION = {\n match: /[{}[\\],:]/,\n className: \"punctuation\",\n relevance: 0\n };\n const LITERALS = [\n \"true\",\n \"false\",\n \"null\"\n ];\n // NOTE: normally we would rely on `keywords` for this but using a mode here allows us\n // - to use the very tight `illegal: \\S` rule later to flag any other character\n // - as illegal indicating that despite looking like JSON we do not truly have\n // - JSON and thus improve false-positively greatly since JSON will try and claim\n // - all sorts of JSON looking stuff\n const LITERALS_MODE = {\n scope: \"literal\",\n beginKeywords: LITERALS.join(\" \"),\n };\n\n return {\n name: 'JSON',\n aliases: ['jsonc'],\n keywords:{\n literal: LITERALS,\n },\n contains: [\n ATTRIBUTE,\n PUNCTUATION,\n hljs.QUOTE_STRING_MODE,\n LITERALS_MODE,\n hljs.C_NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ],\n illegal: '\\\\S'\n };\n}\n\nmodule.exports = json;\n","/*\nLanguage: Diff\nDescription: Unified and context diff\nAuthor: Vasily Polovnyov \nWebsite: https://www.gnu.org/software/diffutils/\nCategory: common\n*/\n\n/** @type LanguageFn */\nfunction diff(hljs) {\n const regex = hljs.regex;\n return {\n name: 'Diff',\n aliases: [ 'patch' ],\n contains: [\n {\n className: 'meta',\n relevance: 10,\n match: regex.either(\n /^@@ +-\\d+,\\d+ +\\+\\d+,\\d+ +@@/,\n /^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$/,\n /^--- +\\d+,\\d+ +----$/\n )\n },\n {\n className: 'comment',\n variants: [\n {\n begin: regex.either(\n /Index: /,\n /^index/,\n /={3,}/,\n /^-{3}/,\n /^\\*{3} /,\n /^\\+{3}/,\n /^diff --git/\n ),\n end: /$/\n },\n { match: /^\\*{15}$/ }\n ]\n },\n {\n className: 'addition',\n begin: /^\\+/,\n end: /$/\n },\n {\n className: 'deletion',\n begin: /^-/,\n end: /$/\n },\n {\n className: 'addition',\n begin: /^!/,\n end: /$/\n }\n ]\n };\n}\n\nmodule.exports = diff;\n","/*\nLanguage: Python\nDescription: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.\nWebsite: https://www.python.org\nCategory: common\n*/\n\nfunction python(hljs) {\n const regex = hljs.regex;\n const IDENT_RE = /[\\p{XID_Start}_]\\p{XID_Continue}*/u;\n const RESERVED_WORDS = [\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'case',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'match',\n 'nonlocal|10',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield'\n ];\n\n const BUILT_INS = [\n '__import__',\n 'abs',\n 'all',\n 'any',\n 'ascii',\n 'bin',\n 'bool',\n 'breakpoint',\n 'bytearray',\n 'bytes',\n 'callable',\n 'chr',\n 'classmethod',\n 'compile',\n 'complex',\n 'delattr',\n 'dict',\n 'dir',\n 'divmod',\n 'enumerate',\n 'eval',\n 'exec',\n 'filter',\n 'float',\n 'format',\n 'frozenset',\n 'getattr',\n 'globals',\n 'hasattr',\n 'hash',\n 'help',\n 'hex',\n 'id',\n 'input',\n 'int',\n 'isinstance',\n 'issubclass',\n 'iter',\n 'len',\n 'list',\n 'locals',\n 'map',\n 'max',\n 'memoryview',\n 'min',\n 'next',\n 'object',\n 'oct',\n 'open',\n 'ord',\n 'pow',\n 'print',\n 'property',\n 'range',\n 'repr',\n 'reversed',\n 'round',\n 'set',\n 'setattr',\n 'slice',\n 'sorted',\n 'staticmethod',\n 'str',\n 'sum',\n 'super',\n 'tuple',\n 'type',\n 'vars',\n 'zip'\n ];\n\n const LITERALS = [\n '__debug__',\n 'Ellipsis',\n 'False',\n 'None',\n 'NotImplemented',\n 'True'\n ];\n\n // https://docs.python.org/3/library/typing.html\n // TODO: Could these be supplemented by a CamelCase matcher in certain\n // contexts, leaving these remaining only for relevance hinting?\n const TYPES = [\n \"Any\",\n \"Callable\",\n \"Coroutine\",\n \"Dict\",\n \"List\",\n \"Literal\",\n \"Generic\",\n \"Optional\",\n \"Sequence\",\n \"Set\",\n \"Tuple\",\n \"Type\",\n \"Union\"\n ];\n\n const KEYWORDS = {\n $pattern: /[A-Za-z]\\w+|__\\w+__/,\n keyword: RESERVED_WORDS,\n built_in: BUILT_INS,\n literal: LITERALS,\n type: TYPES\n };\n\n const PROMPT = {\n className: 'meta',\n begin: /^(>>>|\\.\\.\\.) /\n };\n\n const SUBST = {\n className: 'subst',\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS,\n illegal: /#/\n };\n\n const LITERAL_BRACKET = {\n begin: /\\{\\{/,\n relevance: 0\n };\n\n const STRING = {\n className: 'string',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n variants: [\n {\n begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,\n end: /'''/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT\n ],\n relevance: 10\n },\n {\n begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?\"\"\"/,\n end: /\"\"\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT\n ],\n relevance: 10\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])'''/,\n end: /'''/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])\"\"\"/,\n end: /\"\"\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([uU]|[rR])'/,\n end: /'/,\n relevance: 10\n },\n {\n begin: /([uU]|[rR])\"/,\n end: /\"/,\n relevance: 10\n },\n {\n begin: /([bB]|[bB][rR]|[rR][bB])'/,\n end: /'/\n },\n {\n begin: /([bB]|[bB][rR]|[rR][bB])\"/,\n end: /\"/\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])'/,\n end: /'/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])\"/,\n end: /\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE\n ]\n };\n\n // https://docs.python.org/3.9/reference/lexical_analysis.html#numeric-literals\n const digitpart = '[0-9](_?[0-9])*';\n const pointfloat = `(\\\\b(${digitpart}))?\\\\.(${digitpart})|\\\\b(${digitpart})\\\\.`;\n // Whitespace after a number (or any lexical token) is needed only if its absence\n // would change the tokenization\n // https://docs.python.org/3.9/reference/lexical_analysis.html#whitespace-between-tokens\n // We deviate slightly, requiring a word boundary or a keyword\n // to avoid accidentally recognizing *prefixes* (e.g., `0` in `0x41` or `08` or `0__1`)\n const lookahead = `\\\\b|${RESERVED_WORDS.join('|')}`;\n const NUMBER = {\n className: 'number',\n relevance: 0,\n variants: [\n // exponentfloat, pointfloat\n // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals\n // optionally imaginary\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n // Note: no leading \\b because floats can start with a decimal point\n // and we don't want to mishandle e.g. `fn(.5)`,\n // no trailing \\b for pointfloat because it can end with a decimal point\n // and we don't want to mishandle e.g. `0..hex()`; this should be safe\n // because both MUST contain a decimal point and so cannot be confused with\n // the interior part of an identifier\n {\n begin: `(\\\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})`\n },\n {\n begin: `(${pointfloat})[jJ]?`\n },\n\n // decinteger, bininteger, octinteger, hexinteger\n // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals\n // optionally \"long\" in Python 2\n // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals\n // decinteger is optionally imaginary\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n {\n begin: `\\\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[bB](_?[01])+[lL]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})`\n },\n\n // imagnumber (digitpart-based)\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n {\n begin: `\\\\b(${digitpart})[jJ](?=${lookahead})`\n }\n ]\n };\n const COMMENT_TYPE = {\n className: \"comment\",\n begin: regex.lookahead(/# type:/),\n end: /$/,\n keywords: KEYWORDS,\n contains: [\n { // prevent keywords from coloring `type`\n begin: /# type:/\n },\n // comment within a datatype comment includes no keywords\n {\n begin: /#/,\n end: /\\b\\B/,\n endsWithParent: true\n }\n ]\n };\n const PARAMS = {\n className: 'params',\n variants: [\n // Exclude params in functions without params\n {\n className: \"\",\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS,\n contains: [\n 'self',\n PROMPT,\n NUMBER,\n STRING,\n hljs.HASH_COMMENT_MODE\n ]\n }\n ]\n };\n SUBST.contains = [\n STRING,\n NUMBER,\n PROMPT\n ];\n\n return {\n name: 'Python',\n aliases: [\n 'py',\n 'gyp',\n 'ipython'\n ],\n unicodeRegex: true,\n keywords: KEYWORDS,\n illegal: /(<\\/|\\?)|=>/,\n contains: [\n PROMPT,\n NUMBER,\n {\n // very common convention\n scope: 'variable.language',\n match: /\\bself\\b/\n },\n {\n // eat \"if\" prior to string so that it won't accidentally be\n // labeled as an f-string\n beginKeywords: \"if\",\n relevance: 0\n },\n { match: /\\bor\\b/, scope: \"keyword\" },\n STRING,\n COMMENT_TYPE,\n hljs.HASH_COMMENT_MODE,\n {\n match: [\n /\\bdef/, /\\s+/,\n IDENT_RE,\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [ PARAMS ]\n },\n {\n variants: [\n {\n match: [\n /\\bclass/, /\\s+/,\n IDENT_RE, /\\s*/,\n /\\(\\s*/, IDENT_RE,/\\s*\\)/\n ],\n },\n {\n match: [\n /\\bclass/, /\\s+/,\n IDENT_RE\n ],\n }\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 6: \"title.class.inherited\",\n }\n },\n {\n className: 'meta',\n begin: /^[\\t ]*@/,\n end: /(?=#)|$/,\n contains: [\n NUMBER,\n PARAMS,\n STRING\n ]\n }\n ]\n };\n}\n\nmodule.exports = python;\n","/*\nLanguage: Rust\nAuthor: Andrey Vlasovskikh \nContributors: Roman Shmatov , Kasper Andersen \nWebsite: https://www.rust-lang.org\nCategory: common, system\n*/\n\n/** @type LanguageFn */\n\nfunction rust(hljs) {\n const regex = hljs.regex;\n // ============================================\n // Added to support the r# keyword, which is a raw identifier in Rust.\n const RAW_IDENTIFIER = /(r#)?/;\n const UNDERSCORE_IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);\n const IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.IDENT_RE);\n // ============================================\n const FUNCTION_INVOKE = {\n className: \"title.function.invoke\",\n relevance: 0,\n begin: regex.concat(\n /\\b/,\n /(?!let|for|while|if|else|match\\b)/,\n IDENT_RE,\n regex.lookahead(/\\s*\\(/))\n };\n const NUMBER_SUFFIX = '([ui](8|16|32|64|128|size)|f(32|64))\\?';\n const KEYWORDS = [\n \"abstract\",\n \"as\",\n \"async\",\n \"await\",\n \"become\",\n \"box\",\n \"break\",\n \"const\",\n \"continue\",\n \"crate\",\n \"do\",\n \"dyn\",\n \"else\",\n \"enum\",\n \"extern\",\n \"false\",\n \"final\",\n \"fn\",\n \"for\",\n \"if\",\n \"impl\",\n \"in\",\n \"let\",\n \"loop\",\n \"macro\",\n \"match\",\n \"mod\",\n \"move\",\n \"mut\",\n \"override\",\n \"priv\",\n \"pub\",\n \"ref\",\n \"return\",\n \"self\",\n \"Self\",\n \"static\",\n \"struct\",\n \"super\",\n \"trait\",\n \"true\",\n \"try\",\n \"type\",\n \"typeof\",\n \"union\",\n \"unsafe\",\n \"unsized\",\n \"use\",\n \"virtual\",\n \"where\",\n \"while\",\n \"yield\"\n ];\n const LITERALS = [\n \"true\",\n \"false\",\n \"Some\",\n \"None\",\n \"Ok\",\n \"Err\"\n ];\n const BUILTINS = [\n // functions\n 'drop ',\n // traits\n \"Copy\",\n \"Send\",\n \"Sized\",\n \"Sync\",\n \"Drop\",\n \"Fn\",\n \"FnMut\",\n \"FnOnce\",\n \"ToOwned\",\n \"Clone\",\n \"Debug\",\n \"PartialEq\",\n \"PartialOrd\",\n \"Eq\",\n \"Ord\",\n \"AsRef\",\n \"AsMut\",\n \"Into\",\n \"From\",\n \"Default\",\n \"Iterator\",\n \"Extend\",\n \"IntoIterator\",\n \"DoubleEndedIterator\",\n \"ExactSizeIterator\",\n \"SliceConcatExt\",\n \"ToString\",\n // macros\n \"assert!\",\n \"assert_eq!\",\n \"bitflags!\",\n \"bytes!\",\n \"cfg!\",\n \"col!\",\n \"concat!\",\n \"concat_idents!\",\n \"debug_assert!\",\n \"debug_assert_eq!\",\n \"env!\",\n \"eprintln!\",\n \"panic!\",\n \"file!\",\n \"format!\",\n \"format_args!\",\n \"include_bytes!\",\n \"include_str!\",\n \"line!\",\n \"local_data_key!\",\n \"module_path!\",\n \"option_env!\",\n \"print!\",\n \"println!\",\n \"select!\",\n \"stringify!\",\n \"try!\",\n \"unimplemented!\",\n \"unreachable!\",\n \"vec!\",\n \"write!\",\n \"writeln!\",\n \"macro_rules!\",\n \"assert_ne!\",\n \"debug_assert_ne!\"\n ];\n const TYPES = [\n \"i8\",\n \"i16\",\n \"i32\",\n \"i64\",\n \"i128\",\n \"isize\",\n \"u8\",\n \"u16\",\n \"u32\",\n \"u64\",\n \"u128\",\n \"usize\",\n \"f32\",\n \"f64\",\n \"str\",\n \"char\",\n \"bool\",\n \"Box\",\n \"Option\",\n \"Result\",\n \"String\",\n \"Vec\"\n ];\n return {\n name: 'Rust',\n aliases: [ 'rs' ],\n keywords: {\n $pattern: hljs.IDENT_RE + '!?',\n type: TYPES,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILTINS\n },\n illegal: ''\n },\n FUNCTION_INVOKE\n ]\n };\n}\n\nmodule.exports = rust;\n","/*\nLanguage: Shell Session\nRequires: bash.js\nAuthor: TSUYUSATO Kitsune \nCategory: common\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction shell(hljs) {\n return {\n name: 'Shell Session',\n aliases: [\n 'console',\n 'shellsession'\n ],\n contains: [\n {\n className: 'meta.prompt',\n // We cannot add \\s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.\n // For instance, in the following example, it would match \"echo /path/to/home >\" as a prompt:\n // echo /path/to/home > t.exe\n begin: /^\\s{0,3}[/~\\w\\d[\\]()@-]*[>%$#][ ]?/,\n starts: {\n end: /[^\\\\](?=\\s*$)/,\n subLanguage: 'bash'\n }\n }\n ]\n };\n}\n\nmodule.exports = shell;\n","/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: //,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n //,\n { relevance: 10 }\n ),\n {\n begin: //,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the