diff --git a/404.html b/404.html index 9022e1fac6..32da8b0764 100644 --- a/404.html +++ b/404.html @@ -5,12 +5,12 @@ Page Not Found | polkadot{.js} - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/api-contract/FAQ/index.html b/api-contract/FAQ/index.html index 587acca65b..6b18075ca3 100644 --- a/api-contract/FAQ/index.html +++ b/api-contract/FAQ/index.html @@ -5,12 +5,12 @@ FAQ | polkadot{.js} - +
Skip to main content

FAQ

The list will be updated/expanded as questions come up, dealing with some common issues that API users find.

My ABI cannot be parsed

When passing an older pre ink! 3.0-rc1 version of the ABI, you will have an "Invalid JSON ABI structure supplied, expected a recent metadata version" error being returned. As explained in the getting started guide as of @polkadot/api-contract 2.2+ the older ink! 2.1 versions are not supported.

If you are using an older version you would need to use an older version of the API or upgrade your contracts to ink! 3.0.

Why is there a snake_case vs camelCase difference

The API always tries to use camelCase naming where available. This aligns with the de-facto standards that are generally (not always!) used in JS interfaces. This means that when decorating the ABIs into contract.<query|tx>.methodName the methodName part would be in camelCase format.

An example of this would be in the erc20 ink! ABI - the method in the above would be balance_of however the API (for consistency with the full suite of libraries), decorate this as contract.query.balanceOf.

How do I subscribe to a contract query?

Subscriptions, and queries to the raw storage are on their way! Unfortunately until then there isn't a proper way to subscribe to a contract query. A temporary workaround is to subscribe to api.query.contracts.contractInfoOf.

const unsub = await api.query.contracts.contractInfoOf(contractAddress, async () => {
// Perform a read of the contract's `get` message
const callValue = await contract.query.get(alicePair.address, value, gasLimit);

// Do something with callValue
});

But this workaround is not without drawbacks. Since the callback will be executed every time the contract's storage is affected you will ultimately end up calling your contract query more often than necessary.

- + \ No newline at end of file diff --git a/api-contract/index.html b/api-contract/index.html index 6aca33fb8f..f618e48962 100644 --- a/api-contract/index.html +++ b/api-contract/index.html @@ -5,12 +5,12 @@ Overview | polkadot{.js} - +
Skip to main content

Overview

The @polkadot/api-contract interfaces provide a thin layer on-top of the available API transactions to allow you to manage Substrate contracts in a consistent way.

Since not all Substrate chains have contracts available, we assume that you are connecting to a chain that has the FRAME contracts pallet and that you are using a compatible compiler cargo-contract for ink!, or Solang for Solidity.

The API contracts interfaces transparently handle any encoding and decoding of messages and results using the available ABIs, allowing the developer to work with contract deployments and calls without having to handle encoding themselves.

To get started, follow the getting started journey for installation and use for the Promise-based version for the contracts interfaces.

- + \ No newline at end of file diff --git a/api-contract/start/basics/index.html b/api-contract/start/basics/index.html index 9bd7d2965b..bba1aea3d8 100644 --- a/api-contract/start/basics/index.html +++ b/api-contract/start/basics/index.html @@ -5,13 +5,13 @@ Basics | polkadot{.js} - +
Skip to main content

Basics

The @polkadot/api-contract comes with 4 general helpers and has *Rx-based versions for the users of the ApiRx version of the API. However here we will focus only on the ApiPromise-based version of the helpers, in much the same way as the API documentation. The four main interfaces provided are:

  • CodePromise - upload and instantiate a WASM blob
  • BlueprintPromise - instantiate a contract from on-chain code
  • ContractPromise - interact with on-chain contract instances, making read calls and executing transactions
  • Abi - generic registry that contains all the types and all the messages for a given ABI

Now that we have a good overview of what is available and the use of each interface, let's take a brief tour through the prerequisites needed to complete this guide.

- + \ No newline at end of file diff --git a/api-contract/start/blueprint/index.html b/api-contract/start/blueprint/index.html index a1434cea13..7f2b98f01d 100644 --- a/api-contract/start/blueprint/index.html +++ b/api-contract/start/blueprint/index.html @@ -5,13 +5,13 @@ Blueprint | polkadot{.js} - +
Skip to main content

Blueprint

A BlueprintPromise works similarly to a CodePromise. It manages calls to the instantiate dispatchable in the contracts pallet and uses a code hash to retrieve previously uploaded contract code from chain storage. If a non-existent codeHash is used, the instantiation will fail on-chain.

Let's take for example an ink! flipper contract, the tx.<constructorName> interface is a normal submittable extrinsic with the result containing an actual ContractPromise instance, containing the address of the new contract.

import { BlueprintPromise } from '@polkadot/api-contract';

const blueprint = new BlueprintPromise(api, metadata, codeHash);

const tx = blueprint.tx.default({ gasLimit, storageDepositLimit, salt });

let address;

const unsub = await tx.signAndSend(alicePair, ({ contract, status }) => {
if (status.isInBlock || status.isFinalized) {
address = contract.address.toString();
unsub();
}
});

We have made it this far. At this point you should be familiar with code deployments as well as contract instantiation, next up we will read a contract value.

- + \ No newline at end of file diff --git a/api-contract/start/code/index.html b/api-contract/start/code/index.html index cfe1880faf..5e40769635 100644 --- a/api-contract/start/code/index.html +++ b/api-contract/start/code/index.html @@ -5,7 +5,7 @@ Code | polkadot{.js} - +
@@ -13,6 +13,6 @@ It is useful in cases where an existing codeHash is not available, meaning that the code has never been deployed to the blockchain in its current form.

The instantiate_with_code dispatchable uploads the wasm code to the blockchain and creates a new instance in one go. Learn how it works under the hood in the Substrate Metadata section

The CodePromise constructor takes 3 arguments: an API instance, the contract metadata, and the contract code. Only the wasm code will end up on-chain; the metadata is only used in the JavaScript world. See Prerequisites to find out how to obtain them.

import { CodePromise } from '@polkadot/api-contract';

const code = new CodePromise(api, metadata, wasm);

The newly generated code object lets you call instantiate_with_code without having to encode the data yourself. You will need to provide values for the instantiation options. Getting accurate gas and storage deposit costs is possible by calling the instantiate RPC, which dry runs the instantiation and returns the outcome. For the scope of this tutorial we will use hardcoded values.

Here is how you would retrieve the contract address after instantiation for an ink! incrementer contract, whose constructor signature looks like this: new (initValue: i32)

// maximum gas to be consumed for the instantiation. if limit is too small the instantiation will fail.
const gasLimit = 100000n * 1000000n
// a limit to how much Balance to be used to pay for the storage created by the instantiation
// if null is passed, unlimited balance can be used
const storageDepositLimit = null
// used to derive contract address,
// use null to prevent duplicate contracts
const salt = new Uint8Array()
// balance to transfer to the contract account, formerly known as "endowment".
// use only with payable constructors, will fail otherwise.
const value = api.registry.createType('Balance', 1000)
const initValue = 1;

const tx = code.tx.new({ gasLimit, storageDepositLimit }, initValue)

let address;

const unsub = await tx.signAndSend(alicePair, ({ contract, status }) => {
if (status.isInBlock || status.isFinalized) {
address = contract.address.toString();
unsub();
}
});

After we have uploaded the WASM on-chain, next we'll use the Blueprint to (re)instantiate on-chain code.

- + \ No newline at end of file diff --git a/api-contract/start/contract.read/index.html b/api-contract/start/contract.read/index.html index 1a1bbb3fef..89ca088307 100644 --- a/api-contract/start/contract.read/index.html +++ b/api-contract/start/contract.read/index.html @@ -5,7 +5,7 @@ Contract | polkadot{.js} - +
@@ -14,6 +14,6 @@ It is useful because it encodes the message using the selector and the input values to allow execution in the contract environment. We would get the value of an incrementer contract like so:


// maximum gas to be consumed for the call. if limit is too small the call will fail.
const gasLimit = 3000n * 1000000n;
// a limit to how much Balance to be used to pay for the storage created by the contract call
// if null is passed, unlimited balance can be used
const storageDepositLimit = null
// balance to transfer to the contract account. use only with payable messages, will fail otherwise.
// formerly know as "endowment"
const value: api.registry.createType('Balance', 1000)

// (We perform the send from an account, here using Alice's address)
const { gasRequired, storageDeposit, result, output } = await contract.query.get(
alicePair.address,
{
gasLimit,
storageDepositLimit,
}
);

// The actual result from RPC as `ContractExecResult`
console.log(result.toHuman());

// the gas consumed for contract execution
console.log(gasRequired.toHuman());

// check if the call was successful
if (result.isOk) {
// output the return value
console.log('Success', output.toHuman());
} else {
console.error('Error', result.asErr);
}

An example of querying a balance of a specific account on an erc20 contract will therefore be :

// the address we are going to query
const target = '5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY';
// the address to subtract the fees from
const from = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';

// only 1 param needed, the actual address we are querying for (more
// params can follow at the end, separated by , if needed by the message)
const callValue = await contract.query.balanceOf(from, { gasLimit: -1 }, target);

In this example we have specified a gasLimit of -1, in a subsequent section we will expand on this. for now, just remember that is indicated to use max available, i.e. we don't explicitly want to specify a value.

Now that we understand the underlying call/read interfaces where a message is executed, but not part of a block, we will look into sending transaction messages in our next section.

- + \ No newline at end of file diff --git a/api-contract/start/contract.tx/index.html b/api-contract/start/contract.tx/index.html index 7c5930eac4..f55fdfe97c 100644 --- a/api-contract/start/contract.tx/index.html +++ b/api-contract/start/contract.tx/index.html @@ -5,12 +5,12 @@ Contract tx | polkadot{.js} - +
Skip to main content

Contract tx

Interface

In addition to using the .query.<messageName> on a contract, the .tx.<messageName> method provides a way to send an actual encoded transaction to the contract, allow for execution and have this applied in a block. Expanding on our previous ink! incrementer example, we can now execute and then retrieve the subsequent value.

const value = 10000; // only for payable messages, call will fail otherwise
const gasLimit = 3000n * 1000000n;
const storageDepositLimit = null;
const incValue = 1;

// Send the transaction, like elsewhere this is a normal extrinsic
// with the same rules as applied in the API (As with the read example,
// additional params, if required can follow - here only one is needed)
await contract.tx
.inc({ storageDepositLimit, gasLimit }, incValue)
.signAndSend(alicePair, result => {
if (result.status.isInBlock) {
console.log('in a block');
} else if (result.status.isFinalized) {
console.log('finalized');
}
});

For the above interface we can specify the message as the string name, the index of the actual message as retrieved via the Abi.

Cost estimation

To estimate values for gasLimit and storageDepositLimit, we can dry run the contract call using the .query (read) interfaces with a sufficiently large value to retrieve the actual gas and storage deposit consumed. The API makes this easy by passing gasLimit: -1 and storageDepositLimit: null to the query. The query will use the maximum tx weight for gasLimit and available free balance for storageDepositLimit.

See this in practice for the inc message on the ink! incrementer contract

const incValue = 1;
const options = { storageDepositLimit: null, gasLimit: -1 }

const { gasRequired, storageDeposit, result } = await contract.query.inc(
alicePair,
options,
incValue
);

console.log(`outcome: ${result.isOk ? 'Ok' : 'Error'}`);
console.log(`gasRequired ${gasRequired.toString()}`);

We can use the gasRequired input (potentially with a buffer for various execution paths) in any calls to contract.tx.inc(...) with the same input parameters specified on the query where the estimation was done.

Events

On current versions of the API, any events raised by the contract will be transparently decoded with the relevant ABI and will be made available on the result (from .signAndSend(alicePair, (result) => {...}) as contractEvents.

Where no events were emitted this value would be undefined, however should events be emitted, the array will contain all the decoded values.

That is it... for now

This was a whirl-wind tour of what the API provides in terms of the @polkadot/api-contract interface. It is not perfect yet, we would like to expand it to allow for greater type-checking on the contracts (instead of read/exec wit messages), but hopefully in the current state it already enhances the way you can interact with contracts.

- + \ No newline at end of file diff --git a/api-contract/start/index.html b/api-contract/start/index.html index 1c81b59409..5d4e5dea37 100644 --- a/api-contract/start/index.html +++ b/api-contract/start/index.html @@ -5,12 +5,12 @@ Overview | polkadot{.js} - +
Skip to main content

Overview

These sections should provide you with all the information needed to install the @polkadot/api-contract package, understand the structure of the interfaces and allow you to start using it. For existing users this really should be titled "Things I wish I knew before I started using contracts" - it really aims to close the gap to allow anybody to get to grips with using the package.

ES2015 Usage and examples

Before we jump into the guide, be aware that in all cases we are using ES2015, including using things like async/await, import and others. Depending on your environment, this may require some adjustments.

We are using the await naked in all examples (removing boilerplate allows us to focus on the actual libraries), so unless your environment supports top-level await, you will need to wrap the code samples in an async block async function main () { ... } and then just call main().then(() => console.log('completed')).

What this is not

This is not line-by-line documentation of all the existing function calls available, nor it is tied to a specific environment. There will be some things in the Keyring that are probably not covered, which brings us to the next point...

Help us help others

If you spot gaps in the information provided, or are uncertain about any specific area, please do log an issue or if you are that way inclined, make a pull-request. We really want to have good documentation in these areas and allow people to be productive right from the start.

Ready? Steady? Go!

Let's get started... What should be installed, and how should we do it?

- + \ No newline at end of file diff --git a/api-contract/start/install/index.html b/api-contract/start/install/index.html index 76fc86a278..464c05cbd7 100644 --- a/api-contract/start/install/index.html +++ b/api-contract/start/install/index.html @@ -5,12 +5,12 @@ Installation | polkadot{.js} - +
Skip to main content

Installation

Packages

The @polkadot/api-contract packages is to be used alongside the @polkadot/api package. With that in mind, we can install from npm, so we are not going to waste too much time with the bare basics, just install the API & contracts extensions via

yarn add @polkadot/api @polkadot/api-contract

Generally you would want to keep the versions of the 2 in lock-step, which mean that if you upgrade one or the other, ensure that the versions continue to match.

Notes on use

Be aware that Substrate chains are different, which means that some chains will not have the FRAME contracts pallet installed. For instance, relay chains such as Polkadot do not have this functionality; however, many have parachains that do.

Additionally the contracts pallet and ink! are still evolving. With the upgrade from ink! v2 to v3 the ABI structure has changed completely. As of the polkadot-js API v2.2.1 only ink! v3.0-rc1 and later is supported. If you are using an earlier version, this guide will not be useful since the wrapper interfaces have changed in a major way to support the new formats.

So once we have it installed, let's take a brief tour through the base classes and interfaces before we get into using them.

- + \ No newline at end of file diff --git a/api-contract/start/prerequisites/index.html b/api-contract/start/prerequisites/index.html index 84d4e4be39..b375b45371 100644 --- a/api-contract/start/prerequisites/index.html +++ b/api-contract/start/prerequisites/index.html @@ -5,12 +5,12 @@ Prerequisites | polkadot{.js} - +
Skip to main content

Prerequisites

Connected API

Read the section on Creating an API instance if you haven't done so already. The following examples assume you are connected to a compatible chain.

For development purposes it's generally preferred to use a local development network, that way you can swap and purge contracts while developing. We recommend running the latest Substrate Contracts Node binary.

Web3 accounts

You will need a Substrate account to sign messages. Check the docs section on Keyring in order to get access to dev accounts (Alice, Bob, Charlie, ..etc.) or create new ones. Alternatively, check out the Extension package docs in order to retrieve all injected accounts.

Contract build artifacts

The contract metadata and the wasm code are generated by building the contract with a tool like cargo-contract or solang. These tools also generate a <name>.contract file which contains the metadata and includes the wasm code under metadata.source.wasm.

As metadata, all api-contract helpers accept either a JSON string, a parsed JSON or an Abi instance.

To understand everything fits together, let's deploy a WASM contract and start using it.

- + \ No newline at end of file diff --git a/api/FAQ/index.html b/api/FAQ/index.html index 1d50d4f08f..e3219d58be 100644 --- a/api/FAQ/index.html +++ b/api/FAQ/index.html @@ -5,12 +5,12 @@ FAQ | polkadot{.js} - +
Skip to main content

FAQ

The list will be updated/expanded as questions come up, dealing with some common issues that API users find.

I am getting a "Unknown types found, no types for ..." error

There are 2 causes for this, both related to the version of the API that you are using and the support of types. As explained in the elsewhere, types on Polkadot/Substrate are continuously evolving - the latest version of the API always tries to support types for the latest Polkadot networks, such as Kusama. So for Polkadot public chains, ensure that you are using the latest released API version.

If you are connected to a customized chain, you would rather want to register the types either on your own, or via packages that the chain vendor provides.

If however you are running against a master branch of either Polkadot or Substrate, and the type additions are very new and have not made it into an API release yet you may well be better suited running a beta version, tracking master.

I am getting a "Metadata:: failed on MagicNumber" error

Update your version of the API to the latest version. Like types, the metadata interfaces are continuously evolving. For instance with the Polkadot Alexander network, only metadata v3 is available. By the time Kusama launched, this has been bumped to v7. As these versions are added to the Polkadot/Substrate codebase, they are added to the API.

The node returns a "Could not convert" error on send

The typical error that you would see is Verification Error: Execution(ApiError("Could not convert parameter 'tx' between node and runtime. This means that the transaction data serialized from the API cannot be deserialized on the node.

All data transferred between the API and the Node is in a SCALE-encoded binary format, so the definition of the types between the API and the node needs to match 100%. When you find the above, it would mean the definition of the types on the API side does not match what is on the node. Specifically the API encodes against the definition, but since there is a mismatch the Node cannot parse the data correctly.

To fix this, you should look at the specific api.tx.* params and adjust the type definitions for those param types to match what is found on the node side. In some rare cases the cause could be extrinsic formatting related, to track these make an api.tx.system.remark(data: Bytes) call, if it fails, the API and node cannot agree on an extrinsic format and adjustments are required.

Also see the next entry for causes related to wrong Address formats.

I cannot send transactions, sending yields decoding failures

Depending on the chain, you could get either an Address or Signature or extensions decoding error when sending the transaction returned from the node. This is due to a type mismatch on the Address types defined on the node vs what the API uses. This is not something the API can detect via the metadata and it is generally configured on a per-chain basis.

The API always injects the default type definitions as specified by the Substrate master fully-featured node. This means that any customizations to chains needs to be applied as types, should there be differences in specific user-implementations.

Due to these customizations and differences that bleed through to the transaction formats, out-of-the-box chains based on the node-template will have issues when sending transactions. To fix this, you would need to add the customized Address types into your API instances (or UIs), allowing the API to have the information required to adjust the encoding.

There are 3 Address types that are generally configured in different chains, and one variant should be passed to the Api.create({ ... }) options as types -

  • type Address = MultiAddress (Rust), this is the current default in Substrate master and the API and used in chains such as Polkadot/Kusama from runtime 28. It allows an enhancement to the original Indices lookup, catering for a wide array of address types. To configure this type in the API, use { "Address": "MultiAddress", "LookupSource": "MultiAddress" }

  • type Address = <Indices as StaticLookup>::Source (Rust), this is the previous the default as applied in the API and yields types { "Address": "IndicesLookupSource", "LookupSource": "IndicesLookupSource" } when explicitly specified;

  • type Address = AccountId (Rust), this is used in a number of chains such as Kusama/Polkadot (prior to the 28 runtime) and a previous default for the node-template chain as well. To override to this type of Address, use the API types { "Address": "AccountId", "LookupSource": "AccountId" }

The above may also apply when you use polkadot-js/apps to connect to your node. Known chains are correctly configured, however any custom chain may need additional types.

I would like to sign transactions offline

The API itself is independent of where the signature comes from and how it is injected. Additionally it implements a signer interface, that can be used for external signing - an example of this is the polkadot-js/apps support for signing via extensions and even the polkadot-js/extension support for tools such as the Parity Signer.

As of this writing we don't have an explicit example of implementing the signer interface in these docs, although we do use one in our tests. Additionally, the polkadot-js/tools has an implementation of a very basic offline signer where transactions are generated in one process and signatures in another non-connected process.

I would like to send a root transaction

Some calls in Polkadot/Substrate can only be submitted as root, these are indicated by ensure_root(origin) in the Rust codebase. Root here does not refer to the actual account, i.e. //Alice on a --dev chain, but rather that it cannot be submitted as a bare user transaction. This restriction applies to chain upgrades, changing balances or anything that modifies the state and/or chain operation.

To submit these transactions, it needs to be sent as a wrapped transaction via either sudo.sudo (assuming you have access on your chain) or democracy.proposal (which would allow users of the chain to vote on it).

How do I call a function with a Tuple input

Tuples, as defined in the Polkadot/Substrate types appear as (TypeA, TypeB). For instance we may have an (AccountId, u64) input as defined in the metadata or as part of the user types. To specify a Tuple as an input, wrap it in an array format, for instance to call query.module.get((u32, u64)) where a (u32, u64) Tuple input is expected, you would do query.module.get([123, 456])

How long do transactions live

Polkadot/Substrate supports both immortal and mortal transactions. For immortal, this means that the transaction has an infinite lifetime, for mortals, the transactions expire after a defined period. By default the API sends mortal transactions when no explicit extrinsic era has been specified. This means that all transaction has a limited lifetime and will expire if not included in the period set.

The length for this transaction validity is set to 5 minutes, calculated based on the blocktime for the chain. (10 blocks per minute in this default 6s Substrate configuration).

My chain does not support system.account queries

The API always tracks the latest Substrate master in terms of examples. This means that nonce & balance queries are done via the api.query.system.account(<account>) which returns a struct { nonce: Index, data: AccountData } where the data is struct containing the free and reserved balances. As with all api.query.* endpoints, this is decorated based on what the chain you connect to support, via the metadata exchange.

It is possible that you are connecting to an older chain that has not been upgraded yet. For these chains, this storage entry won't be available (yet). To query the nonce on older chains, you can do a query to api.query.system.accountNonce(<account>) and balances can be retrieved via api.query.balances.freeBalance(<account>).

Likewise, if your chain has been upgraded recently and you are still using the old system.accountNonce or balances.freeBalance queries in your code (which is now not available in the chain metadata), you need to update it to query the new location.

Using a non-current-master node, I have issues parsing events

Recently Substrate master updated the Weight type from u32 -> u64. This type is used in the DispatchInfo struct in the system.ExtrinsicSuccess events, to return the applied call weights as well as the resulting fees. Since the API master branch tracks Substrate master, this means the change has been applied by default, with the default set to u64.

If you are on a chain that has not been upgraded yet, you need to add Weight: 'u32' to your types to allow for successful parsing of all events. Without this override, parsing will fail. As soon as one event in the Vec<EventRecord> structure from system.events fails to parse, all subsequent events are affected and the decoding will return an error.

On a non-current, non Substrate 2.0 branch, my balances are wrong

As part of the Substrate 2.0 release, the RefCount type has been changed from u8 to a u32. Since the API always tracks latest Substrate, this change has been applied by default. The impact of this type is that it is used in the AccountInfo type which is returned from system.account, which, in turn, tracks balances.

If on an older version of the chain, apply the older type via RefCount: 'u8' to your types.

Which API can I use to query by transaction hash?

There is no such API. Substrate does not expose a "query-by-tx-hash" RPC, nor are transactions indexed by hash on the Substrate node. The reason for this is that transaction hashes are non-unique across the chain, although they will generally be unique inside a block.

For more information around this, refer to the Polkadot wiki on unique extrinsic identifiers.

Since upgrading to the 7.x series, TypeScript augmentation is missing

For TS users, since the 7.x release, type augmentation is not applied by default to the API anymore. This could manifest in various ways,

  • query results may just return Codec instead of the actual expected type
  • dependent packages, e.g. api-derive or api-contract may yield TS errors

Historically Substrate-specific types and endpoints were auto-augmented, which worked in 95% of cases, until any known module was changed/extended from default Substrate behavior or types were extended or adjusted from what Substrate exposes. This resulted in any type overrides working in some cases and returning type errors in other critical areas, without a way of adjusting this correctly for the TS compiler.

Since the start of the 7.x series, type augmentation is to be applied explicitly. To restore Substrate-only types as found earlier versions, an import '@polkadot/api-augment' is to be added to your codebase entry point before any imports from the API itself. The various shipped aliases available are the folowing -

  • import '@polkadot/api-augment/substrate' - same as the @polkadot/api-augment form, the default (and what was applied before the 7.x release)
  • import '@polkadot/api-augment/kusama' - applies Kusama types and endpoint augmentation
  • import '@polkadot/api-augment/polkadot' - applies Polkadot types and endpoint augmentation

For non-Kusama/Polkadot chains, the above imports should be skipped completely and only the augmentation for the specific chain, as published by the teams themselves (generated via the typegen package), should be imported.

Internally the api-augment when included applies 3 different API augmentations based on the import applied -

  • applies all augmentation for tx, query, const, event endpoints for the specific chain
  • import '@polkadot/rpc-augment' - to decorate all RPC endpoints with defaults for Substrate
  • import '@polkadot/types-augment' - applying all generic Substrate types, this includes
    • import '@polkadot/types-augment/lookup' for Substrate/Kusama/Polkadot lookup types
    • import '@polkadot/types-augment/registry' for Substrate-specific registry types

The above breakdown could be useful to tweak and include some types, while excluding others.

- + \ No newline at end of file diff --git a/api/cookbook/blocks/index.html b/api/cookbook/blocks/index.html index e14b68d26f..5f85b4fdd6 100644 --- a/api/cookbook/blocks/index.html +++ b/api/cookbook/blocks/index.html @@ -5,12 +5,12 @@ Blocks | polkadot{.js} - +
Skip to main content

Blocks

The building blocks for each blockchain. As such there are a number of examples for working with blocks and headers, that could be useful.

How do I retrieve the header/extrinsic hash from blocks?

A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all objects returned by the API implements the .hash => Hash getter, we can simply use this to view the actual hash.

// returns Hash
const blockHash = await api.rpc.chain.getBlockHash(blockNumber);
// returns SignedBlock
const signedBlock = await api.rpc.chain.getBlock(blockHash);

// the hash for the block, always via header (Hash -> toHex()) - will be
// the same as blockHash above (also available on any header retrieved,
// subscription or once-off)
console.log(signedBlock.block.header.hash.toHex());

// the hash for each extrinsic in the block
signedBlock.block.extrinsics.forEach((ex, index) => {
console.log(index, ex.hash.toHex());
});

How do I extract the block author?

The block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).

// subscribe to all new headers (with extended info)
api.derive.chain.subscribeNewHeads((header) => {
console.log(`#${header.number}: ${header.author}`);
});

For a single header only, the derives also contain a getHeader, which once again returns a header extended with the author -

// retrieve the last header (hash optional)
const header = await api.derive.chain.getHeader();

console.log(`#${header.number}: ${header.author}`);

How do I view extrinsic information?

The transactions are included in a signed block as part of the extrinsics - some of these will be unsigned and generated by the block author and some of these may be submitted from external sources and be signed. (Some palettes do use unsigned transactions, so signed/unsigned is not an indication of origin). To retrieve the block and display the transaction information, we can do the following -

// no blockHash is specified, so we retrieve the latest
const signedBlock = await api.rpc.chain.getBlock();

// the information for each of the contained extrinsics
signedBlock.block.extrinsics.forEach((ex, index) => {
// the extrinsics are decoded by the API, human-like view
console.log(index, ex.toHuman());

const { isSigned, meta, method: { args, method, section } } = ex;

// explicit display of name, args & documentation
console.log(`${section}.${method}(${args.map((a) => a.toString()).join(', ')})`);
console.log(meta.documentation.map((d) => d.toString()).join('\n'));

// signer/nonce info
if (isSigned) {
console.log(`signer=${ex.signer.toString()}, nonce=${ex.nonce.toString()}`);
}
});

In the above .toHuman() is used to format into a human-readable representation. You can inspect/extract specific fields from the decoded extrinsic as required, for instance ex.method.section would return the pallete that executed this transaction.

How do I map extrinsics to their events?

While the blocks contain the extrinsics, the system event storage will contain the events and the details needed to allow for a mapping between. For events the phase is an enum that would be isApplyExtrinsic with the index in the cases where it refers to an extrinsic in a block. This index maps through the order of the extrinsics as found.

To perform a mapping between the two, we need information from both sources.

// no blockHash is specified, so we retrieve the latest
const signedBlock = await api.rpc.chain.getBlock();
const apiAt = await api.at(signedBlock.block.header.hash);
const allRecords = await apiAt.query.system.events();

// map between the extrinsics and events
signedBlock.block.extrinsics.forEach(({ method: { method, section } }, index) => {
// filter the specific events based on the phase and then the
// index of our extrinsic in the block
const events = allRecords
.filter(({ phase }) =>
phase.isApplyExtrinsic &&
phase.asApplyExtrinsic.eq(index)
)
.map(({ event }) => `${event.section}.${event.method}`);

console.log(`${section}.${method}:: ${events.join(', ') || 'no events'}`);
});

How do I determine if an extrinsic succeeded/failed?

This is an extension of the above example where extrinsics are mapped to their blocks. However in this example, we will look for specific extrinsic events, in this case the system.ExtrinsicSuccess and system.ExtrinsicFailed events. The same logic can be applied to inspect any other type of expected event.

// no blockHash is specified, so we retrieve the latest
const signedBlock = await api.rpc.chain.getBlock();

// get the api and events at a specific block
const apiAt = await api.at(signedBlock.block.header.hash);
const allRecords = await apiAt.query.system.events();

// map between the extrinsics and events
signedBlock.block.extrinsics.forEach(({ method: { method, section } }, index) => {
allRecords
// filter the specific events based on the phase and then the
// index of our extrinsic in the block
.filter(({ phase }) =>
phase.isApplyExtrinsic &&
phase.asApplyExtrinsic.eq(index)
)
// test the events against the specific types we are looking for
.forEach(({ event }) => {
if (api.events.system.ExtrinsicSuccess.is(event)) {
// extract the data for this event
// (In TS, because of the guard above, these will be typed)
const [dispatchInfo] = event.data;

console.log(`${section}.${method}:: ExtrinsicSuccess:: ${JSON.stringify(dispatchInfo.toHuman())}`);
} else if (api.events.system.ExtrinsicFailed.is(event)) {
// extract the data for this event
const [dispatchError, dispatchInfo] = event.data;
let errorInfo;

// decode the error
if (dispatchError.isModule) {
// for module errors, we have the section indexed, lookup
// (For specific known errors, we can also do a check against the
// api.errors.<module>.<ErrorName>.is(dispatchError.asModule) guard)
const decoded = api.registry.findMetaError(dispatchError.asModule);

errorInfo = `${decoded.section}.${decoded.name}`;
} else {
// Other, CannotLookup, BadOrigin, no extra info
errorInfo = dispatchError.toString();
}

console.log(`${section}.${method}:: ExtrinsicFailed:: ${errorInfo}`);
}
});
});
- + \ No newline at end of file diff --git a/api/cookbook/index.html b/api/cookbook/index.html index 713b3525cd..5b083055ed 100644 --- a/api/cookbook/index.html +++ b/api/cookbook/index.html @@ -5,12 +5,12 @@ Overview | polkadot{.js} - +
Skip to main content

Overview

The cookbook hosts small code snippets in a question-answer format. It does not walk you through the whole setup, like the basic examples, but rather aims to answer some questions around specific uses. It also does not replace the FAQ, rather this is focussed explicitly on code samples, instead of general trouble-shooting for common mishaps.

These questions are added as they do come up and the hope is that the snippets here is will be useful to others, instead of just the original person who asked on a specific use-case. As of today, it is only making a start and not fully comprehensive yet - check back early, check back often.

Sections

The following cookbook sections are available -

  • Blocks - Snippets around working with blocks and headers
  • Storage - Snippets for working with storage
  • Transactions - Snippets for working with transactions

... more to come.

Contribute

And as always, if you have an addition to make, or a question to ask any any PRs or issues are appreciated. The initial content was generate from exactly such questions, either in Riot chat or as submitted as issues.

- + \ No newline at end of file diff --git a/api/cookbook/storage/index.html b/api/cookbook/storage/index.html index 93873e609a..081d1835e7 100644 --- a/api/cookbook/storage/index.html +++ b/api/cookbook/storage/index.html @@ -5,12 +5,12 @@ Storage | polkadot{.js} - +
Skip to main content

Storage

Here you will find snippets for working with storage.

How do I check for storage existence?

In the metadata, for each storage item a fallback is provided. This means that when an entry does not exist, the fallback (which is the default value for the type) will be provided. This means, that querying for a non-existent key (unless an option), will yield a value -

// retrieve Option<StakingLedger>
const ledger = await api.query.staking.ledger('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
// retrieve ValidatorPrefs (will yield the default value)
const prefs = await api.query.staking.validators('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');

console.log(ledger.isNone, ledger.isSome); // true, false
console.log(JSON.stringify(prefs.toHuman())); // {"commission":"0"}

In the second case, the non-existent prefs returns the default/fallback value for the storage item. So in this case we don't know if the value is set to 0 or unset. Existence can be checked by using the storage size, which would be zero if nothing is stored.

// exists
const sizeY = await api.query.staking.validators.size('DB2mp5nNhbFN86J9hxoAog8JALMhDXgwvWMxrRMLNUFMEY4');
// non existent
const sizeN = await api.query.staking.validators.size('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');

console.log(sizeY.isZero(), sizeY.toNumber()); // false 4
console.log(sizeN.isZero(), sizeY.toNumber()); // true 0

How do I use .entries()/.keys() on double maps?

As explained elsewhere each map-type storage entry exposes the entries/keys helpers to retrieve the whole list. In the case of double maps, with the addition of a single argument, you can retrieve either all entries or a subset based on the first map key.

In both these cases, entries/keys operate the same way, .entries() retrieving (StorageKey, Codec)[] and .keys() retrieving StorageKey[]

// Retrieves the entries for all slashes, in all eras (no arg)
const allEntries = await api.query.staking.nominatorSlashInEra.entries();

// nominatorSlashInEra(EraIndex, AccountId) for the types of the key args
allEntries.forEach(([{ args: [era, nominatorId] }, value]) => {
console.log(`${era}: ${nominatorId} slashed ${value.toHuman()}`);
});

While we can retrieve only the keys for a specific era, using a argument for the first part of the doublemap (as defined here, an EraIndex) -

// Retrieves the keys for the slashed validators in era 652
const slashedKeys = await api.query.staking.nominatorSlashInEra.keys(652);

// key args still contains [EraIndex, AccountId] decoded
console.log(`slashed: ${slashedKeys.map(({ args: [era, nominatorId] }) => nominatorId)`);
- + \ No newline at end of file diff --git a/api/cookbook/tx/index.html b/api/cookbook/tx/index.html index edae37029a..dc11e662a9 100644 --- a/api/cookbook/tx/index.html +++ b/api/cookbook/tx/index.html @@ -5,12 +5,12 @@ Transactions | polkadot{.js} - +
Skip to main content

Transactions

A blockchain is no fun if you are not submitting transactions. Or at least if somebody is not submitting any. Here you will find some snippets for dealing with some common issues.

How do I estimate the transaction fees?

In addition to the signAndSend helper on transactions, .paymentInfo (with the exact same parameters) are also exposed. Using the same sender, it applies a dummy signature to the transaction and then gets the fee estimation via RPC.

// estimate the fees as RuntimeDispatchInfo, using the signer (either
// address or locked/unlocked keypair) (When overrides are applied, e.g
// nonce, the format would be `paymentInfo(sender, { nonce })`)
const info = await api.tx.balances
.transfer(recipient, 123)
.paymentInfo(sender);

// log relevant info, partialFee is Balance, estimated for current
console.log(`
class=${info.class.toString()},
weight=${info.weight.toString()},
partialFee=${info.partialFee.toHuman()}
`);

How do I get the decoded enum for an ExtrinsicFailed event?

Assuming you are sending a tx via .signAndSend, the callback yields information around the tx pool status as well as any events when isInBlock or isFinalized. If an extrinsic fails via system.ExtrinsicFailed event, you can retrieve the error, if defined as an enum on a module.

api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
// find/filter for failed events
.filter(({ event }) =>
api.events.system.ExtrinsicFailed.is(event)
)
// we know that data for system.ExtrinsicFailed is
// (DispatchError, DispatchInfo)
.forEach(({ event: { data: [error, info] } }) => {
if (error.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(error.asModule);
const { docs, method, section } = decoded;

console.log(`${section}.${method}: ${docs.join(' ')}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(error.toString());
}
});
}
});

As of the @polkadot/api 2.3.1 additional result fields are exposed. Firstly there is dispatchInfo: DispatchInfo which occurs in both ExtrinsicSuccess & ExtrinsicFailed events. Additionally, on failures the dispatchError: DispatchError is exposed. With this in mind, the above can be simplified to be -

api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, ({ status, events, dispatchError }) => {
// status would still be set, but in the case of error we can shortcut
// to just check it (so an error would indicate InBlock or Finalized)
if (dispatchError) {
if (dispatchError.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(dispatchError.asModule);
const { docs, name, section } = decoded;

console.log(`${section}.${name}: ${docs.join(' ')}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(dispatchError.toString());
}
}
});

How do I get the Result of a Sudo event?

The section above shows you how to listen for the result of a regular extrinsic. However, Sudo extrinsics do not directly report the success or failure of the underlying call. Instead, a Sudo transaction will return Sudid(result), where result will be the information you are looking for.

To properly parse this information, we will follow the steps above, but then specifically peek into the event data to find the final result:

const unsub = await api.tx.sudo
.sudo(
api.tx.balances.forceTransfer(user1, user2, amount)
)
.signAndSend(sudoPair, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
// We know this tx should result in `Sudid` event.
.filter(({ event }) =>
api.events.sudo.Sudid.is(event)
)
// We know that `Sudid` returns just a `Result`
.forEach(({ event : { data: [result] } }) => {
// Now we look to see if the extrinsic was actually successful or not...
if (result.isError) {
let error = result.asError;
if (error.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(error.asModule);
const { docs, name, section } = decoded;

console.log(`${section}.${name}: ${docs.join(' ')}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(error.toString());
}
}
});
unsub();
}
});

How do I send an unsigned extrinsic?

For most runtime modules, transactions need to be signed and validation for this happens node-side. There are however modules that accepts unsigned extrinsics, an example would be the Polkadot/Kusama token claims (which is here used as an example).

// construct the transaction, exactly as per normal
const utx = api.tx.claims.claim(beneficiary, ethSignature);

// send it without calling sign, pass callback with status/events
tx.send(({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});

The signing is indicated by the first byte in the transaction, so in this case we have called .send on it (no .sign or .signAndSend), so it will be sent using the unsigned state, without signature attached.

NOTE: The status event is only available on providers that support subscriptions such as WSProvider or ScProvider. On HttpProvider, which does not have bi-directional capabilities, there are no subscriptions, so it cannot listen to the events that are emitted by the transaction pool. In the case of HttpProvider the result object returned will always be the non-unique transaction hash.

How can I batch transactions?

Polkadot/Substrate provides a utility.batch method that can be used to send a number of transactions at once. These are then executed from a single sender (single nonce specified) in sequence. This is very useful in a number of cases, for instance if you wish to create a payout for a validator for multiple eras, you can use this method. Likewise, you can send a number of transfers at once. Or even batch different types of transactions.

// construct a list of transactions we want to batch
const txs = [
api.tx.balances.transfer(addrBob, 12345),
api.tx.balances.transfer(addrEve, 12345),
api.tx.staking.unbond(12345)
];

// construct the batch and send the transactions
api.tx.utility
.batch(txs)
.signAndSend(sender, ({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});

The fee for a batch transaction can be estimated similar to the fee for a single transaction using the exposed .paymentInfo helper method that was described earlier, and it is usually less than the sum of the fees for each individual transaction.

How do I take the pending tx pool into account in my nonce?

The system.account query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that signAndSend would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the signAndSend operation, we can override the nonce, either by manually incrementing it or querying it via rpc.system.accountNextIndex.

for (let i = 0; i < 10; i++) {
// retrieve sender's next index/nonce, taking txs in the pool into account
const nonce = await api.rpc.system.accountNextIndex(sender);

// send, just retrieving the hash, not waiting on status
const txhash = await api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, { nonce });
}

As a convenience function, the accountNextIndex can be omitted by specifying a nonce of -1, allow the API to do the lookup. In this case the above can be simplified even further,

for (let i = 0; i < 10; i++) {
const txhash = await api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, { nonce: -1 });
}

The latter form is preferred since it dispatches the RPC calls for nonce and blockHash (used for mortality) in parallel and therefore will yield a better throughput, especially with the above bulk example.

- + \ No newline at end of file diff --git a/api/examples/promise/chain-info/index.html b/api/examples/promise/chain-info/index.html index 77c381abae..6873ad13e4 100644 --- a/api/examples/promise/chain-info/index.html +++ b/api/examples/promise/chain-info/index.html @@ -5,12 +5,12 @@ Get chain information | polkadot{.js} - +
Skip to main content

Get chain information

This example shows how to connect to the api and retrieve the chain information such as the token name, the ss58 format for address encoding and the token decimals.

// Import the API
import { ApiPromise, WsProvider } from '@polkadot/api';

async function main () {
// Create connection to websocket
const wsProvider = new WsProvider('wss://rpc.polkadot.io');
// Create a new instance of the api
const api = await ApiPromise.create({ provider: wsProvider });
// get the chain information
const chainInfo = await api.registry.getChainProperties()

console.log(chainInfo);
// for Polkadot this would print
// {ss58Format: 0, tokenDecimals: [10], tokenSymbol: [DOT]}
}

main().catch(console.error).finally(() => process.exit());
- + \ No newline at end of file diff --git a/api/examples/promise/index.html b/api/examples/promise/index.html index b6465126ee..4b043faa9b 100644 --- a/api/examples/promise/index.html +++ b/api/examples/promise/index.html @@ -5,12 +5,12 @@ ApiPromise Examples | polkadot{.js} - +
Skip to main content

ApiPromise Examples

Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. It uses the [[ApiPromise]] interface.

Prerequisites

For the following examples, you need a local node. It is usually convenient testing with:

substrate --dev

Running the examples

From each folder, run yarn to install the required dependencies and then run yarn start to execute the example against the running node.

Development accounts

Some of the examples use the following accounts:

  • Alice: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
  • Bob: 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty

Those accounts are easy to add if you don't have/see them. The seed of Alice's account is //Alice (via keyring.addUri(...), dev seed implied) and the seed of Bob is... well you guess...

- + \ No newline at end of file diff --git a/api/examples/promise/listen-to-balance-change/index.html b/api/examples/promise/listen-to-balance-change/index.html index bbd9b591f4..b5527b5077 100644 --- a/api/examples/promise/listen-to-balance-change/index.html +++ b/api/examples/promise/listen-to-balance-change/index.html @@ -5,12 +5,12 @@ Listen to balance changes | polkadot{.js} - +
Skip to main content

Listen to balance changes

This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.

// Import the API
const { ApiPromise } = require('@polkadot/api');

// Known account we want to use (available on dev chain, with funds)
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';

async function main () {
// Create an await for the API
const api = await ApiPromise.create();

// Retrieve the initial balance. Since the call has no callback, it is simply a promise
// that resolves to the current on-chain value
let { data: { free: previousFree }, nonce: previousNonce } = await api.query.system.account(ALICE);

console.log(`${ALICE} has a balance of ${previousFree}, nonce ${previousNonce}`);
console.log(`You may leave this example running and start example 06 or transfer any value to ${ALICE}`);

// Here we subscribe to any balance changes and update the on-screen value
api.query.system.account(ALICE, ({ data: { free: currentFree }, nonce: currentNonce }) => {
// Calculate the delta
const change = currentFree.sub(previousFree);

// Only display positive value changes (Since we are pulling `previous` above already,
// the initial balance change will also be zero)
if (!change.isZero()) {
console.log(`New balance change of ${change}, nonce ${currentNonce}`);

previousFree = currentFree;
previousNonce = currentNonce;
}
});
}

main().catch(console.error);
- + \ No newline at end of file diff --git a/api/examples/promise/listen-to-blocks/index.html b/api/examples/promise/listen-to-blocks/index.html index d97b7eab60..0766f47eb9 100644 --- a/api/examples/promise/listen-to-blocks/index.html +++ b/api/examples/promise/listen-to-blocks/index.html @@ -5,12 +5,12 @@ Listen to new blocks | polkadot{.js} - +
Skip to main content

Listen to new blocks

This example shows how to subscribe to new blocks.

It displays the block number every time a new block is seen by the node you are connected to.

NOTE: The example runs until you stop it with CTRL+C

// Import the API
const { ApiPromise } = require('@polkadot/api');

async function main () {
// Here we don't pass the (optional) provider, connecting directly to the default
// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure
// the API has connected to the node and completed the initialisation process
const api = await ApiPromise.create();

// We only display a couple, then unsubscribe
let count = 0;

// Subscribe to the new headers on-chain. The callback is fired when new headers
// are found, the call itself returns a promise with a subscription that can be
// used to unsubscribe from the newHead subscription
const unsubscribe = await api.rpc.chain.subscribeNewHeads((header) => {
console.log(`Chain is at block: #${header.number}`);

if (++count === 256) {
unsubscribe();
process.exit(0);
}
});
}

main().catch(console.error);
- + \ No newline at end of file diff --git a/api/examples/promise/listen-to-multiple-balances-change/index.html b/api/examples/promise/listen-to-multiple-balances-change/index.html index 59b6cf1723..a3f7f404e7 100644 --- a/api/examples/promise/listen-to-multiple-balances-change/index.html +++ b/api/examples/promise/listen-to-multiple-balances-change/index.html @@ -5,12 +5,12 @@ Listen to balance changes | polkadot{.js} - +
Skip to main content

Listen to balance changes

This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.

// Import the API
const { ApiPromise } = require('@polkadot/api');

// Known account we want to use (available on dev chain, with funds)
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';

async function main () {
// Create an await for the API
const api = await ApiPromise.create();

console.log('Tracking balances for:', [ALICE, BOB]);

// Subscribe and listen to several balance changes
api.query.system.account.multi([ALICE, BOB], (balances) => {
console.log('Change detected, new balances: ', balances.map(({ data: { free } }) => free));
});
}

main().catch(console.error);
- + \ No newline at end of file diff --git a/api/examples/promise/make-transfer/index.html b/api/examples/promise/make-transfer/index.html index c852db5a33..461492e012 100644 --- a/api/examples/promise/make-transfer/index.html +++ b/api/examples/promise/make-transfer/index.html @@ -5,12 +5,12 @@ Make a simple transfer | polkadot{.js} - +
Skip to main content

Make a simple transfer

This sample shows how to create a transaction to make a transfer from one account to another.

// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@polkadot/api');
const { Keyring } = require('@polkadot/keyring');

const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';

async function main () {
// Instantiate the API
const api = await ApiPromise.create();

// Construct the keyring after the API (crypto has an async init)
const keyring = new Keyring({ type: 'sr25519' });

// Add Alice to our keyring with a hard-derivation path (empty phrase, so uses dev)
const alice = keyring.addFromUri('//Alice');

// Create a extrinsic, transferring 12345 units to Bob
const transfer = api.tx.balances.transferAllowDeath(BOB, 12345);

// Sign and send the transaction using our account
const hash = await transfer.signAndSend(alice);

console.log('Transfer sent with hash', hash.toHex());
}

main().catch(console.error).finally(() => process.exit());
- + \ No newline at end of file diff --git a/api/examples/promise/read-storage-at/index.html b/api/examples/promise/read-storage-at/index.html index 737c7d3241..8ed1c17fa2 100644 --- a/api/examples/promise/read-storage-at/index.html +++ b/api/examples/promise/read-storage-at/index.html @@ -5,12 +5,12 @@ Read storage, at a specific blockhash | polkadot{.js} - +
Skip to main content

Read storage, at a specific blockhash

In addition to querying the latest storage, you can make storage queries at a specific blockhash. Be aware that the node applies a pruning strategy and typically only keeps the last 256 blocks, unless run in archive mode.

// Import the API
const { ApiPromise } = require('@polkadot/api');

// Our address for Alice on the dev chain
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';

async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();

// Retrieve the last block header, extracting the hash and parentHash
const { hash, parentHash } = await api.rpc.chain.getHeader();

console.log(`last header hash ${hash.toHex()}`);

// Retrieve the balance at the preceding block for Alice using an at api
const apiAt = await api.at(parentHash);
const balance = await apiAt.query.system.account(ALICE);

console.log(`Alice's balance at ${parentHash.toHex()} was ${balance.data.free}`);

// Now perform a multi query, returning multiple balances at once
const balances = await api.query.system.account.multi([ALICE, BOB]);

console.log(`Current balances for Alice and Bob are ${balances[0].data.free} and ${balances[1].data.free}`);
}

main().catch(console.error).finally(() => process.exit());
- + \ No newline at end of file diff --git a/api/examples/promise/read-storage/index.html b/api/examples/promise/read-storage/index.html index 983954436f..91e722f5b9 100644 --- a/api/examples/promise/read-storage/index.html +++ b/api/examples/promise/read-storage/index.html @@ -5,12 +5,12 @@ Read storage | polkadot{.js} - +
Skip to main content

Read storage

Many important variables are available through the storage API. This example shows how to call a few of those APIs.

// Import the API
const { ApiPromise } = require('@polkadot/api');

// Our address for Alice on the dev chain
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';

async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();

// Make our basic chain state/storage queries, all in one go
const [{ nonce: accountNonce }, now, validators] = await Promise.all([
api.query.system.account(ALICE),
api.query.timestamp.now(),
api.query.session.validators()
]);

console.log(`accountNonce(${ALICE}) ${accountNonce}`);
console.log(`last block timestamp ${now.toNumber()}`);

if (validators && validators.length > 0) {
// Retrieve the balances for all validators
const validatorBalances = await Promise.all(
validators.map((authorityId) =>
api.query.system.account(authorityId)
)
);

// Print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].data.free.toHuman(),
nonce: validatorBalances[index].nonce.toHuman()
})));
}
}

main().catch(console.error).finally(() => process.exit());
- + \ No newline at end of file diff --git a/api/examples/promise/simple-connect/index.html b/api/examples/promise/simple-connect/index.html index 698490cf3d..e55b115d98 100644 --- a/api/examples/promise/simple-connect/index.html +++ b/api/examples/promise/simple-connect/index.html @@ -5,12 +5,12 @@ Simple Connect | polkadot{.js} - +
Skip to main content

Simple Connect

The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiPromise.

// Required imports
const { ApiPromise, WsProvider } = require('@polkadot/api');

async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');

// Create the API and wait until ready
const api = await ApiPromise.create({ provider });

// Retrieve the chain & node information information via rpc calls
const [chain, nodeName, nodeVersion] = await Promise.all([
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
]);

console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
}

main().catch(console.error).finally(() => process.exit());
- + \ No newline at end of file diff --git a/api/examples/promise/system-events/index.html b/api/examples/promise/system-events/index.html index 34843bc0ac..4e09eb588e 100644 --- a/api/examples/promise/system-events/index.html +++ b/api/examples/promise/system-events/index.html @@ -5,12 +5,12 @@ Traverse events | polkadot{.js} - +
Skip to main content

Traverse events

Query the system events and extract information from them. This example runs until exited via Ctrl-C

// Import the API
const { ApiPromise } = require('@polkadot/api');

async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();

// Subscribe to system events via storage
api.query.system.events((events) => {
console.log(`\nReceived ${events.length} events:`);

// Loop through the Vec<EventRecord>
events.forEach((record) => {
// Extract the phase, event and the event types
const { event, phase } = record;
const types = event.typeDef;

// Show what we are busy with
console.log(`\t${event.section}:${event.method}:: (phase=${phase.toString()})`);
console.log(`\t\t${event.meta.documentation.toString()}`);

// Loop through each of the parameters, displaying the type and data
event.data.forEach((data, index) => {
console.log(`\t\t\t${types[index].type}: ${data.toString()}`);
});
});
});
}

main().catch((error) => {
console.error(error);
process.exit(-1);
});
- + \ No newline at end of file diff --git a/api/examples/promise/transfer-events/index.html b/api/examples/promise/transfer-events/index.html index 51743eefa1..fcdb2d9f61 100644 --- a/api/examples/promise/transfer-events/index.html +++ b/api/examples/promise/transfer-events/index.html @@ -5,12 +5,12 @@ Transfer events | polkadot{.js} - +
Skip to main content

Transfer events

Display the events that occur during a transfer by sending a value to a random account

// Import the API & Provider and some utility functions
const { ApiPromise } = require('@polkadot/api');

// Import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@polkadot/keyring/testing');

// Utility function for random values
const { randomAsU8a } = require('@polkadot/util-crypto');

// Some constants we are using in this sample
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const AMOUNT = 10000;

async function main () {
// Create the API and wait until ready
const api = await ApiPromise.create();

// Create an instance of our testing keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();

// Get the nonce for the admin key
const { nonce } = await api.query.system.account(ALICE);

// Find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);

// Create a new random recipient
const recipient = keyring.addFromSeed(randomAsU8a(32)).address;

console.log('Sending', AMOUNT, 'from', alicePair.address, 'to', recipient, 'with nonce', nonce.toString());

// Do the transfer and track the actual status
api.tx.balances
.transfer(recipient, AMOUNT)
.signAndSend(alicePair, { nonce }, ({ events = [], status }) => {
console.log('Transaction status:', status.type);

if (status.isInBlock) {
console.log('Included at block hash', status.asInBlock.toHex());
console.log('Events:');

events.forEach(({ event: { data, method, section }, phase }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
} else if (status.isFinalized) {
console.log('Finalized block hash', status.asFinalized.toHex());

process.exit(0);
}
});
}

main().catch(console.error);
- + \ No newline at end of file diff --git a/api/examples/promise/typegen/index.html b/api/examples/promise/typegen/index.html index cd1cba1a7f..8b6b90c7c3 100644 --- a/api/examples/promise/typegen/index.html +++ b/api/examples/promise/typegen/index.html @@ -5,12 +5,12 @@ TS type generation | polkadot{.js} - +
Skip to main content

TS type generation

This is a sample TypeScript project with full source & config on GitHub, that uses @polkadot/typegen to generate type definitions that can be used to decorate the @polkadot/api. It uses both types defined for the specific chain as well as the chain metadata to generate TypeScript interfaces. This means that interfaces such as api.query.*, api.tx.* and api.consts.* will be decorated based on chain-specific information, instead of an un-augmented catch-all definition.

NOTE This is built using the updates in the 1.4.0 api track and as such it uses the latest (at the time of writing) @polkadot/api 1.4.0. If you want to play on your own, it is also suggested that you use the 1.4+ series since some generation types have moved around internally, making it easier to augment.

Packages

For the packages we need from the @polkadot/* we have added @polkadot/api (we want to do API stuff) and @polkadot/typegen (to generate the actual interfaces). So our scripts and dependencies inside package.json contain the following -

{
"scripts": {
"build": "yarn generate:defs && yarn generate:meta",
"generate:defs": "ts-node --skip-project node_modules/.bin/polkadot-types-from-defs --package sample-polkadotjs-typegen/interfaces --input ./src/interfaces --endpoint ./edgeware.json",
"generate:meta": "ts-node --skip-project node_modules/.bin/polkadot-types-from-chain --package sample-polkadotjs-typegen/interfaces --endpoint ./edgeware.json --output ./src/interfaces",
"lint": "tsc --noEmit --pretty"
},
"dependencies": {
"@polkadot/api": "^2.3.1"
},
"devDependencies": {
"@polkadot/typegen": "^2.3.1",
"ts-node": "^8.6.2",
"typescript": "^4.0.2"
}
}

We will delve into the setup and running the scripts and what they do in a short bit, but as of now just notice that we are running the scripts via ts-node. Since we supply our definitions as *.ts files, this is important otherwise they will not be parsable. build will just run both the types and meta generators (in that order, so metadata can use the types) and we have a lint that can just check that everything is as it is meant to be.

Metadata setup

The idea here is to use the actual chain metadata to generate the actual api types and augmented endpoints. The metadata we are adding here (in addition to the manually-defined user types), is from the Edgeware Berlin testnet. So this is a real-world example of configuring the API for a specific substrate chain. For the metadata retrieval, we just ran a simple curl command to get it from the node -

curl -H "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' http://localhost:9933

And then add the full JSONPC output as received to the edgeware.json file as specified by the generation command. A trimmed version would look like -

{"jsonrpc":"2.0","result":"0x6d6574610b6c185379737....","id":29}

The generator can also use a wss:// as an --endpoint param as part of the generation, but in most cases you would want a static metadata to work from in development, hence we are actually adding it here.

Types setup

The types are defined in the src/interfaces folder. While this repo contains a number of generated files in there as well, including auto-generated types, you can specify additional type definitions by adding the following -

  • src/interfaces/definitions.ts - this just exports all the sub-folder definitions in one go
  • src/interfaces/<module>/definitions.ts - manual type definitions for a specific module

This structure fully matches what is available in the @polkadot/type/interfaces folder, so the structure is setup based on the convention used in the @polkadot/types library. The generating scripts will expect something matching this since the same underlying code is actually used inside @polkadot/types as well. The top-level interfaces/ folder can be name anything, however the internal content structure need to match what is defined above.

For the top-level the definition file has the following contents -

export { default as signaling } from './signaling/definitions';
export { default as treasuryRewards } from './treasuryRewards/definitions';
export { default as voting } from './voting/definitions';

As explained above, it really is just a re-export of the definitions, so they are all easily accessible to the outside, i.e. we will use this import inside our own code to use the definitions in API initialization. The generation scripts will load this file to determine which types it needs to import. By the @polkadot/types convention, match the export names with the folders (preferably your runtime module names), the generation scripts will use these names to find the correct folders to output the generated types.ts to.

For each of the folders, signaling, treasuryRewards and voting another definitions.ts file is contained within. Looking at the one from signaling, it contains this -

export default {
types: {
ProposalRecord: {
index: 'u32',
author: 'AccountId',
stage: 'VoteStage',
transition_time: 'u32',
title: 'Text',
contents: 'Text',
vote_id: 'u64'
},
ProposalContents: 'Vec<u8>',
ProposalTitle: 'Vec<u8>'
}
}

Just the type definitions (the structure of which you should be familiar with), nested inside a types: {...} container. This allows us future extension points, i.e. there is some work to expose the custom RPC types alongside, so that would become another key on a per-module basis.

In the above, you will note that the ProposalRecord references a type for voting, i.e. VoteStage. The type generation and resolution will determine where the type comes from, and provide the required imports on generation.

Looking at the example in this repo, it also has augment*, index.ts and types.ts files in the interfaces folder. These are all generated, and will be re-generated when the generator is run - so all edits to these files will be lost. The only requirement for user-edits are the definitions.ts files.

Generating

Now that both the metadata and types setup is completed, we just run the build command via yarn build and magically (assuming you didn't have the augment* and other generated files), these files will be added. When running this command, the console should display something like -

> yarn build
$ yarn generate:defs && yarn generate:meta
$ ts-node --skip-project \
node_modules/.bin/polkadot-types-from-defs \
--package sample-polkadotjs-typegen/interfaces \
--input ./src/interfaces
--endpoint ./edgeware.json

sample-polkadotjs-typegen/src/interfaces/types.ts
Generating
Extracting interfaces for signaling
...
Writing

sample-polkadotjs-typegen/src/interfaces/augment-types.ts
Generating
Writing

$ ts-node --skip-project \
node_modules/.bin/polkadot-types-from-chain \
--package sample-polkadotjs-typegen/interfaces \
--endpoint ./edgeware.json \
--output ./src/interfaces

Generating from metadata, 81,267 bytes
...

sample-polkadotjs-typegen/src/interfaces/augment-api.ts
Generating
Writing

✨ Done in 4.04s.

Now if we check the actual output against the source via yarn lint, we would see that valid output has been generated -

> yarn lint
$ tsc --noEmit --pretty
✨ Done in 2.28s.

Peering at the output

We are ready to use all these generated types after some TS config. If you take a look at the generated src/signaling/types.ts, you would see generated TS interfaces, such as -

import { Struct } from '@polkadot/types/codec';
import { Bytes, Text, u32, u64 } from '@polkadot/types/primitive';
import { AccountId } from '@polkadot/types/interfaces/runtime';
import { VoteStage } from 'sample-polkadotjs-typegen/interfaces/voting';

/** @name ProposalContents */
export interface ProposalContents extends Bytes {}

/** @name ProposalRecord */
export interface ProposalRecord extends Struct {
readonly index: u32;
readonly author: AccountId;
readonly stage: VoteStage;
readonly transition_time: u32;
readonly title: Text;
readonly contents: Text;
readonly vote_id: u64;
}

/** @name ProposalTitle */
export interface ProposalTitle extends Bytes {}

As mentioned earlier, here you will notice the import { VoteStage }, the generator has determined that voting exports that interface and has added the required imports.

The metadata-generated types can be imported from @polkadot/types/lookup, which is declared in src/interfaces/types-lookup.ts.

TypeScript config

Now that we have files generated, it is time to make TypeScript aware of the types and add an explicit override into out tsconfig.json. After some changes, the paths in the config looks as follow (comments are in the actual config file here) -

{
"compilerOptions": {
"paths": {
"sample-polkadotjs-typegen/*": ["src/*"],
"@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
"@polkadot/types/augment": ["src/interfaces/augment-types.ts"]
}
}
}

Effectively what we do above is tell the TypeScript compiler to not use the built-in API augmentation, but rather to replace it with our version. This means that all types from these are injected not by the substrate-latest-master version, but rather with what we have defined above.

Usage

For simple usage, we have added the src/index.ts file that show how the metadata and types actually decorate the API. In addition, we also have setup instructions included here.

// We need to import the augmented definitions "somewhere" in our project, however since we have
// it in tsconfig as an override and the api/types has imports, it is not strictly required here.
// Because of the tsconfig override, we could import from '@polkadot/{api, types}/augment'
import './interfaces/augment-api';
import './interfaces/augment-types';

// all type stuff, the only one we are using here
import type { VoteRecord } from './interfaces';

// external imports
import { ApiPromise } from '@polkadot/api';
import { createType } from '@polkadot/types';

// our local stuff
import * as definitions from './interfaces/definitions';

async function main (): Promise<void> {
// extract all types from definitions - fast and dirty approach, flatted on 'types'
const types = Object.values(definitions).reduce((res, { types }): object => ({ ...res, ...types }), {});

const api = await ApiPromise.create({
types: {
...types,
// aliases that don't do well as part of interfaces
'voting::VoteType': 'VoteType',
'voting::TallyType': 'TallyType',
// chain-specific overrides
Keys: 'SessionKeys4'
}
});

// get a query
const recordOpt = await api.query.voting.voteRecords(123);

// the types match with what we expect here
let firstRecord: VoteRecord | null = recordOpt.unwrapOr(null);
console.log(firstRecord?.toHuman());

// it even does work for arrays & subscriptions
api.query.signaling.activeProposals((results): void => {
results.forEach(([hash, blockNumber]): void => {
console.log(hash.toHex(), ':', blockNumber.toNumber());
});
});

// even createType works, allowing for our types to be used
console.log(`Balance2 bitLength:`, [
api.createType('Balance2').bitLength(),
api.registry.createType('Balance2').bitLength(),
createType(api.registry, 'Balance2').bitLength()
]);
}

await main();

And that is a ...

... wrap. Just a really simple walk-through to customizing the API TypeScript definitions for your chain.

- + \ No newline at end of file diff --git a/api/examples/promise/unsubscribe/index.html b/api/examples/promise/unsubscribe/index.html index a8e0661e54..fe6bb7c8d4 100644 --- a/api/examples/promise/unsubscribe/index.html +++ b/api/examples/promise/unsubscribe/index.html @@ -5,12 +5,12 @@ Unsubscribe from listening to updates | polkadot{.js} - +
Skip to main content

Unsubscribe from listening to updates

This example shows how to subscribe to and later unsubscribe from listening to block updates.

In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.

// Import the API
const { ApiPromise } = require('@polkadot/api');

async function main () {
// Create a new instance of the api
const api = await ApiPromise.create();

// Subscribe to chain updates and log the current block number on update.
const unsubscribe = await api.rpc.chain.subscribeNewHeads((header) => {
console.log(`Chain is at block: #${header.number}`);
});

// In this example we're calling the unsubscribe() function that is being
// returned by the api call function after 20s.
setTimeout(() => {
unsubscribe();
console.log('Unsubscribed');
}, 20000);
}

main().catch(console.error);
- + \ No newline at end of file diff --git a/api/examples/promise/upgrade-chain/index.html b/api/examples/promise/upgrade-chain/index.html index f784be26e5..183a633f2f 100644 --- a/api/examples/promise/upgrade-chain/index.html +++ b/api/examples/promise/upgrade-chain/index.html @@ -5,12 +5,12 @@ Chain upgrade | polkadot{.js} - +
Skip to main content

Chain upgrade

Performs a chain upgrade using the sudo module. This may brick your chain, so use it as an educational sample. (use substrate purge-chain --dev to remove DB and recover).

// Import the API & Provider and some utility functions
const { ApiPromise, WsProvider } = require('@polkadot/api');

// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@polkadot/keyring/testing');

const fs = require('fs');

async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');

// Create the API and wait until ready (optional provider passed through)
const api = await ApiPromise.create({ provider });

// Retrieve the upgrade key from the chain state
const adminId = await api.query.sudo.key();

// Find the actual keypair in the keyring (if this is a changed value, the key
// needs to be added to the keyring before - this assumes we have defaults, i.e.
// Alice as the key - and this already exists on the test keyring)
const keyring = testKeyring.default();
const adminPair = keyring.getPair(adminId.toString());

// Retrieve the runtime to upgrade
const code = fs.readFileSync('./test.wasm').toString('hex');
const proposal = api.tx.system && api.tx.system.setCode
? api.tx.system.setCode(`0x${code}`) // For newer versions of Substrate
: api.tx.consensus.setCode(`0x${code}`); // For previous versions

console.log(`Upgrading from ${adminId}, ${code.length / 2} bytes`);

// Perform the actual chain upgrade via the sudo module
api.tx.sudo
.sudo(proposal)
.signAndSend(adminPair, ({ events = [], status }) => {
console.log('Proposal status:', status.type);

if (status.isInBlock) {
console.error('You have just upgraded your chain');

console.log('Included at block hash', status.asInBlock.toHex());
console.log('Events:');

console.log(JSON.stringify(events.toHuman(), null, 2));
} else if (status.isFinalized) {
console.log('Finalized block hash', status.asFinalized.toHex());

process.exit(0);
}
});
}

main().catch((error) => {
console.error(error);
process.exit(-1);
});
- + \ No newline at end of file diff --git a/api/examples/rxjs/index.html b/api/examples/rxjs/index.html index ce10ee1b8f..06a10d2b7a 100644 --- a/api/examples/rxjs/index.html +++ b/api/examples/rxjs/index.html @@ -5,12 +5,12 @@ ApiRx Examples | polkadot{.js} - +
Skip to main content

ApiRx Examples

Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. It uses the [[ApiRx]] interface.

Prerequisites

For the following examples, you need a local node. It is usually convenient testing with:

substrate --dev

Running the examples

From each folder, run yarn to install the required dependencies and then run yarn start to execute the example against the running node.

Development accounts

Some of the examples use the following accounts:

  • Alice: 5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ
  • Bob: 5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE

Those accounts are easy to add if you don't have/see them. The seed of Alice's account is Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ and the seed of Bob is... well you guess...

NOTE: Note the spaces padding Alice's key up to 32 chars.

- + \ No newline at end of file diff --git a/api/examples/rxjs/listen_to_balance_change/index.html b/api/examples/rxjs/listen_to_balance_change/index.html index 5c8b872064..1dbe97691e 100644 --- a/api/examples/rxjs/listen_to_balance_change/index.html +++ b/api/examples/rxjs/listen_to_balance_change/index.html @@ -5,12 +5,12 @@ Listen to balance changes | polkadot{.js} - +
Skip to main content

Listen to balance changes

This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.

<<< @/docs/examples/rx/03_listen_to_balance_change/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/listen_to_blocks/index.html b/api/examples/rxjs/listen_to_blocks/index.html index ae535321c8..09df3744b5 100644 --- a/api/examples/rxjs/listen_to_blocks/index.html +++ b/api/examples/rxjs/listen_to_blocks/index.html @@ -5,12 +5,12 @@ Listen to new blocks | polkadot{.js} - +
Skip to main content

Listen to new blocks

This example shows how to subscribe to new blocks.

It displays the block number every time a new block is seen by the node you are connected to.

NOTE: The example runs until you stop it with CTRL+C

<<< @/docs/examples/rx/02_listen_to_blocks/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/make_transfer/index.html b/api/examples/rxjs/make_transfer/index.html index bc149bdd1d..0b4cdcd7af 100644 --- a/api/examples/rxjs/make_transfer/index.html +++ b/api/examples/rxjs/make_transfer/index.html @@ -5,12 +5,12 @@ Make a simple transfer | polkadot{.js} - +
Skip to main content

Make a simple transfer

This sample shows how to create a transaction to make a transfer from one an account to another.

<<< @/docs/examples/rx/06_make_transfer/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/read_storage/index.html b/api/examples/rxjs/read_storage/index.html index 36a22b75e4..27abef24b5 100644 --- a/api/examples/rxjs/read_storage/index.html +++ b/api/examples/rxjs/read_storage/index.html @@ -5,12 +5,12 @@ Read storage | polkadot{.js} - +
Skip to main content

Read storage

Many important variables are available through the storage API. This example shows how to call a few of those APIs.

<<< @/docs/examples/rx/05_read_storage/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/simple_connect/index.html b/api/examples/rxjs/simple_connect/index.html index ce8211d345..e32e7ca04c 100644 --- a/api/examples/rxjs/simple_connect/index.html +++ b/api/examples/rxjs/simple_connect/index.html @@ -5,12 +5,12 @@ Simple Connect | polkadot{.js} - +
Skip to main content

Simple Connect

The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiRx.

<<< @/docs/examples/rx/01_simple_connect/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/system_events/index.html b/api/examples/rxjs/system_events/index.html index 8e70c19949..5ebdfd8d4f 100644 --- a/api/examples/rxjs/system_events/index.html +++ b/api/examples/rxjs/system_events/index.html @@ -5,12 +5,12 @@ Traverse events | polkadot{.js} - +
Skip to main content

Traverse events

Query the system events and extract information from them. This example runs until exited via Ctrl-C

<<< @/docs/examples/rx/08_system_events/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/transfer_events/index.html b/api/examples/rxjs/transfer_events/index.html index a1770144cd..e6d25c3779 100644 --- a/api/examples/rxjs/transfer_events/index.html +++ b/api/examples/rxjs/transfer_events/index.html @@ -5,12 +5,12 @@ Transfer events | polkadot{.js} - +
Skip to main content

Transfer events

Display the events that occur during a transfer by sending a value to a random account

<<< @/docs/examples/rx/09_transfer_events/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/unsubscribe/index.html b/api/examples/rxjs/unsubscribe/index.html index ae2c15c0c8..60584c70d1 100644 --- a/api/examples/rxjs/unsubscribe/index.html +++ b/api/examples/rxjs/unsubscribe/index.html @@ -5,12 +5,12 @@ Unsubscribe from listening to updates | polkadot{.js} - +
Skip to main content

Unsubscribe from listening to updates

This example shows how to subscribe to and later unsubscribe from listening to block updates.

In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.

<<< @/docs/examples/rx/04_unsubscribe/index.js

- + \ No newline at end of file diff --git a/api/examples/rxjs/upgrade_chain/index.html b/api/examples/rxjs/upgrade_chain/index.html index ba665222b8..6b68aa6f26 100644 --- a/api/examples/rxjs/upgrade_chain/index.html +++ b/api/examples/rxjs/upgrade_chain/index.html @@ -5,12 +5,12 @@ Chain upgrade | polkadot{.js} - +
Skip to main content

Chain upgrade

Performs a chain upgrade using the sudo module. This may brick your chain, so us it as an educational sample. (use substrate --dev purge-chain to remove DB and recover).

<<< @/docs/examples/rx/10_upgrade_chain/index.js

- + \ No newline at end of file diff --git a/api/index.html b/api/index.html index de45d63790..7635a6be8c 100644 --- a/api/index.html +++ b/api/index.html @@ -5,12 +5,12 @@ Overview | polkadot{.js} - +
Skip to main content

Overview

The API provides application developers the ability to query a node and interact with the Polkadot or Substrate chains using Javascript. Here you will find documentation and examples to get you started.

Jump right in and get an overview on using the API in your projects, from installation all the way through to making it do magic. Have things working and want tips? The cookbook provides some tips and tricks. Getting started and want some full examples? The ApiPromise examples provide some basic examples.

For oft-repeated questions, the FAQ may have what you are looking for.

Separated from the API you will also find the Substrate metadata section that has an overview of the RPC, extrinsics, events and errors available on a typical Substrate node.

- + \ No newline at end of file diff --git a/api/start/api.consts/index.html b/api/start/api.consts/index.html index c5ebe00df0..c47fd18336 100644 --- a/api/start/api.consts/index.html +++ b/api/start/api.consts/index.html @@ -5,12 +5,12 @@ Runtime constants | polkadot{.js} - +
Skip to main content

Runtime constants

Constant queries will introduce you to the concepts behind the types and the interaction of the API with those types. The same concepts are implemented in the remainder of the API - the runtime constants is just the simplest starting point.

For some background: constants are values that are defined in the runtime and used as part of chain operations. These constants can be changed as part of an upgrade.

// Initialize the API as per previous sections
...

// The length of an epoch (session) in Babe
console.log(api.consts.babe.epochDuration.toNumber());

// The amount required to create a new account
console.log(api.consts.balances.existentialDeposit.toNumber());

// The amount required per byte on an extrinsic
console.log(api.consts.transactionPayment.transactionByteFee.toNumber());

Since these are constants and defined by the metadata, it is not a call, but rather the values immediately available - as you'll see in subsequent sections, there is no need for await on these, it immediately returns the type and value for you to work with.

The API and types

There is some magic applied by the API. For instance, as the createFee result is returned, the API knows the expected type and makes a Balance object available, hence the toNumber. This result mapping is consistent in retrieving constants, making queries or even sending transactions:

  • when values are passed to the API, the API will convert whatever is provided into the correct type as required by the call
  • when a value is retrieved, the API will provide an object of the correct type that wraps this value

From the last point, this means that a Balance will be returned as a number object extending bn.js. In a later section we will go through a breakdown of all the commonly-used types and all the basics available on types.

Making queries

In the next section we will take an initial dive into chain state and state queries, allowing the use of the API to retrieve information contained in the chain state.

- + \ No newline at end of file diff --git a/api/start/api.query.multi/index.html b/api/start/api.query.multi/index.html index c840a80054..64ab05bba5 100644 --- a/api/start/api.query.multi/index.html +++ b/api/start/api.query.multi/index.html @@ -5,12 +5,12 @@ Multi queries | polkadot{.js} - +
Skip to main content

Multi queries

In a number of applications, it is useful to monitor a number of like-queries at the same time. For instance, we may want to track the balances for a list of accounts we have. The api.query interfaces allows this via the .multi subscription call.

Multi queries, same type

Where possible, the use of multi queries are encouraged since it tracks a number of state entries over a single RPC call, instead of making a call for each single item. In addition it allows you to have a single callback to track changes. For queries of the same type we can use .multi, for example to retrieve the balances of a number of accounts at once -

...

// Subscribe to balance changes for 2 accounts, ADDR1 & ADDR2 (already defined)
const unsub = await api.query.system.account.multi([ADDR1, ADDR2], (balances) => {
const [{ data: balance1 }, { data: balance2 }] = balances;

console.log(`The balances are ${balance1.free} and ${balance2.free}`);
});

A couple of items to note in the example above: we don't call account directly, but rather account.multi. We pass the addresses we want to query as an array, and the length thereof would depend on the number of addresses we want to query. As an extended example, we can track the balances of a list of validators,

...

// Retrieve a snapshot of the validators
// (all active & waiting based on ValidatorPrefs storage)
const validatorKeys = await api.query.staking.validators.keys();

// Subscribe to the balances for these accounts
const unsub = await api.query.balances.account.multi(validatorKeys, (balances) => {
console.log(`The nonce and free balances are: ${balances.map(([nonce, { free }]) => [nonce, free])}`);
});

The above example does not subscribe to the validators explicitly, but only gets a snapshot and uses this into the future. It should be trivially extendable to subscribe to the validators, track which one have entered or left and then subscribe to balances as they change through the next blocks.

Multi queries, distinct types

The previous .multi examples assumes that we do queries for the same types, i.e. we retrieve the balances for a number of accounts. However, there is also a need to retrieve various distinct types, as an example we would like to track the block timestamp in addition to the nonce and balance of a specific account. To cater for this, the api has a specific api.queryMulti interface that can be used to perform this query -

...

// Subscribe to the timestamp, our index and balance
const unsub = await api.queryMulti([
api.query.timestamp.now,
[api.query.system.account, ADDR]
], ([now, { nonce, data: balance }]) => {
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
});

The above example certainly does not quite look as ergonomic and clean, but the API needs to understand (a) which are all the calls we need to make and (b) the calls and their params (if required). So breaking it down -

  • api.query.timestamp.now - the timestamp is passed naked without any params. Also note that we do not call it while passing, but rather only provides a reference to the function, i.e. we do not have the expected () at the end. (This could also be of the form [api.query.timestamp.now], aligning with subsequent entries)
  • [api.query.system.account, ADDR] - the nonce & balance query is passed as an array containing the function (once again naked), followed by the parameters that apply.

Rounding out queries

To round out our query introduction, there are a number of other utilities and calls available that allows the api.query user to perform certain tasks, such as querying state at a specific block. These are covered in the next section.

- + \ No newline at end of file diff --git a/api/start/api.query.other/index.html b/api/start/api.query.other/index.html index 9edd779ec8..ec9fc1ffd5 100644 --- a/api/start/api.query.other/index.html +++ b/api/start/api.query.other/index.html @@ -5,12 +5,12 @@ Query extras | polkadot{.js} - +
Skip to main content

Query extras

In previous sections we took a walk through queries, showing how to use one-shot queries, how to subscribe to results and how to combine multiple queries into one. This section will aim to extend that knowledge showing some other features and utilities that are available on the api.query interfaces.

State at a specific block

Quite often it is useful (taking pruning into account, more on this later) to retrieve the state at a specific block. For instance we may wish to retrieve the current balance as well as the balance at a previous block for a specific account -

...

// Retrieve the current block header
const lastHdr = await api.rpc.chain.getHeader();

// Get a decorated api instance at a specific block
const apiAt = await api.at(lastHdr.hash);

// query the balance at this point of the chain
const { data: { free } } = await apiAt.query.system.account(ADDR);

// Display the free balance
console.log(`The current free is ${free.toString()}`);

The .at queries are all single-shot, i.e. there are no subscription option to these, since the state for a previous block should be static. (This is true to a certain extent, i.e. when blocks have been finalized).

An additional point to take care of (briefly mentioned above), is state pruning. By default a Polkadot/Substrate node will only keep state for the last 256 blocks, unless it is explicitly run in archive mode. This means that querying state further back than the pruning period will result in an error returned from the Node. (Generally most public RPC nodes only run with default settings, which includes aggressive state pruning)

Map keys & entries

When working maps and double-maps, it is possible to retrieve a list of all the keys and entries for the map. For this we can use the .entries(<args>): [StorageKey, Type][] queries. For example we may want to know the current list of validator exposures at a current era in the staking module -

...
// Retrieve the active era
const activeEra = await api.query.staking.activeEra();

// retrieve all exposures for the active era
const exposures = await api.query.staking.erasStakers.entries(activeEra.unwrap().index);

exposures.forEach(([key, exposure]) => {
console.log('key arguments:', key.args.map((k) => k.toHuman()));
console.log(' exposure:', exposure.toHuman());
});

To understand the usage of the key.args, you need to understand that map/doublemap keys are stored alongside their lookups. This means that the raw key has hashed parts as well as the raw data. The API will decode the keys and provide the raw key arguments in args. This would mean -

  • if we are querying api.query.staking.validators(validatorId: AccountId) via entries, the key.args would be [AccountId]
  • if we are querying api.query.staking.erasStakers(era: EraIndex, validatorId: AccountId) via entries, the key.args would be [EraIndex, AccountId]

the same applies to .keys() - here the list of keys also have the decoded args, as specified. You can think of .args as a tuple with the same types as the types required to retrieve a single entry in the map.

In the first example we are querying a double-map, so we supply 1 argument. No arguments on double-maps will be very costly, retrieving all the eras and associated entries. In the same way as above we can simply do .keys(activeEra.unwrap().index): StorageKey[] to retrieve all the keys here, including the individual keys args (available on maps with decodable hashing functions) -

// retrieve all the nominator keys
const keys = await api.query.staking.nominators.keys();

// extract the first key argument [AccountId] as string
const nominatorIds = keys.map(({ args: [nominatorId] }) => nominatorId);

console.log('all nominators:', nominatorIds.join(', '));

There is also the keysAt(<hash>) and entriesAt(<hash>) methods for another source of single-shot calls to retrieve lists from a particular block. Note, that the state pruning limits described above also apply here.

State entries

In addition to using api.query to make actual on-chain queries, it can also be used to retrieve some information on the state entries. For instance to retrieve both the hash and size of an existing entry, we can make the following calls -

...

// Retrieve the hash & size of the entry as stored on-chain
const [entryHash, entrySize] = await Promise.all([
api.query.system.account.hash(ADDR),
api.query.system.account.size(ADDR)
]);

// Output the info
console.log(`The current size is ${entrySize} bytes with a hash of ${entryHash}`);

As per the previous examples, the params here apply explicitly to the actual needed values to identify an entry. As with .at queries, there are no subscription versions for these queries, rather they are seen as one-shot values at a specific point in time.

Entry metadata

It has been explained that the api.query interfaces are decorated from the metadata. This also means that there is some information that we can gather from the entry, as decorated -

// Extract the info
const { meta, method, section } = api.query.system.account;

// Display some info on a specific entry
console.log(`${section}.${method}: ${meta.documentation.join(' ')}`);
console.log(`query key: ${api.query.system.account.key(ADDR)}`);

The section & method is an indication of where it is exposed on the API. In addition the meta holds an array with the metadata documentation for the entry.

The key endpoint requires some explanation. In the chain state, the key values (identified by the module, method & params) are hashed and this is used as a lookup. So underlying a single-shot query would utilize the api.rpc.state.getStorage entry, passing the output of key (which is a hashed representation of the values). Apart from the hashing, the API also takes care of type formatting, handling optional values and merging results across multiple subscriptions.

Let's transact already!

At this point you are already burning to actually make some transactions. Making queries is cool, but just how do you actually submit transactions on-chain.

- + \ No newline at end of file diff --git a/api/start/api.query.subs/index.html b/api/start/api.query.subs/index.html index 26fbd61e8f..ae0af5c2ab 100644 --- a/api/start/api.query.subs/index.html +++ b/api/start/api.query.subs/index.html @@ -5,12 +5,12 @@ Query subscriptions | polkadot{.js} - +
Skip to main content

Query subscriptions

Previously we explained the concepts between api.query. In this section we will expand on that knowledge to introduce subscriptions (akin to what we found in api.rpc) to stream results from the state, as it changes between blocks.

Subscriptions

As in the case with api.rpc subscriptions, query subscriptions follow exactly the same form - an actual call is augmented with a callback to return the current state value that is updated as the underlying value changes. As an example, we can extend on what we had previously -

...

// Retrieve the current timestamp via subscription
const unsub = await api.query.timestamp.now((moment) => {
console.log(`The last block has a timestamp of ${moment}`);
});

The form is exactly the same as the subscriptions we have seen previously, instead of the await returning the actual once-off value, it returns a subscription unsub() function that can be used to stop the subscription and clear up any underlying RPC connections. The supplied callback will contain the value as it changes, streamed from the node.

Subscriptions with params

If we had a query with parameters, i.e. where we wish to perform a query for a specific account, the form is exactly the same - the last parameter contains the actual callback, after all other parameters. To retrieve the balances for an account as it changes, we could do the following -

...

// Subscribe to balance changes for our account
const unsub = await api.query.system.account(ADDR, ({ nonce, data: balance }) => {
console.log(`free balance is ${balance.free} with ${balance.reserved} reserved and a nonce of ${nonce}`);
});

By now this subscription form should be familiar to you, including the usage of unsub.

Multiple queries

In most non-trivial applications, it is useful to optimize both our code in terms of callbacks as well as node resources, for instance by performing multiple queries at once, over the same RPC call.

- + \ No newline at end of file diff --git a/api/start/api.query/index.html b/api/start/api.query/index.html index 0005f78392..3f57b13078 100644 --- a/api/start/api.query/index.html +++ b/api/start/api.query/index.html @@ -5,12 +5,12 @@ State queries | polkadot{.js} - +
Skip to main content

State queries

In previous sections, we initialized the API and retrieved runtime constants. This section will walk through the concepts behind making queries to the chain to retrieve current state. The api.query.<module>.<method> interfaces, as already described earlier, is populated from the metadata. The API uses the metadata information provided to construct queries based on the location and parameters provided to generate state keys, and then queries these via RPC.

Basic queries

Let's dive right in, connect to a general chain and retrieve some information on the current state. Of interest may be retrieving the nonce of a particular account as well as the current balance, this can be achieved via -

// Initialize the API as in previous sections
...

// The actual address that we will use
const ADDR = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE';

// Retrieve the last timestamp
const now = await api.query.timestamp.now();

// Retrieve the account balance & nonce via the system module
const { nonce, data: balance } = await api.query.system.account(ADDR);

console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);

There have been some additions in the code above comparing with retrieving runtime constants. In these cases, since we are making a query to the actual chain, we use the await syntax to retrieve the information. Since the API is Promise-based, this means we can also rewrite the above to follow a Promise pattern,

...
// Retrieve last block timestamp, account nonce & balances
const [now, { nonce, data: balance }] = await Promise.all([
api.query.timestamp.now(),
api.query.system.account(ADDR)
]);

Parameters & return values

As indicated in previous sections, any return value is always an object with a consistent interface that reflects the type being returned. In the above example, the timestamp is a Moment (a u64 value), the nonce is an Index (a u32 value) and the Balance is an underlying u128.

Additionally we have provided some parameters for the query calls, specifically for the retrieval of the nonce and balance. It is important to note that the API will automatically convert any parameters into the correct type for encoding and making calls, in this case the AccountId parameter could be specified as a ss58 address (as it was), an actual AccountId (retrieved via another call) or just a plain Uint8Array (or even hex-string representation) for a publicKey.

Exploring RPCs

Where all query functions use the underlying RPCs, together with metadata, to construct and retrieve information, the direct node RPCs can be seen as raw calls that enable these (slightly) higher-level operations. Next up we will take a dive into making RPC calls via the API.

- + \ No newline at end of file diff --git a/api/start/api.rpc/index.html b/api/start/api.rpc/index.html index f27c64fc2f..f967156b1f 100644 --- a/api/start/api.rpc/index.html +++ b/api/start/api.rpc/index.html @@ -5,12 +5,12 @@ RPC queries | polkadot{.js} - +
Skip to main content

RPC queries

The RPC calls provide the backbone for the transmission of data to and from the node. This means that all API endpoints such as api.query, api.tx or api.derive just wrap RPC calls, providing information in the encoded format as expected by the node.

Since you are already familiar with the api.query interface, the api.rpc interface follows the same format, for instance -

...

// Retrieve the chain name
const chain = await api.rpc.system.chain();

// Retrieve the latest header
const lastHeader = await api.rpc.chain.getHeader();

// Log the information
console.log(`${chain}: last block #${lastHeader.number} has hash ${lastHeader.hash}`);

In this example, you will see the same pattern as with queries: each result is a promise and a simple await makes the query and resolves with the result.

Subscriptions

The RPCs lend themselves to using subscriptions, for instance in the above case you would assume that once connected, the chain won't change, however new blocks will come in at intervals and we probably want to keep track of those. We can adapt the previous example to start using subscriptions -

...

// Subscribe to the new headers
await api.rpc.chain.subscribeNewHeads((lastHeader) => {
console.log(`${chain}: last block #${lastHeader.number} has hash ${lastHeader.hash}`);
});

Since we are dealing with a subscription, we now pass a callback into the subscribeNewHeads function, and this will be triggered on each header, as they are imported. The same pattern would apply to each of the api.rpc.subscribe* functions - as a last parameter a callback is to be provided that streams the latest data, as it becomes available.

In general, whenever we create a subscription, we would like to cleanup after ourselves and unsubscribe, so assuming we only want to log the first 10 headers, the above example can be adjusted in the following manner -

...
let count = 0;

// Subscribe to the new headers
const unsubHeads = await api.rpc.chain.subscribeNewHeads((lastHeader) => {
console.log(`${chain}: last block #${lastHeader.number} has hash ${lastHeader.hash}`);

if (++count === 10) {
unsubHeads();
}
});

Unlike single-shot queries, for subscriptions we are await-ing a function, taking no parameters (that also returns nothing) that can be used to unsubscribe for the subscription and clear the underlying RPC connection. So in the above example we set unsubHeads and then call it when we wish to cancel the subscription.

Detour into derives

The api.derive interfaces will be covered in a follow-up section, but since the above example deals with new head subscriptions, a quick detour is warranted. The derives are just helpers that define certain functions and combine results from multiple sources. For new headers, the following information is useful in certain scenarios -

...
const unsub = await api.derive.chain.subscribeNewHeads((lastHeader) => {
console.log(`#${lastHeader.number} was authored by ${lastHeader.author}`);
});

In the above case the subscribeNewHeads derive augments the header retrieved with an .author getter. This is done by parsing the actual header and logs received and filling in the author from the api.query.session.validators call.

Extended Queries

As a next step, now that we have understood subscription and RPC basics, we will circle back to the api.query interface, extending our queries with subscriptions.

- + \ No newline at end of file diff --git a/api/start/api.tx.subs/index.html b/api/start/api.tx.subs/index.html index 04f014d218..1dc4408754 100644 --- a/api/start/api.tx.subs/index.html +++ b/api/start/api.tx.subs/index.html @@ -5,12 +5,12 @@ Transaction subscriptions | polkadot{.js} - +
Skip to main content

Transaction subscriptions

Previously we sent simple transactions using the api.tx endpoints, in this section we will extend that to monitor the actual transactions for inclusion and also extend the monitoring for transaction events.

Transaction inclusion

To send a transaction and then waiting until it has been included in a block, we will use a subscription interface instead of just waiting for the transaction pool addition to yield the extrinsic hash. For the simplest form, we can do the following -

...

// Create alice (carry-over from the keyring section)
const alice = keyring.addFromUri('//Alice');

// Make a transfer from Alice to BOB, waiting for inclusion
const unsub = await api.tx.balances
.transfer(BOB, 12345)
.signAndSend(alice, (result) => {
console.log(`Current status is ${result.status}`);

if (result.status.isInBlock) {
console.log(`Transaction included at blockHash ${result.status.asInBlock}`);
} else if (result.status.isFinalized) {
console.log(`Transaction finalized at blockHash ${result.status.asFinalized}`);
unsub();
}
});

As per all previous subscriptions, the transaction subscription returns in unsub() and the actual method has a subscription callback. The result object has 2 parts, events (to be covered in the next section) and the status enum.

When the status enum is in Finalized state (checked via isFinalized), the underlying value contains the block hash of the block where the transaction has been finalized. Finalized will follow InBlock, which is the block where the transaction has been included. InBlock does not mean the block is finalized, but rather applies to the transaction state, where Finalized means that the transaction cannot be forked off the chain.

Transaction events

Any transaction will emit events, as a bare minimum this will always be either a system.ExtrinsicSuccess or system.ExtrinsicFailed event for the specific transaction. These provide the overall execution result for the transaction, i.e. execution has succeeded or failed.

Depending on the transaction sent, some other events may however be emitted, for instance for a balances.transfer this could include one or more of Transfer, NewAccount or ReapedAccount, as defined in the substrate balances event defaults.

To display or act on these events, we can do the following -

...
// Make a transfer from Alice to BOB, waiting for inclusion
const unsub = await api.tx.balances
.transfer(BOB, 12345)
.signAndSend(alice, ({ events = [], status, txHash }) => {
console.log(`Current status is ${status.type}`);

if (status.isFinalized) {
console.log(`Transaction included at blockHash ${status.asFinalized}`);
console.log(`Transaction hash ${txHash.toHex()}`);

// Loop through Vec<EventRecord> to display all events
events.forEach(({ phase, event: { data, method, section } }) => {
console.log(`\t' ${phase}: ${section}.${method}:: ${data}`);
});

unsub();
}
});

Be aware that when a transaction status is isFinalized, it means it is included, but it may still have failed - for instance if you try to send a larger amount that you have free, the transaction is included in a block, however from a end-user perspective the transaction failed since the transfer did not occur. In these cases a system.ExtrinsicFailed event will be available in the events array.

Payment information

The Polkadot/Substrate RPC endpoints exposes weight/payment information that takes an encoded extrinsic and calculates the on-chain weight fees for it. A wrapper for this is available on the tx itself, taking exactly the same parameters as you would pass to a normal .signAndSend operation, specifically .paymentInfo(sender, <any options>). To expand on our previous example -

// construct a transaction
const transfer = api.tx.balances.transfer(BOB, 12345);

// retrieve the payment info
const { partialFee, weight } = await transfer.paymentInfo(alice);

console.log(`transaction will have a weight of ${weight}, with ${partialFee.toHuman()} weight fees`);

// send the tx
transfer.signAndSend(alice, ({ events = [], status }) => { ... });

Complex transactions

In many cases transactions can carry quite complex information, be it for passing objects or proposing changes. In the next section we will take a dive into complex transactions, including those wrapped for sudo.

- + \ No newline at end of file diff --git a/api/start/api.tx.wrap/index.html b/api/start/api.tx.wrap/index.html index e54a547300..0b7d770bea 100644 --- a/api/start/api.tx.wrap/index.html +++ b/api/start/api.tx.wrap/index.html @@ -5,12 +5,12 @@ Complex transactions | polkadot{.js} - +
Skip to main content

Complex transactions

Up till now we have focussed on the base operation of transactions. There are however some more complex operations that deserve some more information, for instance when doing either democracy proposals or executing sudo calls, in both these cases the transaction wraps a call or proposal to be evaluated.

Sudo use

When running a development chain (Polkadot/Substrate with a --dev flag), or in certain testnets a sudo module is available - just like the sudo command found on some systems, it allows root-level access to perform actions. For instance, we can perform a setBalance(<accountId>, <free>, <reserved>) on an account -

...
// Get the current sudo key in the system
const sudoKey = await api.query.sudo.key();

// Lookup from keyring (assuming we have added all, on --dev this would be `//Alice`)
const sudoPair = keyring.getPair(sudoKey);

// Send the actual sudo transaction
const unsub = await api.tx.sudo
.sudo(
api.tx.balances.setBalance(ADDR, 12345, 678)
)
.signAndSend(sudoPair, (result) => { ... });

The above is really quite straight-forward, the sudo.sudo(<call>) call takes 1 parameter, which is a Call. We construct this via the api.tx and pass it through. The only difference is that the nested call has no actual .signAndSend on it, rather it is only used as a container for data.

Exactly the same would apply to the standard democracy.propose(<proposal>, <value>), for instance we can just swap the above sudo wrapper with a proposal and add the correct fees for the proposal.

Complex types

As indicated in previous sections (we will cover types in more detail next), the API will format the inputs into the actual type required for submission. For primitives such as numbers, this is quite understandable, but it is worth spending at least one example on cases where an object is provided as an input. For instance, making a call to validate -

...
const txHash = await api.tx.staking.validate({
validatorPayment: 12345
});

In the above example, all we need to provide is a the fields for the ValidatorPrefs object. (Any fields not defined will be set to the default for that type, i.e. all zero). This object maps through to what is defined on the Polkadot/Substrate side, with the @polkadot/types version mapping all fields.

Understanding types

As has been very apparent in all the preceding sections, the management of types is what allows the API to communicate with the node. Most values are in a binary SCALE-encoded format and it is the responsibility of the API is to encode and decode these. In the next section we will take a look at what interfaces the API provides around types.

- + \ No newline at end of file diff --git a/api/start/api.tx/index.html b/api/start/api.tx/index.html index aee517914c..d987b026ad 100644 --- a/api/start/api.tx/index.html +++ b/api/start/api.tx/index.html @@ -5,12 +5,12 @@ Transactions | polkadot{.js} - +
Skip to main content

Transactions

Transaction endpoints are exposed, as determined by the metadata, on the api.tx endpoint. These allow you to submit transactions for inclusion in blocks, be it transfers, setting information or anything else your chain supports.

Simple transactions

To start off, let's make a balance transfer from Alice to Bob.

...

// Sign and send a transfer from Alice to Bob
const txHash = await api.tx.balances
.transfer(BOB, 12345)
.signAndSend(alice);

// Show the hash
console.log(`Submitted with hash ${txHash}`);

We have already become familiar with the Promise syntax that is used throughout the API, in this case it is no different. We construct a transaction by calling balances.transfer(<accountId>, <value>) with the required params and then as a next step we submit it to the node.

As with all other API operations, the to params just needs to be "account-like" and the value params needs to be "number-like", the API will take care of encoding and conversion into the correct format.

The result for this call (we will deal with subscriptions in a short while), is the transaction hash. This is a hash of the data and receiving this does not mean that transaction has been included, but rather only that it has been accepted for propagation by the node. (It can still fail on execution, we will handle this in some of our follow-up sections.)

Under the hood

Despite the single-line format of signAndSend, there is a lot happening under the hood (and all of this can be manually provided) -

  • Based on the sender, the API will query system.account (or system.accountNonce on older chains) to determine the next nonce to use
  • The API will retrieve the current block hash and use it to create a mortal transaction, i.e. the transaction will only be valid for a limited number of blocks (by default this is 5 mins at 6s block times)
  • It will construct a payload and sign this, this includes the genesisHash, the blockHash for the start of the mortal era as well as the current chain specVersion
  • The transaction is submitted to the node

As suggested, you can override all of this, i.e. by retrieving the nonce yourself and passing that as an option, i.e. signAndSend(alice, { nonce: aliceNonce }), this could be useful when manually tracking and submitting transactions in bulk.

Into the keyring we go

With the examples above, the variable alice seems to have appeared from thin air. To understand how transactions are signed, we will take a brief diversion into the keyring before returning to our regularly scheduled program.

- + \ No newline at end of file diff --git a/api/start/basics/index.html b/api/start/basics/index.html index 2ac2e5ab22..6873126aaf 100644 --- a/api/start/basics/index.html +++ b/api/start/basics/index.html @@ -5,12 +5,12 @@ Basics & Metadata | polkadot{.js} - +
Skip to main content

Basics & Metadata

One of the most important things to understand about the @polkadot/api is that most interfaces are actually generated automatically when it connects to a running node. This is quite a departure from other APIs in projects where the interfaces are static. While sounding quite scary, it actually is a powerful concept that exists in both Polkadot and Substrate chains, and allows the API to be used in environments where the chain is customized.

To unpack this, we will start with the Metadata and explain what it actually provides, since it is critical for understanding how to interact with the API and any underlying chain.

Metadata

When the API connects to a node, one of the first things it does is to retrieve the metadata and decorate the API based on the metadata information. The metadata effectively provides data in the form of api.<type>.<module>.<section> that fits into one of the following categories -

  • consts - All runtime constants, e.g. api.consts.balances.existentialDeposit. These are not functions, rather accessing the endpoint immediately yields the result as defined.
  • query - All chain state, e.g. api.query.system.account(<accountId>).
  • tx - All extrinsics, e.g. api.tx.balances.transfer(<accountId>, <value>).

Additionally the metadata also provides information on events, these are query-able via the api.query.system.events() interface and also appear on transactions... both these cases are detailed later.

None of the information contained within the api.{consts, query, tx}.<module>.<method> endpoints are hard coded in the API. Rather everything is fully decorated by what the metadata exposes and is therefore completely dynamic. This means that when you connect to different chains, the metadata and API decoration will change and the API interfaces will reflect what is available on the chain you are connected to.

Types

The metadata defines the calls with all the type names used in the various interfaces. At the moment (this is undergoing investigations and could improve in future versions of metadata), this also means that the types between the API and the node need to be aligned. For instance, by default Substrate defines a BlockNumber type as a u32 and the API follows the Substrate defaults - if a chain has a different definition, the API needs to be aware of this so it can actually decode (and encode) the type.

At this point just be aware of it, we will touch on types, custom chains and their impacts in a later section.

Chain Defaults

In addition to the api.[consts | query | tx] detailed above, the API, upon connecting to a chain, fills in some information and makes it available directly on the API interface. These include -

  • api.genesisHash - The genesisHash of the connected chain
  • api.runtimeMetadata - The metadata as retrieved from the chain
  • api.runtimeVersion - The chain runtime version (including spec/impl. versions and types)
  • api.libraryInfo - The version of the API, i.e. @polkadot/api v0.90.1

Let's do something!

Now that we have covered what the API actually exposes, it is time to dive in and actually use what we installed earlier.

- + \ No newline at end of file diff --git a/api/start/create/index.html b/api/start/create/index.html index 971d4d7544..ce9c2bad58 100644 --- a/api/start/create/index.html +++ b/api/start/create/index.html @@ -5,12 +5,12 @@ Create an instance | polkadot{.js} - +
Skip to main content

Create an instance

We have the API installed, we have an understanding of what will actually be exposed and how the API knows what to expose. So down the rabbit hole we go - let's create an actual API instance, and then take it from there -

// Import
import { ApiPromise, WsProvider } from '@polkadot/api';

...
// Construct
const wsProvider = new WsProvider('wss://rpc.polkadot.io');
const api = await ApiPromise.create({ provider: wsProvider });

// Do something
console.log(api.genesisHash.toHex());

Where other code is included (or just some previous boilerplate is used), you will see ... in most of the examples. This is not due to laziness, but rather just to keep things straight and to the point.

Providers

Focusing on the construction, any API requires a provider and we create one via the const wsProvider = new WsProvider(...). By default, if none is provided to the API it will construct a default WsProvider instance to connect to ws://127.0.0.1:9944.

We generally recommend always specifying the endpoint since in most cases we want to connect to an external node and even for local nodes, it is always better being explicit, less magic that can make you wonder in the future.

At this time the only provider type that is fully supported by the API is the WebSocket version. Polkadot/Substrate really comes alive with possibilities once you have access to bi-directional RPCs such as what WebSockets provide. (It is technically possible to have some limited capability via bare-HTTP, but at this point WebSockets is the only fully-operational and supported version - always remember that it is just "upgraded HTTP".)

API Instance

The API creation is done via the ApiPromise.create interface which is a shortcut version for calling new and then waiting until the API is connected. Without the async syntax, this would be,

ApiPromise
.create({ provider: wsProvider })
.then((api) =>
console.log(api.genesisHash.toHex())
);

In most cases we would suggest using the .create shortcut, which really just takes care of the following boilerplate that otherwise needs to be provided -

// Create the instance
const api = new ApiPromise({ provider: wsProvider });

// Wait until we are ready and connected
await api.isReady;

// Do something
console.log(api.genesisHash.toHex());

Failures

In all cases the API will handle reconnecting automatically. This means that when you connect and the endpoint is not (yet) ready, the promise will not resolve immediately, but rather when connected. The same applies to when connection is lost, the API will manage re-connections.

In cases where the API does not support the chain being connected to, such as it using an unknown metadata version, the ready promise will fail to resolve and instead reject.

Advanced creation

There are more advanced cases where you would prefer to use the longer version, for instance: if you want to explicitly listen to events emitted, you probably want to attach to the API even before connecting to the chain. All API instances implement an EventEmitter interface, with on handlers, which emit connected, disconnected, ready and error events, allowing you to listen to events on the transport layer.

In these cases, create via new, attach listeners and then wait for the isReady.

Do something

Now that we have the API initialized, the next step would be to start using it to interact and extract data starting with chain constants.

- + \ No newline at end of file diff --git a/api/start/index.html b/api/start/index.html index 5b037550cb..f259a5aedf 100644 --- a/api/start/index.html +++ b/api/start/index.html @@ -5,12 +5,12 @@ Overview | polkadot{.js} - +
Skip to main content

Overview

These sections should provide you with all the information needed to install the @polkadot/api package, understand the structure of the interfaces and allow you to start using it. For existing users this really should be titled "Things I wish I knew before I started using the api" - it really aims to close the gap to allow anybody to get to grips with using the packages.

We are basing all our examples on the ApiPromise version of the API, however there is also an RxJS version available. Since Promises are a part of the ES2015 specification, it covers the greater amount of use and is the one that will be used in 95% of the cases and should be familiar to 100% of all developers.

For now... just ignore the various flavors and focus on understanding the concepts.

ES2015 Usage and examples

Before we jump into the guide, be aware that in all cases we are using ES2015, including using things like async/await, import and others. Depending on your environment, this may require some adjustments.

While we are using the await naked in all examples (this removes boilerplate and allows us to focus on the actual libraries), and unless your environment supports top-level await, it will need to be wrapped in an async block. So basically to make it run-able we should wrap all samples inside a async function main () { ... } and then just call main().then(() => console.log('completed')).

In the case of Node.js you would change the import into require, i.e.

// Import
const { ApiPromise, WsProvider } = require('@polkadot/api');
...

While Node.js versions >=12 support the import syntax, we are only exporting CommonJS modules, hence the need for require.

What this is not

This is not line-by-line documentation of all the existing function calls available, nor it is tied to a specific chain. (Although the examples do refer to the base Polkadot & Substrate chains). There will be some things in the API that are probably not covered, which brings us to the next point...

Help us help others

If you spot gaps in the information provided, or are uncertain about any specific area, please do log an issue or if you are that way inclined, make a pull-request. We really want to have good documentation in these areas and allow people to be productive right from the start.

Ready? Steady? Go!

If you already have a good grasp on the API and are just looking for a specific answer, you may want to take a look at the Frequently Asked Questions. With all that said, let's get started... What should be installed, and how should we do it?

- + \ No newline at end of file diff --git a/api/start/install/index.html b/api/start/install/index.html index 79a43142c0..e4d2a2d2d1 100644 --- a/api/start/install/index.html +++ b/api/start/install/index.html @@ -5,12 +5,12 @@ Installation | polkadot{.js} - +
Skip to main content

Installation

Yes, it really is as simple as installing from npm, so we are not going to waste too much time with the bare basics, just install the API via

yarn add @polkadot/api

And it will be added and ready for use. The above will always install the latest stable release, which should allow you to connect to test networks and local nodes that are tracking versioned releases for Polkadot and Substrate.

Betas

For users who have a slightly higher appetite for risk, or are using bleeding-edge master branches of either Polkadot/Substrate, we also publish a beta version as soon as anything is merged into the API master branch. This version really contains all the latest fixes and features and is the version we actually use inside the polkadot-js projects - eating our own dog food.

To install a beta version, either to test or for support of a feature that is available in Substrate master (and has not yet made it to a stable api release), you can install it via the @beta tag, i.e.

yarn add @polkadot/api@beta

Other dependencies

In most cases, you don't need to do anything else apart from just installing @polkadot/api above. It has dependencies such as @polkadot/types which are installed automatically alongside. When using yarn the dependencies are installed, flattened, available for use and you will never run into issues with mismatched versions.

This means that by simply installing @polkadot/api, you will have access to utilities (crypto and normal), types, providers and even higher-order (derived) API functions. (We will get to all of these in follow-up sections)

If you do however decide to explicitly install other packages (even though they are dependencies), please make sure that the versions inside the api package always match with your versions, i.e. if you installed @polkadot/api 2.1.2-3 and you have your own version of @polkadot/types, ensure that it is also 2.1.2-3.

API basics

So we have it installed. Before we jump into actual real-world usage, let's understand what the API gives us.

- + \ No newline at end of file diff --git a/api/start/keyring/index.html b/api/start/keyring/index.html index 0043bc69d8..23e215d2fc 100644 --- a/api/start/keyring/index.html +++ b/api/start/keyring/index.html @@ -5,12 +5,12 @@ Keyring | polkadot{.js} - +
Skip to main content

Keyring

This section will give a quick introduction into the Keyring, including the addition of accounts, retrieving pairs and the signing of any data. Unlike the rest of the API, only the core concepts will be covered with the most-used-functions. However, what is covered is enough for 99.9% of the use-cases ... or rather, that is the aim.

Installation

The @polkadot/keyring keyring is included directly with the API as a dependency, so it is directly importable (since the 0.92 version) alongside the API.

If you do opt to install it separately, ensure that the version of @polkadot/util-crypto that is included with the API matches with the version of @polkadot/keyring installed. So if the API depends on util-crypto 1.4.1, it would make sense to include keyring 1.4.1 as the installed version. (This helps in making sure extra versions of the libraries are not included as duplicates, especially in the case where bundles are created. Additionally, this makes sure that weird side-effects in the WASM initialization is avoided.)

Creating a keyring instance

Once installed, you can create an instance by just creating an instance of the Keyring class -

// Import the keyring as required
import { Keyring } from '@polkadot/api';

// Initialize the API as we would normally do
...

// Create a keyring instance
const keyring = new Keyring({ type: 'sr25519' });

In the above example, the import is self-explanatory. Upon creation we pass through a type which can have a value of either ed25519 or sr25519, when not specified this would default to ed25519. This type parameter only applies to the default type of account created when no type is specified, it does not mean that the keyring can only store that type of account.

So effectively, when creating an account and not specifying a type, it will be sr25519 by default based on the above construction params, however we can also add an ed25519 account and use it transparently in the same keyring.

One "trick" that is done implicitly in the above sample is that that keyring is only initialized after the API. In the case of sr25519 the keyring relies on a WASM build of the schnorrkel libraries. Since the API inlitialization is already async, it initializes the WASM libraries as part of the setup.

Adding accounts

The recommended catch-all approach to adding accounts is via .addFromUri(<suri>, [meta], [type]) function, where only the suri param is required. For instance to add an account via mnemonic, you would do the following -

...

// Some mnemonic phrase
const PHRASE = 'entire material egg meadow latin bargain dutch coral blood melt acoustic thought';

// Add an account, straight mnemonic
const newPair = keyring.addFromUri(PHRASE);

// (Advanced) add an account with a derivation path (hard & soft)
const newDeri = keyring.addFromUri(`${PHRASE}//hard-derived/soft-derived`);

// (Advanced, development-only) add with an implied dev seed and hard derivation
const alice = keyring.addFromUri('//Alice', { name: 'Alice default' });

The above additions cater for most of the use cases and aligns with what you would find in the Substrate subkey. Be very wary of the last "dev-seed" option, it is explicitly added for subkey compatibility and implies using the "known-everywhere" dev seed. It is however useful when running Polkadot/Substrate with a --dev flag.

Adding accounts with raw seeds

Since mnemonics are recommended and the defacto standard for current Polkadot/Substrate generations, the only mentioned way of adding keys thus far has been via mnemonic. However, the addFromUri method on the keyring is intelligent enough to detect and add from inputs specified as mnemonics, hex seeds and string seeds (appropriately padded).

With the above in mind, we could extend our examples above for custom raw seed. For instance to add both a hex and string seed, we can follow the following approach -

...
// add a hex seed, 32-characters in length
const hexPair = keyring.addFromUri('0x1234567890123456789012345678901234567890123456789012345678901234');

// add a string seed, internally this is padded with ' ' to 32-bytes in length
const strPair = keyring.addFromUri('Janice');

You could extend derivation from these specified seeds with derivation paths if applicable, i.e. Janice//hard will perform a hard derivation with the path hard on the pair that is generated from the Janice seed. As far as possible, try to stick with mnemonics in your applications, unless you have a good reason to not do so. Humans are generally bad at generating their own entropy and mnemonics has additional properties such as built-in checksums.

Working with pairs

In the previous examples we added a pair to the keyring (and we actually immediately got access to the pair). From this pair there is some information we can retrieve -

...

// Add our Alice dev account
const alice = keyring.addFromUri('//Alice', { name: 'Alice default' });

// Log some info
console.log(`${alice.meta.name}: has address ${alice.address} with publicKey [${alice.publicKey}]`);

Additionally you can sign and verify using the pairs. This is the same internally to the API when constructing transactions -

// Some helper functions used here
import { stringToU8a, u8aToHex } from '@polkadot/util';

...

// Convert message, sign and then verify
const message = stringToU8a('this is our message');
const signature = alice.sign(message);
const isValid = alice.verify(message, signature, alice.publicKey);

// Log info
console.log(`The signature ${u8aToHex(signature)}, is ${isValid ? '' : 'in'}valid`);

This covers the keyring basics, however there are two additional functions here of interest, keyring.getPairs() to retrieve a list of all pairs in the keyring and keyring.getPair(<address or publicKey>) to retrieve a pair where we have an identifier.

Back to transactions

Now that we have short introduction to the keyring, we can move back to API transactions and find out how to subscribe and track events, taking our management of transactions to the next level.

- + \ No newline at end of file diff --git a/api/start/rpc.custom/index.html b/api/start/rpc.custom/index.html index d6ee9c691f..b88133ef6b 100644 --- a/api/start/rpc.custom/index.html +++ b/api/start/rpc.custom/index.html @@ -5,12 +5,12 @@ Custom RPC | polkadot{.js} - +
Skip to main content

Custom RPC

In the previous section we looked at how to override the types the node uses and how to define extra custom types. You can also define custom RPC methods and we will cover that here.

Custom definitions

RPCs are exposed as a method on a specific module. This means that once available: you can call any rpc via api.rpc.<module>.<method>(...params[]). For example, you can define a firstModule_testMethod on the Rust node and if correctly defined it will be callable via api.rpc.firstModule.testMethod(...). To supply custom RPC methods, you provide an rpc object on the options to the API.

...
const api = await ApiPromise.create({
rpc: {
firstModule: {
testMethod: {
description: 'Just a test method',
params: [
{
name: 'index',
type: 'u64'
},
{
name: 'at',
type: 'Hash',
isOptional: true
}
],
type: 'Balance'
},
anotherMethod: { ... },
...
},
anotherModule: { ... },
...
},
...
});

In the above example we have defined a new method, which is now available on the API as api.rpc.firstModule.testMethod(index: u64, at?: Hash) => Promise<Balance>. For the optional parameters, we added isOptional: true alongside the name & type in the parameter definition.

Even if you define the method it will only appear on the API if it appears in the list returned by api.rpc.rpc.methods(), which is the list of known RPCs the node exposes. So when making changes to the node you should double-check that it does announce the RPC method and that it conforms to the format <module>_<method>. For example foo_bar is a valid name whereas bar is not. I.E. Methods which do not contain both a module and method component won't be detected and cannot be decorated. If in doubt, follow the conventions in Substrate master.

RPC options in detail

While the above example should be self-explanatory, let's quickly walk through the structure. Under the rpc: { ... } key in the options, keys are the name of the module exposing the RPC. So given 2 modules firstModule & testModule, and the top-level structure would be as follows:

...
const api = await ApiPromise.create({
rpc: {
firstModule: { ... },
testModule: { ... }
}
});

Inside each module definition, the key is the name of the RPC method. In the example, we defined a testMethod on firstModule. A method definition should provide a description of the method, an array of type definitions for the parameters named params, and define the type of the result of the RPC call.

params is an array of type definitions. In the example, contains fields for name, type and an optional flag isOptional that indicates that the field is not required when making the call. (And example of this use would be in cases such as state.getStorage(key, blockHash?) where the last param is optional)

Type creation

While the API always converts all the inputs into the underlying type required by the operation, be it for RPC, query or transaction, in some cases you may want to create an instance of a type yourself.

- + \ No newline at end of file diff --git a/api/start/types.basics/index.html b/api/start/types.basics/index.html index 30d0a419e2..bba1cb3460 100644 --- a/api/start/types.basics/index.html +++ b/api/start/types.basics/index.html @@ -5,12 +5,12 @@ Type basics | polkadot{.js} - +
Skip to main content

Type basics

We've touched upon types in most previous sections, i.e. that these are driven by metadata and that they are created and converted to/from automatically by the API. Since they appear in all results, we will divert a bit from the regularly scheduled program in explaining the API interfaces to giving some info on the base types.

Everything is a type

Just to re-iterate from the above. Everything returned by the API is a type and has a consistent interface: Codec. This means that a Vec<u32> (an array of u32 values) as well as a Struct (an pre-defined object) or an Enum has the same consistent base interface. Specific types will have values, based on the type - decorated and available.

As a minimum, anything returned by the API, be it a Vec<...>, Option<...>, Struct or any normal type will always have the following methods - as defined on the Codec interface:

  • .eq(<other value>) - checks for equality against the other value. In all cases, it will accept "like" values, i.e. in the case of a number you can pass a primitive (such as 1), a hex value (such as 0x01) or even an Unit8Array
  • toHex() - returns a hex-base representation of the value, always prefixed by 0x
  • toHuman() - returns Human-parsable JSON structure with values formatted as per the settings
  • toJSON() - returns a JSON-like representation of the value, this is generally used when calling JSON.stringify(...) on the value
  • toString() - returns a string representation, in some cases this performs additional encoding, i.e. for Address, AccountId and AccountIndex it will encode to the ss58 address
  • .toU8a() - returns a Uint8Array representation of the encoded value (generally exactly as passed to the node, where values are SCALE encoded)

Additionally, the following getters and utilities are available -

  • .isEmpty - true if the value is an all-empty value, i.e. 0 in for numbers, all-zero for Arrays (or anything Uint8Array), false is non-zero
  • .hash - a Hash (once again with all the methods above) that is a blake2-256 representation of the contained value

Comparing types

To reiterate the above API, the .eq method is the preferred means of comparing base types, rather than the JavaScript equality operator (===).

For example:

const { metadata } = await api.rpc.state.getMetadata();
const modules = metadata.asLatest.modules;

// This will not work, because `name` is an instance of `Text`, not a string
// const system = modules.find(m => m.name === 'system');

// This will work, because `Text.eq()` can compare against a string
const system = modules.find(m => m.name.eq('system'));

Working with numbers

All numbers wrap and extend an instance of bn.js. This means that in addition to the interfaces defined above, they have some additional methods -

  • .toNumber() - a JS number (limited to 2^53 - 1). This does mean that for large values, e.g. Balance (a u128 extension), this can cause overflows
  • .toBigInt() - a JS BigInt object (on supported platforms)
  • .add(...), .sub(...), ... - all the base methods available on the BN object

In cases where a Compact is returned, i.e. Compact<Balance>, the value is wrapped. This object should be .unwrap()-ed first to gain access to the underlying Balance object.

Working with structures

All structures, a wrapping of an object containing a number of member variables, is an implementation of a standard JS Map object, so all the functions available on a Map such as .entries() are available. Additionally it is decorated with actual getters for the fields.

As an example, a Header will have getters for the .parentHash, .number, .stateRoot, .extrinsicsRoot and .digest fields. The same applies for all structures, as they are returned, each member will have an associated getter.

Be aware that in the JS version naming defaults to camelCase where names of fields in Substrate defaults to snake_case. (Each version aligning with conventions in the respective languages)

Working with enums

Each enum has additional getters which are injected based on the fields wrapped. These take the form of .is<Name> and .as<Name> to allow you to check if the enum is a certain value or to retrieve the underlying value as a specific type.

As a real-world example, when an extrinsic is applied, the Phase enum has one of two states, ApplyExtrinsic(u32) or Finalization. In this case .isApplyExtrinsic would be true when an extrinsic is being applied, and .asApplyExtrinsic would return the value as a u32 (which is the index of the extrinsic in the block, as it is being applied). When isApplyExtrinsic is false and asApplyExtrinsic is called, the getter will throw.

Working with Option<Type>

An Option<Type> attempts to mimic the Rust approach of having None and Some available. This means the following getters & methods are available on an Option -

  • .isNone - is true if no underlying values is wrapped, effectively the same as .isEmpty
  • .isSome - this is true if a value is wrapped, i.e. if a Option<u32> has an actual underlying u32
  • .unwrap() - when isSome, this will return the wrapped value, i.e. for Option<u32>, this would return the u32. When the value is isNone, this call will throw an exception.
  • .unwrapOr(<default value>) - this extends unwrap(), returning the wrapped value when isSome and in the case of isNone it will return the <default value> passed.
  • .unwrapOrDefault() - returns either the wrapped value when isSome, or the default for the type when isNone

Working with Tuples

A tuple is defined in the form of (u32, AccountId). To access the individual values, you can access it via its index, i.e.

// Assuming a tuple defined as `(32, AccountId)`
const [count, accountId] = tuple;

console.log(`${accountId} has ${count.toNumber()} values`);

When making a call that expect a Tuple input, pass it as an array, so to pass the example above into a call, it would be .call([123, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'])

Boolean values

All bool values are returned as nomal JS Boolean objects, i.e. they extend the JS Boolean to allow it to be used as a Codec type.

In addition to the default getValue() on the JS Boolean and the default interfaces explained above, two additional getters have been added for ease-of-use. These are isTrue and isFalse that will just return a normal JS primitive boolean for a quick check without using getValue().

Extending types

For customized chains, the need exists to register types so the API is aware of how to decode values for those types. The next section will provide a walk-through for the definition of custom types allowing the definition or re-definition of any type the API is aware of.

- + \ No newline at end of file diff --git a/api/start/types.create/index.html b/api/start/types.create/index.html index a176985a32..2cfe5751e9 100644 --- a/api/start/types.create/index.html +++ b/api/start/types.create/index.html @@ -5,12 +5,12 @@ Type creation | polkadot{.js} - +
Skip to main content

Type creation

Circling back to metadata. There are two important things to remember when using the API to make queries or send transactions.

  1. The functionality available, e.g. exposed on api.query.* is not hard-coded in the API, rather this is decorated from the chain metadata. So the metadata lets the API know which endpoints are available and what the type for those endpoints are.

  2. When you supply a value to the API, internally it will convert that value to the correct type as expected by the chain, i.e. as determined by the metadata. This means that a function such as balances.transfer(address: Address, value: Balance) can take at least the following inputs, which are all converted to the correct types -

    • address can be an Address, an AccountId, an Uint8Array publicKey, a hex publicKey or an ss58 formatted address;
    • value can be a Balance, a value encoded in hex, a BN object, a base-10 string, a JS number, a JS BigInt or even a SCALE-encoded Uint8Array
  3. It is advised to not supply a api.tx.somewhere.something, api.query.somewhere.something etc. call with Codec types created via createType, but to simply apply the value. This will ensure that if the Codec type needed for a certain call changes given a specific runtime, then the API will be able to resolve that type for you. This ensures the minimum amount of maintence, and refactoring required when changes to the type naming is applied.

// The following is not advised
const something = api.createType('SomeType', { foo: 'bar' });
...
await api.tx.somewhere.something(something);
...

// This following is advised
await api.tx.somewhere.something({ foo: 'bar' });

In cases where a value is returned such as storage queries, the response from the chain is always encoded into the correct Codec type. This means that while the node may return an encoded block (with encoded extrinsics) via api.rpc.chain.getBlock(), this is decoded into a proper SignedBlock by the API. Outputting this value via .toJSON() will yield an encoding for RPC, so if you are not using TypeScript (which adds code helpers on decoded objects), a representation via .toHuman() will be more representative of the actual object fields, re-formatted for human consumption.

Why create types

With the conversions done in the API, there are limited reasons to create types "manually". However, just because there are not thousands of reasons, does not mean it is not valid. For instance, you may retrieve an Option and for the sake of sanity would like to use .unwrapOr() on it, returning a Codec default value where the value .isNone.

// type import for TypeScript
import type { Balance } from '@polkadot/types/interfaces';

...
// unwrap out option into a zero Balance when not found
// (This can be done via `.unwrapOrDefault()`, which does the same underlying)
const balance: Balance = balanceOpt.unwrapOr(api.createType('Balance'));

In the example above, we introduced the api.createType(<typeName>, [<value>]). The same format is also exposed by the TypeRegistry (more on this in a short while) as well as createType(...) from the actual @polkadot/types package. All doing exactly the same.

Choosing how to create

In most cases, you would always want to use the api.createType helper. What this does is call the underlying @polkadot/types createType, passing through the registry that is attached to the API. Registry? Yes, registry.

The registry contains a listing of all internal types and their classes that have been registered. So upon creation of an API instance, a registry object is attached to the API and this is passed through to all created types. This allows the type definitions to not pollute the global namespace, but rather be contained and able to reference one another.

As mentioned, the createType functions all do exactly the same, and in 99.99% of the cases you would be recommended to just forget about everything and use api.createType if and when required. In some cases, you may just have a type object and from that want to create another type instance. For that you can access the registry on the type object and call createType on it. (If this type object was created from an API instance, the registry on the type and on the API will point to the same instance.)

Basically, this means that we have equivalency in creation for all the items below, all creating on the same registry (containing all injected types), and all wrapping the same value -

import { createType } from '@polkadot/types';

// via API (recommended)
api.createType('Balance', 123);

// via registry (`.registry` is on all API and Codec objects)
api.registry.createType('Balance', 123n);

// via the low-level approach (not recommended)
createType(api.registry, 'Balance', '123');

How to create types

As all methods of creation basically expose the same API, we will explain only how api.createType works. If the type is an alias for another type (like 'Balance', which is just a u128), the second parameter of api.createType is the value of the object you are creating, as detailed in the previous section:

const x = api.createType('Balance', 123);
console.log(`x is equal to ${x.toNumber()}`);

If the type you want to create is a struct, then the second parameter is a dictionary which maps field names to their values:

...
const api = await ApiPromise.create({
types: {
MyStruct: {
a: "u32",
b: "Vec<u32>",
c: "Option<u32>"
}
}
});

const s = api.createType("MyStruct", {a: 1, b: [2, 3], c: 4});
console.log(`s.a == ${s.a.toNumber()}`);
console.log(`s.b == ${s.b.toJSON()}`);
console.log(`s.c == ${s.c.unwrap().toNumber()}`);

If you don't specify a field, it will be initialized with the default value. Numbers are zero, vectors are empty, options are None by default.

If you want to create an enum, the pattern is api.createType(type, enumerator) (for C-style enums or if you want to rely on default enumeration) or api.createType(type, {enumerator: value}) (for typed enums). For example:

const api = await ApiPromise.create({
...
types: {
CLikeEnum: {
_enum: ['One', 'Two', 'Three']
},
TypedEnum: {
_enum: {
One: 'Compact<u32>',
Two: 'u64',
Three: 'Option<Balance>',
Four: null
}
}
}
});

const one = api.createType('CLikeEnum', 'One');
console.log(one.isOne); // true

const two = api.createType('TypedEnum', {'Two': 123});
console.log(two.asTwo.toNumber()); // 123

const three = api.createType('TypedEnum', 'Three'); // Default initialization
console.log(three.asThree.isNone); // true

You may want to construct a Call type given a specific tx. Using create type is unneecessary createType, and it can be achieved by simply using the method key attached to a tx.

const tx = await api.tx.balances.transfer(BOB, 12345);
console.log('Hex = ', tx.method.toHex())

Using with TypeScript

The API is built with TypeScript (as are all projects in the polkadot-js organization and as such allows developers using TS to have access to all the type interfaces defined on the chain, as well as having access to typings on interacting with the api.* namespaces. In the next section we will provide an overview of what is available in terms of types and TypeScript.

- + \ No newline at end of file diff --git a/api/start/types.extend/index.html b/api/start/types.extend/index.html index df16231fe5..1fda781901 100644 --- a/api/start/types.extend/index.html +++ b/api/start/types.extend/index.html @@ -5,12 +5,12 @@ Extending types | polkadot{.js} - +
Skip to main content

Extending types

Circling back to metadata, by default the metadata information (at this point in time), only returns the type names as they apply to any section, be it a call, event or query. As an example, this means that transfers are defined as balances.transfer(AccountId, Balance) with no details as to the mapping of the Balance type to a u128. (The underlying Polkadot/Substrate default)

Therefore to cater for all types, a mapping is done in the @polkadot/types library to define each of the types and align with their underlying structures as it maps to a default Polkadot or Substrate chain.

Additionally, the API contains some logic for chain type detection, for instance in the case of Substrate 1.x based chains, it will define BlockNumber & Index (nonce) as a u64, while for current-generation chains, these will be defined as u32. Some of the work in maintaining the API for Polkadot/Substrate is the addition of types as they appear and gets used in the Rust codebase.

Extension

As a blockchain toolkit, Substrate makes it easy to add your own modules and types. In most non-trivial implementations, this would mean that developers are adding specific types for their implementation as well. The API will get to know the names of these types via the metadata, however it won't understand what they are, which means it cannot encode or decode them. Additionally, when a type is mismatched between the node and the API, the decoding can fail, yielding issues such as Could not convert errors when submitting transactions.

To close this gap, the API allows for the injection of types, i.e. you can explicitly define (or override) types for the node/chain you are connecting to. In the simplest example, assuming you have a chain where your Balance type is a u64 (as opposed to the default u128), you need to let the API know.

...
const api = await ApiPromise.create({
provider: wsProvider,
types: {
Balance: 'u64'
}
});

The above introduces the types registry, effectively allowing overrides and the definition of new types. The override above would mean that immediately the API will treat all occurrences of Balance not as the default, but rather as the defined size.

Field ordering

When defining any custom structures or types, it is critical that the following rules are applied -

  • Map exactly to what is defined in the Rust code, i.e. defining a SaleType cannot be u16 on the one end and u32 on the other end. If mismatches occur, the serialization will fail.
  • Ensure that the field order is maintained in all definitions. The SCALE serialization is binary and contains no field names in the serialization, only the encoded values. Any decoding is therefore done based on the size of the type and the order thereof in the definitions.

These rules apply everywhere. Always ensure that the types match exactly between the environments and that the ordering is maintained, be it for structs, tuples or enums.

User-defined structs

Registration also applies to any type that can be found on a specific chain, i.e. we can add any types that is available on a specific node -

...
const api = await ApiPromise.create({
...,
types: {
TransactionInput: {
parentOutput: 'Hash',
signature: 'Signature'
},
TransactionOutput: {
value: 'u128',
pubkey: 'Hash',
sale: 'u32'
},
Transaction: {
inputs: 'Vec<TransactionInput>',
outputs: 'Vec<TransactionOutput>'
}
}
})

The example above defines non-primitive types (as found in the specific implementation) as structures. Additionally it also shows the user-defined types can depend on other user-defined types with Transaction referencing both TransactionInput and TransactionOutput. Here you can reference any known types, i.e. in the above we have referenced primitives such as u32 and Signature (itself an alias for H512).

Definition clashes

As explained in a previous section, the underlying API Codec types have a number of built-in properties and in some cases it could be that your struct has a field that conflicts. These should be minimal, however it can happen. Take the following example where a defined hash property clashes with the same-name Codec property -

Document: {
name: 'Text',
uri: 'Text',
hash: 'Text'
}

For this struct the hash will not be exposed, but rather be kept as the built-in hash. At this point it is important to know that the values "over-the-wire" for calls, queries, events and consts is in binary form, i.e. it is an encoding of the values only. So on the JS side you can apply a rename with no ill-effects. Here we rename the hash to docHash, which mean the value will be available on <instance>.docHash.

Document: {
name: 'Text',
uri: 'Text',
docHash: 'Text'
}

Type clashes

Another kind of clash is a clash of types. For example a chain can have a Balance type defined in two pallets. In one, let's say the balances pallet, it is defined as u128 and in the other, e.g. the assets pallet, it is defined as u64.

This will create an issue as polkadot JS will try to use the global balance defined (the u128 in this case). In this scenario we would need a typeAlias.

{
typesAlias: {
"assets": {
"Balance": "u64"
}
},
types: {
"AssetDetails": {
"supply": "Balance"
}
}
}

We define in our typesAlias that we want the type Balance to be a u64 for the assets pallet, then we can define our types.

User-defined enum

One form of types that appear regularly is enums, these can be defined as follows -

...
const api = await ApiPromise.create({
...,
types: {
CLikeEnum: {
_enum: ['One', 'Two', 'Three']
},
TypedEnum: {
_enum: {
One: 'Compact<u32>',
Two: 'u64',
Three: 'Option<Balance>',
Four: null
}
}
}
});

As seen in these examples, types are built up in terms of primitives and aligns with the Rust-type definition model with Compact, Option and Vec.

Node and chain-specific types

There are cases where a single API object can be used to connect to different types of nodes or chains, each including their own specific types. For these cases the typesChain and typesSpec injectors are made available.

As a real-world example, the polkadot-js/apps UI can connect to a variety of chains. To support Edgeware by default, the following node-type (specName as per the runtime version) overrides are made -

import { IdentityTypes } from 'edgeware-node-types/dist/identity';
import { SignalingTypes } from 'edgeware-node-types/dist/signaling';
import { VotingTypes } from 'edgeware-node-types/dist/voting';

...
const api = await ApiPromise.create({
...,
typesSpec: {
edgeware: {
...IdentityTypes,
...SignalingTypes,
...VotingTypes
}
}
});

In the same way typesChain can be used to match on the actual chain name, i.e. for a chain such as Kusama, the following overrides can be made (as per example only - Kusama uses the Polkadot defaults, so no overrides are needed) -

...
const api = await ApiPromise.create({
...,
typesChain: {
Kusama: {
BlockNumber: 'u32',
Index: 'u32'
}
}
});

The types, typesChain and typesSpec overrides are all optional and all are applied, as applicable to a specific connection. From the options types are registered first, followed by typesSpec for node-specific overrides and finally typesChain for chain-specific overrides. The would mean is you have the following (contrived) example,

...
const api = await ApiPromise.create({
...,
types: {
Balance: 'u32',
}
typesChain: {
Balance: 'u128'
},
typesSpec: {
Balance: 'u64',
}
});

Balance would be defined as an u128 at the end. Effectively based on the flow it is first registered as a u32, then overridden as a u64 and finally overridden once more as a u128 by the chain types.

Impact on extrinsics

When configuring your chain, be cognizant of the types you are using, and always ensure that any changes are replicated back to the API. In an earlier example we configured Balance as u64, in this case the same changes needs to be applied on the API, especially when there are mismatches compared to Substrate master. Not doing so means that failures will occur. The same would happen when your own types have mismatched fields or types are lacking fields on structs or enums.

Mismatches also applies to any other chain-specific configured types and can have impacts on transactions. For instance you can customize Lookup and Address on your chain, changing the default lookup behavior. A real example of this is the Substrate master node vs the Substrate master node-template -

/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = Indices;
...
/// The address format for describing accounts.
pub type Address = <Indices as StaticLookup>::Source;

And this is what is defined on the node-template -

/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
...
/// The address format for describing accounts.
pub type Address = AccountId;

Here the template was customized from the Substrate node defaults and the API needs to know how to map these types. Failure to make adjustments means transactions will fail. With this in mind the correct types that needs to be added here would be -

const api = await ApiPromise.create({
...,
types: {
// mapping the actual specified address format
Address: 'AccountId',
// mapping the lookup
LookupSource: 'AccountId'
}
});

Always look at customization and understand the impacts, replicating these changes between the node and the API. For the above the Address type is used in the construction of the UncheckedExtrinsic type, while the lookup type is applicable on transactions such as balances.transfer(to: LookupSource, value: Balance)

Custom RPC

In addition to customizing your node's modules and types, you can also add custom RPC definitions. Like the type definitions in this section, these can be defined and passed to the API for decoration.

- + \ No newline at end of file diff --git a/api/start/typescript.user/index.html b/api/start/typescript.user/index.html index d5d3c74895..110d676153 100644 --- a/api/start/typescript.user/index.html +++ b/api/start/typescript.user/index.html @@ -5,12 +5,12 @@ TypeScript user generated | polkadot{.js} - +
Skip to main content

TypeScript user generated

In the previous section we looked at the TypeScript definitions that are available and are generated from both the chain and definitions. Here we will expand upon the use of the infrastructure created to define types as part of the @polkadot/types library and see how to use them to generate your own definitions and chain types.

Definitions

A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with type extensions and the rules around fields, but effectively the types library does exactly the same.

To create TypeScript-aware definitions and keep your files in a single place, you can follow the same approach. Assuming you have a package named @MeInc/stuff where you have the definitions in an stuff/interfaces folder. Each sub-folder would indicate a runtime module, e.g.

  • stuff/interfaces/<module>/definitions.ts for each module (types.ts & index.ts will be generated)
  • stuff/interfaces/definitions.ts importing all sub-definitions`

With this structure setup, you can generate TypeScript definitions.

In the root of your project (with the @polkadot/typegen package installed), you can run yarn polkadot-types-from-defs --input ./stuff/interfaces --package @MeInc/stuff/interfaces which will create types.ts and index.ts files with the generated types. You can use these in exactly the same way as you would use your types from @polkadot/types/interfaces.

Chain modules

In the same way as the type library provides defaults from a substrate-base chain, you can also, directly from the chain's metadata, generate a complete api.{consts,query}.* definition for your specific chain. The command will create 2 files, {consts, query}.types.ts which you can either use to augment the TypeScript definitions, or replace those in @polkadot/api/* with your versions (copy, TypeScript replacement or browser/node aliasing).

In the root of your project, you can run yarn polkadot-types-from-chain --endpoint wss://<url> --output ./stuff and it will create the required output. (Here you can specify an optional --package @MeInc/stuff to read definitions for the targeted output folder with the specified package name.)

Example of actual use

The TypeScript augmentation example example provides a full real-world example of these scripts in action. Additionally it shows all the configurations from a TypeScript as well as an in-use perspective, showing how the types and interfaces are fully augmented based on the provided metadata.

And that's a wrap

This brings us to the end of our overview and jump through the API. While the documentation is still very much an ever evolving item, we can encourage you to try out what you have learned with some examples. As we indicated right at the start of this journey, if there are areas for improvement, let us know.

- + \ No newline at end of file diff --git a/api/start/typescript/index.html b/api/start/typescript/index.html index e2a95be76b..46cac6c022 100644 --- a/api/start/typescript/index.html +++ b/api/start/typescript/index.html @@ -5,12 +5,12 @@ TypeScript interfaces | polkadot{.js} - +
Skip to main content

TypeScript interfaces

The API is written in TypeScript, and as such definitions for all actual exposed interfaces are available. In general terms, care has been taken to expose types via a @polkadot/<package>/types interface, for instance the ApiOptions type which is passed through on the .create interface is available under @polkadot/api/types.

RPC interfaces

Before getting to the "hard things", i.e. methods as decorated based on metadata interfaces, let's take a look at more "static" interfaces such as RPC. (Be aware though that these can be customized on a per-chain basis as well - for now this functionality is not reflected in the API itself).

import { Header } from '@polkadot/types/interfaces';

...
const firstHead = api.rpc.chain.getHeader();

api.rpc.chain.subscribeNewHeads((lastHead: Header): void => {
console.log('current header:', JSON.stringify(lastHead));
});

In the above example a couple of things are introduced - most of the chain definitions (the default types for both Polkadot & Substrate) can be imported as interfaces from the @polkadot/types/interfaces endpoint. These are not classes (since they are generated from definitions) but rather a combination of TypeScript interfaces (where structures are involved) and type, i.e. type Balance = u128.

In the subscription example, we explicitly define lastHead: Header, although the same definition is missing for firstHead. However, in both these cases the definitions for the api.rpc sections are such that TypeScript understands that firstHead and lastHead are of type Header. The : Header here is rather for our own understanding (and could be needed based on your eslint/tslint config).

As indicated, most of the Polkadot/Substrate default types are available via types/interfaces. However, for primitives types where there is an actual implementation, these are made available via @polkadot/types directly. For instance, import { u32 } from '@polkadot/types is valid in this context.

Storage generics

For any interface injected by metadata, the types are not fully described but rather names and the API will decode all these into an instance that complies with the Codec interface. (The base of all our types)

However, this does allow you to perform overrides via generics, making the following possible -

import { Balance } from '@polkadot/types/interfaces';

type Balance2 = Balance;

...
const total = await api.query.balances.totalIssuance<Balance2>();

In this example (although the query does indeed return a Balance) we can instruct the TypeScript compiler that we are expecting a Balance2, not just the interface as generated. This means that functions like .toNumber() is available on both these types - as opposed to just the general type defaults with .toHex() and friends.

Adding user types

In addition to the generated and available interfaces, there is also the ability to create TypeScript interfaces from your own definitions and well as your on-chain modules.

- + \ No newline at end of file diff --git a/assets/js/main.5e6f8adb.js b/assets/js/main.50868bab.js similarity index 99% rename from assets/js/main.5e6f8adb.js rename to assets/js/main.50868bab.js index 2f023aff4c..e9eaebac5d 100644 --- a/assets/js/main.5e6f8adb.js +++ b/assets/js/main.50868bab.js @@ -1,2 +1,2 @@ -/*! For license information please see main.5e6f8adb.js.LICENSE.txt */ -(self.webpackChunkpolkadot_js=self.webpackChunkpolkadot_js||[]).push([[179],{997:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(7294),a=n(7462),o=n(8356),i=n.n(o),s=n(6887),l={"012d6adc":[function(){return n.e(8574).then(n.bind(n,5080))},"@site/docs/api-contract/start/contract.read.md",5080],"024f2b9d":[function(){return n.e(2765).then(n.bind(n,5571))},"@site/docs/api/start/api.query.md",5571],"02df19fc":[function(){return n.e(3166).then(n.bind(n,4785))},"@site/docs/substrate/extrinsics.md",4785],"03cd8334":[function(){return n.e(4353).then(n.bind(n,4134))},"@site/docs/substrate/storage.md",4134],"07317cec":[function(){return n.e(4409).then(n.bind(n,8288))},"@site/docs/api-contract/start/contract.tx.md",8288],"0ba64b44":[function(){return n.e(9575).then(n.bind(n,9308))},"@site/docs/api/examples/promise/simple-connect.md",9308],"0e247082":[function(){return n.e(358).then(n.bind(n,5936))},"@site/docs/api/examples/promise/intro.md",5936],"0e384e19":[function(){return n.e(9671).then(n.bind(n,1039))},"@site/docs/intro.md",1039],"125ca214":[function(){return n.e(4957).then(n.bind(n,1691))},"@site/docs/api/start/api.rpc.md",1691],"15b5cb8d":[function(){return n.e(2547).then(n.bind(n,9772))},"@site/docs/keyring/start/sign-verify.md",9772],"15f658b8":[function(){return n.e(5747).then(n.bind(n,2298))},"@site/docs/keyring/intro.md",2298],17896441:[function(){return Promise.all([n.e(532),n.e(7918)]).then(n.bind(n,5775))},"@theme/DocItem",5775],"18aa7cb6":[function(){return n.e(3183).then(n.bind(n,4400))},"@site/docs/api/cookbook/storage.md",4400],"1b14fe8f":[function(){return n.e(3470).then(n.bind(n,7107))},"@site/docs/api/start/typescript.md",7107],"1be78505":[function(){return Promise.all([n.e(532),n.e(9514)]).then(n.bind(n,1299))},"@theme/DocPage",1299],"1c299ab9":[function(){return n.e(3744).then(n.bind(n,8146))},"@site/docs/polkadot/extrinsics.md",8146],"247783bb":[function(){return n.e(9334).then(n.t.bind(n,3769,19))},"/home/runner/work/docs/docs/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],"25148fda":[function(){return n.e(5515).then(n.bind(n,8892))},"@site/docs/api/examples/rxjs/08_system_events/README.md",8892],25967881:[function(){return n.e(7926).then(n.bind(n,3029))},"@site/docs/api/examples/promise/chain-info.md",3029],"2b20c3ce":[function(){return n.e(3332).then(n.bind(n,1472))},"@site/docs/api/examples/promise/unsubscribe.md",1472],"2ca4316d":[function(){return n.e(6916).then(n.bind(n,8712))},"@site/docs/substrate/runtime.md",8712],"302da12d":[function(){return n.e(8580).then(n.bind(n,1007))},"@site/docs/kusama/extrinsics.md",1007],"3044fdd8":[function(){return n.e(31).then(n.bind(n,2870))},"@site/docs/api-contract/FAQ.md",2870],"368ec150":[function(){return n.e(7436).then(n.bind(n,3247))},"@site/docs/substrate/events.md",3247],37285116:[function(){return n.e(7264).then(n.bind(n,4931))},"@site/docs/ui-keyring/start/intro.md",4931],"37ccf30c":[function(){return n.e(2804).then(n.bind(n,2949))},"@site/docs/keyring/examples/intro.md",2949],"386d4ef6":[function(){return n.e(6093).then(n.bind(n,8108))},"@site/docs/keyring/examples/sign-verify.md",8108],"39553b4c":[function(){return n.e(3478).then(n.bind(n,9181))},"@site/docs/polkadot/constants.md",9181],"3989c669":[function(){return n.e(6561).then(n.bind(n,5978))},"@site/docs/api/start/api.tx.wrap.md",5978],"3ceeaf41":[function(){return n.e(3749).then(n.bind(n,6723))},"@site/docs/api/examples/rxjs/03_listen_to_balance_change/README.md",6723],"3cf79be7":[function(){return n.e(1934).then(n.bind(n,3033))},"@site/docs/api-contract/start/prerequisites.md",3033],"3f4f0a3c":[function(){return n.e(726).then(n.bind(n,6539))},"@site/docs/keyring/FAQ.md",6539],"403f916c":[function(){return n.e(2222).then(n.bind(n,953))},"@site/docs/kusama/constants.md",953],"44eda3b5":[function(){return n.e(1735).then(n.bind(n,7780))},"@site/docs/api/examples/promise/upgrade-chain.md",7780],"4938ede4":[function(){return n.e(46).then(n.bind(n,4111))},"@site/docs/polkadot/events.md",4111],"49be255f":[function(){return n.e(4451).then(n.bind(n,1414))},"@site/docs/api/start/intro.md",1414],"4c51c4a4":[function(){return n.e(5669).then(n.bind(n,1408))},"@site/docs/keyring/start/basics.md",1408],"4d22bb21":[function(){return n.e(6472).then(n.bind(n,9699))},"@site/docs/ui-keyring/start/install.md",9699],"4fa5cade":[function(){return n.e(4458).then(n.bind(n,6607))},"@site/docs/api/examples/promise/transfer-events.md",6607],"4ffd5770":[function(){return n.e(1504).then(n.bind(n,2953))},"@site/docs/api/start/create.md",2953],"51e9ff07":[function(){return n.e(463).then(n.bind(n,6547))},"@site/docs/api/start/rpc.custom.md",6547],"520414cd":[function(){return n.e(9698).then(n.bind(n,9873))},"@site/docs/api/start/api.consts.md",9873],"52ac863c":[function(){return n.e(2039).then(n.bind(n,304))},"@site/docs/api/examples/promise/read-storage-at.md",304],"537ed919":[function(){return n.e(613).then(n.bind(n,8582))},"@site/docs/ui-keyring/start/addresses.md",8582],"544296b2":[function(){return n.e(4905).then(n.bind(n,2971))},"@site/docs/api/examples/promise/typegen.md",2971],"57f2e5a8":[function(){return n.e(897).then(n.bind(n,9657))},"@site/docs/util-crypto/FAQ.md",9657],"5e36d043":[function(){return n.e(2406).then(n.bind(n,1914))},"@site/docs/keyring/start/ss58.md",1914],"6083935d":[function(){return n.e(4898).then(n.bind(n,7296))},"@site/docs/api-contract/start/intro.md",7296],"6262e02f":[function(){return n.e(5791).then(n.bind(n,281))},"@site/docs/api/intro.md",281],"637d662b":[function(){return n.e(5061).then(n.bind(n,4316))},"@site/docs/api/start/api.query.other.md",4316],"639a3dbd":[function(){return n.e(7791).then(n.bind(n,529))},"@site/docs/ui-identicon/vue.md",529],"63fa056c":[function(){return n.e(3289).then(n.bind(n,8401))},"@site/docs/api/start/typescript.user.md",8401],64075394:[function(){return n.e(6253).then(n.bind(n,902))},"@site/docs/ui-keyring/start/loading.md",902],"65d222ad":[function(){return n.e(5386).then(n.bind(n,491))},"@site/docs/kusama/intro.md",491],"6d2d3c1e":[function(){return n.e(2194).then(n.bind(n,8307))},"@site/docs/kusama/storage.md",8307],"6e5ecb7a":[function(){return n.e(9784).then(n.bind(n,6560))},"@site/docs/util-crypto/examples/create-multisig.md",6560],"732d9e50":[function(){return n.e(7400).then(n.bind(n,29))},"@site/docs/extension/usage.md",29],"7b0b40b0":[function(){return n.e(5332).then(n.bind(n,6710))},"@site/docs/ui-keyring/intro.md",6710],"7b1b3f4d":[function(){return n.e(9610).then(n.bind(n,5585))},"@site/docs/api/start/keyring.md",5585],"7c4921ef":[function(){return n.e(9191).then(n.bind(n,3724))},"@site/docs/ui-identicon/react-native.md",3724],"7cf2b0e9":[function(){return n.e(9591).then(n.bind(n,9655))},"@site/docs/api/cookbook/blocks.md",9655],"7d73d85f":[function(){return n.e(1722).then(n.bind(n,6588))},"@site/docs/api/examples/promise/listen-to-multiple-balances-change.md",6588],"82ac0777":[function(){return n.e(8269).then(n.bind(n,2744))},"@site/docs/api/start/types.extend.md",2744],84731616:[function(){return n.e(8408).then(n.bind(n,6724))},"@site/docs/api/start/api.tx.md",6724],"85429f4a":[function(){return n.e(7084).then(n.bind(n,5897))},"@site/docs/api/examples/rxjs/05_read_storage/README.md",5897],"87d1b13c":[function(){return n.e(4993).then(n.bind(n,8315))},"@site/docs/api/examples/rxjs/06_make_transfer/README.md",8315],"8f044512":[function(){return n.e(7661).then(n.bind(n,9881))},"@site/docs/polkadot/intro.md",9881],"935f2afb":[function(){return n.e(53).then(n.t.bind(n,1109,19))},"~docs/default/version-current-metadata-prop-751.json",1109],"9398fe2b":[function(){return n.e(4267).then(n.bind(n,3922))},"@site/docs/polkadot/storage.md",3922],"943030be":[function(){return n.e(6115).then(n.bind(n,780))},"@site/docs/keyring/start/suri.md",780],"94ef5465":[function(){return n.e(9211).then(n.bind(n,844))},"@site/docs/api/examples/rxjs/README.md",844],"968e0336":[function(){return n.e(4127).then(n.bind(n,191))},"@site/docs/kusama/runtime.md",191],"96a10314":[function(){return n.e(2202).then(n.bind(n,8698))},"@site/docs/keyring/examples/create-account.md",8698],"9961a5af":[function(){return n.e(3708).then(n.bind(n,8982))},"@site/docs/api/examples/rxjs/09_transfer_events/README.md",8982],"99e17b8d":[function(){return n.e(4638).then(n.bind(n,4483))},"@site/docs/usage/FAQ.md",4483],"9b7b59d4":[function(){return n.e(2605).then(n.bind(n,7087))},"@site/docs/util-crypto/examples/create-mnemonic.md",7087],a020ae0f:[function(){return n.e(6321).then(n.bind(n,9616))},"@site/docs/api/cookbook/intro.md",9616],a3c88f82:[function(){return n.e(4548).then(n.bind(n,4919))},"@site/docs/api/examples/rxjs/10_upgrade_chain/README.md",4919],a47bda99:[function(){return n.e(8935).then(n.bind(n,301))},"@site/docs/ui-keyring/start/init.md",301],a5f31434:[function(){return n.e(4145).then(n.bind(n,1320))},"@site/docs/substrate/rpc.md",1320],a81bd23a:[function(){return n.e(8296).then(n.bind(n,9862))},"@site/docs/api/examples/rxjs/04_unsubscribe/README.md",9862],a95f894f:[function(){return n.e(3395).then(n.bind(n,3351))},"@site/docs/api/FAQ.md",3351],aa4bead7:[function(){return n.e(6246).then(n.bind(n,9102))},"@site/docs/api-contract/start/blueprint.md",9102],aacba4f7:[function(){return n.e(8373).then(n.bind(n,1792))},"@site/docs/extension/intro.md",1792],ab20e5ed:[function(){return n.e(4362).then(n.bind(n,7869))},"@site/docs/api/start/types.create.md",7869],ac867de3:[function(){return n.e(307).then(n.bind(n,3053))},"@site/docs/kusama/rpc.md",3053],ad72f253:[function(){return n.e(3071).then(n.bind(n,6045))},"@site/docs/substrate/constants.md",6045],ae24562b:[function(){return n.e(4246).then(n.bind(n,4902))},"@site/docs/api/examples/rxjs/01_simple_connect/README.md",4902],b2d871e8:[function(){return n.e(6691).then(n.bind(n,9718))},"@site/docs/extension/FAQ.md",9718],b5f7435c:[function(){return n.e(8485).then(n.bind(n,9938))},"@site/docs/keyring/start/install.md",9938],b6a51449:[function(){return n.e(2095).then(n.bind(n,4260))},"@site/docs/api/examples/promise/system-events.md",4260],beb6b946:[function(){return n.e(5361).then(n.bind(n,4367))},"@site/docs/api/start/install.md",4367],c07e8dc6:[function(){return n.e(5416).then(n.bind(n,4457))},"@site/docs/util-crypto/examples/encrypt-decrypt.md",4457],c1b215c0:[function(){return n.e(6277).then(n.bind(n,9394))},"@site/docs/util-crypto/examples/intro.md",9394],c427311a:[function(){return n.e(36).then(n.bind(n,6132))},"@site/docs/api/start/types.basics.md",6132],c5a5062c:[function(){return n.e(3963).then(n.bind(n,6939))},"@site/docs/api-contract/start/code.md",6939],c664d0ef:[function(){return n.e(8791).then(n.bind(n,1212))},"@site/docs/keyring/start/create.md",1212],c91d4e77:[function(){return n.e(1021).then(n.bind(n,3273))},"@site/docs/api/cookbook/tx.md",3273],cacf1fee:[function(){return n.e(8642).then(n.bind(n,7346))},"@site/docs/keyring/start/intro.md",7346],cd4472d2:[function(){return n.e(1239).then(n.bind(n,9024))},"@site/docs/kusama/errors.md",9024],cdeec012:[function(){return n.e(4399).then(n.bind(n,9472))},"@site/docs/util-crypto/examples/verify-signature.md",9472],d1c32569:[function(){return n.e(42).then(n.bind(n,9343))},"@site/docs/keyring/examples/load-accounts.md",9343],d58137f2:[function(){return n.e(1875).then(n.bind(n,5411))},"@site/docs/api-contract/intro.md",5411],d5e045e7:[function(){return n.e(2873).then(n.bind(n,6109))},"@site/docs/ui-identicon/react.md",6109],d5e75881:[function(){return n.e(2364).then(n.bind(n,8779))},"@site/docs/api/start/api.tx.subs.md",8779],ddad7749:[function(){return n.e(9679).then(n.bind(n,2816))},"@site/docs/ui-keyring/start/accounts.md",2816],df16c110:[function(){return n.e(3043).then(n.bind(n,3154))},"@site/docs/extension/cookbook.md",3154],e129269f:[function(){return n.e(9763).then(n.bind(n,81))},"@site/docs/api/start/api.query.multi.md",81],e3fa6414:[function(){return n.e(6179).then(n.bind(n,6012))},"@site/docs/api/examples/promise/listen-to-balance-change.md",6012],e48c9ee8:[function(){return n.e(5192).then(n.bind(n,1797))},"@site/docs/api/examples/promise/listen-to-blocks.md",1797],e7767b8d:[function(){return n.e(5885).then(n.bind(n,5404))},"@site/docs/util-crypto/examples/validate-address.md",5404],e8bc4a65:[function(){return n.e(7887).then(n.bind(n,635))},"@site/docs/util-crypto/intro.md",635],e8dd54a1:[function(){return n.e(9869).then(n.bind(n,8896))},"@site/docs/polkadot/runtime.md",8896],eb11a785:[function(){return n.e(9316).then(n.bind(n,8809))},"@site/docs/api/start/basics.md",8809],eb2e8386:[function(){return n.e(3066).then(n.bind(n,457))},"@site/docs/kusama/events.md",457],ec1150d3:[function(){return n.e(7497).then(n.bind(n,2983))},"@site/docs/api/examples/rxjs/02_listen_to_blocks/README.md",2983],eec41f26:[function(){return n.e(5745).then(n.bind(n,8881))},"@site/docs/api/examples/promise/read-storage.md",8881],f00ced23:[function(){return n.e(6268).then(n.bind(n,4856))},"@site/docs/api-contract/start/basics.md",4856],f0d9f312:[function(){return n.e(4028).then(n.bind(n,658))},"@site/docs/util-crypto/examples/hash-data.md",658],f25e701a:[function(){return n.e(8194).then(n.bind(n,8713))},"@site/docs/polkadot/errors.md",8713],f336b2cf:[function(){return n.e(5072).then(n.bind(n,5323))},"@site/docs/api/start/api.query.subs.md",5323],f3558826:[function(){return n.e(5796).then(n.bind(n,7978))},"@site/docs/substrate/errors.md",7978],f4368608:[function(){return n.e(4311).then(n.bind(n,2814))},"@site/docs/substrate/intro.md",2814],f7aaffb4:[function(){return n.e(1537).then(n.bind(n,9498))},"@site/docs/polkadot/rpc.md",9498],f9dd0516:[function(){return n.e(3229).then(n.bind(n,4588))},"@site/docs/api/examples/promise/make-transfer.md",4588],fa1f9237:[function(){return n.e(9560).then(n.bind(n,996))},"@site/docs/ui-identicon/intro.md",996],fb6dc4c5:[function(){return n.e(1805).then(n.bind(n,3468))},"@site/docs/api-contract/start/install.md",3468]};function c(e){var t=e.error,n=e.retry,a=e.pastDelay;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):a?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(5304),d=n(9656);function p(e,t){if("*"===e)return i()({loading:c,loader:function(){return n.e(4248).then(n.bind(n,4248))},modules:["@theme/NotFound"],webpack:function(){return[4248]},render:function(e,t){var n=e.default;return r.createElement(d.z,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});var o=s[e+"-"+t],p={},f=[],m=[],h=(0,u.Z)(o);return Object.entries(h).forEach((function(e){var t=e[0],n=e[1],r=l[n];r&&(p[t]=r[0],f.push(r[1]),m.push(r[2]))})),i().Map({loading:c,loader:p,modules:f,webpack:function(){return m},render:function(t,n){var i=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((function(t){var n=t[0],r=t[1],a=r.default;if(!a)throw new Error("The page component at "+e+" doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.");"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((function(e){return"default"!==e})).forEach((function(e){a[e]=r[e]}));var o=i,s=n.split(".");s.slice(0,-1).forEach((function(e){o=o[e]})),o[s[s.length-1]]=a}));var s=i.__comp;delete i.__comp;var l=i.__context;return delete i.__context,r.createElement(d.z,{value:l},r.createElement(s,(0,a.Z)({},i,n)))}})}var f=[{path:"/docs/",component:p("/docs/","f8f"),routes:[{path:"/docs/",component:p("/docs/","e00"),exact:!0,sidebar:"reference"},{path:"/docs/api",component:p("/docs/api","b88"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract",component:p("/docs/api-contract","6d1"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/FAQ",component:p("/docs/api-contract/FAQ","564"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start",component:p("/docs/api-contract/start","4e6"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/basics",component:p("/docs/api-contract/start/basics","9dd"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/blueprint",component:p("/docs/api-contract/start/blueprint","8a9"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/code",component:p("/docs/api-contract/start/code","48a"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/contract.read",component:p("/docs/api-contract/start/contract.read","e01"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/contract.tx",component:p("/docs/api-contract/start/contract.tx","d4d"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/install",component:p("/docs/api-contract/start/install","e73"),exact:!0,sidebar:"reference"},{path:"/docs/api-contract/start/prerequisites",component:p("/docs/api-contract/start/prerequisites","291"),exact:!0,sidebar:"reference"},{path:"/docs/api/cookbook",component:p("/docs/api/cookbook","4bd"),exact:!0,sidebar:"reference"},{path:"/docs/api/cookbook/blocks",component:p("/docs/api/cookbook/blocks","907"),exact:!0,sidebar:"reference"},{path:"/docs/api/cookbook/storage",component:p("/docs/api/cookbook/storage","0cf"),exact:!0,sidebar:"reference"},{path:"/docs/api/cookbook/tx",component:p("/docs/api/cookbook/tx","0e1"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise",component:p("/docs/api/examples/promise","205"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/chain-info",component:p("/docs/api/examples/promise/chain-info","ee3"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/listen-to-balance-change",component:p("/docs/api/examples/promise/listen-to-balance-change","6b8"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/listen-to-blocks",component:p("/docs/api/examples/promise/listen-to-blocks","2c8"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/listen-to-multiple-balances-change",component:p("/docs/api/examples/promise/listen-to-multiple-balances-change","0c5"),exact:!0},{path:"/docs/api/examples/promise/make-transfer",component:p("/docs/api/examples/promise/make-transfer","adf"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/read-storage",component:p("/docs/api/examples/promise/read-storage","bff"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/read-storage-at",component:p("/docs/api/examples/promise/read-storage-at","0d3"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/simple-connect",component:p("/docs/api/examples/promise/simple-connect","aab"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/system-events",component:p("/docs/api/examples/promise/system-events","198"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/transfer-events",component:p("/docs/api/examples/promise/transfer-events","31f"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/typegen",component:p("/docs/api/examples/promise/typegen","0dd"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/unsubscribe",component:p("/docs/api/examples/promise/unsubscribe","d78"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/promise/upgrade-chain",component:p("/docs/api/examples/promise/upgrade-chain","2aa"),exact:!0,sidebar:"reference"},{path:"/docs/api/examples/rxjs/",component:p("/docs/api/examples/rxjs/","48f"),exact:!0},{path:"/docs/api/examples/rxjs/listen_to_balance_change/",component:p("/docs/api/examples/rxjs/listen_to_balance_change/","a02"),exact:!0},{path:"/docs/api/examples/rxjs/listen_to_blocks/",component:p("/docs/api/examples/rxjs/listen_to_blocks/","afa"),exact:!0},{path:"/docs/api/examples/rxjs/make_transfer/",component:p("/docs/api/examples/rxjs/make_transfer/","cb6"),exact:!0},{path:"/docs/api/examples/rxjs/read_storage/",component:p("/docs/api/examples/rxjs/read_storage/","36d"),exact:!0},{path:"/docs/api/examples/rxjs/simple_connect/",component:p("/docs/api/examples/rxjs/simple_connect/","f07"),exact:!0},{path:"/docs/api/examples/rxjs/system_events/",component:p("/docs/api/examples/rxjs/system_events/","e21"),exact:!0},{path:"/docs/api/examples/rxjs/transfer_events/",component:p("/docs/api/examples/rxjs/transfer_events/","69b"),exact:!0},{path:"/docs/api/examples/rxjs/unsubscribe/",component:p("/docs/api/examples/rxjs/unsubscribe/","7ae"),exact:!0},{path:"/docs/api/examples/rxjs/upgrade_chain/",component:p("/docs/api/examples/rxjs/upgrade_chain/","c91"),exact:!0},{path:"/docs/api/FAQ",component:p("/docs/api/FAQ","d24"),exact:!0,sidebar:"reference"},{path:"/docs/api/start",component:p("/docs/api/start","e75"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.consts",component:p("/docs/api/start/api.consts","3d6"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.query",component:p("/docs/api/start/api.query","721"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.query.multi",component:p("/docs/api/start/api.query.multi","e23"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.query.other",component:p("/docs/api/start/api.query.other","fdb"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.query.subs",component:p("/docs/api/start/api.query.subs","6e6"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.rpc",component:p("/docs/api/start/api.rpc","885"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.tx",component:p("/docs/api/start/api.tx","c27"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.tx.subs",component:p("/docs/api/start/api.tx.subs","7b5"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/api.tx.wrap",component:p("/docs/api/start/api.tx.wrap","059"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/basics",component:p("/docs/api/start/basics","1c3"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/create",component:p("/docs/api/start/create","548"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/install",component:p("/docs/api/start/install","1c0"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/keyring",component:p("/docs/api/start/keyring","7f1"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/rpc.custom",component:p("/docs/api/start/rpc.custom","a1e"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/types.basics",component:p("/docs/api/start/types.basics","5cc"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/types.create",component:p("/docs/api/start/types.create","638"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/types.extend",component:p("/docs/api/start/types.extend","574"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/typescript",component:p("/docs/api/start/typescript","f6e"),exact:!0,sidebar:"reference"},{path:"/docs/api/start/typescript.user",component:p("/docs/api/start/typescript.user","ea0"),exact:!0,sidebar:"reference"},{path:"/docs/extension",component:p("/docs/extension","0b7"),exact:!0,sidebar:"reference"},{path:"/docs/extension/cookbook",component:p("/docs/extension/cookbook","651"),exact:!0,sidebar:"reference"},{path:"/docs/extension/FAQ",component:p("/docs/extension/FAQ","a38"),exact:!0,sidebar:"reference"},{path:"/docs/extension/usage",component:p("/docs/extension/usage","b12"),exact:!0,sidebar:"reference"},{path:"/docs/keyring",component:p("/docs/keyring","0cc"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/examples",component:p("/docs/keyring/examples","654"),exact:!0},{path:"/docs/keyring/examples/create-account",component:p("/docs/keyring/examples/create-account","e02"),exact:!0},{path:"/docs/keyring/examples/load-accounts",component:p("/docs/keyring/examples/load-accounts","84f"),exact:!0},{path:"/docs/keyring/examples/sign-verify",component:p("/docs/keyring/examples/sign-verify","23f"),exact:!0},{path:"/docs/keyring/FAQ",component:p("/docs/keyring/FAQ","527"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start",component:p("/docs/keyring/start","6dd"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/basics",component:p("/docs/keyring/start/basics","9f9"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/create",component:p("/docs/keyring/start/create","b3e"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/install",component:p("/docs/keyring/start/install","a80"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/sign-verify",component:p("/docs/keyring/start/sign-verify","926"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/ss58",component:p("/docs/keyring/start/ss58","f52"),exact:!0,sidebar:"reference"},{path:"/docs/keyring/start/suri",component:p("/docs/keyring/start/suri","da1"),exact:!0,sidebar:"reference"},{path:"/docs/kusama",component:p("/docs/kusama","7a1"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/constants",component:p("/docs/kusama/constants","f16"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/errors",component:p("/docs/kusama/errors","972"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/events",component:p("/docs/kusama/events","664"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/extrinsics",component:p("/docs/kusama/extrinsics","6bb"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/rpc",component:p("/docs/kusama/rpc","52d"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/runtime",component:p("/docs/kusama/runtime","0a9"),exact:!0,sidebar:"reference"},{path:"/docs/kusama/storage",component:p("/docs/kusama/storage","a59"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot",component:p("/docs/polkadot","72a"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/constants",component:p("/docs/polkadot/constants","826"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/errors",component:p("/docs/polkadot/errors","8d4"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/events",component:p("/docs/polkadot/events","f9d"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/extrinsics",component:p("/docs/polkadot/extrinsics","649"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/rpc",component:p("/docs/polkadot/rpc","78c"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/runtime",component:p("/docs/polkadot/runtime","e8b"),exact:!0,sidebar:"reference"},{path:"/docs/polkadot/storage",component:p("/docs/polkadot/storage","a97"),exact:!0,sidebar:"reference"},{path:"/docs/substrate",component:p("/docs/substrate","4f2"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/constants",component:p("/docs/substrate/constants","f1c"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/errors",component:p("/docs/substrate/errors","f44"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/events",component:p("/docs/substrate/events","634"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/extrinsics",component:p("/docs/substrate/extrinsics","406"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/rpc",component:p("/docs/substrate/rpc","225"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/runtime",component:p("/docs/substrate/runtime","78a"),exact:!0,sidebar:"reference"},{path:"/docs/substrate/storage",component:p("/docs/substrate/storage","235"),exact:!0,sidebar:"reference"},{path:"/docs/ui-identicon",component:p("/docs/ui-identicon","2d6"),exact:!0,sidebar:"reference"},{path:"/docs/ui-identicon/react",component:p("/docs/ui-identicon/react","c73"),exact:!0,sidebar:"reference"},{path:"/docs/ui-identicon/react-native",component:p("/docs/ui-identicon/react-native","0aa"),exact:!0,sidebar:"reference"},{path:"/docs/ui-identicon/vue",component:p("/docs/ui-identicon/vue","878"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring",component:p("/docs/ui-keyring","a87"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start",component:p("/docs/ui-keyring/start","1ae"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start/accounts",component:p("/docs/ui-keyring/start/accounts","4d4"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start/addresses",component:p("/docs/ui-keyring/start/addresses","524"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start/init",component:p("/docs/ui-keyring/start/init","15c"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start/install",component:p("/docs/ui-keyring/start/install","c1d"),exact:!0,sidebar:"reference"},{path:"/docs/ui-keyring/start/loading",component:p("/docs/ui-keyring/start/loading","d7c"),exact:!0,sidebar:"reference"},{path:"/docs/usage/FAQ",component:p("/docs/usage/FAQ","48e"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto",component:p("/docs/util-crypto","69f"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples",component:p("/docs/util-crypto/examples","fde"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/create-mnemonic",component:p("/docs/util-crypto/examples/create-mnemonic","f93"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/create-multisig",component:p("/docs/util-crypto/examples/create-multisig","5f1"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/encrypt-decrypt",component:p("/docs/util-crypto/examples/encrypt-decrypt","43b"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/hash-data",component:p("/docs/util-crypto/examples/hash-data","a66"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/validate-address",component:p("/docs/util-crypto/examples/validate-address","305"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/examples/verify-signature",component:p("/docs/util-crypto/examples/verify-signature","7ac"),exact:!0,sidebar:"reference"},{path:"/docs/util-crypto/FAQ",component:p("/docs/util-crypto/FAQ","103"),exact:!0,sidebar:"reference"}]},{path:"*",component:p("*")}]},5351:function(e,t,n){var r,a;!function(){var o,i,s,l,c,u,d,p,f,m,h,g,v,b,y,w,k,x,E,S,_,O,C,P,T,I,A,L,N,R,j=function e(t){var n=new e.Builder;return n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),n.searchPipeline.add(e.stemmer),t.call(n,n),n.build()};j.version="2.3.9",(j.utils={}).warn=(o=this,function(e){o.console&&console.warn&&console.warn(e)}),j.utils.asString=function(e){return null==e?"":e.toString()},j.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),n=Object.keys(e),r=0;r0){var l=j.utils.clone(t)||{};l.position=[i,s],l.index=a.length,a.push(new j.Token(n.slice(i,o),l))}i=o+1}}return a}).separator=/[\s\-]+/,(j.Pipeline=function(){this._stack=[]}).registeredFunctions=Object.create(null),j.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&j.utils.warn("Overwriting existing registered function: "+t),e.label=t,j.Pipeline.registeredFunctions[e.label]=e},j.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||j.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},j.Pipeline.load=function(e){var t=new j.Pipeline;return e.forEach((function(e){var n=j.Pipeline.registeredFunctions[e];if(!n)throw new Error("Cannot load unregistered function: "+e);t.add(n)})),t},j.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach((function(e){j.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},j.Pipeline.prototype.after=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e);if(-1==n)throw new Error("Cannot find existingFn");n+=1,this._stack.splice(n,0,t)},j.Pipeline.prototype.before=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e);if(-1==n)throw new Error("Cannot find existingFn");this._stack.splice(n,0,t)},j.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},j.Pipeline.prototype.run=function(e){for(var t=this._stack.length,n=0;n1&&(oe&&(n=a),o!=e);)r=n-t,a=t+Math.floor(r/2),o=this.elements[2*a];return o==e||o>e?2*a:os?c+=2:i==s&&(t+=n[l+1]*r[c+1],l+=2,c+=2);return t},j.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},j.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,n=0;t0){var o,i=a.str.charAt(0);i in a.node.edges?o=a.node.edges[i]:(o=new j.TokenSet,a.node.edges[i]=o),1==a.str.length&&(o.final=!0),r.push({node:o,editsRemaining:a.editsRemaining,str:a.str.slice(1)})}if(0!=a.editsRemaining){if("*"in a.node.edges)var s=a.node.edges["*"];else{s=new j.TokenSet;a.node.edges["*"]=s}if(0==a.str.length&&(s.final=!0),r.push({node:s,editsRemaining:a.editsRemaining-1,str:a.str}),a.str.length>1&&r.push({node:a.node,editsRemaining:a.editsRemaining-1,str:a.str.slice(1)}),1==a.str.length&&(a.node.final=!0),a.str.length>=1){if("*"in a.node.edges)var l=a.node.edges["*"];else{l=new j.TokenSet;a.node.edges["*"]=l}1==a.str.length&&(l.final=!0),r.push({node:l,editsRemaining:a.editsRemaining-1,str:a.str.slice(1)})}if(a.str.length>1){var c,u=a.str.charAt(0),d=a.str.charAt(1);d in a.node.edges?c=a.node.edges[d]:(c=new j.TokenSet,a.node.edges[d]=c),1==a.str.length&&(c.final=!0),r.push({node:c,editsRemaining:a.editsRemaining-1,str:u+a.str.slice(2)})}}}return n},j.TokenSet.fromString=function(e){for(var t=new j.TokenSet,n=t,r=0,a=e.length;r=e;t--){var n=this.uncheckedNodes[t],r=n.child.toString();r in this.minimizedNodes?n.parent.edges[n.char]=this.minimizedNodes[r]:(n.child._str=r,this.minimizedNodes[r]=n.child),this.uncheckedNodes.pop()}},(j.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline}).prototype.search=function(e){return this.query((function(t){new j.QueryParser(e,t).parse()}))},j.Index.prototype.query=function(e){for(var t=new j.Query(this.fields),n=Object.create(null),r=Object.create(null),a=Object.create(null),o=Object.create(null),i=Object.create(null),s=0;s1?1:e},j.Builder.prototype.k1=function(e){this._k1=e},j.Builder.prototype.add=function(e,t){var n=e[this._ref],r=Object.keys(this._fields);this._documents[n]=t||{},this.documentCount+=1;for(var a=0;a=this.length)return j.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},j.QueryLexer.prototype.width=function(){return this.pos-this.start},j.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},j.QueryLexer.prototype.backup=function(){this.pos-=1},j.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=j.QueryLexer.EOS&&this.backup()},j.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(j.QueryLexer.TERM)),e.ignore(),e.more())return j.QueryLexer.lexText},j.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.EDIT_DISTANCE),j.QueryLexer.lexText},j.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.BOOST),j.QueryLexer.lexText},j.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(j.QueryLexer.TERM)},j.QueryLexer.termSeparator=j.tokenizer.separator,j.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==j.QueryLexer.EOS)return j.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return j.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if(t.match(j.QueryLexer.termSeparator))return j.QueryLexer.lexTerm}else e.escapeCharacter()}},(j.QueryParser=function(e,t){this.lexer=new j.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0}).prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=j.QueryParser.parseClause;e;)e=e(this);return this.query},j.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},j.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},j.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},j.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case j.QueryLexer.PRESENCE:return j.QueryParser.parsePresence;case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:var n="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(n+=" with value '"+t.str+"'"),new j.QueryParseError(n,t.start,t.end)}},j.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=j.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=j.Query.presence.REQUIRED;break;default:var n="unrecognised presence operator'"+t.str+"'";throw new j.QueryParseError(n,t.start,t.end)}var r=e.peekLexeme();if(null==r)throw new j.QueryParseError(n="expecting term or field, found nothing",t.start,t.end);switch(r.type){case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:n="expecting term or field, found '"+r.type+"'";throw new j.QueryParseError(n,r.start,r.end)}}},j.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var n=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),r="unrecognised field '"+t.str+"', possible fields: "+n;throw new j.QueryParseError(r,t.start,t.end)}e.currentClause.fields=[t.str];var a=e.peekLexeme();if(null==a)throw new j.QueryParseError(r="expecting term, found nothing",t.start,t.end);if(a.type===j.QueryLexer.TERM)return j.QueryParser.parseTerm;r="expecting term, found '"+a.type+"'";throw new j.QueryParseError(r,a.start,a.end)}},j.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var n=e.peekLexeme();if(null!=n)switch(n.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+n.type+"'";throw new j.QueryParseError(r,n.start,n.end)}else e.nextClause()}},j.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var n=parseInt(t.str,10);if(isNaN(n))throw new j.QueryParseError(a="edit distance must be numeric",t.start,t.end);e.currentClause.editDistance=n;var r=e.peekLexeme();if(null!=r)switch(r.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:var a="Unexpected lexeme type '"+r.type+"'";throw new j.QueryParseError(a,r.start,r.end)}else e.nextClause()}},j.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var n=parseInt(t.str,10);if(isNaN(n))throw new j.QueryParseError(a="boost must be numeric",t.start,t.end);e.currentClause.boost=n;var r=e.peekLexeme();if(null!=r)switch(r.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:var a="Unexpected lexeme type '"+r.type+"'";throw new j.QueryParseError(a,r.start,r.end)}else e.nextClause()}},void 0===(a="function"==typeof(r=function(){return j})?r.call(t,n,t,e):r)||(e.exports=a)}()},8121:function(e,t,n){"use strict";n.d(t,{_:function(){return a},t:function(){return o}});var r=n(7294),a=r.createContext(!1);function o(e){var t=e.children,n=(0,r.useState)(!1),o=n[0],i=n[1];return(0,r.useEffect)((function(){i(!0)}),[]),r.createElement(a.Provider,{value:o},t)}},9717:function(e,t,n){"use strict";var r=n(7294),a=n(3935),o=n(3727),i=n(405),s=n(6136),l=[n(984),n(2251),n(9957),n(6930)],c=n(997),u=n(6775),d=n(8790);function p(e){var t=e.children;return r.createElement(r.Fragment,null,t)}var f=n(7462),m=n(1514),h=n(9962),g=n(9524),v=n(107),b=n(5463),y=n(626),w=n(8181),k=n(246),x=n(3905),E=n(3647);function S(){var e=(0,h.Z)().i18n,t=e.defaultLocale,n=e.localeConfigs,a=(0,y.l)();return r.createElement(m.Z,null,Object.entries(n).map((function(e){var t=e[0],n=e[1].htmlLang;return r.createElement("link",{key:t,rel:"alternate",href:a.createUrl({locale:t,fullyQualified:!0}),hrefLang:n})})),r.createElement("link",{rel:"alternate",href:a.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}))}function _(e){var t=e.permalink,n=(0,h.Z)().siteConfig.url,a=function(){var e=(0,h.Z)().siteConfig,t=e.url,n=e.baseUrl,r=e.trailingSlash,a=(0,u.TH)().pathname;return t+(0,x.applyTrailingSlash)((0,g.Z)(a),{trailingSlash:r,baseUrl:n})}(),o=t?""+n+t:a;return r.createElement(m.Z,null,r.createElement("meta",{property:"og:url",content:o}),r.createElement("link",{rel:"canonical",href:o}))}function O(){var e=(0,h.Z)().i18n.currentLocale,t=(0,v.L)(),n=t.metadata,a=t.image;return r.createElement(r.Fragment,null,r.createElement(m.Z,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:w.h})),a&&r.createElement(b.d,{image:a}),r.createElement(_,null),r.createElement(S,null),r.createElement(E.Z,{tag:k.HX,locale:e}),r.createElement(m.Z,null,n.map((function(e,t){return r.createElement("meta",(0,f.Z)({key:t},e))}))))}var C=new Map;function P(e){if(C.has(e.pathname))return Object.assign({},e,{pathname:C.get(e.pathname)});if((0,d.f)(c.Z,e.pathname).some((function(e){return!0===e.route.exact})))return C.set(e.pathname,e.pathname),e;var t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,t),Object.assign({},e,{pathname:t})}var T=n(8121),I=n(694),A=n(4578);function L(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = '+e+" "+("/"===e?" (default value)":"")+'

\n

We suggest trying baseUrl =

\n\n'}(e)).replace(/0)&&(M.current.unobserve(e),M.current.disconnect(),null!=R&&window.docusaurus.prefetch(R))}))})),M.current.observe(e))},to:R},h&&{isActive:y,activeClassName:b}))}var h=o.forwardRef(m)},7325:function(e,t,n){"use strict";n.d(t,{Z:function(){return l},I:function(){return s}});var r=n(7294);function a(e,t){var n=e.split(/(\{\w+\})/).map((function(e,n){if(n%2==1){var r=null==t?void 0:t[e.slice(1,-1)];if(void 0!==r)return r}return e}));return n.some((function(e){return(0,r.isValidElement)(e)}))?n.map((function(e,t){return(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e})).filter((function(e){return""!==e})):n.join("")}var o=n(7529);function i(e){var t,n,r=e.id,a=e.message;if(void 0===r&&void 0===a)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return null!=(t=null!=(n=o[null!=r?r:a])?n:a)?t:r}function s(e,t){return a(i({message:e.message,id:e.id}),t)}function l(e){var t=e.children,n=e.id,o=e.values;if(t&&"string"!=typeof t)throw console.warn("Illegal children",t),new Error("The Docusaurus component only accept simple string values");var s=i({message:t,id:n});return r.createElement(r.Fragment,null,a(s,o))}},6875:function(e,t,n){"use strict";n.d(t,{m:function(){return r}});var r="default"},2735:function(e,t,n){"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{Z:function(){return a},b:function(){return r}})},9524:function(e,t,n){"use strict";n.d(t,{C:function(){return i},Z:function(){return s}});var r=n(7294),a=n(9962),o=n(2735);function i(){var e=(0,a.Z)().siteConfig,t=e.baseUrl,n=e.url,i=(0,r.useCallback)((function(e,r){return function(e,t,n,r){var a=void 0===r?{}:r,i=a.forcePrependBaseUrl,s=void 0!==i&&i,l=a.absolute,c=void 0!==l&&l;if(!n||n.startsWith("#")||(0,o.b)(n))return n;if(s)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;var u=n.startsWith(t)?n:t+n.replace(/^\//,"");return c?e+u:u}(n,t,e,r)}),[n,t]);return{withBaseUrl:i}}function s(e,t){return void 0===t&&(t={}),(0,i().withBaseUrl)(e,t)}},9962:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7294),a=n(694);function o(){return(0,r.useContext)(a._)}},1610:function(e,t,n){"use strict";n.d(t,{OD:function(){return o},eZ:function(){return i}});var r=n(9962),a=n(6875);function o(e,t){void 0===t&&(t={});var n=(0,r.Z)().globalData[e];if(!n&&t.failfast)throw new Error('Docusaurus plugin global data not found for "'+e+'" plugin.');return n}function i(e,t,n){void 0===t&&(t=a.m),void 0===n&&(n={});var r=o(e),i=null==r?void 0:r[t];if(!i&&n.failfast)throw new Error('Docusaurus plugin global data not found for "'+e+'" plugin with id "'+t+'".');return i}},1048:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7294),a=n(8121);function o(){return(0,r.useContext)(a._)}},5304:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=function(e){return"object"==typeof e&&!!e&&Object.keys(e).length>0};function a(e){var t={};return function e(n,a){Object.entries(n).forEach((function(n){var o=n[0],i=n[1],s=a?a+"."+o:o;r(i)?e(i,s):t[s]=i}))}(e),t}},9656:function(e,t,n){"use strict";n.d(t,{_:function(){return a},z:function(){return o}});var r=n(7294),a=r.createContext(null);function o(e){var t=e.children,n=e.value,o=r.useContext(a),i=(0,r.useMemo)((function(){return function(e){var t=e.parent,n=e.value;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}var r=Object.assign({},t.data,null==n?void 0:n.data);return{plugin:t.plugin,data:r}}({parent:o,value:n})}),[o,n]);return r.createElement(a.Provider,{value:i},t)}},868:function(e,t,n){"use strict";n.d(t,{Iw:function(){return h},gA:function(){return d},WS:function(){return p},_r:function(){return c},Jo:function(){return g},zh:function(){return u},yW:function(){return m},gB:function(){return f}});var r=n(6775),a=n(1610);var o=function(e){return e.versions.find((function(e){return e.isLast}))};function i(e,t){var n=o(e);return[].concat(e.versions.filter((function(e){return e!==n})),[n]).find((function(e){return!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})}))}function s(e,t){var n,a,o=i(e,t),s=null==o?void 0:o.docs.find((function(e){return!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})}));return{activeVersion:o,activeDoc:s,alternateDocVersions:s?(n=s.id,a={},e.versions.forEach((function(e){e.docs.forEach((function(t){t.id===n&&(a[e.name]=t)}))})),a):{}}}var l={},c=function(){var e;return null!=(e=(0,a.OD)("docusaurus-plugin-content-docs"))?e:l},u=function(e){return(0,a.eZ)("docusaurus-plugin-content-docs",e,{failfast:!0})};function d(e){return void 0===e&&(e={}),function(e,t,n){void 0===n&&(n={});var a=Object.entries(e).sort((function(e,t){return t[1].path.localeCompare(e[1].path)})).find((function(e){var n=e[1];return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error("Can't find active docs plugin for \""+t+'" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: '+Object.values(e).map((function(e){return e.path})).join(", "));return o}(c(),(0,r.TH)().pathname,e)}function p(e){void 0===e&&(e={});var t=d(e),n=(0,r.TH)().pathname;if(t)return{activePlugin:t,activeVersion:i(t.pluginData,n)}}function f(e){return u(e).versions}function m(e){var t=u(e);return o(t)}function h(e){return s(u(e),(0,r.TH)().pathname)}function g(e){return function(e,t){var n=o(e);return{latestDocSuggestion:s(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(u(e),(0,r.TH)().pathname)}},9957:function(e,t,n){"use strict";n.r(t);var r=n(4865),a=n.n(r);a().configure({showSpinner:!1});var o={onRouteUpdate:function(e){var t=e.location,n=e.previousLocation;if(n&&t.pathname!==n.pathname){var r=window.setTimeout((function(){a().start()}),200);return function(){return window.clearTimeout(r)}}},onRouteDidUpdate:function(){a().done()}};t.default=o},2251:function(e,t,n){"use strict";n.r(t);var r,a,o=n(7410),i=n(6809);r=o.Z,a=i.Z.themeConfig.prism.additionalLanguages,globalThis.Prism=r,a.forEach((function(e){n(6726)("./prism-"+e)})),delete globalThis.Prism},4082:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7294),a={iconExternalLink:"iconExternalLink_nPIU"};function o(e){var t=e.width,n=void 0===t?13.5:t,o=e.height,i=void 0===o?13.5:o;return r.createElement("svg",{width:n,height:i,"aria-hidden":"true",viewBox:"0 0 24 24",className:a.iconExternalLink},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},5199:function(e,t,n){"use strict";n.d(t,{Z:function(){return Bo}});var r=n(7294),a=n(6010),o=n(3256),i=n(5463),s=n(7462),l=n(6775),c=n(7325),u=n(3266),d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){var e=(0,r.useRef)(null),t=(0,l.k6)().action,n=(0,r.useCallback)((function(e){e.preventDefault();var t,n=null!=(t=document.querySelector("main:first-of-type"))?t:document.getElementById(d);n&&p(n)}),[]);return(0,u.S)((function(n){var r=n.location;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}var m=(0,c.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){var t,n=null!=(t=e.children)?t:m,a=f(),o=a.containerRef,i=a.onClick;return r.createElement("div",{ref:o,role:"region","aria-label":m},r.createElement("a",(0,s.Z)({},e,{href:"#"+d,onClick:i}),n))}var g=n(3702),v=n(8181),b={skipToContent:"skipToContent_fXgn"};function y(){return r.createElement(h,{className:b.skipToContent})}var w=n(107),k=n(5830),x=n(3366),E=["width","height","color","strokeWidth","className"];function S(e){var t=e.width,n=void 0===t?21:t,a=e.height,o=void 0===a?21:a,i=e.color,l=void 0===i?"currentColor":i,c=e.strokeWidth,u=void 0===c?1.2:c,d=(e.className,(0,x.Z)(e,E));return r.createElement("svg",(0,s.Z)({viewBox:"0 0 15 15",width:n,height:o},d),r.createElement("g",{stroke:l,strokeWidth:u},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}var _={closeButton:"closeButton_CVFx"};function O(e){return r.createElement("button",(0,s.Z)({type:"button","aria-label":(0,c.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,a.Z)("clean-btn close",_.closeButton,e.className)}),r.createElement(S,{width:14,height:14,strokeWidth:3.1}))}var C={content:"content_knG7"};function P(e){var t=(0,w.L)().announcementBar.content;return r.createElement("div",(0,s.Z)({},e,{className:(0,a.Z)(C.content,e.className),dangerouslySetInnerHTML:{__html:t}}))}var T={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function I(){var e=(0,w.L)().announcementBar,t=(0,k.nT)(),n=t.isActive,a=t.close;if(!n)return null;var o=e.backgroundColor,i=e.textColor,s=e.isCloseable;return r.createElement("div",{className:T.announcementBar,style:{backgroundColor:o,color:i},role:"banner"},s&&r.createElement("div",{className:T.announcementBarPlaceholder}),r.createElement(P,{className:T.announcementBarContent}),s&&r.createElement(O,{onClick:a,className:T.announcementBarClose}))}var A=n(2600),L=n(2957);var N=n(8755),R=n(3086),j=r.createContext(null);function D(e){var t,n,a,o,i,s,l,c=e.children,u=(t=(0,A.e)(),n=(0,R.HY)(),a=(0,r.useState)(!1),o=a[0],i=a[1],s=null!==n.component,l=(0,N.D9)(s),(0,r.useEffect)((function(){s&&!l&&i(!0)}),[s,l]),(0,r.useEffect)((function(){s?t.shown||i(!0):i(!1)}),[t.shown,s]),(0,r.useMemo)((function(){return[o,i]}),[o]));return r.createElement(j.Provider,{value:u},c)}function F(e){if(e.component){var t=e.component;return r.createElement(t,e.props)}}function M(){var e=(0,r.useContext)(j);if(!e)throw new N.i6("NavbarSecondaryMenuDisplayProvider");var t=e[0],n=e[1],a=(0,r.useCallback)((function(){return n(!1)}),[n]),o=(0,R.HY)();return(0,r.useMemo)((function(){return{shown:t,hide:a,content:F(o)}}),[a,o,t])}function B(e){var t=e.header,n=e.primaryMenu,o=e.secondaryMenu,i=M().shown;return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,a.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var z=n(9200),U=n(1048);function q(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function $(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}var H={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function Q(e){var t=e.className,n=e.buttonClassName,o=e.value,i=e.onChange,s=(0,U.Z)(),l=(0,c.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===o?(0,c.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,c.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,a.Z)(H.toggle,t)},r.createElement("button",{className:(0,a.Z)("clean-btn",H.toggleButton,!s&&H.toggleButtonDisabled,n),type:"button",onClick:function(){return i("dark"===o?"light":"dark")},disabled:!s,title:l,"aria-label":l,"aria-live":"polite"},r.createElement(q,{className:(0,a.Z)(H.toggleIcon,H.lightToggleIcon)}),r.createElement($,{className:(0,a.Z)(H.toggleIcon,H.darkToggleIcon)})))}var Z=r.memo(Q),G={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_X3D1"};function V(e){var t=e.className,n=(0,w.L)().navbar.style,a=(0,w.L)().colorMode.disableSwitch,o=(0,z.I)(),i=o.colorMode,s=o.setColorMode;return a?null:r.createElement(Z,{className:t,buttonClassName:"dark"===n?G.darkNavbarColorModeToggle:void 0,value:i,onChange:s})}var W=n(6811);function K(){return r.createElement(W.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function Y(){var e=(0,A.e)();return r.createElement("button",{type:"button","aria-label":(0,c.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:function(){return e.toggle()}},r.createElement(S,{color:"var(--ifm-color-emphasis-600)"}))}function X(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(K,null),r.createElement(V,{className:"margin-right--md"}),r.createElement(Y,null))}var J=n(3699),ee=n(9524),te=n(2735);function ne(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}var re=n(4082),ae=["activeBasePath","activeBaseRegex","to","href","label","html","isDropdownLink","prependBaseUrlToHref"];function oe(e){var t=e.activeBasePath,n=e.activeBaseRegex,a=e.to,o=e.href,i=e.label,l=e.html,c=e.isDropdownLink,u=e.prependBaseUrlToHref,d=(0,x.Z)(e,ae),p=(0,ee.Z)(a),f=(0,ee.Z)(t),m=(0,ee.Z)(o,{forcePrependBaseUrl:!0}),h=i&&o&&!(0,te.Z)(o),g=l?{dangerouslySetInnerHTML:{__html:l}}:{children:r.createElement(r.Fragment,null,i,h&&r.createElement(re.Z,c&&{width:12,height:12}))};return o?r.createElement(J.Z,(0,s.Z)({href:u?m:o},d,g)):r.createElement(J.Z,(0,s.Z)({to:p,isNavLink:!0},(t||n)&&{isActive:function(e,t){return n?ne(n,t.pathname):t.pathname.startsWith(f)}},d,g))}var ie=["className","isDropdownItem"],se=["className","isDropdownItem"],le=["mobile","position"];function ce(e){var t=e.className,n=e.isDropdownItem,o=void 0!==n&&n,i=(0,x.Z)(e,ie),l=r.createElement(oe,(0,s.Z)({className:(0,a.Z)(o?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:o},i));return o?r.createElement("li",null,l):l}function ue(e){var t=e.className,n=(e.isDropdownItem,(0,x.Z)(e,se));return r.createElement("li",{className:"menu__list-item"},r.createElement(oe,(0,s.Z)({className:(0,a.Z)("menu__link",t)},n)))}function de(e){var t,n=e.mobile,a=void 0!==n&&n,o=(e.position,(0,x.Z)(e,le)),i=a?ue:ce;return r.createElement(i,(0,s.Z)({},o,{activeClassName:null!=(t=o.activeClassName)?t:a?"menu__link--active":"navbar__link--active"}))}var pe=n(4639),fe=n(9003),me=n(9962);var he=["items","position","className","onClick"],ge=["items","className","position","onClick"],ve=["mobile"];function be(e,t){return e.some((function(e){return function(e,t){return!!(0,fe.Mg)(e.to,t)||!!ne(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)}))}function ye(e){var t,n=e.items,o=e.position,i=e.className,l=(e.onClick,(0,x.Z)(e,he)),c=(0,r.useRef)(null),u=(0,r.useState)(!1),d=u[0],p=u[1];return(0,r.useEffect)((function(){var e=function(e){c.current&&!c.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[c]),r.createElement("div",{ref:c,className:(0,a.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===o,"dropdown--show":d})},r.createElement(oe,(0,s.Z)({"aria-haspopup":"true","aria-expanded":d,role:"button",href:l.to?void 0:"#",className:(0,a.Z)("navbar__link",i)},l,{onClick:l.to?void 0:function(e){return e.preventDefault()},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),p(!d))}}),null!=(t=l.children)?t:l.label),r.createElement("ul",{className:"dropdown__menu"},n.map((function(e,t){return r.createElement(Va,(0,s.Z)({isDropdownItem:!0,activeClassName:"dropdown__link--active"},e,{key:t}))}))))}function we(e){var t,n,o=e.items,i=e.className,c=(e.position,e.onClick),u=(0,x.Z)(e,ge),d=(n=(0,me.Z)().siteConfig.baseUrl,(0,l.TH)().pathname.replace(n,"/")),p=be(o,d),f=(0,pe.u)({initialState:function(){return!p}}),m=f.collapsed,h=f.toggleCollapsed,g=f.setCollapsed;return(0,r.useEffect)((function(){p&&g(!p)}),[d,p,g]),r.createElement("li",{className:(0,a.Z)("menu__list-item",{"menu__list-item--collapsed":m})},r.createElement(oe,(0,s.Z)({role:"button",className:(0,a.Z)("menu__link menu__link--sublist menu__link--sublist-caret",i)},u,{onClick:function(e){e.preventDefault(),h()}}),null!=(t=u.children)?t:u.label),r.createElement(pe.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:m},o.map((function(e,t){return r.createElement(Va,(0,s.Z)({mobile:!0,isDropdownItem:!0,onClick:c,activeClassName:"menu__link--active"},e,{key:t}))}))))}function ke(e){var t=e.mobile,n=void 0!==t&&t,a=(0,x.Z)(e,ve),o=n?we:ye;return r.createElement(o,a)}var xe=n(626),Ee=["width","height"];function Se(e){var t=e.width,n=void 0===t?20:t,a=e.height,o=void 0===a?20:a,i=(0,x.Z)(e,Ee);return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:n,height:o,"aria-hidden":!0},i),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}var _e="iconLanguage_nlXk",Oe=["mobile","dropdownItemsBefore","dropdownItemsAfter"];var Ce=n(1002);function Pe(){Pe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(P){l=function(e,t,n){return e[t]=n}}function c(e,t,n,a){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),s=new _(a||[]);return r(i,"_invoke",{value:k(e,n,s)}),i}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(P){return{type:"throw",arg:P}}}e.wrap=c;var d={};function p(){}function f(){}function m(){}var h={};l(h,o,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(O([])));v&&v!==t&&n.call(v,o)&&(h=v);var b=m.prototype=p.prototype=Object.create(h);function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,s){var l=u(e[r],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==(0,Ce.Z)(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){a("next",e,i,s)}),(function(e){a("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return a("throw",e,i,s)}))}s(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function k(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return C()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=u(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,d;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Te(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(c){return void n(c)}s.done?t(l):Promise.resolve(l).then(r,a)}function Ie(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Te(o,r,a,i,s,"next",e)}function s(e){Te(o,r,a,i,s,"throw",e)}i(void 0)}))}}var Ae=n(3935);function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t,n){var r,a=t.initialState;return{getState:function(){return a},dispatch:function(r,o){var i=function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0},reshape:function(e){return e.sources}},e),{},{id:null!==(n=e.id)&&void 0!==n?n:Ue(),plugins:a,initialState:We({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(n){return Promise.all([].concat(Ze(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var n=[];return Promise.resolve(e(t)).then((function(e){return Array.isArray(e),Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,n.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:qe,onResolve:qe};Object.keys(t).forEach((function(e){t[e].__default=!0}));var r=He(He({},t),e);return Promise.resolve(r)})))}))}(e,n)}))).then((function(e){return je(e)})).then((function(e){return e.map((function(e){return We(We({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:We({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,"_blank","noopener")}},e.navigator)})}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Je(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Et,St,_t,Ot=null,Ct=(Et=-1,St=-1,_t=void 0,function(e){var t=++Et;return Promise.resolve(e).then((function(e){return _t&&t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Rt=/((gt|sm)-|galaxy nexus)|samsung[- ]/i;var jt=["props","refresh","store"],Dt=["inputElement","formElement","panelElement"],Ft=["inputElement"],Mt=["inputElement","maxLength"],Bt=["sourceIndex"],zt=["sourceIndex"],Ut=["item","source","sourceIndex"];function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $t(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Zt(e){var t=e.props,n=e.refresh,r=e.store,a=Qt(e,jt),o=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var n=e.inputElement,a=e.formElement,o=e.panelElement;function i(e){!r.getState().isOpen&&r.pendingRequests.isEmpty()||e.target===n||!1===[a,o].some((function(t){return n=t,r=e.target,n===r||n.contains(r);var n,r}))&&(r.dispatch("blur",null),t.debug||r.pendingRequests.cancelAll())}return $t({onTouchStart:i,onMouseDown:i,onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},Qt(e,Dt))},getRootProps:function(e){return $t({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-owns":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return $t({action:"",noValidate:!0,role:"search",onSubmit:function(o){var i;o.preventDefault(),t.onSubmit($t({event:o,refresh:n,state:r.getState()},a)),r.dispatch("submit",null),null===(i=e.inputElement)||void 0===i||i.blur()},onReset:function(o){var i;o.preventDefault(),t.onReset($t({event:o,refresh:n,state:r.getState()},a)),r.dispatch("reset",null),null===(i=e.inputElement)||void 0===i||i.focus()}},Qt(e,Ft))},getLabelProps:function(e){var n=e||{},r=n.sourceIndex,a=Qt(n,Bt);return $t({htmlFor:"".concat(o(t.id,r),"-input"),id:"".concat(o(t.id,r),"-label")},a)},getInputProps:function(e){var o;function i(e){(t.openOnFocus||Boolean(r.getState().query))&&Pt($t({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},a)),r.dispatch("focus",null)}var s=e||{},l=(s.inputElement,s.maxLength),c=void 0===l?512:l,u=Qt(s,Mt),d=vt(r.getState()),p=function(e){return Boolean(e&&e.match(Rt))}((null===(o=t.environment.navigator)||void 0===o?void 0:o.userAgent)||""),f=null!=d&&d.itemUrl&&!p?"go":"search";return $t({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?"".concat(t.id,"-item-").concat(r.getState().activeItemId):void 0,"aria-controls":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:r.getState().completion||r.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:f,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:c,type:"search",onChange:function(e){Pt($t({event:e,props:t,query:e.currentTarget.value.slice(0,c),refresh:n,store:r},a))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,a=e.store,o=Nt(e,Tt);if("ArrowUp"===t.key||"ArrowDown"===t.key){var i=function(){var e=n.environment.document.getElementById("".concat(n.id,"-item-").concat(a.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},s=function(){var e=vt(a.getState());if(null!==a.getState().activeItemId&&e){var n=e.item,i=e.itemInputValue,s=e.itemUrl,l=e.source;l.onActive(At({event:t,item:n,itemInputValue:i,itemUrl:s,refresh:r,source:l,state:a.getState()},o))}};t.preventDefault(),!1===a.getState().isOpen&&(n.openOnFocus||Boolean(a.getState().query))?Pt(At({event:t,props:n,query:a.getState().query,refresh:r,store:a},o)).then((function(){a.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),s(),setTimeout(i,0)})):(a.dispatch(t.key,{}),s(),i())}else if("Escape"===t.key)t.preventDefault(),a.dispatch(t.key,null),a.pendingRequests.cancelAll();else if("Tab"===t.key)a.dispatch("blur",null),a.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===a.getState().activeItemId||a.getState().collections.every((function(e){return 0===e.items.length})))return void(n.debug||a.pendingRequests.cancelAll());t.preventDefault();var l=vt(a.getState()),c=l.item,u=l.itemInputValue,d=l.itemUrl,p=l.source;if(t.metaKey||t.ctrlKey)void 0!==d&&(p.onSelect(At({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:a.getState()},o)),n.navigator.navigateNewTab({itemUrl:d,item:c,state:a.getState()}));else if(t.shiftKey)void 0!==d&&(p.onSelect(At({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:a.getState()},o)),n.navigator.navigateNewWindow({itemUrl:d,item:c,state:a.getState()}));else if(t.altKey);else{if(void 0!==d)return p.onSelect(At({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:a.getState()},o)),void n.navigator.navigate({itemUrl:d,item:c,state:a.getState()});Pt(At({event:t,nextState:{isOpen:!1},props:n,query:u,refresh:r,store:a},o)).then((function(){p.onSelect(At({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:a.getState()},o))}))}}}($t({event:e,props:t,refresh:n,store:r},a))},onFocus:i,onBlur:qe,onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||i(n)}},u)},getPanelProps:function(e){return $t({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){var n=e||{},r=n.sourceIndex,a=Qt(n,zt);return $t({role:"listbox","aria-labelledby":"".concat(o(t.id,r),"-label"),id:"".concat(o(t.id,r),"-list")},a)},getItemProps:function(e){var i=e.item,s=e.source,l=e.sourceIndex,c=Qt(e,Ut);return $t({id:"".concat(o(t.id,l),"-item-").concat(i.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===i.__autocomplete_id,onMouseMove:function(e){if(i.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",i.__autocomplete_id);var t=vt(r.getState());if(null!==r.getState().activeItemId&&t){var o=t.item,s=t.itemInputValue,l=t.itemUrl,c=t.source;c.onActive($t({event:e,item:o,itemInputValue:s,itemUrl:l,refresh:n,source:c,state:r.getState()},a))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=s.getItemInputValue({item:i,state:r.getState()}),l=s.getItemUrl({item:i,state:r.getState()});(l?Promise.resolve():Pt($t({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:n,store:r},a))).then((function(){s.onSelect($t({event:e,item:i,itemInputValue:o,itemUrl:l,refresh:n,source:s,state:r.getState()},a))}))}},c)}}}var Gt="1.8.3",Vt=[{segment:"autocomplete-core",version:Gt}];function Wt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Kt(e){for(var t=1;t=n?null===r?null:0:a}function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nn(e){for(var t=1;t=5&&((a||!e&&5===r)&&(i.push(r,0,a,n),r=6),e&&(i.push(r,e,0,n),r=6)),a=""},l=0;l"===t?(r=1,a=""):a=t+a[0]:o?t===o?o="":a+=t:'"'===t||"'"===t?o=t:">"===t?(s(),r=1):r&&("="===t?(r=5,n=a,a=""):"/"===t&&(r<5||">"===e[l][c+1])?(s(),3===r&&(i=i[0]),r=i,(i=i[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(s(),r=2):a+=t),3===r&&"!--"===a&&(r=4,i=i[0])}return s(),i}(e)),t),arguments,[])).length>1?t:t[0]}var hn=function(e){var t=e.environment,n=t.document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("class","aa-SubmitIcon"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("width","20"),n.setAttribute("height","20"),n.setAttribute("fill","currentColor");var r=t.document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M16.041 15.856c-0.034 0.026-0.067 0.055-0.099 0.087s-0.060 0.064-0.087 0.099c-1.258 1.213-2.969 1.958-4.855 1.958-1.933 0-3.682-0.782-4.95-2.050s-2.050-3.017-2.050-4.95 0.782-3.682 2.050-4.95 3.017-2.050 4.95-2.050 3.682 0.782 4.95 2.050 2.050 3.017 2.050 4.95c0 1.886-0.745 3.597-1.959 4.856zM21.707 20.293l-3.675-3.675c1.231-1.54 1.968-3.493 1.968-5.618 0-2.485-1.008-4.736-2.636-6.364s-3.879-2.636-6.364-2.636-4.736 1.008-6.364 2.636-2.636 3.879-2.636 6.364 1.008 4.736 2.636 6.364 3.879 2.636 6.364 2.636c2.125 0 4.078-0.737 5.618-1.968l3.675 3.675c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"),n.appendChild(r),n},gn=function(e){var t=e.environment,n=t.document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("class","aa-ClearIcon"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("width","18"),n.setAttribute("height","18"),n.setAttribute("fill","currentColor");var r=t.document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M5.293 6.707l5.293 5.293-5.293 5.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l5.293-5.293 5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-5.293-5.293 5.293-5.293c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"),n.appendChild(r),n},vn=function(e){var t=e.environment.document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("class","aa-LoadingIcon"),t.setAttribute("viewBox","0 0 100 100"),t.setAttribute("width","20"),t.setAttribute("height","20"),t.innerHTML='\n \n',t},bn=["ontouchstart","ontouchend","ontouchmove","ontouchcancel"];function yn(e,t,n){e[t]=null===n?"":"number"!=typeof n?n:n+"px"}function wn(e){this._listeners[e.type](e)}function kn(e,t,n){var r,a,o=e[t];if("style"===t)if("string"==typeof n)e.style=n;else if(null===n)e.style="";else for(t in n)o&&n[t]===o[t]||yn(e.style,t,n[t]);else"o"===t[0]&&"n"===t[1]?(r=t!==(t=t.replace(/Capture$/,"")),((a=t.toLowerCase())in e||bn.includes(a))&&(t=a),t=t.slice(2),e._listeners||(e._listeners={}),e._listeners[t]=n,n?o||e.addEventListener(t,wn,r):e.removeEventListener(t,wn,r)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function xn(e){return"onChange"===e?"onInput":e}function En(e,t){for(var n in t)kn(e,xn(n),t[n])}function Sn(e,t){for(var n in t)"o"===n[0]&&"n"===n[1]||kn(e,xn(n),t[n])}var _n=["children"];function On(e){return function(e){if(Array.isArray(e))return Cn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Tn(e){return function(t,n){var r=n.children,a=void 0===r?[]:r,o=Pn(n,_n),i=e.document.createElement(t);return En(i,o),i.append.apply(i,On(a)),i}}var In=["autocompleteScopeApi","environment","classNames","getInputProps","getInputPropsCore","isDetached","state"];function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ln(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var jn=function(e){var t=e.autocompleteScopeApi,n=e.environment,r=(e.classNames,e.getInputProps),a=e.getInputPropsCore,o=e.isDetached,i=e.state,s=Rn(e,In),l=Tn(n)("input",s),c=r(Ln({state:i,props:a({inputElement:l}),inputElement:l},t));return En(l,Ln(Ln({},c),{},{onKeyDown:function(e){o&&"Tab"===e.key||c.onKeyDown(e)}})),l};function Dn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fn(e){for(var t=1;t2&&(i.children=arguments.length>3?Bn.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===i[o]&&(i[o]=e.defaultProps[o]);return Yn(e,i,r,a,null)}function Yn(e,t,n,r,a){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++Un:a};return null==a&&null!=zn.vnode&&zn.vnode(o),o}function Xn(e){return e.children}function Jn(e,t){this.props=e,this.context=t}function er(e,t){if(null==t)return e.__?er(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t0?Yn(f.type,f.props,f.key,null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(p=v[u])||p&&f.key==p.key&&f.type===p.type)v[u]=void 0;else for(d=0;d0&&void 0!==arguments[0]?arguments[0]:[];return{get:function(){return e},add:function(t){var n=e[e.length-1];(null==n?void 0:n.isHighlighted)===t.isHighlighted?e[e.length-1]={value:n.value+t.value,isHighlighted:n.isHighlighted}:e.push(t)}}}(n?[{value:n,isHighlighted:!1}]:[]);return t.forEach((function(e){var t=e.split(wr);r.add({value:t[0],isHighlighted:!0}),""!==t[1]&&r.add({value:t[1],isHighlighted:!1})})),r.get()}function xr(e){return function(e){if(Array.isArray(e))return Er(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Er(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n",""":'"',"'":"'"},Cr=new RegExp(/\w/i),Pr=/&(amp|quot|lt|gt|#39);/g,Tr=RegExp(Pr.source);function Ir(e,t){var n,r,a,o=e[t],i=(null===(n=e[t+1])||void 0===n?void 0:n.isHighlighted)||!0,s=(null===(r=e[t-1])||void 0===r?void 0:r.isHighlighted)||!0;return Cr.test((a=o.value)&&Tr.test(a)?a.replace(Pr,(function(e){return Or[e]})):a)||s!==i?o.isHighlighted:s}function Ar(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Lr(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Vr={clearButton:"aa-ClearButton",detachedCancelButton:"aa-DetachedCancelButton",detachedContainer:"aa-DetachedContainer",detachedFormContainer:"aa-DetachedFormContainer",detachedOverlay:"aa-DetachedOverlay",detachedSearchButton:"aa-DetachedSearchButton",detachedSearchButtonIcon:"aa-DetachedSearchButtonIcon",detachedSearchButtonPlaceholder:"aa-DetachedSearchButtonPlaceholder",detachedSearchButtonQuery:"aa-DetachedSearchButtonQuery",form:"aa-Form",input:"aa-Input",inputWrapper:"aa-InputWrapper",inputWrapperPrefix:"aa-InputWrapperPrefix",inputWrapperSuffix:"aa-InputWrapperSuffix",item:"aa-Item",label:"aa-Label",list:"aa-List",loadingIndicator:"aa-LoadingIndicator",panel:"aa-Panel",panelLayout:"aa-PanelLayout aa-Panel--scrollable",root:"aa-Autocomplete",source:"aa-Source",sourceFooter:"aa-SourceFooter",sourceHeader:"aa-SourceHeader",sourceNoResults:"aa-SourceNoResults",submitButton:"aa-SubmitButton"},Wr=function(e,t){var n=e.children;(0,e.render)(n,t)},Kr={createElement:Kn,Fragment:Xn,render:vr};function Yr(e){var t=e.panelPlacement,n=e.container,r=e.form,a=e.environment,o=n.getBoundingClientRect(),i=(a.pageYOffset||a.document.documentElement.scrollTop||a.document.body.scrollTop||0)+o.top+o.height;switch(t){case"start":return{top:i,left:o.left};case"end":return{top:i,right:a.document.documentElement.clientWidth-(o.left+o.width)};case"full-width":return{top:i,left:0,right:0,width:"unset",maxWidth:"unset"};case"input-wrapper-width":var s=r.getBoundingClientRect();return{top:i,left:s.left,right:a.document.documentElement.clientWidth-(s.left+s.width),width:"unset",maxWidth:"unset"};default:throw new Error("[Autocomplete] The `panelPlacement` value ".concat(JSON.stringify(t)," is not valid."))}}function Xr(){return Xr=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ha(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ga(e){for(var t=1;t0;if(!p.value.core.openOnFocus&&!t.query)return n;var r=Boolean(c.current||p.value.renderer.renderNoResults);return!n&&r||n},__autocomplete_metadata:{userAgents:na,options:e}}))})),h=un(ga({collections:[],completion:null,context:{},isOpen:!1,query:"",activeItemId:null,status:"idle"},p.value.core.initialState)),g={getEnvironmentProps:p.value.renderer.getEnvironmentProps,getFormProps:p.value.renderer.getFormProps,getInputProps:p.value.renderer.getInputProps,getItemProps:p.value.renderer.getItemProps,getLabelProps:p.value.renderer.getLabelProps,getListProps:p.value.renderer.getListProps,getPanelProps:p.value.renderer.getPanelProps,getRootProps:p.value.renderer.getRootProps},v={setActiveItemId:m.value.setActiveItemId,setQuery:m.value.setQuery,setCollections:m.value.setCollections,setIsOpen:m.value.setIsOpen,setStatus:m.value.setStatus,setContext:m.value.setContext,refresh:m.value.refresh,navigator:m.value.navigator},b=s((function(){return mn.bind(p.value.renderer.renderer.createElement)})),y=s((function(){return function(e){var t=e.autocomplete,n=e.autocompleteScopeApi,r=e.classNames,a=e.environment,o=e.isDetached,i=e.placeholder,s=void 0===i?"Search":i,l=e.propGetters,c=e.setIsModalOpen,u=e.state,d=e.translations,p=Tn(a),f=l.getRootProps(Fn({state:u,props:t.getRootProps({})},n)),m=p("div",Fn({class:r.root},f)),h=p("div",{class:r.detachedContainer,onMouseDown:function(e){e.stopPropagation()}}),g=p("div",{class:r.detachedOverlay,children:[h],onMouseDown:function(){c(!1),t.setIsOpen(!1)}}),v=l.getLabelProps(Fn({state:u,props:t.getLabelProps({})},n)),b=p("button",{class:r.submitButton,type:"submit",title:d.submitButtonTitle,children:[hn({environment:a})]}),y=p("label",Fn({class:r.label,children:[b]},v)),w=p("button",{class:r.clearButton,type:"reset",title:d.clearButtonTitle,children:[gn({environment:a})]}),k=p("div",{class:r.loadingIndicator,children:[vn({environment:a})]}),x=jn({class:r.input,environment:a,state:u,getInputProps:l.getInputProps,getInputPropsCore:t.getInputProps,autocompleteScopeApi:n,isDetached:o}),E=p("div",{class:r.inputWrapperPrefix,children:[y,k]}),S=p("div",{class:r.inputWrapperSuffix,children:[w]}),_=p("div",{class:r.inputWrapper,children:[x]}),O=l.getFormProps(Fn({state:u,props:t.getFormProps({inputElement:x})},n)),C=p("form",Fn({class:r.form,children:[E,_,S]},O)),P=l.getPanelProps(Fn({state:u,props:t.getPanelProps({})},n)),T=p("div",Fn({class:r.panel},P)),I=p("div",{class:r.detachedSearchButtonQuery,textContent:u.query}),A=p("div",{class:r.detachedSearchButtonPlaceholder,hidden:Boolean(u.query),textContent:s});if(o){var L=p("div",{class:r.detachedSearchButtonIcon,children:[hn({environment:a})]}),N=p("button",{type:"button",class:r.detachedSearchButton,onClick:function(){c(!0)},children:[L,A,I]}),R=p("button",{type:"button",class:r.detachedCancelButton,textContent:d.detachedCancelButtonText,onTouchStart:function(e){e.stopPropagation()},onClick:function(){t.setIsOpen(!1),c(!1)}}),j=p("div",{class:r.detachedFormContainer,children:[C,R]});h.appendChild(j),m.appendChild(N)}else m.appendChild(C);return{detachedContainer:h,detachedOverlay:g,detachedSearchButtonQuery:I,detachedSearchButtonPlaceholder:A,inputWrapper:_,input:x,root:m,form:C,label:y,submitButton:b,clearButton:w,loadingIndicator:k,panel:T}}({autocomplete:m.value,autocompleteScopeApi:v,classNames:p.value.renderer.classNames,environment:p.value.core.environment,isDetached:f.value,placeholder:p.value.core.placeholder,propGetters:g,setIsModalOpen:E,state:h.current,translations:p.value.renderer.translations})}));function w(){En(y.value.panel,{style:f.value?{}:Yr({panelPlacement:p.value.renderer.panelPlacement,container:y.value.root,form:y.value.form,environment:p.value.core.environment})})}function k(e){h.current=e;var t={autocomplete:m.value,autocompleteScopeApi:v,classNames:p.value.renderer.classNames,components:p.value.renderer.components,container:p.value.renderer.container,html:b.value,dom:y.value,panelContainer:f.value?y.value.detachedContainer:p.value.renderer.panelContainer,propGetters:g,state:h.current,renderer:p.value.renderer.renderer},n=!Be(e)&&!c.current&&p.value.renderer.renderNoResults||p.value.renderer.render;!function(e){var t=e.autocomplete,n=e.autocompleteScopeApi,r=e.dom,a=e.propGetters,o=e.state;Sn(r.root,a.getRootProps(ea({state:o,props:t.getRootProps({})},n))),Sn(r.input,a.getInputProps(ea({state:o,props:t.getInputProps({inputElement:r.input}),inputElement:r.input},n))),En(r.label,{hidden:"stalled"===o.status}),En(r.loadingIndicator,{hidden:"stalled"!==o.status}),En(r.clearButton,{hidden:!o.query}),En(r.detachedSearchButtonQuery,{textContent:o.query}),En(r.detachedSearchButtonPlaceholder,{hidden:Boolean(o.query)})}(t),function(e,t){var n=t.autocomplete,r=t.autocompleteScopeApi,a=t.classNames,o=t.html,i=t.dom,s=t.panelContainer,l=t.propGetters,c=t.state,u=t.components,d=t.renderer;if(c.isOpen){s.contains(i.panel)||"loading"===c.status||s.appendChild(i.panel),i.panel.classList.toggle("aa-Panel--stalled","stalled"===c.status);var p=c.collections.filter((function(e){var t=e.source,n=e.items;return t.templates.noResults||n.length>0})).map((function(e,t){var i=e.source,s=e.items;return d.createElement("section",{key:t,className:a.source,"data-autocomplete-source-id":i.sourceId},i.templates.header&&d.createElement("div",{className:a.sourceHeader},i.templates.header({components:u,createElement:d.createElement,Fragment:d.Fragment,items:s,source:i,state:c,html:o})),i.templates.noResults&&0===s.length?d.createElement("div",{className:a.sourceNoResults},i.templates.noResults({components:u,createElement:d.createElement,Fragment:d.Fragment,source:i,state:c,html:o})):d.createElement("ul",Xr({className:a.list},l.getListProps(ea({state:c,props:n.getListProps({sourceIndex:t})},r))),s.map((function(e){var s=n.getItemProps({item:e,source:i,sourceIndex:t});return d.createElement("li",Xr({key:s.id,className:a.item},l.getItemProps(ea({state:c,props:s},r))),i.templates.item({components:u,createElement:d.createElement,Fragment:d.Fragment,item:e,state:c,html:o}))}))),i.templates.footer&&d.createElement("div",{className:a.sourceFooter},i.templates.footer({components:u,createElement:d.createElement,Fragment:d.Fragment,items:s,source:i,state:c,html:o})))})),f=d.createElement(d.Fragment,null,d.createElement("div",{className:a.panelLayout},p),d.createElement("div",{className:"aa-GradientBottom"})),m=p.reduce((function(e,t){return e[t.props["data-autocomplete-source-id"]]=t,e}),{});e(ea(ea({children:f,state:c,sections:p,elements:m},d),{},{components:u,html:o},r),i.panel)}else s.contains(i.panel)&&s.removeChild(i.panel)}(n,t)}function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a();var t,n,r=p.value.renderer,i=r.components,s=ma(r,fa);u.current=sa(s,p.value.core,{components:(t=i,n=function(e){return!e.value.hasOwnProperty("__autocomplete_componentName")},Object.entries(t).reduce((function(e,t){var r=da(t,2),a=r[0],o=r[1];return n({key:a,value:o})?ca(ca({},e),{},ua({},a,o)):e}),{})),initialState:h.current},e),l(),o(),m.value.refresh().then((function(){k(h.current)}))}function E(e){requestAnimationFrame((function(){var t=p.value.core.environment.document.body.contains(y.value.detachedOverlay);e!==t&&(e?(p.value.core.environment.document.body.appendChild(y.value.detachedOverlay),p.value.core.environment.document.body.classList.add("aa-Detached"),y.value.input.focus()):(p.value.core.environment.document.body.removeChild(y.value.detachedOverlay),p.value.core.environment.document.body.classList.remove("aa-Detached")))}))}return r((function(){var e=m.value.getEnvironmentProps({formElement:y.value.form,panelElement:y.value.panel,inputElement:y.value.input});return En(p.value.core.environment,e),function(){En(p.value.core.environment,Object.keys(e).reduce((function(e,t){return ga(ga({},e),{},va({},t,void 0))}),{}))}})),r((function(){var e=f.value?p.value.core.environment.document.body:p.value.renderer.panelContainer,t=f.value?y.value.detachedOverlay:y.value.panel;return f.value&&h.current.isOpen&&E(!0),k(h.current),function(){e.contains(t)&&e.removeChild(t)}})),r((function(){var e=p.value.renderer.container;return e.appendChild(y.value.root),function(){e.removeChild(y.value.root)}})),r((function(){var e=dn((function(e){k(e.state)}),0);return d.current=function(t){var n=t.state,r=t.prevState;(f.value&&r.isOpen!==n.isOpen&&E(n.isOpen),f.value||!n.isOpen||r.isOpen||w(),n.query!==r.query)&&p.value.core.environment.document.querySelectorAll(".aa-Panel--scrollable").forEach((function(e){0!==e.scrollTop&&(e.scrollTop=0)}));e({state:n})},function(){d.current=void 0}})),r((function(){var e=dn((function(){var e=f.value;f.value=p.value.core.environment.matchMedia(p.value.renderer.detachedMediaQuery).matches,e!==f.value?x({}):requestAnimationFrame(w)}),20);return p.value.core.environment.addEventListener("resize",e),function(){p.value.core.environment.removeEventListener("resize",e)}})),r((function(){if(!f.value)return function(){};function e(e){y.value.detachedContainer.classList.toggle("aa-DetachedContainer--modal",e)}function t(t){e(t.matches)}var n=p.value.core.environment.matchMedia(getComputedStyle(p.value.core.environment.document.documentElement).getPropertyValue("--aa-detached-modal-media-query"));e(n.matches);var r=Boolean(n.addEventListener);return r?n.addEventListener("change",t):n.addListener(t),function(){r?n.removeEventListener("change",t):n.removeListener(t)}})),r((function(){return requestAnimationFrame(w),function(){}})),ga(ga({},v),{},{update:x,destroy:function(){a()}})}var ya=n(1514),wa=n(5351),ka=function(e){return wa.tokenizer(e).map((function(e){return e.str}))},xa=wa,Ea=n(813),Sa=n.n(Ea),_a=["cmfcmfhighlight"];function Oa(){var e,t=(0,l.TH)(),n=(0,l.k6)(),a=(0,me.Z)().siteConfig.baseUrl,o=(0,r.useState)({terms:[],isDocsOrBlog:!1}),i=o[0],s=o[1];return(0,r.useEffect)((function(){var e;if(null!=(e=t.state)&&e.cmfcmfhighlight&&0!==t.state.cmfcmfhighlight.terms.length){s(t.state.cmfcmfhighlight);var r=t.state,a=(r.cmfcmfhighlight,(0,x.Z)(r,_a));n.replace(Object.assign({},t,{state:a}))}}),[null==(e=t.state)?void 0:e.cmfcmfhighlight,n,t]),(0,r.useEffect)((function(){if(0!==i.terms.length){var e=i.isDocsOrBlog?document.getElementsByTagName("article")[0]:document.getElementsByTagName("main")[0];if(e){var t=new(Sa())(e),n={ignoreJoiners:!0};return t.mark(i.terms,n),function(){return t.unmark(n)}}}}),[i,a]),null}var Ca=n(1610),Pa=n(246),Ta=!0;function Ia(e){var t=e.document.sectionRoute.split("#"),n=t[0],r=t[1],a=n;return r&&(a+="#"+r),a}var Aa={documents:[],index:xa((function(){this.ref("id"),this.field("title"),this.field("content")}))};function La(e,t){return Na.apply(this,arguments)}function Na(){return(Na=Ie(Pe().mark((function e(t,n){var r,a;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ta){e.next=18;break}return e.prev=1,e.next=4,fetch(t+"search-index-"+n+".json");case 4:if((a=e.sent).ok){e.next=7;break}return e.abrupt("return",Aa);case 7:return e.next=9,a.json();case 9:r=e.sent,e.next=15;break;case 12:return e.prev=12,e.t0=e.catch(1),e.abrupt("return",Aa);case 15:return e.abrupt("return",{documents:r.documents,index:xa.Index.load(r.index)});case 18:return e.abrupt("return",Promise.resolve(Aa));case 19:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}var Ra=function(){var e=(0,U.Z)(),t=(0,r.useState)((function(){return!!e&&"dark"===document.documentElement.getAttribute("data-theme")})),n=t[0],a=t[1];(0,r.useEffect)((function(){var e=new MutationObserver((function(){a("dark"===document.documentElement.getAttribute("data-theme"))}));return e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),function(){return e.disconnect()}}),[]);var o=(0,me.Z)().siteConfig.baseUrl,i=(0,Ca.eZ)("@cmfcmf/docusaurus-search-local"),s=i.titleBoost,u=i.contentBoost,d=i.tagsBoost,p=i.parentCategoriesBoost,f=i.indexDocSidebarParentCategories,m=i.maxSearchResults,h=(0,l.k6)(),g=(0,Pa._q)().tags,v=(0,r.useRef)(g);(0,r.useEffect)((function(){v.current=g}),[g]);var b=(0,r.useRef)({}),y=function(){var e=Ie(Pe().mark((function e(t){var n,r,a;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=b.current[t],e.t0=null==n?void 0:n.state,e.next="ready"===e.t0?4:void 0===e.t0?5:"loading"===e.t0?12:13;break;case 4:return e.abrupt("return",n);case 5:return r=[],b.current[t]={state:"loading",callbacks:r},e.next=9,La(o,t);case 9:return a=e.sent,r.forEach((function(e){return e(a)})),e.abrupt("return",b.current[t]=Object.assign({state:"ready"},a));case 12:return e.abrupt("return",new Promise((function(e){n.callbacks.push(e)})));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),w=(0,c.I)({message:"cmfcmf/d-s-l.searchBar.placeholder",description:"Placeholder shown in the searchbar"}),k=(0,r.useRef)(null),x=(0,r.useRef)(null);return(0,r.useEffect)((function(){if(k.current)return x.current=ba({container:k.current,placeholder:w,renderer:{createElement:r.createElement,Fragment:r.Fragment,render:Ae.render},navigator:{navigate:function(e){var t=e.item,n=e.itemUrl;h.push(n,{cmfcmfhighlight:{terms:t.terms,isDocsOrBlog:"docs"===t.document.type||"blog"===t.document.type}})}},detachedMediaQuery:"",defaultActiveItemId:0,translations:{clearButtonTitle:(0,c.I)({message:"cmfcmf/d-s-l.searchBar.clearButtonTitle",description:"Title of the button to clear the current search input"}),detachedCancelButtonText:(0,c.I)({message:"cmfcmf/d-s-l.searchBar.detachedCancelButtonText",description:"Text of the button to close the detached search window"}),submitButtonTitle:(0,c.I)({message:"cmfcmf/d-s-l.searchBar.submitButtonTitle",description:"Title of the button to submit a new search"})},getSources:function(e){var t=e.query;return[{sourceId:"search-results",templates:{item:function(e){var t=e.item,n=Ia(t);return r.createElement("a",{href:n,className:"aa-ItemLink",onClick:function(e){e.preventDefault(),h.push(n,{cmfcmfhighlight:{terms:t.terms,isDocsOrBlog:"docs"===t.document.type||"blog"===t.document.type}})}},r.createElement("div",{className:"aa-ItemContent"},r.createElement("div",{className:"aa-ItemContentBody"},r.createElement("div",{className:"aa-ItemContentTitle"},t.document.sectionTitle),t.document.pageTitle!==t.document.sectionTitle&&r.createElement("div",{className:"aa-ItemContentDescription"},t.document.pageTitle))),r.createElement("div",{className:"aa-ItemActions"},r.createElement("button",{className:"aa-ItemActionButton aa-DesktopOnly aa-ActiveOnly",type:"button",title:"Select"},r.createElement("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},r.createElement("path",{d:"M18.984 6.984h2.016v6h-15.188l3.609 3.609-1.406 1.406-6-6 6-6 1.406 1.406-3.609 3.609h13.172v-4.031z"})))))},noResults:function(){return r.createElement("div",{className:"aa-ItemContent"},r.createElement("div",{className:"aa-ItemContentBody"},Ta?(0,c.I)({message:"cmfcmf/d-s-l.searchBar.noResults",description:"message shown if no results are found"}):"The search index is only available when you run docusaurus build!"))}},getItemUrl:function(e){return Ia(e.item)},getItems:function(){return Ie(Pe().mark((function e(){var n,r,a;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.current,e.next=3,Promise.all(n.map((function(e){return y(e)})));case 3:return r=e.sent,a=ka(t),e.abrupt("return",r.flatMap((function(e){var t=e.index,n=e.documents;return t.query((function(e){e.term(a,{fields:["title"],boost:s}),e.term(a,{fields:["title"],boost:s,wildcard:xa.Query.wildcard.TRAILING}),e.term(a,{fields:["content"],boost:u}),e.term(a,{fields:["content"],boost:u,wildcard:xa.Query.wildcard.TRAILING}),e.term(a,{fields:["tags"],boost:d}),e.term(a,{fields:["tags"],boost:d,wildcard:xa.Query.wildcard.TRAILING}),f&&(e.term(a,{fields:["sidebarParentCategories"],boost:p}),e.term(a,{fields:["sidebarParentCategories"],boost:p,wildcard:xa.Query.wildcard.TRAILING}))})).slice(0,m).map((function(e){return{document:n.find((function(t){return t.id.toString()===e.ref})),score:e.score,terms:a}}))})).sort((function(e,t){return t.score-e.score})).slice(0,m));case 6:case"end":return e.stop()}}),e)})))()}}]}}),function(){var e;return null==(e=x.current)?void 0:e.destroy()}}),[m]),r.createElement(r.Fragment,null,r.createElement(ya.Z,null,r.createElement("body",{"data-theme":n?"dark":"light"})),r.createElement(Oa,null),r.createElement("div",{className:"dsla-search-wrapper"},r.createElement("div",{className:"dsla-search-field",ref:k,"data-tags":g.join(",")})))},ja={searchBox:"searchBox_ZlJk"};function Da(e){var t=e.children,n=e.className;return r.createElement("div",{className:(0,a.Z)(n,ja.searchBox)},t)}var Fa=n(868),Ma=n(5019),Ba=["docId","label","docsPluginId"];var za=["sidebarId","label","docsPluginId"];var Ua=["label","to","docsPluginId"];var qa=n(6409),$a=["mobile","docsPluginId","dropdownActiveClassDisabled","dropdownItemsBefore","dropdownItemsAfter"],Ha=function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))};var Qa={default:de,localeDropdown:function(e){var t=e.mobile,n=e.dropdownItemsBefore,a=e.dropdownItemsAfter,o=(0,x.Z)(e,Oe),i=(0,me.Z)().i18n,u=i.currentLocale,d=i.locales,p=i.localeConfigs,f=(0,xe.l)(),m=(0,l.TH)(),h=m.search,g=m.hash,v=d.map((function(e){var n=""+("pathname://"+f.createUrl({locale:e,fullyQualified:!1}))+h+g;return{label:p[e].label,lang:p[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===u?t?"menu__link--active":"dropdown__link--active":""}})),b=[].concat(n,v,a),y=t?(0,c.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):p[u].label;return r.createElement(ke,(0,s.Z)({},o,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(Se,{className:_e}),y),items:b}))},search:function(e){var t=e.mobile,n=e.className;return t?null:r.createElement(Da,{className:n},r.createElement(Ra,null))},dropdown:ke,html:function(e){var t=e.value,n=e.className,o=e.mobile,i=void 0!==o&&o,s=e.isDropdownItem,l=void 0!==s&&s,c=l?"li":"div";return r.createElement(c,{className:(0,a.Z)({navbar__item:!i&&!l,"menu__list-item":i},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){var t=e.docId,n=e.label,a=e.docsPluginId,o=(0,x.Z)(e,Ba),i=(0,Fa.Iw)(a).activeDoc,l=(0,Ma.vY)(t,a);return null===l?null:r.createElement(de,(0,s.Z)({exact:!0},o,{isActive:function(){return(null==i?void 0:i.path)===l.path||!(null==i||!i.sidebar)&&i.sidebar===l.sidebar},label:null!=n?n:l.id,to:l.path}))},docSidebar:function(e){var t=e.sidebarId,n=e.label,a=e.docsPluginId,o=(0,x.Z)(e,za),i=(0,Fa.Iw)(a).activeDoc,l=(0,Ma.oz)(t,a).link;if(!l)throw new Error('DocSidebarNavbarItem: Sidebar with ID "'+t+"\" doesn't have anything to be linked to.");return r.createElement(de,(0,s.Z)({exact:!0},o,{isActive:function(){return(null==i?void 0:i.sidebar)===t},label:null!=n?n:l.label,to:l.path}))},docsVersion:function(e){var t=e.label,n=e.to,a=e.docsPluginId,o=(0,x.Z)(e,Ua),i=(0,Ma.lO)(a)[0],l=null!=t?t:i.label,c=null!=n?n:function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))}(i).path;return r.createElement(de,(0,s.Z)({},o,{label:l,to:c}))},docsVersionDropdown:function(e){var t=e.mobile,n=e.docsPluginId,a=e.dropdownActiveClassDisabled,o=e.dropdownItemsBefore,i=e.dropdownItemsAfter,u=(0,x.Z)(e,$a),d=(0,l.TH)(),p=d.search,f=d.hash,m=(0,Fa.Iw)(n),h=(0,Fa.gB)(n),g=(0,qa.J)(n).savePreferredVersionName,v=h.map((function(e){var t,n=null!=(t=m.alternateDocVersions[e.name])?t:Ha(e);return{label:e.label,to:""+n.path+p+f,isActive:function(){return e===m.activeVersion},onClick:function(){return g(e.name)}}})),b=[].concat(o,v,i),y=(0,Ma.lO)(n)[0],w=t&&b.length>1?(0,c.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):y.label,k=t&&b.length>1?void 0:Ha(y).path;return b.length<=1?r.createElement(de,(0,s.Z)({},u,{mobile:t,label:w,to:k,isActive:a?function(){return!1}:void 0})):r.createElement(ke,(0,s.Z)({},u,{mobile:t,label:w,to:k,items:b,isActive:a?function(){return!1}:void 0}))}},Za=Qa,Ga=["type"];function Va(e){var t=e.type,n=(0,x.Z)(e,Ga),a=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=Za[a];if(!o)throw new Error('No NavbarItem component found for type "'+t+'".');return r.createElement(o,n)}function Wa(){var e=(0,A.e)(),t=(0,w.L)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map((function(t,n){return r.createElement(Va,(0,s.Z)({mobile:!0},t,{onClick:function(){return e.toggle()},key:n}))})))}function Ka(e){return r.createElement("button",(0,s.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(c.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Ya(){var e=0===(0,w.L)().navbar.items.length,t=M();return r.createElement(r.Fragment,null,!e&&r.createElement(Ka,{onClick:function(){return t.hide()}}),t.content)}function Xa(){var e,t=(0,A.e)();return void 0===(e=t.shown)&&(e=!0),(0,r.useEffect)((function(){return document.body.style.overflow=e?"hidden":"visible",function(){document.body.style.overflow="visible"}}),[e]),t.shouldRender?r.createElement(B,{header:r.createElement(X,null),primaryMenu:r.createElement(Wa,null),secondaryMenu:r.createElement(Ya,null)}):null}var Ja={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function eo(e){return r.createElement("div",(0,s.Z)({role:"presentation"},e,{className:(0,a.Z)("navbar-sidebar__backdrop",e.className)}))}function to(e){var t=e.children,n=(0,w.L)().navbar,o=n.hideOnScroll,i=n.style,s=(0,A.e)(),l=function(e){var t=(0,r.useState)(e),n=t[0],a=t[1],o=(0,r.useRef)(!1),i=(0,r.useRef)(0),s=(0,r.useCallback)((function(e){null!==e&&(i.current=e.getBoundingClientRect().height)}),[]);return(0,L.RF)((function(t,n){var r=t.scrollY;if(e)if(r=s?a(!1):r+c0&&r.createElement(Oo,{links:n}),logo:a&&r.createElement(Io,{logo:a}),copyright:t&&r.createElement(Ao,{copyright:t})})}var Ro=r.memo(No),jo=(0,N.Qc)([z.S,k.pl,L.OC,qa.L5,i.VC,function(e){var t=e.children;return r.createElement(R.n2,null,r.createElement(A.M,null,r.createElement(D,null,t)))}]);function Do(e){var t=e.children;return r.createElement(jo,null,t)}function Fo(e){var t=e.error,n=e.tryAgain;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(c.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("div",{className:"margin-vert--lg"},r.createElement(oo,{onClick:n,className:"button button--primary shadow--lw"})),r.createElement("hr",null),r.createElement("div",{className:"margin-vert--md"},r.createElement(io,{error:t})))))}var Mo={mainWrapper:"mainWrapper_z2l0"};function Bo(e){var t=e.children,n=e.noFooter,s=e.wrapperClassName,l=e.title,c=e.description;return(0,v.t)(),r.createElement(Do,null,r.createElement(i.d,{title:l,description:c}),r.createElement(y,null),r.createElement(I,null),r.createElement(vo,null),r.createElement("div",{id:d,className:(0,a.Z)(g.k.wrapper.main,Mo.mainWrapper,s)},r.createElement(o.Z,{fallback:function(e){return r.createElement(Fo,e)}},t)),!n&&r.createElement(Ro,null))}},6811:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(7462),a=n(3366),o=n(7294),i=n(3699),s=n(9524),l=n(9962),c=n(107),u=n(7909),d=["imageClassName","titleClassName"];function p(e){var t=e.logo,n=e.alt,r=e.imageClassName,a={light:(0,s.Z)(t.src),dark:(0,s.Z)(t.srcDark||t.src)},i=o.createElement(u.Z,{className:t.className,sources:a,height:t.height,width:t.width,alt:n,style:t.style});return r?o.createElement("div",{className:r},i):i}function f(e){var t,n=(0,l.Z)().siteConfig.title,u=(0,c.L)().navbar,f=u.title,m=u.logo,h=e.imageClassName,g=e.titleClassName,v=(0,a.Z)(e,d),b=(0,s.Z)((null==m?void 0:m.href)||"/"),y=f?"":n,w=null!=(t=null==m?void 0:m.alt)?t:y;return o.createElement(i.Z,(0,r.Z)({to:b},v,(null==m?void 0:m.target)&&{target:m.target}),m&&o.createElement(p,{logo:m,alt:w,imageClassName:h}),null!=f&&o.createElement("b",{className:g},f))}},3647:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7294),a=n(1514);function o(e){var t=e.locale,n=e.version,o=e.tag,i=t;return r.createElement(a.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),o&&r.createElement("meta",{name:"docusaurus_tag",content:o}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),o&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},7909:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(7462),a=n(3366),o=n(7294),i=n(6010),s=n(1048),l=n(9200),c={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"},u=["sources","className","alt"];function d(e){var t=(0,s.Z)(),n=(0,l.I)().colorMode,d=e.sources,p=e.className,f=e.alt,m=(0,a.Z)(e,u),h=t?"dark"===n?["dark"]:["light"]:["light","dark"];return o.createElement(o.Fragment,null,h.map((function(e){return o.createElement("img",(0,r.Z)({key:e,src:d[e],alt:f,className:(0,i.Z)(c.themedImage,c["themedImage--"+e],p)},m))})))}},4639:function(e,t,n){"use strict";n.d(t,{u:function(){return d},z:function(){return y}});var r=n(7462),a=n(3366),o=n(7294),i=n(6136),s=n(8986),l=["collapsed"],c=["lazy"],u="ease-in-out";function d(e){var t=e.initialState,n=(0,o.useState)(null!=t&&t),r=n[0],a=n[1],i=(0,o.useCallback)((function(){a((function(e){return!e}))}),[]);return{collapsed:r,setCollapsed:a,toggleCollapsed:i}}var p={display:"none",overflow:"hidden",height:"0px"},f={display:"block",overflow:"visible",height:"auto"};function m(e,t){var n=t?p:f;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function h(e){var t=e.collapsibleRef,n=e.collapsed,r=e.animation,a=(0,o.useRef)(!1);(0,o.useEffect)((function(){var e,o=t.current;function i(){var e,t,n=o.scrollHeight,a=null!=(e=null==r?void 0:r.duration)?e:function(e){if((0,s.n)())return 1;var t=e/36;return Math.round(10*(4+15*Math.pow(t,.25)+t/5))}(n);return{transition:"height "+a+"ms "+(null!=(t=null==r?void 0:r.easing)?t:u),height:n+"px"}}function l(){var e=i();o.style.transition=e.transition,o.style.height=e.height}if(!a.current)return m(o,n),void(a.current=!0);return o.style.willChange="height",e=requestAnimationFrame((function(){n?(l(),requestAnimationFrame((function(){o.style.height=p.height,o.style.overflow=p.overflow}))):(o.style.display="block",requestAnimationFrame((function(){l()})))})),function(){return cancelAnimationFrame(e)}}),[t,n,r])}function g(e){if(!i.Z.canUseDOM)return e?p:f}function v(e){var t=e.as,n=void 0===t?"div":t,r=e.collapsed,a=e.children,i=e.animation,s=e.onCollapseTransitionEnd,l=e.className,c=e.disableSSRStyle,u=(0,o.useRef)(null);return h({collapsibleRef:u,collapsed:r,animation:i}),o.createElement(n,{ref:u,style:c?void 0:g(r),onTransitionEnd:function(e){"height"===e.propertyName&&(m(u.current,r),null==s||s(r))},className:l},a)}function b(e){var t=e.collapsed,n=(0,a.Z)(e,l),i=(0,o.useState)(!t),s=i[0],c=i[1],u=(0,o.useState)(t),d=u[0],p=u[1];return(0,o.useLayoutEffect)((function(){t||c(!0)}),[t]),(0,o.useLayoutEffect)((function(){s&&p(t)}),[s,t]),s?o.createElement(v,(0,r.Z)({},n,{collapsed:d})):null}function y(e){var t=e.lazy,n=(0,a.Z)(e,c),r=t?b:v;return o.createElement(r,n)}},5830:function(e,t,n){"use strict";n.d(t,{nT:function(){return m},pl:function(){return f}});var r=n(7294),a=n(1048),o=n(2560),i=n(8755),s=n(107),l=(0,o.WA)("docusaurus.announcement.dismiss"),c=(0,o.WA)("docusaurus.announcement.id"),u=function(){return"true"===l.get()},d=function(e){return l.set(String(e))},p=r.createContext(null);function f(e){var t=e.children,n=function(){var e=(0,s.L)().announcementBar,t=(0,a.Z)(),n=(0,r.useState)((function(){return!!t&&u()})),o=n[0],i=n[1];(0,r.useEffect)((function(){i(u())}),[]);var l=(0,r.useCallback)((function(){d(!0),i(!0)}),[]);return(0,r.useEffect)((function(){if(e){var t=e.id,n=c.get();"annoucement-bar"===n&&(n="announcement-bar");var r=t!==n;c.set(t),r&&d(!1),!r&&u()||i(!1)}}),[e]),(0,r.useMemo)((function(){return{isActive:!!e&&!o,close:l}}),[e,o,l])}();return r.createElement(p.Provider,{value:n},t)}function m(){var e=(0,r.useContext)(p);if(!e)throw new i.i6("AnnouncementBarProvider");return e}},9200:function(e,t,n){"use strict";n.d(t,{I:function(){return g},S:function(){return h}});var r=n(7294),a=n(6136),o=n(8755),i=n(2560),s=n(107),l=r.createContext(void 0),c="theme",u=(0,i.WA)(c),d={light:"light",dark:"dark"},p=function(e){return e===d.dark?d.dark:d.light},f=function(e){return a.Z.canUseDOM?p(document.documentElement.getAttribute("data-theme")):p(e)},m=function(e){u.set(p(e))};function h(e){var t=e.children,n=function(){var e=(0,s.L)().colorMode,t=e.defaultMode,n=e.disableSwitch,a=e.respectPrefersColorScheme,o=(0,r.useState)(f(t)),i=o[0],l=o[1];(0,r.useEffect)((function(){n&&u.del()}),[n]);var h=(0,r.useCallback)((function(e,n){void 0===n&&(n={});var r=n.persist,o=void 0===r||r;e?(l(e),o&&m(e)):(l(a?window.matchMedia("(prefers-color-scheme: dark)").matches?d.dark:d.light:t),u.del())}),[a,t]);(0,r.useEffect)((function(){document.documentElement.setAttribute("data-theme",p(i))}),[i]),(0,r.useEffect)((function(){if(!n){var e=function(e){if(e.key===c){var t=u.get();null!==t&&h(p(t))}};return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}}}),[n,h]);var g=(0,r.useRef)(!1);return(0,r.useEffect)((function(){if(!n||a){var e=window.matchMedia("(prefers-color-scheme: dark)"),t=function(){window.matchMedia("print").matches||g.current?g.current=window.matchMedia("print").matches:h(null)};return e.addListener(t),function(){return e.removeListener(t)}}}),[h,n,a]),(0,r.useMemo)((function(){return{colorMode:i,setColorMode:h,get isDarkTheme(){return i===d.dark},setLightTheme:function(){h(d.light)},setDarkTheme:function(){h(d.dark)}}}),[i,h])}();return r.createElement(l.Provider,{value:n},t)}function g(){var e=(0,r.useContext)(l);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},6409:function(e,t,n){"use strict";n.d(t,{J:function(){return b},L5:function(){return g},Oh:function(){return y}});var r=n(7294),a=n(868),o=n(6875),i=n(107),s=n(5019),l=n(8755),c=n(2560),u=function(e){return"docs-preferred-version-"+e},d={save:function(e,t,n){(0,c.WA)(u(e),{persistence:t}).set(n)},read:function(e,t){return(0,c.WA)(u(e),{persistence:t}).get()},clear:function(e,t){(0,c.WA)(u(e),{persistence:t}).del()}},p=function(e){return Object.fromEntries(e.map((function(e){return[e,{preferredVersionName:null}]})))};var f=r.createContext(null);function m(){var e=(0,a._r)(),t=(0,i.L)().docs.versionPersistence,n=(0,r.useMemo)((function(){return Object.keys(e)}),[e]),o=(0,r.useState)((function(){return p(n)})),s=o[0],l=o[1];return(0,r.useEffect)((function(){l(function(e){var t=e.pluginIds,n=e.versionPersistence,r=e.allDocsData;return Object.fromEntries(t.map((function(e){return[e,(t=e,a=d.read(t,n),r[t].versions.some((function(e){return e.name===a}))?{preferredVersionName:a}:(d.clear(t,n),{preferredVersionName:null}))];var t,a})))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]),[s,(0,r.useMemo)((function(){return{savePreferredVersion:function(e,n){d.save(e,t,n),l((function(t){var r;return Object.assign({},t,((r={})[e]={preferredVersionName:n},r))}))}}}),[t])]}function h(e){var t=e.children,n=m();return r.createElement(f.Provider,{value:n},t)}function g(e){var t=e.children;return s.cE?r.createElement(h,null,t):r.createElement(r.Fragment,null,t)}function v(){var e=(0,r.useContext)(f);if(!e)throw new l.i6("DocsPreferredVersionContextProvider");return e}function b(e){var t;void 0===e&&(e=o.m);var n=(0,a.zh)(e),i=v(),s=i[0],l=i[1],c=s[e].preferredVersionName;return{preferredVersion:null!=(t=n.versions.find((function(e){return e.name===c})))?t:null,savePreferredVersionName:(0,r.useCallback)((function(t){l.savePreferredVersion(e,t)}),[l,e])}}function y(){var e=(0,a._r)(),t=v()[0];var n=Object.keys(e);return Object.fromEntries(n.map((function(n){return[n,(r=n,o=e[r],i=t[r].preferredVersionName,null!=(a=o.versions.find((function(e){return e.name===i})))?a:null)];var r,a,o,i})))}},4432:function(e,t,n){"use strict";n.d(t,{V:function(){return l},b:function(){return s}});var r=n(7294),a=n(8755),o=Symbol("EmptyContext"),i=r.createContext(o);function s(e){var t=e.children,n=e.name,a=e.items,o=(0,r.useMemo)((function(){return n&&a?{name:n,items:a}:null}),[n,a]);return r.createElement(i.Provider,{value:o},t)}function l(){var e=(0,r.useContext)(i);if(e===o)throw new a.i6("DocsSidebarProvider");return e}},2600:function(e,t,n){"use strict";n.d(t,{M:function(){return p},e:function(){return f}});var r=n(7294),a=n(3086),o=n(3488),i=n(6775),s=(n(1688),n(8755));function l(e){!function(e){var t=(0,i.k6)(),n=(0,s.zX)(e);(0,r.useEffect)((function(){return t.block((function(e,t){return n(e,t)}))}),[t,n])}((function(t,n){if("POP"===n)return e(t,n)}))}var c=n(107),u=r.createContext(void 0);function d(){var e,t=(e=(0,a.HY)(),0===(0,c.L)().navbar.items.length&&!e.component),n=(0,o.i)(),i=!t&&"mobile"===n,s=(0,r.useState)(!1),u=s[0],d=s[1];l((function(){if(u)return d(!1),!1}));var p=(0,r.useCallback)((function(){d((function(e){return!e}))}),[]);return(0,r.useEffect)((function(){"desktop"===n&&d(!1)}),[n]),(0,r.useMemo)((function(){return{disabled:t,shouldRender:i,toggle:p,shown:u}}),[t,i,p,u])}function p(e){var t=e.children,n=d();return r.createElement(u.Provider,{value:n},t)}function f(){var e=r.useContext(u);if(void 0===e)throw new s.i6("NavbarMobileSidebarProvider");return e}},3086:function(e,t,n){"use strict";n.d(t,{HY:function(){return s},Zo:function(){return l},n2:function(){return i}});var r=n(7294),a=n(8755),o=r.createContext(null);function i(e){var t=e.children,n=(0,r.useState)({component:null,props:null});return r.createElement(o.Provider,{value:n},t)}function s(){var e=(0,r.useContext)(o);if(!e)throw new a.i6("NavbarSecondaryMenuContentProvider");return e[0]}function l(e){var t=e.component,n=e.props,i=(0,r.useContext)(o);if(!i)throw new a.i6("NavbarSecondaryMenuContentProvider");var s=i[1],l=(0,a.Ql)(n);return(0,r.useEffect)((function(){s({component:t,props:l})}),[s,t,l]),(0,r.useEffect)((function(){return function(){return s({component:null,props:null})}}),[s]),null}},8181:function(e,t,n){"use strict";n.d(t,{h:function(){return a},t:function(){return o}});var r=n(7294),a="navigation-with-keyboard";function o(){(0,r.useEffect)((function(){function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),function(){document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},3488:function(e,t,n){"use strict";n.d(t,{i:function(){return c}});var r=n(7294),a=n(6136),o={desktop:"desktop",mobile:"mobile",ssr:"ssr"},i=996;function s(){return a.Z.canUseDOM?window.innerWidth>i?o.desktop:o.mobile:o.ssr}var l=!1;function c(){var e=(0,r.useState)((function(){return l?"ssr":s()})),t=e[0],n=e[1];return(0,r.useEffect)((function(){function e(){n(s())}var t=l?window.setTimeout(e,1e3):void 0;return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),clearTimeout(t)}}),[]),t}},3702:function(e,t,n){"use strict";n.d(t,{k:function(){return r}});var r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:function(e){return"theme-admonition-"+e}},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:function(e){return"theme-doc-sidebar-item-category-level-"+e},docSidebarItemLinkLevel:function(e){return"theme-doc-sidebar-item-link-level-"+e}},blog:{}}},8986:function(e,t,n){"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{n:function(){return r}})},5019:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(t,{Wl:function(){return m},_F:function(){return v},cE:function(){return f},hI:function(){return E},lO:function(){return w},vY:function(){return x},oz:function(){return k},s1:function(){return y}});var o=n(7294),i=n(6775),s=n(8790),l=n(868),c=n(6409),u=n(4432);function d(e){return Array.from(new Set(e))}var p=n(9003),f=!!l._r;function m(e){if(e.href)return e.href;for(var t,n=a(e.items);!(t=n()).done;){var r=t.value;if("link"===r.type)return r.href;if("category"===r.type){var o=m(r);if(o)return o}}}var h=function(e,t){return void 0!==e&&(0,p.Mg)(e,t)},g=function(e,t){return e.some((function(e){return v(e,t)}))};function v(e,t){return"link"===e.type?h(e.href,t):"category"===e.type&&(h(e.href,t)||g(e.items,t))}function b(e){var t=e.sidebarItems,n=e.pathname,r=e.onlyCategories,o=void 0!==r&&r,i=[];return function e(t){for(var r,s=a(t);!(r=s()).done;){var l=r.value;if("category"===l.type&&((0,p.Mg)(l.href,n)||e(l.items))||"link"===l.type&&(0,p.Mg)(l.href,n))return o&&"category"!==l.type||i.unshift(l),!0}return!1}(t),i}function y(){var e,t=(0,u.V)(),n=(0,i.TH)().pathname;return!1!==(null==(e=(0,l.gA)())?void 0:e.pluginData.breadcrumbs)&&t?b({sidebarItems:t.items,pathname:n}):null}function w(e){var t=(0,l.Iw)(e).activeVersion,n=(0,c.J)(e).preferredVersion,r=(0,l.yW)(e);return(0,o.useMemo)((function(){return d([t,n,r].filter(Boolean))}),[t,n,r])}function k(e,t){var n=w(t);return(0,o.useMemo)((function(){var t=n.flatMap((function(e){return e.sidebars?Object.entries(e.sidebars):[]})),r=t.find((function(t){return t[0]===e}));if(!r)throw new Error("Can't find any sidebar with id \""+e+'" in version'+(n.length>1?"s":"")+" "+n.map((function(e){return e.name})).join(", ")+'".\nAvailable sidebar ids are:\n- '+t.map((function(e){return e[0]})).join("\n- "));return r[1]}),[e,n])}function x(e,t){var n=w(t);return(0,o.useMemo)((function(){var t=n.flatMap((function(e){return e.docs})),r=t.find((function(t){return t.id===e}));if(!r){if(n.flatMap((function(e){return e.draftIds})).includes(e))return null;throw new Error("Couldn't find any doc with id \""+e+'" in version'+(n.length>1?"s":"")+' "'+n.map((function(e){return e.name})).join(", ")+'".\nAvailable doc ids are:\n- '+d(t.map((function(e){return e.id}))).join("\n- "))}return r}),[e,n])}function E(e){var t=e.route,n=e.versionMetadata,r=(0,i.TH)(),a=t.routes,o=a.find((function(e){return(0,i.LX)(r.pathname,e)}));if(!o)return null;var l=o.sidebar,c=l?n.docsSidebars[l]:void 0;return{docElement:(0,s.H)(a),sidebarName:l,sidebarItems:c}}},5463:function(e,t,n){"use strict";n.d(t,{FG:function(){return p},d:function(){return u},VC:function(){return f}});var r=n(7294),a=n(6010),o=n(1514),i=n(9656);function s(){var e=r.useContext(i._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var l=n(9524),c=n(9962);function u(e){var t=e.title,n=e.description,a=e.keywords,i=e.image,s=e.children,u=function(e){var t=(0,c.Z)().siteConfig,n=t.title,r=t.titleDelimiter;return null!=e&&e.trim().length?e.trim()+" "+r+" "+n:n}(t),d=(0,l.C)().withBaseUrl,p=i?d(i,{absolute:!0}):void 0;return r.createElement(o.Z,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),a&&r.createElement("meta",{name:"keywords",content:Array.isArray(a)?a.join(","):a}),p&&r.createElement("meta",{property:"og:image",content:p}),p&&r.createElement("meta",{name:"twitter:image",content:p}),s)}var d=r.createContext(void 0);function p(e){var t=e.className,n=e.children,i=r.useContext(d),s=(0,a.Z)(i,t);return r.createElement(d.Provider,{value:s},r.createElement(o.Z,null,r.createElement("html",{className:s})),n)}function f(e){var t=e.children,n=s(),o="plugin-"+n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,""),i="plugin-id-"+n.plugin.id;return r.createElement(p,{className:(0,a.Z)(o,i)},t)}},8755:function(e,t,n){"use strict";n.d(t,{i6:function(){return f},Qc:function(){return h},zX:function(){return d},D9:function(){return p},Ql:function(){return m}});var r=n(7099),a=n(4578);function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var i=n(9611);function s(e,t,n){return s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&(0,i.Z)(a,n.prototype),a},s.apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return l=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),(0,i.Z)(r,e)},l(e)}var c=n(7294),u=n(6136).Z.canUseDOM?c.useLayoutEffect:c.useEffect;function d(e){var t=(0,c.useRef)(e);return u((function(){t.current=e}),[e]),(0,c.useCallback)((function(){return t.current.apply(t,arguments)}),[])}function p(e){var t=(0,c.useRef)();return u((function(){t.current=e})),t.current}var f=function(e){function t(t,n){var a,o,i,s,l;return(l=e.call(this)||this).name="ReactContextError",l.message="Hook "+(null!=(a=null==(o=l.stack)||null==(i=o.split("\n")[1])||null==(s=i.match((0,r.Z)(/at (?:\w+\.)?(\w+)/,{name:1})))?void 0:s.groups.name)?a:"")+" is called outside the <"+t+">. "+(null!=n?n:""),l}return(0,a.Z)(t,e),t}(l(Error));function m(e){var t=Object.entries(e);return t.sort((function(e,t){return e[0].localeCompare(t[0])})),(0,c.useMemo)((function(){return e}),t.flat())}function h(e){return function(t){var n=t.children;return c.createElement(c.Fragment,null,e.reduceRight((function(e,t){return c.createElement(t,null,e)}),n))}}},9003:function(e,t,n){"use strict";n.d(t,{Mg:function(){return i},Ns:function(){return s}});var r=n(7294),a=n(997),o=n(9962);function i(e,t){var n=function(e){var t;return null==(t=!e||e.endsWith("/")?e:e+"/")?void 0:t.toLowerCase()};return n(e)===n(t)}function s(){var e=(0,o.Z)().siteConfig.baseUrl;return(0,r.useMemo)((function(){return function(e){var t=e.baseUrl;function n(e){return e.path===t&&!0===e.exact}function r(e){return e.path===t&&!e.exact}return function e(t){if(0!==t.length)return t.find(n)||e(t.filter(r).flatMap((function(e){var t;return null!=(t=e.routes)?t:[]})))}(e.routes)}({routes:a.Z,baseUrl:e})}),[e])}},2957:function(e,t,n){"use strict";n.d(t,{Ct:function(){return p},OC:function(){return l},RF:function(){return d}});var r=n(7294),a=n(6136),o=n(1048),i=n(8755);var s=r.createContext(void 0);function l(e){var t,n=e.children,a=(t=(0,r.useRef)(!0),(0,r.useMemo)((function(){return{scrollEventsEnabledRef:t,enableScrollEvents:function(){t.current=!0},disableScrollEvents:function(){t.current=!1}}}),[]));return r.createElement(s.Provider,{value:a},n)}function c(){var e=(0,r.useContext)(s);if(null==e)throw new i.i6("ScrollControllerProvider");return e}var u=function(){return a.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null};function d(e,t){void 0===t&&(t=[]);var n=c().scrollEventsEnabledRef,a=(0,r.useRef)(u()),o=(0,i.zX)(e);(0,r.useEffect)((function(){var e=function(){if(n.current){var e=u();o(e,a.current),a.current=e}},t={passive:!0};return e(),window.addEventListener("scroll",e,t),function(){return window.removeEventListener("scroll",e,t)}}),[o,n].concat(t))}function p(){var e=(0,r.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:function(n){e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),function(){}}(n):function(e){var t=null,n=document.documentElement.scrollTop>e;return function r(){var a=document.documentElement.scrollTop;(n&&a>e||!n&&a=0;p--){var f=i[p];"."===f?o(i,p):".."===f?(o(i,p),d++):d&&(o(i,p),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m},s=n(2177);function l(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function f(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(s){throw s instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):s}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function m(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=f(e,t,h(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=a,this.iframesTimeout=o}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(t){var n=e.filter((function(e){return e.contains(t)})).length>0;-1!==e.indexOf(t)||n||e.push(t)})),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var a=e.contentWindow;if(r=a.document,!a||!r)throw new Error("iframe inaccessible")}catch(o){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,a=!1,o=null,i=function i(){if(!a){a=!0,clearTimeout(o);try{r.isIframeBlank(e)||(e.removeEventListener("load",i),r.getIframeContents(e,t,n))}catch(s){n()}}};e.addEventListener("load",i),o=setTimeout(i,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(r){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,(function(){return!0}),(function(e){r++,n.waitForIframes(e.querySelector("html"),(function(){--r||t()}))}),(function(e){e||t()}))}},{key:"forEachIframe",value:function(t,n,r){var a=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},i=t.querySelectorAll("iframe"),s=i.length,l=0;i=Array.prototype.slice.call(i);var c=function(){--s<=0&&o(l)};s||c(),i.forEach((function(t){e.matches(t,a.exclude)?c():a.onIframeReady(t,(function(e){n(t)&&(l++,r(e)),c()}),c)}))}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var a=!1,o=!1;return r.forEach((function(e,t){e.val===n&&(a=t,o=e.handled)})),this.compareNodeIframe(e,t,n)?(!1!==a||o?!1===a||o||(r[a].handled=!0):r.push({val:n,handled:!0}),!0):(!1===a&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var a=this;e.forEach((function(e){e.handled||a.getIframeContents(e.val,(function(e){a.createInstanceOnIframe(e).forEachNode(t,n,r)}))}))}},{key:"iterateThroughNodes",value:function(e,t,n,r,a){for(var o=this,i=this.createIterator(t,e,r),s=[],l=[],c=void 0,u=void 0,d=function(){var e=o.getIteratorNode(i);return u=e.prevNode,c=e.node};d();)this.iframes&&this.forEachIframe(t,(function(e){return o.checkIframeFilter(c,u,e,s)}),(function(t){o.createInstanceOnIframe(t).forEachNode(e,(function(e){return l.push(e)}),r)})),l.push(c);l.forEach((function(e){n(e)})),this.iframes&&this.handleOpenIframes(s,e,n,r),a()}},{key:"forEachNode",value:function(e,t,n){var r=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),i=o.length;i||a(),o.forEach((function(o){var s=function(){r.iterateThroughNodes(e,o,t,n,(function(){--i<=0&&a()}))};r.iframes?r.waitForIframes(o,s):s()}))}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var a=!1;return n.every((function(t){return!r.call(e,t)||(a=!0,!1)})),a}return!1}}]),e}(),o=function(){function o(e){t(this,o),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(o,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var a in t)if(t.hasOwnProperty(a)){var o=t[a],i="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(a):this.escapeStr(a),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==i&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(i)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.processSynomyms(i)+"|"+this.processSynomyms(s)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,(function(e){return"\\"===e.charAt(0)?"?":"\x01"}))).replace(/(?:\\)*\*/g,(function(e){return"\\"===e.charAt(0)?"*":"\x02"}))}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,(function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"}))}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105","A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010d","C\xc7\u0106\u010c","d\u0111\u010f","D\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119","E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012b","I\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142","L\u0141","n\xf1\u0148\u0144","N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014d","O\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159","R\u0158","s\u0161\u015b\u0219\u015f","S\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163","T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016b","U\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xff","Y\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017a","Z\u017d\u017b\u0179"]:["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010dC\xc7\u0106\u010c","d\u0111\u010fD\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012bI\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142L\u0141","n\xf1\u0148\u0144N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014dO\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159R\u0158","s\u0161\u015b\u0219\u015fS\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016bU\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xffY\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017aZ\u017d\u017b\u0179"],r=[];return e.split("").forEach((function(a){n.every((function(n){if(-1!==n.indexOf(a)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0}))})),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\xa1\xbf",r=this.opt.accuracy,a="string"==typeof r?r:r.value,o="string"==typeof r?[]:r.limiters,i="";switch(o.forEach((function(e){i+="|"+t.escapeStr(e)})),a){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+(i||this.escapeStr(n)))+"]*"+e+"[^"+i+"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach((function(e){t.opt.separateWordSearch?e.split(" ").forEach((function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)})):e.trim()&&-1===n.indexOf(e)&&n.push(e)})),{keywords:n.sort((function(e,t){return t.length-e.length})),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort((function(e,t){return e.start-t.start})).forEach((function(e){var a=t.callNoMatchOnInvalidRanges(e,r),o=a.start,i=a.end;a.valid&&(e.start=o,e.length=i-o,n.push(e),r=i)})),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,a=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?a=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:a}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,a=!0,o=n.length,i=t-o,s=parseInt(e.start,10)-i;return(r=(s=s>o?o:s)+parseInt(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),s<0||r-s<0||s>o||r>o?(a=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:a}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,(function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})}),(function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),(function(){e({value:n,nodes:r})}))}},{key:"matchesExclude",value:function(e){return a.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",a=e.splitText(t),o=a.splitText(n-t),i=document.createElement(r);return i.setAttribute("data-markjs","true"),this.opt.className&&i.setAttribute("class",this.opt.className),i.textContent=a.textContent,a.parentNode.replaceChild(i,a),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,a){var o=this;e.nodes.every((function(i,s){var l=e.nodes[s+1];if(void 0===l||l.start>t){if(!r(i.node))return!1;var c=t-i.start,u=(n>i.end?i.end:n)-i.start,d=e.value.substr(0,i.start),p=e.value.substr(u+i.start);if(i.node=o.wrapRangeInTextNode(i.node,c,u),e.value=d+p,e.nodes.forEach((function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[n].start-=u),e.nodes[n].end-=u)})),n-=u,a(i.node.previousSibling,i.start),!(n>i.end))return!1;t=i.end}return!0}))}},{key:"wrapMatches",value:function(e,t,n,r,a){var o=this,i=0===t?0:t+1;this.getTextNodes((function(t){t.nodes.forEach((function(t){t=t.node;for(var a=void 0;null!==(a=e.exec(t.textContent))&&""!==a[i];)if(n(a[i],t)){var s=a.index;if(0!==i)for(var l=1;l
'};function a(e,t,n){return en?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,s((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),l(c,i(e,u,d)),1===e?(l(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){l(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),s=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return l(i,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&f(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),l=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},7410:function(e,t){"use strict";var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);E+=x.value.length,x=x.next){var S=x.value;if(t.length>e.length)return;if(!(S instanceof a)){var _,O=1;if(b){if(!(_=o(k,E,e,v))||_.index>=e.length)break;var C=_.index,P=_.index+_[0].length,T=E;for(T+=x.value.length;C>=T;)T+=(x=x.next).value.length;if(E=T-=x.value.length,x.value instanceof a)continue;for(var I=x;I!==t.tail&&(Td.reach&&(d.reach=R);var j=x.prev;if(L&&(j=l(t,j,L),E+=L.length),c(t,j,O),x=l(t,j,new a(p,g?r.tokenize(A,g):A,y,A)),N&&l(t,x,N),O>1){var D={cause:p+","+m,reach:R};i(e,t,n,x.prev,E,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a"+o.content+""},r}(),r=n;n.default=n,r.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:r.languages[t]},n.cdata=/^$/i;var a={"included-cdata":{pattern://i,inside:n}};a["language-"+t]={pattern:/[\s\S]+/,inside:r.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:a},r.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(e,t){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:r.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.c=r.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),r.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),r.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},r.languages.c.string],char:r.languages.c.char,comment:r.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:r.languages.c}}}}),r.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete r.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(r),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(r),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:a})}(r),r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(r),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(r),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(r),r.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:r.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},r.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n0)){var s=p(/^\{$/,/^\}$/);if(-1===s)continue;for(var l=n;l=0&&f(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function l(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function c(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var i=[1,1];i.push.apply(i,l(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,i)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),i=0,u={},d=l(a.map((function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=s(i++,r)););return u[n]=a,n})).join(""),n,r),p=Object.keys(u);return i=0,function e(t){for(var n=0;n=p.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=p[i],o="string"==typeof r?r:r.content,s=o.indexOf(a);if(-1!==s){++i;var l=o.substring(0,s),d=c(u[a]),f=o.substring(s+a.length),m=[];if(l&&m.push(l),m.push(d),f){var h=[f];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,a=n.length;r]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(r),function(e){function t(e,t){return RegExp(e.replace(//g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:(?:\s*,\s*(?:\*\s*as\s+|\{[^{}]*\}))?|\*\s*as\s+|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r*\.{3}(?:[^{}]|)*\})/.source;function o(e,t){return e=e.replace(//g,(function(){return n})).replace(//g,(function(){return r})).replace(//g,(function(){return a})),RegExp(e,t)}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},s=function(t){for(var n=[],r=0;r0&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&n.length>0&&0===n[n.length-1].openedBraces){var l=i(a);r0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(l=i(t[r-1])+l,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",l,null,l)}a.content&&"string"!=typeof a.content&&s(a.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||s(e.tokens)}))}(r),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],a=[];/^\w+$/.test(n)||a.push(/\w+/.exec(n)[0]),"diff"===n&&a.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(r),r.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},r.languages.go=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),r.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete r.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,s=i.length;-1!==n.code.indexOf(a=t(r,s));)++s;return i[s]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(s){for(var l=0;l=o.length);l++){var c=s[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],p="string"==typeof c?c:c.content,f=t(r,u),m=p.indexOf(f);if(m>-1){++a;var h=p.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),v=p.substring(m+f.length),b=[];h&&b.push.apply(b,i([h])),b.push(g),v&&b.push.apply(b,i([v])),"string"==typeof c?s.splice.apply(s,[l,1].concat(b)):c.content=b}}else c.content&&i(c.content)}return s}(n.tokens)}}}})}(r),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(r),r.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},r.languages.webmanifest=r.languages.json,r.languages.less=r.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),r.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),r.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},r.languages.objectivec=r.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete r.languages.objectivec["class-name"],r.languages.objc=r.languages.objectivec,r.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},r.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},r.languages.python["string-interpolation"].inside.interpolation.inside.rest=r.languages.python,r.languages.py=r.languages.python,r.languages.reason=r.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),r.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete r.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(r),r.languages.scss=r.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),r.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),r.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),r.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),r.languages.scss.atrule.inside.rest=r.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(r),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(r),r.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/},t.Z=r},9901:function(e){e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:"shell",aliasTitles:{shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (Scss)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},2885:function(e,t,n){const r=n(9901),a=n(9642),o=new Set;function i(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...o,...Object.keys(Prism.languages)];a(r,e,t).load((e=>{if(!(e in r.languages))return void(i.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(6500).resolve(t)],delete Prism.languages[e],n(6500)(t),o.add(e)}))}i.silent=!1,e.exports=i},6726:function(e,t,n){var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6726},6500:function(e,t,n){var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6500},9642:function(e){"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n "));var s={},l=e[r];if(l){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in s))for(var i in a(t,o),s[t]=!0,n[t])s[i]=!0}t(l.require,c),t(l.optional,c),t(l.modify,c)}n[r]=s,o.pop()}}return function(e){var t=n[e];return t||(a(e,r),t=n[e]),t}}function a(e){for(var t in e)return!0;return!1}return function(o,i,s){var l=function(e){var t={};for(var n in e){var r=e[n];for(var a in r)if("meta"!=a){var o=r[a];t[a]="string"==typeof o?{title:o}:o}}return t}(o),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var a in n={},e){var o=e[a];t(o&&o.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+a+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+a+" because it is a component.");n[t]=a}))}return n[r]||r}}(l);i=i.map(c),s=(s||[]).map(c);var u=n(i),d=n(s);i.forEach((function e(n){var r=l[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,f=r(l),m=u;a(m);){for(var h in p={},m){var g=l[h];t(g&&g.modify,(function(e){e in d&&(p[e]=!0)}))}for(var v in d)if(!(v in u))for(var b in f(v))if(b in u){p[v]=!0;break}for(var y in m=p)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,a){var o=a?a.series:void 0,i=a?a.parallel:e,s={},l={};function c(e){if(e in s)return s[e];l[e]=!0;var a,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)a=r(e);else{var p=i(u.map((function(e){var t=c(e);return delete l[e],t})));o?a=o(p,(function(){return r(e)})):r(e)}return s[e]=a}for(var u in n)c(u);var d=[];for(var p in l)d.push(s[p]);return i(d)}(f,u,t,n)}};return w}}();e.exports=t},2703:function(e,t,n){"use strict";var r=n(414);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:function(e,t,n){"use strict";var r=n(7294),a=n(3840);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n