# Amplitude SvelteKit Example Project

Repository: https://github.com/amplitude/context-hub
Path: basics/sveltekit

---

## README.md

# SvelteKit Amplitude example

This example integrates Amplitude with SvelteKit: user identification and custom event tracking on the client, with optional server-side events.

### Amplitude SDKs

On the client, [`@amplitude/unified`](https://www.npmjs.com/package/@amplitude/unified) is initialized with `initAll` from client hooks. [Initialize the Unified SDK](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#initialize-the-unified-sdk) describes that call as initializing every product bundled with Unified npm (Analytics, Session Replay, the **Feature Experiment** client, and Guides & Surveys as covered in the [Browser Unified SDK (npm)](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#unified-sdk-npm) overview). Amplitude’s [product support table](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#product-support-by-installation-method) lists **Web Experiment** (`@amplitude/experiment-tag`, including the visual editor) for Amplitude’s [CDN unified script](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#unified-script-cdn), not the Unified **npm** row—the `experiment` config here is `experiment-js-client`, not `experiment-tag`.

For server-only events, use [`@amplitude/analytics-node`](https://www.npmjs.com/package/@amplitude/analytics-node) and keep `@amplitude/unified` in the browser.

## Getting started

### 1. Install dependencies

```bash
npm install
```

### 2. Configure environment variables

Copy the example environment file and add your Amplitude API key:

```bash
cp .env.example .env
```

Edit `.env` with your Amplitude API key:

```
PUBLIC_AMPLITUDE_API_KEY=your_amplitude_api_key_here
```

Get your Amplitude API key from your [Amplitude project settings](https://app.amplitude.com).

### 3. Run the development server

```bash
npm run dev
```

Open [http://localhost:5173](http://localhost:5173) to view the app.

## Project structure

```
src/
├── lib/
│   ├── auth.svelte.ts              # Auth context with Svelte 5 runes
│   ├── components/
│   │   └── Header.svelte           # Navigation component
│   └── server/
│       └── amplitude.ts            # Server-side Amplitude singleton
├── routes/
│   ├── +layout.svelte              # Root layout with auth provider
│   ├── +page.svelte                # Home/login page
│   ├── burrito/
│   │   └── +page.svelte            # Event tracking demo
│   ├── profile/
│   │   └── +page.svelte            # User profile page
│   └── api/
│       └── auth/
│           └── login/
│               └── +server.ts      # Login API with server-side tracking
├── hooks.client.ts                 # Client-side Amplitude initialization
├── hooks.server.ts                 # Server hooks
├── app.css                         # Global styles
└── app.html                        # HTML template
```

## Key integration points

### Client-side initialization (`src/hooks.client.ts`)

Amplitude is initialized in the SvelteKit client hooks `init` function, which runs once when the app starts:

```typescript
import * as amplitude from '@amplitude/unified';
import { env } from '$env/dynamic/public';

export async function init() {
  void amplitude.initAll(env.PUBLIC_AMPLITUDE_API_KEY ?? '');
}
```

`$env/dynamic/public` avoids build failures when `PUBLIC_AMPLITUDE_API_KEY` is missing at build time (see [SvelteKit `$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public)).

### Server-side tracking (`src/lib/server/amplitude.ts`)

A singleton pattern ensures one Amplitude client instance for server-side tracking:

```typescript
import { createInstance } from '@amplitude/analytics-node';
import { env } from '$env/dynamic/public';

type AmplitudeNodeClient = ReturnType<typeof createInstance>;

let amplitudeClient: AmplitudeNodeClient | null = null;

export function getAmplitudeClient(): AmplitudeNodeClient {
  if (!amplitudeClient) {
    amplitudeClient = createInstance();
    amplitudeClient.init(env.PUBLIC_AMPLITUDE_API_KEY ?? '');
  }
  return amplitudeClient;
}
```

### User identification

When a user logs in, they are identified in Amplitude:

```typescript
import * as amplitude from '@amplitude/unified';
import { Identify } from '@amplitude/unified';

// On login
amplitude.setUserId(username);
const identifyObj = new Identify();
identifyObj.set('username', username);
amplitude.identify(identifyObj);
amplitude.track('User Logged In', { username });

// On logout
amplitude.track('User Logged Out');
amplitude.reset();
```

### Event tracking

```typescript
amplitude.track('Burrito Considered', {
  total_considerations: auth.user.burritoConsiderations,
  username: auth.user.username
});
```

## Features demonstrated

1. **Login page** (`/`) - User authentication with Amplitude identification
2. **Burrito page** (`/burrito`) - Custom event tracking with properties
3. **Profile page** (`/profile`) - User profile display

## Learn more

- [Browser Unified SDK](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk) — [npm & `initAll`](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#unified-sdk-npm), [configuration](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk#configuration)
- [Browser SDK 2 (analytics)](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2)
- [Node.js SDK](https://amplitude.com/docs/sdks/analytics/node/node-js-sdk)
- [SvelteKit documentation](https://svelte.dev/docs/kit)

---

## .env.example

```example
# Amplitude configuration
# Get your Amplitude API key from: https://app.amplitude.com
PUBLIC_AMPLITUDE_API_KEY=your_amplitude_api_key_here

```

---

## .npmrc

```
engine-strict=true

```

---

## .svelte-kit/ambient.d.ts

```ts

// this file is generated — do not edit it


/// <reference types="@sveltejs/kit" />

/**
 * This module provides access to environment variables that are injected _statically_ into your bundle at build time and are limited to _private_ access.
 * 
 * |         | Runtime                                                                    | Build time                                                               |
 * | ------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
 * | Private | [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private) | [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) |
 * | Public  | [`$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public)   | [`$env/static/public`](https://svelte.dev/docs/kit/$env-static-public)   |
 * 
 * Static environment variables are [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env` at build time and then statically injected into your bundle at build time, enabling optimisations like dead code elimination.
 * 
 * **_Private_ access:**
 * 
 * - This module cannot be imported into client-side code
 * - This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured)
 * 
 * For example, given the following build time environment:
 * 
 * ```env
 * ENVIRONMENT=production
 * PUBLIC_BASE_URL=http://site.com
 * ```
 * 
 * With the default `publicPrefix` and `privatePrefix`:
 * 
 * ```ts
 * import { ENVIRONMENT, PUBLIC_BASE_URL } from '$env/static/private';
 * 
 * console.log(ENVIRONMENT); // => "production"
 * console.log(PUBLIC_BASE_URL); // => throws error during build
 * ```
 * 
 * The above values will be the same _even if_ different values for `ENVIRONMENT` or `PUBLIC_BASE_URL` are set at runtime, as they are statically replaced in your code with their build time values.
 */
declare module '$env/static/private' {
	export const NVM_INC: string;
	export const _ZO_DOCTOR: string;
	export const DD_INSTRUMENTATION_TELEMETRY_ENABLED: string;
	export const MANPATH: string;
	export const COREPACK_ROOT: string;
	export const TERM_PROGRAM: string;
	export const NODE: string;
	export const PYENV_ROOT: string;
	export const NVM_CD_FLAGS: string;
	export const INIT_CWD: string;
	export const TERM: string;
	export const SHELL: string;
	export const DD_TRACE_ENABLED: string;
	export const TMPDIR: string;
	export const GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE: string;
	export const VSCODE_PYTHON_AUTOACTIVATE_GUARD: string;
	export const TERM_PROGRAM_VERSION: string;
	export const SUDO_ASKPASS: string;
	export const npm_config_npm_globalconfig: string;
	export const DFX_WARNING: string;
	export const ZDOTDIR: string;
	export const MallocNanoZone: string;
	export const TERM_SESSION_ID: string;
	export const NO_COLOR: string;
	export const CURSOR_ASKPASS_SECRET: string;
	export const npm_config_registry: string;
	export const PNPM_HOME: string;
	export const ZSH: string;
	export const NVM_DIR: string;
	export const USER: string;
	export const LS_COLORS: string;
	export const GUILE_LOAD_PATH: string;
	export const COMMAND_MODE: string;
	export const AMP_REPO_ROOT: string;
	export const npm_config_globalconfig: string;
	export const PNPM_SCRIPT_SRC_DIR: string;
	export const CLAUDE_CODE_SSE_PORT: string;
	export const SSH_AUTH_SOCK: string;
	export const VSCODE_PROFILE_INITIALIZED: string;
	export const GUILE_LOAD_COMPILED_PATH: string;
	export const __CF_USER_TEXT_ENCODING: string;
	export const TERM_FEATURES: string;
	export const npm_execpath: string;
	export const PAGER: string;
	export const GOOGLE_CLOUD_PROJECT: string;
	export const LSCOLORS: string;
	export const npm_config_frozen_lockfile: string;
	export const npm_config_verify_deps_before_run: string;
	export const TERMINFO_DIRS: string;
	export const PATH: string;
	export const LaunchInstanceID: string;
	export const npm_config_engine_strict: string;
	export const npm_package_json: string;
	export const USER_ZDOTDIR: string;
	export const __CFBundleIdentifier: string;
	export const COREPACK_ENABLE_DOWNLOAD_PROMPT: string;
	export const PWD: string;
	export const npm_command: string;
	export const AMPLITUDE_USER: string;
	export const npm_config__jsr_registry: string;
	export const npm_lifecycle_event: string;
	export const LANG: string;
	export const CURSOR_AGENT: string;
	export const npm_package_name: string;
	export const PYTHONSTARTUP: string;
	export const ITERM_PROFILE: string;
	export const NODE_PATH: string;
	export const VSCODE_GIT_ASKPASS_EXTRA_ARGS: string;
	export const XPC_FLAGS: string;
	export const MACH_PORT_RENDEZVOUS_PEER_VALDATION: string;
	export const FORCE_COLOR: string;
	export const CURSOR_INVOKED_AS: string;
	export const npm_config_node_gyp: string;
	export const XPC_SERVICE_NAME: string;
	export const npm_package_version: string;
	export const pnpm_config_verify_deps_before_run: string;
	export const VSCODE_INJECTION: string;
	export const COLORFGBG: string;
	export const SHLVL: string;
	export const PYENV_SHELL: string;
	export const HOME: string;
	export const VSCODE_GIT_ASKPASS_MAIN: string;
	export const PYTHON_BASIC_REPL: string;
	export const LC_TERMINAL_VERSION: string;
	export const NODE_COMPILE_CACHE: string;
	export const CURSOR_ASKPASS_SOCKET: string;
	export const ITERM_SESSION_ID: string;
	export const LESS: string;
	export const LOGNAME: string;
	export const npm_lifecycle_script: string;
	export const VSCODE_GIT_IPC_HANDLE: string;
	export const GUILE_SYSTEM_EXTENSIONS_PATH: string;
	export const NVM_BIN: string;
	export const BUN_INSTALL: string;
	export const npm_config_user_agent: string;
	export const VSCODE_GIT_ASKPASS_NODE: string;
	export const GIT_ASKPASS: string;
	export const LC_TERMINAL: string;
	export const SECURITYSESSIONID: string;
	export const COLORTERM: string;
	export const npm_node_execpath: string;
	export const NODE_ENV: string;
}

/**
 * This module provides access to environment variables that are injected _statically_ into your bundle at build time and are _publicly_ accessible.
 * 
 * |         | Runtime                                                                    | Build time                                                               |
 * | ------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
 * | Private | [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private) | [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) |
 * | Public  | [`$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public)   | [`$env/static/public`](https://svelte.dev/docs/kit/$env-static-public)   |
 * 
 * Static environment variables are [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env` at build time and then statically injected into your bundle at build time, enabling optimisations like dead code elimination.
 * 
 * **_Public_ access:**
 * 
 * - This module _can_ be imported into client-side code
 * - **Only** variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`) are included
 * 
 * For example, given the following build time environment:
 * 
 * ```env
 * ENVIRONMENT=production
 * PUBLIC_BASE_URL=http://site.com
 * ```
 * 
 * With the default `publicPrefix` and `privatePrefix`:
 * 
 * ```ts
 * import { ENVIRONMENT, PUBLIC_BASE_URL } from '$env/static/public';
 * 
 * console.log(ENVIRONMENT); // => throws error during build
 * console.log(PUBLIC_BASE_URL); // => "http://site.com"
 * ```
 * 
 * The above values will be the same _even if_ different values for `ENVIRONMENT` or `PUBLIC_BASE_URL` are set at runtime, as they are statically replaced in your code with their build time values.
 */
declare module '$env/static/public' {
	
}

/**
 * This module provides access to environment variables set _dynamically_ at runtime and that are limited to _private_ access.
 * 
 * |         | Runtime                                                                    | Build time                                                               |
 * | ------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
 * | Private | [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private) | [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) |
 * | Public  | [`$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public)   | [`$env/static/public`](https://svelte.dev/docs/kit/$env-static-public)   |
 * 
 * Dynamic environment variables are defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://svelte.dev/docs/kit/cli)), this is equivalent to `process.env`.
 * 
 * **_Private_ access:**
 * 
 * - This module cannot be imported into client-side code
 * - This module includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured)
 * 
 * > [!NOTE] In `dev`, `$env/dynamic` includes environment variables from `.env`. In `prod`, this behavior will depend on your adapter.
 * 
 * > [!NOTE] To get correct types, environment variables referenced in your code should be declared (for example in an `.env` file), even if they don't have a value until the app is deployed:
 * >
 * > ```env
 * > MY_FEATURE_FLAG=
 * > ```
 * >
 * > You can override `.env` values from the command line like so:
 * >
 * > ```sh
 * > MY_FEATURE_FLAG="enabled" npm run dev
 * > ```
 * 
 * For example, given the following runtime environment:
 * 
 * ```env
 * ENVIRONMENT=production
 * PUBLIC_BASE_URL=http://site.com
 * ```
 * 
 * With the default `publicPrefix` and `privatePrefix`:
 * 
 * ```ts
 * import { env } from '$env/dynamic/private';
 * 
 * console.log(env.ENVIRONMENT); // => "production"
 * console.log(env.PUBLIC_BASE_URL); // => undefined
 * ```
 */
declare module '$env/dynamic/private' {
	export const env: {
		NVM_INC: string;
		_ZO_DOCTOR: string;
		DD_INSTRUMENTATION_TELEMETRY_ENABLED: string;
		MANPATH: string;
		COREPACK_ROOT: string;
		TERM_PROGRAM: string;
		NODE: string;
		PYENV_ROOT: string;
		NVM_CD_FLAGS: string;
		INIT_CWD: string;
		TERM: string;
		SHELL: string;
		DD_TRACE_ENABLED: string;
		TMPDIR: string;
		GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE: string;
		VSCODE_PYTHON_AUTOACTIVATE_GUARD: string;
		TERM_PROGRAM_VERSION: string;
		SUDO_ASKPASS: string;
		npm_config_npm_globalconfig: string;
		DFX_WARNING: string;
		ZDOTDIR: string;
		MallocNanoZone: string;
		TERM_SESSION_ID: string;
		NO_COLOR: string;
		CURSOR_ASKPASS_SECRET: string;
		npm_config_registry: string;
		PNPM_HOME: string;
		ZSH: string;
		NVM_DIR: string;
		USER: string;
		LS_COLORS: string;
		GUILE_LOAD_PATH: string;
		COMMAND_MODE: string;
		AMP_REPO_ROOT: string;
		npm_config_globalconfig: string;
		PNPM_SCRIPT_SRC_DIR: string;
		CLAUDE_CODE_SSE_PORT: string;
		SSH_AUTH_SOCK: string;
		VSCODE_PROFILE_INITIALIZED: string;
		GUILE_LOAD_COMPILED_PATH: string;
		__CF_USER_TEXT_ENCODING: string;
		TERM_FEATURES: string;
		npm_execpath: string;
		PAGER: string;
		GOOGLE_CLOUD_PROJECT: string;
		LSCOLORS: string;
		npm_config_frozen_lockfile: string;
		npm_config_verify_deps_before_run: string;
		TERMINFO_DIRS: string;
		PATH: string;
		LaunchInstanceID: string;
		npm_config_engine_strict: string;
		npm_package_json: string;
		USER_ZDOTDIR: string;
		__CFBundleIdentifier: string;
		COREPACK_ENABLE_DOWNLOAD_PROMPT: string;
		PWD: string;
		npm_command: string;
		AMPLITUDE_USER: string;
		npm_config__jsr_registry: string;
		npm_lifecycle_event: string;
		LANG: string;
		CURSOR_AGENT: string;
		npm_package_name: string;
		PYTHONSTARTUP: string;
		ITERM_PROFILE: string;
		NODE_PATH: string;
		VSCODE_GIT_ASKPASS_EXTRA_ARGS: string;
		XPC_FLAGS: string;
		MACH_PORT_RENDEZVOUS_PEER_VALDATION: string;
		FORCE_COLOR: string;
		CURSOR_INVOKED_AS: string;
		npm_config_node_gyp: string;
		XPC_SERVICE_NAME: string;
		npm_package_version: string;
		pnpm_config_verify_deps_before_run: string;
		VSCODE_INJECTION: string;
		COLORFGBG: string;
		SHLVL: string;
		PYENV_SHELL: string;
		HOME: string;
		VSCODE_GIT_ASKPASS_MAIN: string;
		PYTHON_BASIC_REPL: string;
		LC_TERMINAL_VERSION: string;
		NODE_COMPILE_CACHE: string;
		CURSOR_ASKPASS_SOCKET: string;
		ITERM_SESSION_ID: string;
		LESS: string;
		LOGNAME: string;
		npm_lifecycle_script: string;
		VSCODE_GIT_IPC_HANDLE: string;
		GUILE_SYSTEM_EXTENSIONS_PATH: string;
		NVM_BIN: string;
		BUN_INSTALL: string;
		npm_config_user_agent: string;
		VSCODE_GIT_ASKPASS_NODE: string;
		GIT_ASKPASS: string;
		LC_TERMINAL: string;
		SECURITYSESSIONID: string;
		COLORTERM: string;
		npm_node_execpath: string;
		NODE_ENV: string;
		[key: `PUBLIC_${string}`]: undefined;
		[key: `${string}`]: string | undefined;
	}
}

/**
 * This module provides access to environment variables set _dynamically_ at runtime and that are _publicly_ accessible.
 * 
 * |         | Runtime                                                                    | Build time                                                               |
 * | ------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
 * | Private | [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private) | [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) |
 * | Public  | [`$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public)   | [`$env/static/public`](https://svelte.dev/docs/kit/$env-static-public)   |
 * 
 * Dynamic environment variables are defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://svelte.dev/docs/kit/cli)), this is equivalent to `process.env`.
 * 
 * **_Public_ access:**
 * 
 * - This module _can_ be imported into client-side code
 * - **Only** variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`) are included
 * 
 * > [!NOTE] In `dev`, `$env/dynamic` includes environment variables from `.env`. In `prod`, this behavior will depend on your adapter.
 * 
 * > [!NOTE] To get correct types, environment variables referenced in your code should be declared (for example in an `.env` file), even if they don't have a value until the app is deployed:
 * >
 * > ```env
 * > MY_FEATURE_FLAG=
 * > ```
 * >
 * > You can override `.env` values from the command line like so:
 * >
 * > ```sh
 * > MY_FEATURE_FLAG="enabled" npm run dev
 * > ```
 * 
 * For example, given the following runtime environment:
 * 
 * ```env
 * ENVIRONMENT=production
 * PUBLIC_BASE_URL=http://example.com
 * ```
 * 
 * With the default `publicPrefix` and `privatePrefix`:
 * 
 * ```ts
 * import { env } from '$env/dynamic/public';
 * console.log(env.ENVIRONMENT); // => undefined, not public
 * console.log(env.PUBLIC_BASE_URL); // => "http://example.com"
 * ```
 * 
 * ```
 * 
 * ```
 */
declare module '$env/dynamic/public' {
	export const env: {
		[key: `PUBLIC_${string}`]: string | undefined;
	}
}

```

---

## .svelte-kit/generated/client-optimized/app.js

```js
import * as client_hooks from '../../../src/hooks.client.ts';


export { matchers } from './matchers.js';

export const nodes = [
	() => import('./nodes/0'),
	() => import('./nodes/1'),
	() => import('./nodes/2'),
	() => import('./nodes/3'),
	() => import('./nodes/4')
];

export const server_loads = [];

export const dictionary = {
		"/": [2],
		"/burrito": [3],
		"/profile": [4]
	};

export const hooks = {
	handleError: client_hooks.handleError || (({ error }) => { console.error(error) }),
	init: client_hooks.init,
	reroute: (() => {}),
	transport: {}
};

export const decoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.decode]));
export const encoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.encode]));

export const hash = false;

export const decode = (type, value) => decoders[type](value);

export { default as root } from '../root.js';
```

---

## .svelte-kit/generated/client-optimized/matchers.js

```js
export const matchers = {};
```

---

## .svelte-kit/generated/client-optimized/nodes/0.js

```js
export { default as component } from "../../../../src/routes/+layout.svelte";
```

---

## .svelte-kit/generated/client-optimized/nodes/1.js

```js
export { default as component } from "../../../../node_modules/.pnpm/@sveltejs+kit@2.56.1_@sveltejs+vite-plugin-svelte@6.2.4_svelte@5.55.2_vite@7.3.2__svelt_151ca1313abe6eb03c68c3dd144be4dc/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte";
```

---

## .svelte-kit/generated/client-optimized/nodes/2.js

```js
export { default as component } from "../../../../src/routes/+page.svelte";
```

---

## .svelte-kit/generated/client-optimized/nodes/3.js

```js
export { default as component } from "../../../../src/routes/burrito/+page.svelte";
```

---

## .svelte-kit/generated/client-optimized/nodes/4.js

```js
export { default as component } from "../../../../src/routes/profile/+page.svelte";
```

---

## .svelte-kit/generated/client/app.js

```js
import * as client_hooks from '../../../src/hooks.client.ts';


export { matchers } from './matchers.js';

export const nodes = [
	() => import('./nodes/0'),
	() => import('./nodes/1'),
	() => import('./nodes/2'),
	() => import('./nodes/3'),
	() => import('./nodes/4')
];

export const server_loads = [];

export const dictionary = {
		"/": [2],
		"/burrito": [3],
		"/profile": [4]
	};

export const hooks = {
	handleError: client_hooks.handleError || (({ error }) => { console.error(error) }),
	init: client_hooks.init,
	reroute: (() => {}),
	transport: {}
};

export const decoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.decode]));
export const encoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.encode]));

export const hash = false;

export const decode = (type, value) => decoders[type](value);

export { default as root } from '../root.js';
```

---

## .svelte-kit/generated/client/matchers.js

```js
export const matchers = {};
```

---

## .svelte-kit/generated/client/nodes/0.js

```js
export { default as component } from "../../../../src/routes/+layout.svelte";
```

---

## .svelte-kit/generated/client/nodes/1.js

```js
export { default as component } from "../../../../node_modules/.pnpm/@sveltejs+kit@2.56.1_@sveltejs+vite-plugin-svelte@6.2.4_svelte@5.55.2_vite@7.3.2__svelt_151ca1313abe6eb03c68c3dd144be4dc/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte";
```

---

## .svelte-kit/generated/client/nodes/2.js

```js
export { default as component } from "../../../../src/routes/+page.svelte";
```

---

## .svelte-kit/generated/client/nodes/3.js

```js
export { default as component } from "../../../../src/routes/burrito/+page.svelte";
```

---

## .svelte-kit/generated/client/nodes/4.js

```js
export { default as component } from "../../../../src/routes/profile/+page.svelte";
```

---

## .svelte-kit/generated/root.js

```js
import { asClassComponent } from 'svelte/legacy';
import Root from './root.svelte';
export default asClassComponent(Root);
```

---

## .svelte-kit/generated/root.svelte

```svelte
<!-- This file is generated by @sveltejs/kit — do not edit it! -->
<svelte:options runes={true} />
<script>
	import { setContext, onMount, tick } from 'svelte';
	import { browser } from '$app/environment';

	// stores
	let { stores, page, constructors, components = [], form, data_0 = null, data_1 = null } = $props();

	if (!browser) {
		// svelte-ignore state_referenced_locally
		setContext('__svelte__', stores);
	}

	if (browser) {
		$effect.pre(() => stores.page.set(page));
	} else {
		// svelte-ignore state_referenced_locally
		stores.page.set(page);
	}
	$effect(() => {
		stores;page;constructors;components;form;data_0;data_1;
		stores.page.notify();
	});

	let mounted = $state(false);
	let navigated = $state(false);
	let title = $state(null);

	onMount(() => {
		const unsubscribe = stores.page.subscribe(() => {
			if (mounted) {
				navigated = true;
				tick().then(() => {
					title = document.title || 'untitled page';
				});
			}
		});

		mounted = true;
		return unsubscribe;
	});

	const Pyramid_1=$derived(constructors[1])
</script>

{#if constructors[1]}
	{@const Pyramid_0 = constructors[0]}
							<!-- svelte-ignore binding_property_non_reactive -->
							<Pyramid_0 bind:this={components[0]} data={data_0} {form} params={page.params}>
								<!-- svelte-ignore binding_property_non_reactive -->
										<Pyramid_1 bind:this={components[1]} data={data_1} {form} params={page.params} />
							</Pyramid_0>

{:else}
	{@const Pyramid_0 = constructors[0]}
	<!-- svelte-ignore binding_property_non_reactive -->
	<Pyramid_0 bind:this={components[0]} data={data_0} {form} params={page.params} />

{/if}

{#if mounted}
	<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">
		{#if navigated}
			{title}
		{/if}
	</div>
{/if}
```

---

## .svelte-kit/generated/server/internal.js

```js

import root from '../root.js';
import { set_building, set_prerendering } from '__sveltekit/environment';
import { set_assets } from '$app/paths/internal/server';
import { set_manifest, set_read_implementation } from '__sveltekit/server';
import { set_private_env, set_public_env } from '../../../node_modules/.pnpm/@sveltejs+kit@2.56.1_@sveltejs+vite-plugin-svelte@6.2.4_svelte@5.55.2_vite@7.3.2__svelt_151ca1313abe6eb03c68c3dd144be4dc/node_modules/@sveltejs/kit/src/runtime/shared-server.js';

export const options = {
	app_template_contains_nonce: false,
	async: false,
	csp: {"mode":"auto","directives":{"upgrade-insecure-requests":false,"block-all-mixed-content":false},"reportOnly":{"upgrade-insecure-requests":false,"block-all-mixed-content":false}},
	csrf_check_origin: true,
	csrf_trusted_origins: [],
	embedded: false,
	env_public_prefix: 'PUBLIC_',
	env_private_prefix: '',
	hash_routing: false,
	hooks: null, // added lazily, via `get_hooks`
	preload_strategy: "modulepreload",
	root,
	service_worker: false,
	service_worker_options: undefined,
	server_error_boundaries: false,
	templates: {
		app: ({ head, body, assets, nonce, env }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t" + head + "\n\t</head>\n\t<body data-sveltekit-preload-data=\"hover\">\n\t\t<div style=\"display: contents\">" + body + "</div>\n\t</body>\n</html>\n",
		error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
	},
	version_hash: "1bdh8ft"
};

export async function get_hooks() {
	let handle;
	let handleFetch;
	let handleError;
	let handleValidationError;
	let init;
	({ handle, handleFetch, handleError, handleValidationError, init } = await import("../../../src/hooks.server.ts"));

	let reroute;
	let transport;
	

	return {
		handle,
		handleFetch,
		handleError,
		handleValidationError,
		init,
		reroute,
		transport
	};
}

export { set_assets, set_building, set_manifest, set_prerendering, set_private_env, set_public_env, set_read_implementation };

```

---

## .svelte-kit/non-ambient.d.ts

```ts

// this file is generated — do not edit it


declare module "svelte/elements" {
	export interface HTMLAttributes<T> {
		'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;
		'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null;
		'data-sveltekit-preload-code'?:
			| true
			| ''
			| 'eager'
			| 'viewport'
			| 'hover'
			| 'tap'
			| 'off'
			| undefined
			| null;
		'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null;
		'data-sveltekit-reload'?: true | '' | 'off' | undefined | null;
		'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null;
	}
}

export {};


declare module "$app/types" {
	type MatcherParam<M> = M extends (param : string) => param is (infer U extends string) ? U : string;

	export interface AppTypes {
		RouteId(): "/" | "/api" | "/api/auth" | "/api/auth/login" | "/burrito" | "/profile";
		RouteParams(): {
			
		};
		LayoutParams(): {
			"/": Record<string, never>;
			"/api": Record<string, never>;
			"/api/auth": Record<string, never>;
			"/api/auth/login": Record<string, never>;
			"/burrito": Record<string, never>;
			"/profile": Record<string, never>
		};
		Pathname(): "/" | "/api/auth/login" | "/burrito" | "/profile";
		ResolvedPathname(): `${"" | `/${string}`}${ReturnType<AppTypes['Pathname']>}`;
		Asset(): "/robots.txt" | string & {};
	}
}
```

---

## .svelte-kit/output/client/_app/immutable/chunks/3TW-MQft.js

```js
var Ht=Array.isArray,Bt=Array.prototype.indexOf,ie=Array.prototype.includes,Yn=Array.from,qn=Object.defineProperty,de=Object.getOwnPropertyDescriptor,Vt=Object.getOwnPropertyDescriptors,zt=Object.prototype,Gt=Array.prototype,at=Object.getPrototypeOf,Qe=Object.isExtensible;const Kt=()=>{};function Un(e){return e()}function $t(e){for(var t=0;t<e.length;t++)e[t]()}function ot(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}const b=2,le=4,ye=8,ut=1<<24,M=16,F=32,J=64,Wt=128,k=512,g=1024,T=2048,j=4096,I=8192,C=16384,re=32768,et=1<<25,Se=65536,Me=1<<17,Xt=1<<18,ge=1<<19,ct=1<<20,Q=65536,Fe=1<<21,pe=1<<22,H=1<<23,ve=Symbol("$state"),Hn=Symbol("legacy props"),Bn=Symbol(""),q=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},zn=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Ne=3,_t=8;function Zt(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Jt(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qt(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function en(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function tn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function nn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Gn(){throw new Error("https://svelte.dev/e/hydration_failed")}function Kn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function rn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function sn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ln(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function $n(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Wn=1,Xn=2,Zn=4,Jn=8,Qn=16,er=1,tr=2,fn="[",an="[!",nr="[?",on="]",He={},m=Symbol(),un="http://www.w3.org/1999/xhtml";function Be(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function rr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let ee=!1;function sr(e){ee=e}let S;function fe(e){if(e===null)throw Be(),He;return S=e}function ir(){return fe(z(S))}function lr(e){if(ee){if(z(S)!==null)throw Be(),He;S=e}}function fr(e=1){if(ee){for(var t=e,n=S;t--;)n=z(n);S=n}}function ar(e=!0){for(var t=0,n=S;;){if(n.nodeType===_t){var r=n.data;if(r===on){if(t===0)return n;t-=1}else(r===fn||r===an||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=z(n);e&&n.remove(),n=s}}function or(e){if(!e||e.nodeType!==_t)throw Be(),He;return e.data}function dt(e){return e===this.v}function cn(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function vt(e){return!cn(e,this.v)}let De=!1;function ur(){De=!0}let E=null;function Ae(e){E=e}function cr(e){return ht().get(e)}function _r(e,t){return ht().set(e,t),t}function dr(e,t=!1,n){E={p:E,i:!1,c:null,e:null,s:e,x:null,r:v,l:De&&!t?{s:null,u:null,$:[]}:null}}function vr(e){var t=E,n=t.e;if(n!==null){t.e=null;for(var r of n)Nt(r)}return t.i=!0,E=t.p,{}}function me(){return!De||E!==null&&E.l===null}function ht(e){return E===null&&Zt(),E.c??=new Map(_n(E)||void 0)}function _n(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}let $=[];function pt(){var e=$;$=[],$t(e)}function tt(e){if($.length===0&&!he){var t=$;queueMicrotask(()=>{t===$&&pt()})}$.push(e)}function dn(){for(;$.length>0;)pt()}function vn(e){var t=v;if(t===null)return d.f|=H,e;if((t.f&re)===0&&(t.f&le)===0)throw e;Re(e,t)}function Re(e,t){for(;t!==null;){if((t.f&Wt)!==0){if((t.f&re)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const hn=-7169;function y(e,t){e.f=e.f&hn|t}function Ve(e){(e.f&k)!==0||e.deps===null?y(e,g):y(e,j)}function wt(e){if(e!==null)for(const t of e)(t.f&b)===0||(t.f&Q)===0||(t.f^=Q,wt(t.deps))}function pn(e,t,n){(e.f&T)!==0?t.add(e):(e.f&j)!==0&&n.add(e),wt(e.deps),y(e,g)}const G=new Set;let w=null,D=null,je=null,he=!1,Ie=!1,se=null,Te=null;var nt=0;let wn=1;class B{id=wn++;current=new Map;previous=new Map;#f=new Set;#a=new Set;#r=new Map;#t=new Map;#v=null;#e=[];#h=[];#i=new Set;#s=new Set;#n=new Map;#o=new Set;is_fork=!1;#u=!1;#l=new Set;#c(){return this.is_fork||this.#t.size>0}#w(){for(const r of this.#l)for(const s of r.#t.keys()){for(var t=!1,n=s;n.parent!==null;){if(this.#n.has(n)){t=!0;break}n=n.parent}if(!t)return!0}return!1}skip_effect(t){this.#n.has(t)||this.#n.set(t,{d:[],m:[]}),this.#o.delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=this.#n.get(t);if(r){this.#n.delete(t);for(var s of r.d)y(s,T),n(s);for(s of r.m)y(s,j),n(s)}this.#o.add(t)}#_(){if(nt++>1e3&&(G.delete(this),gn()),!this.#c()){for(const l of this.#i)this.#s.delete(l),y(l,T),this.schedule(l);for(const l of this.#s)y(l,j),this.schedule(l)}const t=this.#e;this.#e=[],this.apply();var n=se=[],r=[],s=Te=[];for(const l of t)try{this.#p(l,n,r)}catch(f){throw mt(l),f}if(w=null,s.length>0){var i=B.ensure();for(const l of s)i.schedule(l)}if(se=null,Te=null,this.#c()||this.#w()){this.#d(r),this.#d(n);for(const[l,f]of this.#n)gt(l,f)}else{this.#r.size===0&&G.delete(this),this.#i.clear(),this.#s.clear();for(const l of this.#f)l(this);this.#f.clear(),rt(r),rt(n),this.#v?.resolve()}var o=w;if(this.#e.length>0){const l=o??=this;l.#e.push(...this.#e.filter(f=>!l.#e.includes(f)))}o!==null&&(G.add(o),o.#_())}#p(t,n,r){t.f^=g;for(var s=t.first;s!==null;){var i=s.f,o=(i&(F|J))!==0,l=o&&(i&g)!==0,f=l||(i&I)!==0||this.#n.has(s);if(!f&&s.fn!==null){o?s.f^=g:(i&le)!==0?n.push(s):Ee(s)&&((i&M)!==0&&this.#s.add(s),oe(s));var u=s.first;if(u!==null){s=u;continue}}for(;s!==null;){var a=s.next;if(a!==null){s=a;break}s=s.parent}}}#d(t){for(var n=0;n<t.length;n+=1)pn(t[n],this.#i,this.#s)}capture(t,n,r=!1){t.v!==m&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&H)===0&&(this.current.set(t,[n,r]),D?.set(t,n)),this.is_fork||(t.v=n)}activate(){w=this}deactivate(){w=null,D=null}flush(){try{Ie=!0,w=this,this.#_()}finally{nt=0,je=null,se=null,Te=null,Ie=!1,w=null,D=null,X.clear()}}discard(){for(const t of this.#a)t(this);this.#a.clear(),G.delete(this)}register_created_effect(t){this.#h.push(t)}#y(){for(const a of G){var t=a.id<this.id,n=[];for(const[c,[_,p]]of this.current){if(a.current.has(c)){var r=a.current.get(c)[0];if(t&&_!==r)a.current.set(c,[_,p]);else continue}n.push(c)}var s=[...a.current.keys()].filter(c=>!this.current.has(c));if(s.length===0)t&&a.discard();else if(n.length>0){if(t)for(const c of this.#o)a.unskip_effect(c,_=>{(_.f&(M|pe))!==0?a.schedule(_):a.#d([_])});a.activate();var i=new Set,o=new Map;for(var l of n)yt(l,s,i,o);o=new Map;var f=[...a.current.keys()].filter(c=>this.current.has(c)?this.current.get(c)[0]!==c:!0);for(const c of this.#h)(c.f&(C|I|Me))===0&&ze(c,f,o)&&((c.f&(pe|M))!==0?(y(c,T),a.schedule(c)):a.#i.add(c));if(a.#e.length>0){a.apply();for(var u of a.#e)a.#p(u,[],[]);a.#e=[]}a.deactivate()}}for(const a of G)a.#l.has(this)&&(a.#l.delete(this),a.#l.size===0&&!a.#c()&&(a.activate(),a.#_()))}increment(t,n){let r=this.#r.get(n)??0;if(this.#r.set(n,r+1),t){let s=this.#t.get(n)??0;this.#t.set(n,s+1)}}decrement(t,n,r){let s=this.#r.get(n)??0;if(s===1?this.#r.delete(n):this.#r.set(n,s-1),t){let i=this.#t.get(n)??0;i===1?this.#t.delete(n):this.#t.set(n,i-1)}this.#u||r||(this.#u=!0,tt(()=>{this.#u=!1,this.flush()}))}transfer_effects(t,n){for(const r of t)this.#i.add(r);for(const r of n)this.#s.add(r);t.clear(),n.clear()}oncommit(t){this.#f.add(t)}ondiscard(t){this.#a.add(t)}settled(){return(this.#v??=ot()).promise}static ensure(){if(w===null){const t=w=new B;Ie||(G.add(w),he||tt(()=>{w===t&&t.flush()}))}return w}apply(){{D=null;return}}schedule(t){if(je=t,t.b?.is_pending&&(t.f&(le|ye|ut))!==0&&(t.f&re)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(se!==null&&n===v&&(d===null||(d.f&b)===0))return;if((r&(J|F))!==0){if((r&g)===0)return;n.f^=g}}this.#e.push(n)}}function yn(e){var t=he;he=!0;try{for(var n;;){if(dn(),w===null)return n;w.flush()}}finally{he=t}}function gn(){try{nn()}catch(e){Re(e,je)}}let Y=null;function rt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(C|I))===0&&Ee(r)&&(Y=new Set,oe(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Pt(r),Y?.size>0)){X.clear();for(const s of Y){if((s.f&(C|I))!==0)continue;const i=[s];let o=s.parent;for(;o!==null;)Y.has(o)&&(Y.delete(o),i.push(o)),o=o.parent;for(let l=i.length-1;l>=0;l--){const f=i[l];(f.f&(C|I))===0&&oe(f)}}Y.clear()}}Y=null}}function yt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const i=s.f;(i&b)!==0?yt(s,t,n,r):(i&(pe|M))!==0&&(i&T)===0&&ze(s,t,r)&&(y(s,T),Ge(s))}}function ze(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(ie.call(t,s))return!0;if((s.f&b)!==0&&ze(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function Ge(e){w.schedule(e)}function gt(e,t){if(!((e.f&F)!==0&&(e.f&g)!==0)){(e.f&T)!==0?t.d.push(e):(e.f&j)!==0&&t.m.push(e),y(e,g);for(var n=e.first;n!==null;)gt(n,t),n=n.next}}function mt(e){y(e,g);for(var t=e.first;t!==null;)mt(t),t=t.next}function mn(e,t,n,r){const s=me()?Ke:Tn;var i=e.filter(_=>!_.settled);if(n.length===0&&i.length===0){r(t.map(s));return}var o=v,l=En(),f=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(_=>_.promise)):null;function u(_){l();try{r(_)}catch(p){(o.f&C)===0&&Re(p,o)}ke()}if(n.length===0){f.then(()=>u(t.map(s)));return}var a=Et();function c(){Promise.all(n.map(_=>bn(_))).then(_=>u([...t.map(s),..._])).catch(_=>Re(_,o)).finally(()=>a())}f?f.then(()=>{l(),c(),ke()}):c()}function En(){var e=v,t=d,n=E,r=w;return function(i=!0){ae(e),V(t),Ae(n),i&&(e.f&C)===0&&(r?.activate(),r?.apply())}}function ke(e=!0){ae(null),V(null),Ae(null),e&&w?.deactivate()}function Et(){var e=v,t=e.b,n=w,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(s=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,s)}}function Ke(e){var t=b|T,n=d!==null&&(d.f&b)!==0?d:null;return v!==null&&(v.f|=ge),{ctx:E,deps:null,effects:null,equals:dt,f:t,fn:e,reactions:null,rv:0,v:m,wv:0,parent:n??v,ac:null}}function bn(e,t,n){let r=v;r===null&&Jt();var s=void 0,i=We(m),o=!d,l=new Map;return In(()=>{var f=v,u=ot();s=u.promise;try{Promise.resolve(e()).then(u.resolve,u.reject).finally(ke)}catch(p){u.reject(p),ke()}var a=w;if(o){if((f.f&re)!==0)var c=Et();if(r.b.is_rendered())l.get(a)?.reject(q),l.delete(a);else{for(const p of l.values())p.reject(q);l.clear()}l.set(a,u)}const _=(p,h=void 0)=>{if(c){var N=h===q;c(N)}if(!(h===q||(f.f&C)!==0)){if(a.activate(),h)i.f|=H,Ye(i,h);else{(i.f&H)!==0&&(i.f^=H),Ye(i,p);for(const[ue,be]of l){if(l.delete(ue),ue===a)break;be.reject(q)}}a.deactivate()}};u.promise.then(_,p=>_(null,p||"unknown"))}),Pn(()=>{for(const f of l.values())f.reject(q)}),new Promise(f=>{function u(a){function c(){a===s?f(i):u(s)}a.then(c,c)}u(s)})}function hr(e){const t=Ke(e);return Mt(t),t}function Tn(e){const t=Ke(e);return t.equals=vt,t}function xn(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)te(t[n])}}function Sn(e){for(var t=e.parent;t!==null;){if((t.f&b)===0)return(t.f&C)===0?t:null;t=t.parent}return null}function $e(e){var t,n=v;ae(Sn(e));try{e.f&=~Q,xn(e),t=Yt(e)}finally{ae(n)}return t}function bt(e){var t=$e(e);if(!e.equals(t)&&(e.wv=jt(),(!w?.is_fork||e.deps===null)&&(w!==null?w.capture(e,t,!0):e.v=t,e.deps===null))){y(e,g);return}ne||(D!==null?(Ot()||w?.is_fork)&&D.set(e,t):Ve(e))}function An(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(q),t.teardown=Kt,t.ac=null,we(t,0),Je(t))}function Tt(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&oe(t)}let Le=new Set;const X=new Map;let xt=!1;function We(e,t){var n={f:0,v:e,reactions:null,equals:dt,rv:0,wv:0};return n}function U(e,t){const n=We(e);return Mt(n),n}function pr(e,t=!1,n=!0){const r=We(e);return t||(r.equals=vt),De&&n&&E!==null&&E.l!==null&&(E.l.s??=[]).push(r),r}function K(e,t,n=!1){d!==null&&(!P||(d.f&Me)!==0)&&me()&&(d.f&(b|M|pe|Me))!==0&&(O===null||!ie.call(O,e))&&ln();let r=n?ce(t):t;return Ye(e,r,Te)}function Ye(e,t,n=null){if(!e.equals(t)){X.set(e,ne?t:e.v);var r=B.ensure();if(r.capture(e,t),(e.f&b)!==0){const s=e;(e.f&T)!==0&&$e(s),D===null&&Ve(s)}e.wv=jt(),St(e,T,n),me()&&v!==null&&(v.f&g)!==0&&(v.f&(F|J))===0&&(R===null?jn([e]):R.push(e)),!r.is_fork&&Le.size>0&&!xt&&Rn()}return t}function Rn(){xt=!1;for(const e of Le)(e.f&g)!==0&&y(e,j),Ee(e)&&oe(e);Le.clear()}function Ce(e){K(e,e.v+1)}function St(e,t,n){var r=e.reactions;if(r!==null)for(var s=me(),i=r.length,o=0;o<i;o++){var l=r[o],f=l.f;if(!(!s&&l===v)){var u=(f&T)===0;if(u&&y(l,t),(f&b)!==0){var a=l;D?.delete(a),(f&Q)===0&&(f&k&&(l.f|=Q),St(a,j,n))}else if(u){var c=l;(f&M)!==0&&Y!==null&&Y.add(c),n!==null?n.push(c):Ge(c)}}}}function ce(e){if(typeof e!="object"||e===null||ve in e)return e;const t=at(e);if(t!==zt&&t!==Gt)return e;var n=new Map,r=Ht(e),s=U(0),i=Z,o=l=>{if(Z===i)return l();var f=d,u=Z;V(null),ft(i);var a=l();return V(f),ft(u),a};return r&&n.set("length",U(e.length)),new Proxy(e,{defineProperty(l,f,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&rn();var a=n.get(f);return a===void 0?o(()=>{var c=U(u.value);return n.set(f,c),c}):K(a,u.value,!0),!0},deleteProperty(l,f){var u=n.get(f);if(u===void 0){if(f in l){const a=o(()=>U(m));n.set(f,a),Ce(s)}}else K(u,m),Ce(s);return!0},get(l,f,u){if(f===ve)return e;var a=n.get(f),c=f in l;if(a===void 0&&(!c||de(l,f)?.writable)&&(a=o(()=>{var p=ce(c?l[f]:m),h=U(p);return h}),n.set(f,a)),a!==void 0){var _=_e(a);return _===m?void 0:_}return Reflect.get(l,f,u)},getOwnPropertyDescriptor(l,f){var u=Reflect.getOwnPropertyDescriptor(l,f);if(u&&"value"in u){var a=n.get(f);a&&(u.value=_e(a))}else if(u===void 0){var c=n.get(f),_=c?.v;if(c!==void 0&&_!==m)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return u},has(l,f){if(f===ve)return!0;var u=n.get(f),a=u!==void 0&&u.v!==m||Reflect.has(l,f);if(u!==void 0||v!==null&&(!a||de(l,f)?.writable)){u===void 0&&(u=o(()=>{var _=a?ce(l[f]):m,p=U(_);return p}),n.set(f,u));var c=_e(u);if(c===m)return!1}return a},set(l,f,u,a){var c=n.get(f),_=f in l;if(r&&f==="length")for(var p=u;p<c.v;p+=1){var h=n.get(p+"");h!==void 0?K(h,m):p in l&&(h=o(()=>U(m)),n.set(p+"",h))}if(c===void 0)(!_||de(l,f)?.writable)&&(c=o(()=>U(void 0)),K(c,ce(u)),n.set(f,c));else{_=c.v!==m;var N=o(()=>ce(u));K(c,N)}var ue=Reflect.getOwnPropertyDescriptor(l,f);if(ue?.set&&ue.set.call(a,u),!_){if(r&&typeof f=="string"){var be=n.get("length"),Pe=Number(f);Number.isInteger(Pe)&&Pe>=be.v&&K(be,Pe+1)}Ce(s)}return!0},ownKeys(l){_e(s);var f=Reflect.ownKeys(l).filter(c=>{var _=n.get(c);return _===void 0||_.v!==m});for(var[u,a]of n)a.v!==m&&!(u in l)&&f.push(u);return f},setPrototypeOf(){sn()}})}var st,kn,On,At,Rt;function wr(){if(st===void 0){st=window,kn=document,On=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;At=de(t,"firstChild").get,Rt=de(t,"nextSibling").get,Qe(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Qe(n)&&(n.__t=void 0)}}function Oe(e=""){return document.createTextNode(e)}function qe(e){return At.call(e)}function z(e){return Rt.call(e)}function yr(e,t){if(!ee)return qe(e);var n=qe(S);if(n===null)n=S.appendChild(Oe());else if(t&&n.nodeType!==Ne){var r=Oe();return n?.before(r),fe(r),r}return t&&Xe(n),fe(n),n}function gr(e,t=!1){if(!ee){var n=qe(e);return n instanceof Comment&&n.data===""?z(n):n}if(t){if(S?.nodeType!==Ne){var r=Oe();return S?.before(r),fe(r),r}Xe(S)}return S}function mr(e,t=1,n=!1){let r=ee?S:e;for(var s;t--;)s=r,r=z(r);if(!ee)return r;if(n){if(r?.nodeType!==Ne){var i=Oe();return r===null?s?.after(i):r.before(i),fe(i),i}Xe(r)}return fe(r),r}function Er(e){e.textContent=""}function br(){return!1}function Tr(e,t,n){return document.createElementNS(un,e,void 0)}function Xe(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Ne;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}let it=!1;function Nn(){it||(it=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Ze(e){var t=d,n=v;V(null),ae(null);try{return e()}finally{V(t),ae(n)}}function xr(e,t,n,r=n){e.addEventListener(t,()=>Ze(n));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),Nn()}function kt(e){v===null&&(d===null&&tn(),en()),ne&&Qt()}function Dn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function L(e,t){var n=v;n!==null&&(n.f&I)!==0&&(e|=I);var r={ctx:E,deps:null,nodes:null,f:e|T|k,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};w?.register_created_effect(r);var s=r;if((e&le)!==0)se!==null?se.push(r):B.ensure().schedule(r);else if(t!==null){try{oe(r)}catch(o){throw te(r),o}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&ge)===0&&(s=s.first,(e&M)!==0&&(e&Se)!==0&&s!==null&&(s.f|=Se))}if(s!==null&&(s.parent=n,n!==null&&Dn(s,n),d!==null&&(d.f&b)!==0&&(e&J)===0)){var i=d;(i.effects??=[]).push(s)}return r}function Ot(){return d!==null&&!P}function Pn(e){const t=L(ye,null);return y(t,g),t.teardown=e,t}function Sr(e){kt();var t=v.f,n=!d&&(t&F)!==0&&(t&re)===0;if(n){var r=E;(r.e??=[]).push(e)}else return Nt(e)}function Nt(e){return L(le|ct,e)}function Ar(e){return kt(),L(ye|ct,e)}function Rr(e){B.ensure();const t=L(J|ge,e);return(n={})=>new Promise(r=>{n.outro?Fn(t,()=>{te(t),r(void 0)}):(te(t),r(void 0))})}function kr(e){return L(le,e)}function In(e){return L(pe|ge,e)}function Or(e,t=0){return L(ye|t,e)}function Nr(e,t=[],n=[],r=[]){mn(r,t,n,s=>{L(ye,()=>e(...s.map(_e)))})}function Dr(e,t=0){var n=L(M|t,e);return n}function Pr(e){return L(F|ge,e)}function Dt(e){var t=e.teardown;if(t!==null){const n=ne,r=d;lt(!0),V(null);try{t.call(null)}finally{lt(n),V(r)}}}function Je(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&Ze(()=>{s.abort(q)});var r=n.next;(n.f&J)!==0?n.parent=null:te(n,t),n=r}}function Cn(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&F)===0&&te(t),t=n}}function te(e,t=!0){var n=!1;(t||(e.f&Xt)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Mn(e.nodes.start,e.nodes.end),n=!0),y(e,et),Je(e,t&&!n),we(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const i of r)i.stop();Dt(e),e.f^=et,e.f|=C;var s=e.parent;s!==null&&s.first!==null&&Pt(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Mn(e,t){for(;e!==null;){var n=e===t?null:z(e);e.remove(),e=n}}function Pt(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Fn(e,t,n=!0){var r=[];It(e,r,!0);var s=()=>{n&&te(e),t&&t()},i=r.length;if(i>0){var o=()=>--i||s();for(var l of r)l.out(o)}else s()}function It(e,t,n){if((e.f&I)===0){e.f^=I;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&t.push(l);for(var s=e.first;s!==null;){var i=s.next,o=(s.f&Se)!==0||(s.f&F)!==0&&(e.f&M)!==0;It(s,t,o?n:!1),s=i}}}function Ir(e){Ct(e,!0)}function Ct(e,t){if((e.f&I)!==0){e.f^=I,(e.f&g)===0&&(y(e,T),B.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Se)!==0||(n.f&F)!==0;Ct(n,s?t:!1),n=r}var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)(o.is_global||t)&&o.in()}}function Cr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:z(n);t.append(n),n=s}}let xe=!1,ne=!1;function lt(e){ne=e}let d=null,P=!1;function V(e){d=e}let v=null;function ae(e){v=e}let O=null;function Mt(e){d!==null&&(O===null?O=[e]:O.push(e))}let x=null,A=0,R=null;function jn(e){R=e}let Ft=1,W=0,Z=W;function ft(e){Z=e}function jt(){return++Ft}function Ee(e){var t=e.f;if((t&T)!==0)return!0;if(t&b&&(e.f&=~Q),(t&j)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var i=n[s];if(Ee(i)&&bt(i),i.wv>e.wv)return!0}(t&k)!==0&&D===null&&y(e,g)}return!1}function Lt(e,t,n=!0){var r=e.reactions;if(r!==null&&!(O!==null&&ie.call(O,e)))for(var s=0;s<r.length;s++){var i=r[s];(i.f&b)!==0?Lt(i,t,!1):t===i&&(n?y(i,T):(i.f&g)!==0&&y(i,j),Ge(i))}}function Yt(e){var t=x,n=A,r=R,s=d,i=O,o=E,l=P,f=Z,u=e.f;x=null,A=0,R=null,d=(u&(F|J))===0?e:null,O=null,Ae(e.ctx),P=!1,Z=++W,e.ac!==null&&(Ze(()=>{e.ac.abort(q)}),e.ac=null);try{e.f|=Fe;var a=e.fn,c=a();e.f|=re;var _=e.deps,p=w?.is_fork;if(x!==null){var h;if(p||we(e,A),_!==null&&A>0)for(_.length=A+x.length,h=0;h<x.length;h++)_[A+h]=x[h];else e.deps=_=x;if(Ot()&&(e.f&k)!==0)for(h=A;h<_.length;h++)(_[h].reactions??=[]).push(e)}else!p&&_!==null&&A<_.length&&(we(e,A),_.length=A);if(me()&&R!==null&&!P&&_!==null&&(e.f&(b|j|T))===0)for(h=0;h<R.length;h++)Lt(R[h],e);if(s!==null&&s!==e){if(W++,s.deps!==null)for(let N=0;N<n;N+=1)s.deps[N].rv=W;if(t!==null)for(const N of t)N.rv=W;R!==null&&(r===null?r=R:r.push(...R))}return(e.f&H)!==0&&(e.f^=H),c}catch(N){return vn(N)}finally{e.f^=Fe,x=t,A=n,R=r,d=s,O=i,Ae(o),P=l,Z=f}}function Ln(e,t){let n=t.reactions;if(n!==null){var r=Bt.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&b)!==0&&(x===null||!ie.call(x,t))){var i=t;(i.f&k)!==0&&(i.f^=k,i.f&=~Q),i.v!==m&&Ve(i),An(i),we(i,0)}}function we(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Ln(e,n[r])}function oe(e){var t=e.f;if((t&C)===0){y(e,g);var n=v,r=xe;v=e,xe=!0;try{(t&(M|ut))!==0?Cn(e):Je(e),Dt(e);var s=Yt(e);e.teardown=typeof s=="function"?s:null,e.wv=Ft;var i}finally{xe=r,v=n}}}async function Mr(){await Promise.resolve(),yn()}function Fr(){return B.ensure().settled()}function _e(e){var t=e.f,n=(t&b)!==0;if(d!==null&&!P){var r=v!==null&&(v.f&C)!==0;if(!r&&(O===null||!ie.call(O,e))){var s=d.deps;if((d.f&Fe)!==0)e.rv<W&&(e.rv=W,x===null&&s!==null&&s[A]===e?A++:x===null?x=[e]:x.push(e));else{(d.deps??=[]).push(e);var i=e.reactions;i===null?e.reactions=[d]:ie.call(i,d)||i.push(d)}}}if(ne&&X.has(e))return X.get(e);if(n){var o=e;if(ne){var l=o.v;return((o.f&g)===0&&o.reactions!==null||Ut(o))&&(l=$e(o)),X.set(o,l),l}var f=(o.f&k)===0&&!P&&d!==null&&(xe||(d.f&k)!==0),u=(o.f&re)===0;Ee(o)&&(f&&(o.f|=k),bt(o)),f&&!u&&(Tt(o),qt(o))}if(D?.has(e))return D.get(e);if((e.f&H)!==0)throw e.v;return e.v}function qt(e){if(e.f|=k,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&b)!==0&&(t.f&k)===0&&(Tt(t),qt(t))}function Ut(e){if(e.v===m)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(X.has(t)||(t.f&b)!==0&&Ut(t))return!0;return!1}function jr(e){var t=P;try{return P=!0,e()}finally{P=t}}function Lr(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(ve in e)Ue(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&ve in n&&Ue(n)}}}function Ue(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Ue(e[r],t)}catch{}const n=at(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=Vt(n);for(let s in r){const i=r[s].get;if(i)try{i.call(e)}catch{}}}}}export{kn as $,Oe as A,ge as B,_t as C,z as D,Se as E,sr as F,fe as G,Xt as H,zn as I,S as J,qe as K,Bn as L,Ar as M,un as N,$t as O,Un as P,Lr as Q,Ke as R,ur as S,kr as T,Ot as U,We as V,Ce as W,v as X,Wt as Y,ir as Z,an as _,vr as a,nr as a0,Pr as a1,Fn as a2,Cr as a3,pn as a4,ae as a5,V as a6,Ae as a7,B as a8,vn as a9,or as aA,et as aB,ve as aC,de as aD,Kn as aE,Zn as aF,ce as aG,ne as aH,C as aI,Jn as aJ,Xn as aK,Wn as aL,Tn as aM,Qn as aN,Hn as aO,yn as aP,pr as aQ,hr as aR,Ir as aS,br as aT,Kt as aU,cn as aV,Fr as aW,d as aa,Ye as ab,te as ac,ar as ad,Re as ae,$n as af,rr as ag,qn as ah,Pn as ai,Ze as aj,Tr as ak,On as al,er as am,tr as an,re as ao,Ne as ap,Xe as aq,wr as ar,fn as as,He as at,Gn as au,Er as av,Rr as aw,Yn as ax,on as ay,Be as az,U as b,yr as c,K as d,E as e,gr as f,_e as g,De as h,jr as i,_r as j,cr as k,Zt as l,ee as m,fr as n,Nn as o,dr as p,tt as q,lr as r,mr as s,Nr as t,Sr as u,xr as v,w,Mr as x,Or as y,Dr as z};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/CahBYLSE.js

```js
import{l as o,u as l,e as t,h as u,i as a}from"./3TW-MQft.js";function s(e){t===null&&o(),u&&t.l!==null?c(t).m.push(e):l(()=>{const n=a(e);if(typeof n=="function")return n})}function c(e){var n=e.l;return n.u??={a:[],b:[],m:[]}}export{s as o};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/CcgZgiL9.js

```js
import{U as re,g as G,y as ne,V as J,i as se,W as Y,q as N,J as u,m as _,X as g,Y as q,z as ae,Z as X,_ as ie,a0 as z,a1 as m,A as R,a2 as F,w as U,a3 as oe,a4 as fe,a5 as M,a6 as L,a7 as $,a8 as le,a9 as he,aa as K,e as Z,ab as de,ac as C,G as S,n as ue,ad as ce,ae as A,E as _e,B as pe,af as ve,ag as ge,ah as ye,ai as me,aj as Te,ak as Ee,K as I,al as be,am as we,an as Ne,ao as Re,ap as Se,aq as Ae,ar as k,C as Q,as as De,D as Oe,at as P,F as D,au as Me,av as Le,aw as xe,ax as Fe,p as Ce,ay as Ie,az as ke,a as Pe}from"./3TW-MQft.js";function He(t){let e=0,r=J(0),s;return()=>{re()&&(G(r),ne(()=>(e===0&&(s=se(()=>t(()=>Y(r)))),e+=1,()=>{N(()=>{e-=1,e===0&&(s?.(),s=void 0,Y(r))})})))}}var Be=_e|pe;function Ve(t,e,r,s){new We(t,e,r,s)}class We{parent;is_pending=!1;transform_error;#t;#_=_?u:null;#s;#l;#e;#a=null;#r=null;#n=null;#i=null;#h=0;#f=0;#d=!1;#p=new Set;#v=new Set;#o=null;#m=He(()=>(this.#o=J(this.#h),()=>{this.#o=null}));constructor(e,r,s,a){this.#t=e,this.#s=r,this.#l=n=>{var i=g;i.b=this,i.f|=q,s(n)},this.parent=g.b,this.transform_error=a??this.parent?.transform_error??(n=>n),this.#e=ae(()=>{if(_){const n=this.#_;X();const i=n.data===ie;if(n.data.startsWith(z)){const o=JSON.parse(n.data.slice(z.length));this.#E(o)}else i?this.#b():this.#T()}else this.#g()},Be),_&&(this.#t=u)}#T(){try{this.#a=m(()=>this.#l(this.#t))}catch(e){this.error(e)}}#E(e){const r=this.#s.failed;r&&(this.#n=m(()=>{r(this.#t,()=>e,()=>()=>{})}))}#b(){const e=this.#s.pending;e&&(this.is_pending=!0,this.#r=m(()=>e(this.#t)),N(()=>{var r=this.#i=document.createDocumentFragment(),s=R();r.append(s),this.#a=this.#c(()=>m(()=>this.#l(s))),this.#f===0&&(this.#t.before(r),this.#i=null,F(this.#r,()=>{this.#r=null}),this.#u(U))}))}#g(){try{if(this.is_pending=this.has_pending_snippet(),this.#f=0,this.#h=0,this.#a=m(()=>{this.#l(this.#t)}),this.#f>0){var e=this.#i=document.createDocumentFragment();oe(this.#a,e);const r=this.#s.pending;this.#r=m(()=>r(this.#t))}else this.#u(U)}catch(r){this.error(r)}}#u(e){this.is_pending=!1,e.transfer_effects(this.#p,this.#v)}defer_effect(e){fe(e,this.#p,this.#v)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#s.pending}#c(e){var r=g,s=K,a=Z;M(this.#e),L(this.#e),$(this.#e.ctx);try{return le.ensure(),e()}catch(n){return he(n),null}finally{M(r),L(s),$(a)}}#y(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e,r);return}this.#f+=e,this.#f===0&&(this.#u(r),this.#r&&F(this.#r,()=>{this.#r=null}),this.#i&&(this.#t.before(this.#i),this.#i=null))}update_pending_count(e,r){this.#y(e,r),this.#h+=e,!(!this.#o||this.#d)&&(this.#d=!0,N(()=>{this.#d=!1,this.#o&&de(this.#o,this.#h)}))}get_effect_pending(){return this.#m(),G(this.#o)}error(e){var r=this.#s.onerror;let s=this.#s.failed;if(!r&&!s)throw e;this.#a&&(C(this.#a),this.#a=null),this.#r&&(C(this.#r),this.#r=null),this.#n&&(C(this.#n),this.#n=null),_&&(S(this.#_),ue(),S(ce()));var a=!1,n=!1;const i=()=>{if(a){ge();return}a=!0,n&&ve(),this.#n!==null&&F(this.#n,()=>{this.#n=null}),this.#c(()=>{this.#g()})},c=o=>{try{n=!0,r?.(o,i),n=!1}catch(f){A(f,this.#e&&this.#e.parent)}s&&(this.#n=this.#c(()=>{try{return m(()=>{var f=g;f.b=this,f.f|=q,s(this.#t,()=>o,()=>i)})}catch(f){return A(f,this.#e.parent),null}}))};N(()=>{var o;try{o=this.transform_error(e)}catch(f){A(f,this.#e&&this.#e.parent);return}o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(c,f=>A(f,this.#e&&this.#e.parent)):c(o)})}}const Ye=["touchstart","touchmove"];function qe(t){return Ye.includes(t)}const w=Symbol("events"),ee=new Set,H=new Set;function ze(t,e,r,s={}){function a(n){if(s.capture||B.call(e,n),!n.cancelBubble)return Te(()=>r?.call(this,n))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?N(()=>{e.addEventListener(t,a,s)}):e.addEventListener(t,a,s),a}function Ke(t,e,r,s,a){var n={capture:s,passive:a},i=ze(t,e,r,n);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&me(()=>{e.removeEventListener(t,i,n)})}function Ze(t,e,r){(e[w]??={})[t]=r}function Qe(t){for(var e=0;e<t.length;e++)ee.add(t[e]);for(var r of H)r(t)}let j=null;function B(t){var e=this,r=e.ownerDocument,s=t.type,a=t.composedPath?.()||[],n=a[0]||t.target;j=t;var i=0,c=j===t&&t[w];if(c){var o=a.indexOf(c);if(o!==-1&&(e===document||e===window)){t[w]=e;return}var f=a.indexOf(e);if(f===-1)return;o<=f&&(i=o)}if(n=a[i]||t.target,n!==e){ye(t,"currentTarget",{configurable:!0,get(){return n||r}});var T=K,b=g;L(null),M(null);try{for(var v,h=[];n!==null;){var l=n.assignedSlot||n.parentNode||n.host||null;try{var d=n[w]?.[s];d!=null&&(!n.disabled||t.target===n)&&d.call(n,t)}catch(p){v?h.push(p):v=p}if(t.cancelBubble||l===e||l===null)break;n=l}if(v){for(let p of h)queueMicrotask(()=>{throw p});throw v}}finally{t[w]=e,delete t.currentTarget,L(T),M(b)}}}const Ue=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function $e(t){return Ue?.createHTML(t)??t}function je(t){var e=Ee("template");return e.innerHTML=$e(t.replaceAll("<!>","<!---->")),e.content}function y(t,e){var r=g;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function et(t,e){var r=(e&we)!==0,s=(e&Ne)!==0,a,n=!t.startsWith("<!>");return()=>{if(_)return y(u,null),u;a===void 0&&(a=je(n?t:"<!>"+t),r||(a=I(a)));var i=s||be?document.importNode(a,!0):a.cloneNode(!0);if(r){var c=I(i),o=i.lastChild;y(c,o)}else y(i,i);return i}}function tt(t=""){if(!_){var e=R(t+"");return y(e,e),e}var r=u;return r.nodeType!==Se?(r.before(r=R()),S(r)):Ae(r),y(r,r),r}function rt(){if(_)return y(u,null),u;var t=document.createDocumentFragment(),e=document.createComment(""),r=R();return t.append(e,r),y(e,r),t}function nt(t,e){if(_){var r=g;((r.f&Re)===0||r.nodes.end===null)&&(r.nodes.end=u),X();return}t!==null&&t.before(e)}function st(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=`${r}`)}function Ge(t,e){return te(t,e)}function at(t,e){k(),e.intro=e.intro??!1;const r=e.target,s=_,a=u;try{for(var n=I(r);n&&(n.nodeType!==Q||n.data!==De);)n=Oe(n);if(!n)throw P;D(!0),S(n);const i=te(t,{...e,anchor:n});return D(!1),i}catch(i){if(i instanceof Error&&i.message.split(`
`).some(c=>c.startsWith("https://svelte.dev/e/")))throw i;return i!==P&&console.warn("Failed to hydrate: ",i),e.recover===!1&&Me(),k(),Le(r),D(!1),Ge(t,e)}finally{D(s),S(a)}}const O=new Map;function te(t,{target:e,anchor:r,props:s={},events:a,context:n,intro:i=!0,transformError:c}){k();var o=void 0,f=xe(()=>{var T=r??e.appendChild(R());Ve(T,{pending:()=>{}},h=>{Ce({});var l=Z;if(n&&(l.c=n),a&&(s.$$events=a),_&&y(h,null),o=t(h,s)||{},_&&(g.nodes.end=u,u===null||u.nodeType!==Q||u.data!==Ie))throw ke(),P;Pe()},c);var b=new Set,v=h=>{for(var l=0;l<h.length;l++){var d=h[l];if(!b.has(d)){b.add(d);var p=qe(d);for(const x of[e,document]){var E=O.get(x);E===void 0&&(E=new Map,O.set(x,E));var W=E.get(d);W===void 0?(x.addEventListener(d,B,{passive:p}),E.set(d,1)):E.set(d,W+1)}}}};return v(Fe(ee)),H.add(v),()=>{for(var h of b)for(const p of[e,document]){var l=O.get(p),d=l.get(h);--d==0?(p.removeEventListener(h,B),l.delete(h),l.size===0&&O.delete(p)):l.set(h,d)}H.delete(v),T!==r&&T.parentNode?.removeChild(T)}});return V.set(o,f),o}let V=new WeakMap;function it(t,e){const r=V.get(t);return r?(V.delete(t),r(e)):Promise.resolve()}const Je="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Je);export{nt as a,Ze as b,rt as c,Qe as d,Ke as e,et as f,at as h,Ge as m,st as s,tt as t,it as u};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/CifMVRjc.js

```js
import{_ as x,a as z,g as A}from"./HWAjEwF5.js";var C=10240,D=["image/","audio/","video/","application/octet-stream","font/"];function q(e){return e?D.some(function(n){return e.toLowerCase().startsWith(n)}):!1}function N(e){if(e!=null){if(typeof e=="string")return e;if(e instanceof URLSearchParams)return e.toString();if(e instanceof FormData){var n=[];return e.forEach(function(t,i){n.push("".concat(i,"=").concat(typeof t=="string"?t:"[File]"))}),n.join("&")}}}function k(e,n){if(new Blob([e]).size<=n)return{value:e,truncated:!1};for(var t=0,i=Math.min(e.length,n);t<i;){var s=Math.ceil((t+i)/2);new Blob([e.slice(0,s)]).size<=n?t=s:i=s-1}return t>0&&e.charCodeAt(t-1)>=55296&&e.charCodeAt(t-1)<=56319&&(t-=1),{value:e.slice(0,t),truncated:!0}}var R=(function(){function e(){this.fetchObserver=null}return e.prototype.start=function(n,t){this.eventCallback=n,this.networkConfig=t,this.observeFetch()},e.prototype.stop=function(){var n;(n=this.fetchObserver)===null||n===void 0||n.call(this),this.fetchObserver=null,this.eventCallback=void 0,this.networkConfig=void 0},e.prototype.notifyEvent=function(n){var t;(t=this.eventCallback)===null||t===void 0||t.call(this,n)},e.prototype.observeFetch=function(){var n=this,t=A();if(t){var i=t.fetch;i&&(t.fetch=function(s,o){return x(n,void 0,void 0,function(){var d,r,a,h,b,u,l,v,g,w,p,l,y,B=this,m,E;return z(this,function(f){switch(f.label){case 0:d=Date.now(),r={timestamp:d,type:"fetch",method:o?.method||"GET",url:s.toString(),requestHeaders:o?.headers},a=(m=this.networkConfig)===null||m===void 0?void 0:m.body,a?.request&&(h=N(o?.body),h!==void 0&&(b=(E=a.maxBodySizeBytes)!==null&&E!==void 0?E:C,r.requestBody=k(h,b).value)),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,i(s,o)];case 2:return u=f.sent(),l=Date.now(),r.status=u.status,r.duration=l-d,v={},u.headers.forEach(function(_,c){v[c]=_}),r.responseHeaders=v,a?.response?(g=v["content-type"]||null,q(g)?(r.responseBodyStatus="skipped_binary",this.notifyEvent(r)):(w=u.clone(),w.text().then(function(_){var c,T=(c=a.maxBodySizeBytes)!==null&&c!==void 0?c:C,S=k(_,T),O=S.value,F=S.truncated;r.responseBody=O,r.responseBodyStatus=F?"truncated":"captured",B.notifyEvent(r)},function(){r.responseBodyStatus="error",B.notifyEvent(r)}))):this.notifyEvent(r),[2,u];case 3:throw p=f.sent(),l=Date.now(),r.duration=l-d,y=p,r.error={name:y.name||"UnknownError",message:y.message||"An unknown error occurred"},this.notifyEvent(r),p;case 4:return[2]}})})},this.fetchObserver=function(){t.fetch=i})}},e})();export{R as NetworkObservers};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/CpUSghGZ.js

```js
import{aU as me,aV as wt,b as U,g as A,d as T,x as ne,aW as vt}from"./3TW-MQft.js";import{o as Be}from"./CahBYLSE.js";const D=[];function xe(e,t=me){let n=null;const r=new Set;function a(o){if(wt(e,o)&&(e=o,n)){const l=!D.length;for(const c of r)c[1](),D.push(c,e);if(l){for(let c=0;c<D.length;c+=2)D[c][0](D[c+1]);D.length=0}}}function i(o){a(o(e))}function s(o,l=me){const c=[o,l];return r.add(c),r.size===1&&(n=t(a,i)||me),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class Le{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ue{constructor(t,n){this.status=t,this.location=n}}class Ae extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function yt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function bt(e){return e.split("%25").map(decodeURI).join("%25")}function kt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function we({href:e}){return e.split("#")[0]}function Et(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function St(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Rt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&G.delete(Te(e)),Rt(e,t));const G=new Map;function xt(e,t){const n=Te(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&G.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=St(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Lt(e,t,n){if(G.size>0){const r=Te(e,n),a=G.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);G.delete(r)}}return window.fetch(t,n)}function Te(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Et(...a)}"]`}return r}const Ut=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function At(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${It(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ve(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ve(String.fromCharCode(...l.slice(2).split("-").map(_=>parseInt(_,16))));const f=Ut.exec(l),[,p,w,h,u]=f;return t.push({name:h,matcher:u,optional:!!p,rest:!!w,chained:w?c===1&&s[0]==="":!1}),w?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ve(l)}).join("")}).join("")}/?$`),params:t}}function Tt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function It(e){return e.slice(1).split("/").filter(Tt)}function Ot(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(f=>f).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const f=t[o+1],p=a[o+1];f&&!f.rest&&f.optional&&p&&l.chained&&(s=0),!f&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function ve(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Pt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,f]])=>{const{pattern:p,params:w}=At(o),h={id:o,exec:u=>{const _=p.exec(u);if(_)return Ot(_,w,r)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...c||[]].map(s),leaf:i(l)};return h.errors.length=h.layouts.length=Math.max(h.errors.length,h.layouts.length),h});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Je(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Ke(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const L=globalThis.__sveltekit_1bdh8ft?.base??"",$t=globalThis.__sveltekit_1bdh8ft?.assets??L??"",Ct="1775593135145",Xe="sveltekit:snapshot",Qe="sveltekit:scroll",Ze="sveltekit:states",jt="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},de=location.origin;function Ie(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Me={...j,"":j.hover};function et(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function tt(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=et(e)}}function ke(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||he(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===de&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function re(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=V(o,"preload-code")),a===null&&(a=V(o,"preload-data")),t===null&&(t=V(o,"keepfocus")),n===null&&(n=V(o,"noscroll")),i===null&&(i=V(o,"reload")),s===null&&(s=V(o,"replacestate")),o=et(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Me[r??"off"],preload_data:Me[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function We(e){const t=xe(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const nt={v:()=>{}};function Nt(){const{set:e,subscribe:t}=xe(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${$t}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==Ct;return s&&(e(!0),nt.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function he(e,t,n){return e.origin!==de||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function fn(e){}const rt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...rt];const qt=new Set([...rt]);[...qt];function Dt(e){return e.filter(t=>t!=null)}function Oe(e){return e instanceof Le||e instanceof Ae?e.status:500}function Vt(e){return e instanceof Ae?e.text:"Internal Error"}let E,J,ye;const Bt=Be.toString().includes("$$")||/function \w+\(\) \{\}/.test(Be.toString()),ze="a:";Bt?(E={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},J={current:null},ye={current:!1}):(E=new class{#e=U({});get data(){return A(this.#e)}set data(t){T(this.#e,t)}#t=U(null);get form(){return A(this.#t)}set form(t){T(this.#t,t)}#n=U(null);get error(){return A(this.#n)}set error(t){T(this.#n,t)}#r=U({});get params(){return A(this.#r)}set params(t){T(this.#r,t)}#a=U({id:null});get route(){return A(this.#a)}set route(t){T(this.#a,t)}#o=U({});get state(){return A(this.#o)}set state(t){T(this.#o,t)}#s=U(-1);get status(){return A(this.#s)}set status(t){T(this.#s,t)}#i=U(new URL(ze));get url(){return A(this.#i)}set url(t){T(this.#i,t)}},J=new class{#e=U(null);get current(){return A(this.#e)}set current(t){T(this.#e,t)}},ye=new class{#e=U(!1);get current(){return A(this.#e)}set current(t){T(this.#e,t)}},nt.v=()=>ye.current=!0);function Kt(e){Object.assign(E,e)}const Mt=new Set(["icon","shortcut icon","apple-touch-icon"]);let z=null;const C=Je(Qe)??{},X=Je(Xe)??{},$={url:We({}),page:We({}),navigating:xe(null),updated:Nt()};function Pe(e){C[e]=q()}function Wt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function Q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function at(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}function Fe(){}let $e,Ee,ae,I,Se,y;const oe=[],se=[];let R=null;function ie(){R?.fork?.then(e=>e?.discard()),R=null}const te=new Map,ot=new Set,zt=new Set,Y=new Set;let m={branch:[],error:null,url:null},st=!1,le=!1,Ge=!0,Z=!1,F=!1,it=!1,Ce=!1,lt,v,x,N;const ce=new Set,Ye=new Map;async function gn(e,t,n){globalThis.__sveltekit_1bdh8ft&&(globalThis.__sveltekit_1bdh8ft.query,globalThis.__sveltekit_1bdh8ft.prerender),document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),$e=Pt(e),I=document.documentElement,Se=t,Ee=e.nodes[0],ae=e.nodes[1],Ee(),ae(),v=history.state?.[B],x=history.state?.[H],v||(v=x=Date.now(),history.replaceState({...history.state,[B]:v,[H]:x},""));const r=C[v];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await an(Se,n)):(await K({type:"enter",url:Ie(y.hash?ln(new URL(location.href)):location.href),replace_state:!0}),a()),rn()}function Ft(){oe.length=0,Ce=!1}function ct(e){se.some(t=>t?.snapshot)&&(X[e]=se.map(t=>t?.snapshot?.capture()))}function ut(e){X[e]?.forEach((t,n)=>{se[n]?.snapshot?.restore(t)})}function He(){Pe(v),Ke(Qe,C),ct(x),Ke(Xe,X)}async function ft(e,t,n,r){let a;t.invalidateAll&&ie(),await K({type:"goto",url:Ie(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Ce=!0,a=[],Ye.forEach((i,s)=>{for(const o of i.keys())a.push(s+"/"+o)})),t.invalidate&&t.invalidate.forEach(nn)}}),t.invalidateAll&&ne().then(ne).then(()=>{Ye.forEach((i,s)=>{i.forEach(({resource:o},l)=>{a?.includes(s+"/"+l)&&o.refresh?.()})})})}async function Gt(e){if(e.id!==R?.id){ie();const t={};ce.add(t),R={id:e.id,token:t,promise:ht({...e,preload:t}).then(n=>(ce.delete(t),n.type==="loaded"&&n.state.error&&ie(),n)),fork:null}}return R.promise}async function be(e){const t=(await pe(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function dt(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(E,e.props.page),lt=new y.root({target:t,props:{...e.props,stores:$,components:se},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),ut(x),n){const i={from:null,to:{...r,scroll:C[v]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};Y.forEach(s=>s(i))}le=!0}async function ue({url:e,params:t,branch:n,errors:r,status:a,error:i,route:s,form:o}){let l="never";if(L&&(e.pathname===L||e.pathname===L+"/"))l="always";else for(const u of n)u?.slash!==void 0&&(l=u.slash);e.pathname=yt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:s},props:{constructors:Dt(n).map(u=>u.node.component),page:Ve(E)}};o!==void 0&&(c.props.form=o);let f={},p=!E,w=0;for(let u=0;u<Math.max(n.length,m.branch.length);u+=1){const _=n[u],g=m.branch[u];_?.data!==g?.data&&(p=!0),_&&(f={...f,..._.data},p&&(c.props[`data_${w}`]=f),w+=1)}return(!m.url||e.href!==m.url.href||m.error!==i||o!==void 0&&o!==E.form||p)&&(c.props.page={error:i,params:t,route:{id:s?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:p?f:E.data}),c}async function je({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null;const o={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:s,uses:o}:null,data:s??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function Yt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=le?Lt(r,a.href,t):xt(r,t);return{resolved:a,promise:i}}function Ht(e,t,n,r,a,i){if(Ce)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==m.params[s])return!0;for(const s of a.dependencies)if(oe.some(o=>o(new URL(s))))return!0;return!1}function Ne(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Jt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Xt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Ve(E),constructors:[]}}}async function ht({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(R?.id===e)return ce.delete(R.token),R.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(g=>g?.().catch(()=>{})),c.forEach(g=>g?.[1]().catch(()=>{}));const f=m.url?e!==fe(m.url):!1,p=m.route?a.id!==m.route.id:!1,w=Jt(m.url,n);let h=!1;const u=c.map(async(g,d)=>{if(!g)return;const b=m.branch[d];return g[1]===b?.loader&&!Ht(h,p,f,w,b.universal?.uses,r)?b:(h=!0,je({loader:g[1],url:n,params:r,route:a,parent:async()=>{const O={};for(let P=0;P<d;P+=1)Object.assign(O,(await u[P])?.data);return O},server_data_node:Ne(g[0]?{type:"skip"}:null,g[0]?b?.server:void 0)}))});for(const g of u)g.catch(()=>{});const _=[];for(let g=0;g<c.length;g+=1)if(c[g])try{_.push(await u[g])}catch(d){if(d instanceof Ue)return{type:"redirect",location:d.location};if(ce.has(i))return Xt({error:await ee(d,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=Oe(d),S;if(d instanceof Le)S=d.body;else{if(await $.updated.check())return await at(),await Q(n);S=await ee(d,{params:r,url:n,route:{id:a.id}})}const O=await Qt(g,_,s);return O?ue({url:n,params:r,branch:_.slice(0,O.idx).concat(O.node),errors:s,status:b,error:S,route:a}):await gt(n,{id:a.id},S,b)}else _.push(void 0);return ue({url:n,params:r,branch:_,errors:s,status:200,error:null,route:a,form:t?void 0:null})}async function Qt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function qe({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await je({loader:Ee,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ne(i)}),o={node:await ae(),loader:ae,universal:null,server:null,data:null};return ue({url:n,params:a,branch:[s,o],status:e,error:t,errors:[],route:null})}catch(s){if(s instanceof Ue)return ft(new URL(s.location,location.href),{},0);throw s}}async function Zt(e){const t=e.href;if(te.has(t))return te.get(t);let n;try{const r=(async()=>{let a=await y.hooks.reroute({url:new URL(e),fetch:async(i,s)=>Yt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);y.hash?i.hash=a:i.pathname=a,a=i}return a})();te.set(t,r),n=await r}catch{te.delete(t);return}return n}async function pe(e,t){if(e&&!he(e,L,y.hash)){const n=await Zt(e);if(!n)return;const r=en(n);for(const a of $e){const i=a.exec(r);if(i)return{id:fe(e),invalidating:t,route:a,params:kt(i),url:e}}}}function en(e){return bt(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function fe(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function pt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=De(m,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return Z||ot.forEach(c=>c(l)),s?null:o}async function K({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Fe,block:f=Fe,event:p}){const w=N;N=l;const h=await pe(t,!1),u=e==="enter"?De(m,h,t,e):pt({url:t,type:e,delta:n?.delta,intent:h,scroll:n?.scroll,event:p});if(!u){f(),N===l&&(N=w);return}const _=v,g=x;c(),Z=!0,le&&u.navigation.type!=="enter"&&$.navigating.set(J.current=u.navigation);let d=h&&await ht(h);if(!d){if(he(t,L,y.hash))return await Q(t,i);d=await gt(t,{id:null},await ee(new Ae(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=h?.url||t,N!==l)return u.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(o<20){await K({type:e,url:new URL(d.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),u.fulfil(void 0);return}d=await qe({status:500,error:await ee(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await $.updated.check()&&(await at(),await Q(t,i));if(Ft(),Pe(_),ct(g),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),s=n?n.state:s,!n){const k=i?0:1,M={[B]:v+=k,[H]:x+=k,[Ze]:s};(i?history.replaceState:history.pushState).call(history,M,"",t),i||Wt(v,x)}const b=h&&R?.id===h.id?R.fork:null;R?.fork&&!b&&ie(),R=null,d.props.page.state=s;let S;if(le){const k=(await Promise.all(Array.from(zt,W=>W(u.navigation)))).filter(W=>typeof W=="function");if(k.length>0){let W=function(){k.forEach(_e=>{Y.delete(_e)})};k.push(W),k.forEach(_e=>{Y.add(_e)})}const M=u.navigation.to;m={...d.state,nav:{params:M.params,route:M.route,url:M.url}},d.props.page&&(d.props.page.url=t);const ge=b&&await b;ge?S=ge.commit():(z=null,lt.$set(d.props),z&&Object.assign(d.props.page,z),Kt(d.props.page),S=vt?.()),it=!0}else await dt(d,Se,!1);const{activeElement:O}=document;await S,await ne(),await ne();let P=null;if(Ge){const k=n?n.scroll:a?q():null;k?scrollTo(k.x,k.y):(P=t.hash&&document.getElementById(_t(t)))?P.scrollIntoView():scrollTo(0,0)}const mt=document.activeElement!==O&&document.activeElement!==document.body;!r&&!mt&&sn(t,!P),Ge=!0,d.props.page&&(z&&Object.assign(d.props.page,z),Object.assign(E,d.props.page)),Z=!1,e==="popstate"&&ut(x),u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=q()),Y.forEach(k=>k(u.navigation)),$.navigating.set(J.current=null)}async function gt(e,t,n,r,a){return e.origin===de&&e.pathname===location.pathname&&!st?await qe({status:r,error:n,url:e,route:t}):await Q(e,a)}function tn(){let e,t={element:void 0,href:void 0},n;I.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,j.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],j.tap)}I.addEventListener("mousedown",r),I.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(be(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=tt(o,I),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:p,external:w,download:h}=ke(c,L,y.hash);if(w||h)return;const u=re(c),_=p&&fe(m.url)===fe(p);if(!(u.reload||_))if(l<=u.preload_data){t={element:c,href:c.href},n=j.tap;const g=await pe(p,!1);if(!g)return;Gt(g)}else l<=u.preload_code&&(t={element:c,href:c.href},n=l,be(p))}function s(){a.disconnect();for(const o of I.querySelectorAll("a")){const{url:l,external:c,download:f}=ke(o,L,y.hash);if(c||f)continue;const p=re(o);p.reload||(p.preload_code===j.viewport&&a.observe(o),p.preload_code===j.eager&&be(l))}}Y.add(s),s()}function ee(e,t){if(e instanceof Le)return e.body;const n=Oe(e),r=Vt(e);return y.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function _n(e,t={}){return e=new URL(Ie(e)),e.origin!==de?Promise.reject(new Error("goto: invalid URL")):ft(e,t,0)}function nn(e){if(typeof e=="function")oe.push(e);else{const{href:t}=new URL(e,location.href);oe.push(n=>n.href===t)}}function rn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(He(),!Z){const r=De(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ot.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&He()}),navigator.connection?.saveData||tn(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=tt(t.composedPath()[0],I);if(!n)return;const{url:r,external:a,target:i,download:s}=ke(n,L,y.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=re(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,f]=(y.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===we(location);if(a||o.reload&&(!p||!f)){pt({url:r,type:"link",event:t})?Z=!0:t.preventDefault();return}if(f!==void 0&&p){const[,w]=m.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const h=n.ownerDocument.getElementById(decodeURIComponent(f));h&&(h.scrollIntoView(),h.focus())}return}if(F=!0,Pe(v),e(r),!o.replace_state)return;F=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,100)}),await K({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),I.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(he(s,L,!1))return;const o=t.target,l=re(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),K({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Re){if(t.state?.[B]){const n=t.state[B];if(N={},n===v)return;const r=C[n],a=t.state[Ze]??{},i=new URL(t.state[jt]??location.href),s=t.state[H],o=m.url?we(location)===we(m.url):!1;if(s===x&&(it||o)){a!==E.state&&(E.state=a),e(i),C[v]=q(),r&&scrollTo(r.x,r.y),v=n;return}const c=n-v;await K({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{v=n,x=s},block:()=>{history.go(-c)},nav_token:N,event:t})}else if(!F){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[B]:++v,[H]:x},"",location.href))});for(const t of document.querySelectorAll("link"))Mt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(J.current=null)});function e(t){m.url=E.url=t,$.page.set(Ve(E)),$.page.notify()}}async function an(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){st=!0;const c=new URL(location.href);let f;({params:a={},route:i={id:null}}=await pe(c,!1)||{}),f=$e.find(({id:h})=>h===i.id);let p,w=!0;try{const h=r.map(async(_,g)=>{const d=o[g];return d?.uses&&(d.uses=on(d.uses)),je({loader:y.nodes[_],url:c,params:a,route:i,parent:async()=>{const b={};for(let S=0;S<g;S+=1)Object.assign(b,(await h[S]).data);return b},server_data_node:Ne(d)})}),u=await Promise.all(h);if(f){const _=f.layouts;for(let g=0;g<_.length;g++)_[g]||u.splice(g,0,void 0)}p=await ue({url:c,params:a,branch:u,status:t,error:n,errors:f?.errors,form:l,route:f??null})}catch(h){if(h instanceof Ue){await Q(new URL(h.location,location.href));return}p=await qe({status:Oe(h),error:await ee(h,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",w=!1}p.props.page&&(p.props.page.state={}),await dt(p,e,w)}function on(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Re=!1;function sn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=_t(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;Re=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),Re=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function De(e,t,n,r,a=null){let i,s;const o=new Promise((c,f)=>{i=c,s=f});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function Ve(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function ln(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function _t(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{gn as a,_n as g,fn as l,E as p,$ as s};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/D7Bf6Say.js

```js
var r=`var WebWorker=function(r){"use strict";var n=Uint8Array,e=Uint16Array,f=Uint32Array,t=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i=function(r,n){for(var t=new e(31),a=0;a<31;++a)t[a]=n+=1<<r[a-1];var o=new f(t[30]);for(a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)o[i]=i-t[a]<<5|a;return[t,o]},v=i(t,2),u=v[0],s=v[1];u[28]=258,s[258]=28;for(var l=i(a,0)[1],c=new e(32768),h=0;h<32768;++h){var g=(43690&h)>>>1|(21845&h)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,c[h]=((65280&g)>>>8|(255&g)<<8)>>>1}var w=function(r,n,f){for(var t=r.length,a=0,o=new e(n);a<t;++a)++o[r[a]-1];var i,v=new e(n);for(a=0;a<n;++a)v[a]=v[a-1]+o[a-1]<<1;if(f){i=new e(1<<n);var u=15-n;for(a=0;a<t;++a)if(r[a])for(var s=a<<4|r[a],l=n-r[a],h=v[r[a]-1]++<<l,g=h|(1<<l)-1;h<=g;++h)i[c[h]>>>u]=s}else for(i=new e(t),a=0;a<t;++a)i[a]=c[v[r[a]-1]++]>>>15-r[a];return i},d=new n(288);for(h=0;h<144;++h)d[h]=8;for(h=144;h<256;++h)d[h]=9;for(h=256;h<280;++h)d[h]=7;for(h=280;h<288;++h)d[h]=8;var m=new n(32);for(h=0;h<32;++h)m[h]=5;var y=w(d,9,0),M=w(m,5,0),p=function(r){return(r/8|0)+(7&r&&1)},b=function(r,t,a){(null==a||a>r.length)&&(a=r.length);var o=new(r instanceof e?e:r instanceof f?f:n)(a-t);return o.set(r.subarray(t,a)),o},C=function(r,n,e){e<<=7&n;var f=n/8|0;r[f]|=e,r[f+1]|=e>>>8},S=function(r,n,e){e<<=7&n;var f=n/8|0;r[f]|=e,r[f+1]|=e>>>8,r[f+2]|=e>>>16},x=function(r,f){for(var t=[],a=0;a<r.length;++a)r[a]&&t.push({s:a,f:r[a]});var o=t.length,i=t.slice();if(!o)return[new n(0),0];if(1==o){var v=new n(t[0].s+1);return v[t[0].s]=1,[v,1]}t.sort(function(r,n){return r.f-n.f}),t.push({s:-1,f:25001});var u=t[0],s=t[1],l=0,c=1,h=2;for(t[0]={s:-1,f:u.f+s.f,l:u,r:s};c!=o-1;)u=t[t[l].f<t[h].f?l++:h++],s=t[l!=c&&t[l].f<t[h].f?l++:h++],t[c++]={s:-1,f:u.f+s.f,l:u,r:s};var g=i[0].s;for(a=1;a<o;++a)i[a].s>g&&(g=i[a].s);var w=new e(g+1),d=A(t[c-1],w,0);if(d>f){a=0;var m=0,y=d-f,M=1<<y;for(i.sort(function(r,n){return w[n.s]-w[r.s]||r.f-n.f});a<o;++a){var p=i[a].s;if(!(w[p]>f))break;m+=M-(1<<d-w[p]),w[p]=f}for(m>>>=y;m>0;){var b=i[a].s;w[b]<f?m-=1<<f-w[b]++-1:++a}for(;a>=0&&m;--a){var C=i[a].s;w[C]==f&&(--w[C],++m)}d=f}return[new n(w),d]},A=function(r,n,e){return-1==r.s?Math.max(A(r.l,n,e+1),A(r.r,n,e+1)):n[r.s]=e},O=function(r){for(var n=r.length;n&&!r[--n];);for(var f=new e(++n),t=0,a=r[0],o=1,i=function(r){f[t++]=r},v=1;v<=n;++v)if(r[v]==a&&v!=n)++o;else{if(!a&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(a),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(a);o=1,a=r[v]}return[f.subarray(0,t),n]},T=function(r,n){for(var e=0,f=0;f<n.length;++f)e+=r[f]*n[f];return e},k=function(r,n,e){var f=e.length,t=p(n+2);r[t]=255&f,r[t+1]=f>>>8,r[t+2]=255^r[t],r[t+3]=255^r[t+1];for(var a=0;a<f;++a)r[t+a+4]=e[a];return 8*(t+4+f)},E=function(r,n,f,i,v,u,s,l,c,h,g){C(n,g++,f),++v[256];for(var p=x(v,15),b=p[0],A=p[1],E=x(u,15),J=E[0],N=E[1],U=O(b),D=U[0],I=U[1],W=O(J),_=W[0],j=W[1],P=new e(19),q=0;q<D.length;++q)P[31&D[q]]++;for(q=0;q<_.length;++q)P[31&_[q]]++;for(var z=x(P,7),B=z[0],F=z[1],G=19;G>4&&!B[o[G-1]];--G);var H,K,L,Q,R=h+5<<3,V=T(v,d)+T(u,m)+s,X=T(v,b)+T(u,J)+s+14+3*G+T(P,B)+(2*P[16]+3*P[17]+7*P[18]);if(R<=V&&R<=X)return k(n,g,r.subarray(c,c+h));if(C(n,g,1+(X<V)),g+=2,X<V){H=w(b,A,0),K=b,L=w(J,N,0),Q=J;var Y=w(B,F,0);C(n,g,I-257),C(n,g+5,j-1),C(n,g+10,G-4),g+=14;for(q=0;q<G;++q)C(n,g+3*q,B[o[q]]);g+=3*G;for(var Z=[D,_],$=0;$<2;++$){var rr=Z[$];for(q=0;q<rr.length;++q){var nr=31&rr[q];C(n,g,Y[nr]),g+=B[nr],nr>15&&(C(n,g,rr[q]>>>5&127),g+=rr[q]>>>12)}}}else H=y,K=d,L=M,Q=m;for(q=0;q<l;++q)if(i[q]>255){nr=i[q]>>>18&31;S(n,g,H[nr+257]),g+=K[nr+257],nr>7&&(C(n,g,i[q]>>>23&31),g+=t[nr]);var er=31&i[q];S(n,g,L[er]),g+=Q[er],er>3&&(S(n,g,i[q]>>>5&8191),g+=a[er])}else S(n,g,H[i[q]]),g+=K[i[q]];return S(n,g,H[256]),g+K[256]},J=new f([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),N=function(r,o,i,v,u){return function(r,o,i,v,u,c){var h=r.length,g=new n(v+h+5*(1+Math.floor(h/7e3))+u),w=g.subarray(v,g.length-u),d=0;if(!o||h<8)for(var m=0;m<=h;m+=65535){var y=m+65535;y<h?d=k(w,d,r.subarray(m,y)):(w[m]=c,d=k(w,d,r.subarray(m,h)))}else{for(var M=J[o-1],C=M>>>13,S=8191&M,x=(1<<i)-1,A=new e(32768),O=new e(x+1),T=Math.ceil(i/3),N=2*T,U=function(n){return(r[n]^r[n+1]<<T^r[n+2]<<N)&x},D=new f(25e3),I=new e(288),W=new e(32),_=0,j=0,P=(m=0,0),q=0,z=0;m<h;++m){var B=U(m),F=32767&m,G=O[B];if(A[F]=G,O[B]=F,q<=m){var H=h-m;if((_>7e3||P>24576)&&H>423){d=E(r,w,0,D,I,W,j,P,z,m-z,d),P=_=j=0,z=m;for(var K=0;K<286;++K)I[K]=0;for(K=0;K<30;++K)W[K]=0}var L=2,Q=0,R=S,V=F-G&32767;if(H>2&&B==U(m-V))for(var X=Math.min(C,H)-1,Y=Math.min(32767,m),Z=Math.min(258,H);V<=Y&&--R&&F!=G;){if(r[m+L]==r[m+L-V]){for(var $=0;$<Z&&r[m+$]==r[m+$-V];++$);if($>L){if(L=$,Q=V,$>X)break;var rr=Math.min(V,$-2),nr=0;for(K=0;K<rr;++K){var er=m-V+K+32768&32767,fr=er-A[er]+32768&32767;fr>nr&&(nr=fr,G=er)}}}V+=(F=G)-(G=A[F])+32768&32767}if(Q){D[P++]=268435456|s[L]<<18|l[Q];var tr=31&s[L],ar=31&l[Q];j+=t[tr]+a[ar],++I[257+tr],++W[ar],q=m+L,++_}else D[P++]=r[m],++I[r[m]]}}d=E(r,w,c,D,I,W,j,P,z,m-z,d)}return b(g,0,v+p(d)+u)}(r,null==o.level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,i,v,!0)};function U(r,n){void 0===n&&(n={});var e=function(){var r=1,n=0;return{p:function(e){for(var f=r,t=n,a=e.length,o=0;o!=a;){for(var i=Math.min(o+5552,a);o<i;++o)t+=f+=e[o];f%=65521,t%=65521}r=f,n=t},d:function(){return(r>>>8<<16|(255&n)<<8|n>>>8)+2*((255&r)<<23)}}}();e.p(r);var f,t,a,o=N(r,n,2,4);return f=o,t=n.level,a=0==t?0:t<6?1:9==t?3:2,f[0]=120,f[1]=a<<6|(a?32-2*a:1),function(r,n,e){for(;e;++n)r[n]=e,e>>>=8}(o,o.length-4,e.d()),o}const D=r=>{const e={...r,v:"v1"};return function(r,n){var e="";if(!n&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(r);for(var f=0;f<r.length;){var t=r[f++];t<128||n?e+=String.fromCharCode(t):t<224?e+=String.fromCharCode((31&t)<<6|63&r[f++]):t<240?e+=String.fromCharCode((15&t)<<12|(63&r[f++])<<6|63&r[f++]):(t=((15&t)<<18|(63&r[f++])<<12|(63&r[f++])<<6|63&r[f++])-65536,e+=String.fromCharCode(55296|t>>10,56320|1023&t))}return e}(U(function(r,e){var f=r.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(r);for(var t=new n(r.length+(r.length>>>1)),a=0,o=function(r){t[a++]=r},i=0;i<f;++i){if(a+5>t.length){var v=new n(a+8+(f-i<<1));v.set(t),t=v}var u=r.charCodeAt(i);u<128||e?o(u):u<2048?(o(192|u>>>6),o(128|63&u)):u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&r.charCodeAt(++i))>>>18),o(128|u>>>12&63),o(128|u>>>6&63),o(128|63&u)):(o(224|u>>>12),o(128|u>>>6&63),o(128|63&u))}return b(t,0,a)}(JSON.stringify(e))),!0)};onmessage=r=>{const{event:n,sessionId:e}="string"==typeof r.data?JSON.parse(r.data):r.data,f=JSON.stringify(D(n));postMessage({compressedEvent:f,sessionId:e})};const I=onmessage;return r.compressionOnMessage=I,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
`;export{r as compressionScript};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/DMrp4Fbu.js

```js
var rt={},on=Object.defineProperty,an=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I=(e,t,r)=>an(e,typeof t!="symbol"?t+"":t,r),Jr,ln=Object.defineProperty,un=(e,t,r)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Yr=(e,t,r)=>un(e,typeof t!="symbol"?t+"":t,r),Y=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Y||{});const Qr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Xr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},je={};function cn(e){var t,r;const l=(r=(t=globalThis?.Zone)==null?void 0:t.__symbol__)==null?void 0:r.call(t,e);if(l&&globalThis[l])return globalThis[l]}function kr(e){if(je[e])return je[e];const t=cn(e)||globalThis[e],r=t.prototype,l=e in Qr?Qr[e]:void 0,s=!!(l&&l.every(m=>{var a,p;return!!((p=(a=Object.getOwnPropertyDescriptor(r,m))==null?void 0:a.get)!=null&&p.toString().includes("[native code]"))})),f=e in Xr?Xr[e]:void 0,u=!!(f&&f.every(m=>{var a;return typeof r[m]=="function"&&((a=r[m])==null?void 0:a.toString().includes("[native code]"))}));if(s&&u)return je[e]=t.prototype,t.prototype;try{const m=document.createElement("iframe");document.body.appendChild(m);const a=m.contentWindow;if(!a)return t.prototype;const p=a[e].prototype;return document.body.removeChild(m),p?je[e]=p:r}catch{return r}}const Ct={};function be(e,t,r){var l;const s=`${e}.${String(r)}`;if(Ct[s])return Ct[s].call(t);const f=kr(e),u=(l=Object.getOwnPropertyDescriptor(f,r))==null?void 0:l.get;return u?(Ct[s]=u,u.call(t)):t[r]}const xt={};function wi(e,t,r){const l=`${e}.${String(r)}`;if(xt[l])return xt[l].bind(t);const f=kr(e)[r];return typeof f!="function"?t[r]:(xt[l]=f,f.bind(t))}function hn(e){return be("Node",e,"childNodes")}function fn(e){return be("Node",e,"parentNode")}function pn(e){return be("Node",e,"parentElement")}function dn(e){return be("Node",e,"textContent")}function mn(e,t){return wi("Node",e,"contains")(t)}function gn(e){return wi("Node",e,"getRootNode")()}function yn(e){return!e||!("host"in e)?null:be("ShadowRoot",e,"host")}function wn(e){return e.styleSheets}function bn(e){return!e||!("shadowRoot"in e)?null:be("Element",e,"shadowRoot")}function Sn(e,t){return be("Element",e,"querySelector")(t)}function vn(e,t){return be("Element",e,"querySelectorAll")(t)}function Cn(){return kr("MutationObserver").constructor}const K={childNodes:hn,parentNode:fn,parentElement:pn,textContent:dn,contains:mn,getRootNode:gn,host:yn,styleSheets:wn,shadowRoot:bn,querySelector:Sn,querySelectorAll:vn,mutationObserver:Cn};function bi(e){return e.nodeType===e.ELEMENT_NODE}function Te(e){const t=e&&"host"in e&&"mode"in e&&K.host(e)||null;return!!(t&&"shadowRoot"in t&&K.shadowRoot(t)===e)}function Fe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function xn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Rn(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Mr(e){try{const t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);const l=Array.from(t,s=>Si(s,r)).join("");return xn(l)}catch{return null}}function Si(e,t){if(Mn(e)){let r;try{r=Mr(e.styleSheet)||Rn(e)}catch{r=e.cssText}return e.styleSheet.href?nt(r,e.styleSheet.href):r}else{let r=e.cssText;return En(e)&&e.selectorText.includes(":")&&(r=On(r)),t?nt(r,t):r}}function On(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Mn(e){return"styleSheet"in e}function En(e){return"selectorText"in e}class vi{constructor(){Yr(this,"idNodeMap",new Map),Yr(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(l=>this.removeNodeFromMap(l))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const l=r.id;this.idNodeMap.set(l,t),this.nodeMetaMap.set(t,r)}replace(t,r){const l=this.getNode(t);if(l){const s=this.nodeMetaMap.get(l);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function In(){return new vi}function st({element:e,maskInputOptions:t,tagName:r,type:l,value:s,maskInputFn:f}){let u=s||"";const m=l&&Ce(l);return(t[r.toLowerCase()]||m&&t[m])&&(f?u=f(u,e):u="*".repeat(u.length)),u}function Ce(e){return e.toLowerCase()}const Kr="__rrweb_original__";function An(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let l=0;l<e.width;l+=r)for(let s=0;s<e.height;s+=r){const f=t.getImageData,u=Kr in f?f[Kr]:f;if(new Uint32Array(u.call(t,l,s,Math.min(r,e.width-l),Math.min(r,e.height-s)).data.buffer).some(a=>a!==0))return!1}return!0}function it(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ce(t):null}function Ci(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}const l=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(l);return s?.[1]??null}function kn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}const Nn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Pn=/^(?:[a-z+]+:)?\/\//i,_n=/^www\..*/i,Ln=/^(data:)([^,]*),(.*)/i;function nt(e,t){return(e||"").replace(Nn,(r,l,s,f,u,m)=>{const a=s||u||m,p=l||f||"";if(!a)return r;if(Pn.test(a)||_n.test(a))return`url(${p}${a}${p})`;if(Ln.test(a))return`url(${p}${a}${p})`;if(a[0]==="/")return`url(${p}${kn(t)+a}${p})`;const i=t.split("/"),c=a.split("/");i.pop();for(const o of c)o!=="."&&(o===".."?i.pop():i.push(o));return`url(${p}${i.join("/")}${p})`})}function He(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Dn(e,t,r=!1){const l=Array.from(t.childNodes),s=[];let f=0;if(l.length>1&&e&&typeof e=="string"){let u=He(e,r);const m=u.length/e.length;for(let a=1;a<l.length;a++)if(l[a].textContent&&typeof l[a].textContent=="string"){const p=He(l[a].textContent,r),i=100;let c=3;for(;c<p.length&&(p[c].match(/[a-zA-Z0-9]/)||p.indexOf(p.substring(0,c),1)!==-1);c++);for(;c<p.length;c++){let o=p.substring(0,c),n=u.split(o),d=-1;if(n.length===2)d=n[0].length;else if(n.length>2&&n[0]===""&&l[a-1].textContent!=="")d=u.indexOf(o,1);else if(n.length===1){if(o=o.substring(0,o.length-1),n=u.split(o),n.length<=1)return s.push(e),s;c=i+1}else c===p.length-1&&(d=u.indexOf(o));if(n.length>=2&&c>i){const h=l[a-1].textContent;if(h&&typeof h=="string"){const y=He(h).length;d=u.indexOf(o,y)}d===-1&&(d=n[0].length)}if(d!==-1){let h=Math.floor(d/m);for(;h>0&&h<e.length;){if(f+=1,f>50*l.length)return s.push(e),s;const y=He(e.substring(0,h),r);if(y.length===d){s.push(e.substring(0,h)),e=e.substring(h),u=u.substring(d);break}else y.length<d?h+=Math.max(1,Math.floor((d-y.length)/m)):h-=Math.max(1,Math.floor((y.length-d)*m))}break}}}}return s.push(e),s}function Tn(e,t){return Dn(e,t).join("/* rr_split */")}const Fn="lightgrey";let Un=1;const $n=new RegExp("[^a-z0-9-_:]"),$e=-2;function xi(){return Un++}function Bn(e){if(e instanceof HTMLFormElement)return"form";const t=Ce(e.tagName);return $n.test(t)?"div":t}let Ee,Zr;const zn=/^[^ \t\n\r\u000c]+/,Wn=/^[, \t\n\r\u000c]+/;function qn(e,t){if(t.trim()==="")return t;let r=0;function l(f){let u;const m=f.exec(t.substring(r));return m?(u=m[0],r+=u.length,u):""}const s=[];for(;l(Wn),!(r>=t.length);){let f=l(zn);if(f.slice(-1)===",")f=ke(e,f.substring(0,f.length-1)),s.push(f);else{let u="";f=ke(e,f);let m=!1;for(;;){const a=t.charAt(r);if(a===""){s.push((f+u).trim());break}else if(m)a===")"&&(m=!1);else if(a===","){r+=1,s.push((f+u).trim());break}else a==="("&&(m=!0);u+=a,r+=1}}}return s.join(", ")}const es=new WeakMap;function ke(e,t){return!t||t.trim()===""?t:Nr(e,t)}function jn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Nr(e,t){let r=es.get(e);if(r||(r=e.createElement("a"),es.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Ri(e,t,r,l){return l&&(r==="src"||r==="href"&&!(t==="use"&&l[0]==="#")||r==="xlink:href"&&l[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?ke(e,l):r==="srcset"?qn(e,l):r==="style"?nt(l,Nr(e)):t==="object"&&r==="data"?ke(e,l):l)}function Oi(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function Hn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let l=e.classList.length;l--;){const s=e.classList[l];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function ot(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ot(K.parentNode(e),t,r):!1;for(let l=e.classList.length;l--;){const s=e.classList[l];if(t.test(s))return!0}return r?ot(K.parentNode(e),t,r):!1}function Mi(e,t,r,l){let s;if(bi(e)){if(s=e,!K.childNodes(s).length)return!1}else{if(K.parentElement(e)===null)return!1;s=K.parentElement(e)}try{if(typeof t=="string"){if(l){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(ot(s,t,l))return!0;if(r){if(l){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function Gn(e,t,r){const l=e.contentWindow;if(!l)return;let s=!1,f;try{f=l.document.readyState}catch{return}if(f!=="complete"){const m=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(m),s=!0,t()});return}const u="about:blank";if(l.location.href!==u||e.src===u||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Vn(e,t,r){let l=!1,s;try{s=e.sheet}catch{return}if(s)return;const f=setTimeout(()=>{l||(t(),l=!0)},r);e.addEventListener("load",()=>{clearTimeout(f),l=!0,t()})}function Jn(e,t){const{doc:r,mirror:l,blockClass:s,blockSelector:f,needsMask:u,inlineStylesheet:m,maskInputOptions:a={},maskTextFn:p,maskInputFn:i,maskAttributeFn:c,dataURLOptions:o={},inlineImages:n,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:y=!1,cssCaptured:C=!1,applyBackgroundColorToBlockedElements:w=!1}=t,S=Yn(r,l);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Y.Document,childNodes:[],compatMode:e.compatMode}:{type:Y.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Y.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return Xn(e,{doc:r,blockClass:s,blockSelector:f,inlineStylesheet:m,maskInputOptions:a,maskInputFn:i,maskAttributeFn:c,dataURLOptions:o,inlineImages:n,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:y,rootId:S,applyBackgroundColorToBlockedElements:w});case e.TEXT_NODE:return Qn(e,{doc:r,needsMask:u,maskTextFn:p,rootId:S,cssCaptured:C});case e.CDATA_SECTION_NODE:return{type:Y.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:Y.Comment,textContent:K.textContent(e)||"",rootId:S};default:return!1}}function Yn(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function Qn(e,t){const{needsMask:r,maskTextFn:l,rootId:s,cssCaptured:f}=t,u=K.parentNode(e),m=u&&u.tagName;let a="";const p=m==="STYLE"?!0:void 0,i=m==="SCRIPT"?!0:void 0;return i?a="SCRIPT_PLACEHOLDER":f||(a=K.textContent(e),p&&a&&(a=nt(a,Nr(t.doc)))),!p&&!i&&a&&r&&(a=l?l(a,K.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Y.Text,textContent:a||"",rootId:s}}function Xn(e,t){const{doc:r,blockClass:l,blockSelector:s,inlineStylesheet:f,maskInputOptions:u={},maskInputFn:m,maskAttributeFn:a,dataURLOptions:p={},inlineImages:i,recordCanvas:c,keepIframeSrcFn:o,newlyAddedElement:n=!1,rootId:d,applyBackgroundColorToBlockedElements:h=!1}=t,y=Hn(e,l,s),C=Bn(e);let w={};const S=e.attributes.length;for(let g=0;g<S;g++){const v=e.attributes[g];if(!Oi(C,v.name,v.value)){const x=Ri(r,C,Ce(v.name),v.value);if(a&&x!==null){const O=a(v.name,x,e);O!==null&&(w[v.name]=O)}else w[v.name]=x}}if(C==="link"&&f){const g=Array.from(r.styleSheets).find(x=>x.href===e.href);let v=null;g&&(v=Mr(g)),v&&(delete w.rel,delete w.href,w._cssText=v)}if(C==="style"&&e.sheet){let g=Mr(e.sheet);g&&(e.childNodes.length>1&&(g=Tn(g,e)),w._cssText=g)}if(C==="input"||C==="textarea"||C==="select"){const g=e.value,v=e.checked;w.type!=="radio"&&w.type!=="checkbox"&&w.type!=="submit"&&w.type!=="button"&&g?w.value=st({element:e,type:it(e),tagName:C,value:g,maskInputOptions:u,maskInputFn:m}):v&&(w.checked=v)}if(C==="option"&&(e.selected&&!u.select?w.selected=!0:delete w.selected),C==="dialog"&&e.open&&(w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),C==="canvas"&&c){if(e.__context==="2d")An(e)||(w.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){const g=e.toDataURL(p.type,p.quality),v=r.createElement("canvas");v.width=e.width,v.height=e.height;const x=v.toDataURL(p.type,p.quality);g!==x&&(w.rr_dataURL=g)}}if(C==="img"&&i){Ee||(Ee=r.createElement("canvas"),Zr=Ee.getContext("2d"));const g=e,v=g.currentSrc||g.getAttribute("src")||"<unknown-src>",x=g.crossOrigin,O=()=>{g.removeEventListener("load",O);try{Ee.width=g.naturalWidth,Ee.height=g.naturalHeight,Zr.drawImage(g,0,0),w.rr_dataURL=Ee.toDataURL(p.type,p.quality)}catch(A){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${v}! Error: ${A}`)}g.crossOrigin==="anonymous"&&(x?w.crossOrigin=x:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O)}if(C==="audio"||C==="video"){const g=w;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(n||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),y){const{width:g,height:v}=e.getBoundingClientRect();w={class:w.class,rr_width:`${g}px`,rr_height:`${v}px`,...h?{rr_background_color:Fn}:{}}}C==="iframe"&&!o(w.src)&&(e.contentDocument||(w.rr_src=w.src),delete w.src);let b;try{customElements.get(C)&&(b=!0)}catch{}return{type:Y.Element,tagName:C,attributes:w,childNodes:[],isSVG:jn(e)||void 0,needBlock:y,rootId:d,isCustom:b}}function z(e){return e==null?"":e.toLowerCase()}function Kn(e,t){if(t.comment&&e.type===Y.Comment)return!0;if(e.type===Y.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ci(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(z(e.attributes.name).match(/^msapplication-tile(image|color)$/)||z(e.attributes.name)==="application-name"||z(e.attributes.rel)==="icon"||z(e.attributes.rel)==="apple-touch-icon"||z(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&z(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(z(e.attributes.property).match(/^(og|twitter|fb):/)||z(e.attributes.name).match(/^(og|twitter):/)||z(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(z(e.attributes.name)==="robots"||z(e.attributes.name)==="googlebot"||z(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(z(e.attributes.name)==="author"||z(e.attributes.name)==="generator"||z(e.attributes.name)==="framework"||z(e.attributes.name)==="publisher"||z(e.attributes.name)==="progid"||z(e.attributes.property).match(/^article:/)||z(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(z(e.attributes.name)==="google-site-verification"||z(e.attributes.name)==="yandex-verification"||z(e.attributes.name)==="csrf-token"||z(e.attributes.name)==="p:domain_verify"||z(e.attributes.name)==="verify-v1"||z(e.attributes.name)==="verification"||z(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ne(e,t){const{doc:r,mirror:l,blockClass:s,blockSelector:f,maskTextClass:u,maskTextSelector:m,skipChild:a=!1,inlineStylesheet:p=!0,maskInputOptions:i={},maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOMOptions:d,dataURLOptions:h={},inlineImages:y=!1,recordCanvas:C=!1,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:b=5e3,onStylesheetLoad:g,stylesheetLoadTimeout:v=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:O=!1,cssCaptured:A=!1,applyBackgroundColorToBlockedElements:M=!1}=t;let{needsMask:$}=t,{preserveWhiteSpace:k=!0}=t;$||($=Mi(e,u,m,$===void 0));const R=Jn(e,{doc:r,mirror:l,blockClass:s,blockSelector:f,needsMask:$,inlineStylesheet:p,maskInputOptions:i,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,dataURLOptions:h,inlineImages:y,recordCanvas:C,keepIframeSrcFn:x,newlyAddedElement:O,cssCaptured:A,applyBackgroundColorToBlockedElements:M});if(!R)return console.warn(e,"not serialized"),null;let Z;l.hasNode(e)?Z=l.getId(e):Kn(R,d)||!k&&R.type===Y.Text&&!R.textContent.replace(/^\s+|\s+$/gm,"").length?Z=$e:Z=xi();const N=Object.assign(R,{id:Z});if(l.add(e,N),Z===$e)return null;w&&w(e);let ee=!a;if(N.type===Y.Element){ee=ee&&!N.needBlock,delete N.needBlock;const F=K.shadowRoot(e);F&&Fe(F)&&(N.isShadowHost=!0)}if((N.type===Y.Document||N.type===Y.Element)&&ee){d.headWhitespace&&N.type===Y.Element&&N.tagName==="head"&&(k=!1);const F={doc:r,mirror:l,blockClass:s,blockSelector:f,needsMask:$,maskTextClass:u,maskTextSelector:m,skipChild:a,inlineStylesheet:p,maskInputOptions:i,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOMOptions:d,dataURLOptions:h,inlineImages:y,recordCanvas:C,preserveWhiteSpace:k,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:x,cssCaptured:!1,applyBackgroundColorToBlockedElements:M};if(!(N.type===Y.Element&&N.tagName==="textarea"&&N.attributes.value!==void 0)){N.type===Y.Element&&N.attributes._cssText!==void 0&&typeof N.attributes._cssText=="string"&&(F.cssCaptured=!0);for(const W of Array.from(K.childNodes(e))){const P=Ne(W,F);P&&N.childNodes.push(P)}}let Q=null;if(bi(e)&&(Q=K.shadowRoot(e)))for(const W of Array.from(K.childNodes(Q))){const P=Ne(W,F);P&&(Fe(Q)&&(P.isShadow=!0),N.childNodes.push(P))}}const H=K.parentNode(e);return H&&Te(H)&&Fe(H)&&(N.isShadow=!0),N.type===Y.Element&&N.tagName==="iframe"&&Gn(e,()=>{const F=e.contentDocument;if(F&&S){const Q=Ne(F,{doc:F,mirror:l,blockClass:s,blockSelector:f,needsMask:$,maskTextClass:u,maskTextSelector:m,skipChild:!1,inlineStylesheet:p,maskInputOptions:i,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOMOptions:d,dataURLOptions:h,inlineImages:y,recordCanvas:C,preserveWhiteSpace:k,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:x});Q&&S(e,Q)}},b),N.type===Y.Element&&N.tagName==="link"&&typeof N.attributes.rel=="string"&&(N.attributes.rel==="stylesheet"||N.attributes.rel==="preload"&&typeof N.attributes.href=="string"&&Ci(N.attributes.href)==="css")&&Vn(e,()=>{if(g){const F=Ne(e,{doc:r,mirror:l,blockClass:s,blockSelector:f,needsMask:$,maskTextClass:u,maskTextSelector:m,skipChild:!1,inlineStylesheet:p,maskInputOptions:i,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOMOptions:d,dataURLOptions:h,inlineImages:y,recordCanvas:C,preserveWhiteSpace:k,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:x});F&&g(e,F)}},v),N}function Zn(e,t){const{mirror:r=new vi,blockClass:l="rr-block",blockSelector:s=null,maskTextClass:f="rr-mask",maskTextSelector:u=null,inlineStylesheet:m=!0,inlineImages:a=!1,recordCanvas:p=!1,maskAllInputs:i=!1,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOM:d=!1,dataURLOptions:h,preserveWhiteSpace:y,onSerialize:C,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:g,keepIframeSrcFn:v=()=>!1,applyBackgroundColorToBlockedElements:x=!1}=t||{};return Ne(e,{doc:e,mirror:r,blockClass:l,blockSelector:s,maskTextClass:f,maskTextSelector:u,skipChild:!1,inlineStylesheet:m,maskInputOptions:i===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:i===!1?{password:!0}:i,maskTextFn:c,maskInputFn:o,maskAttributeFn:n,slimDOMOptions:d===!0||d==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:d==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:d===!1?{}:d,dataURLOptions:h,inlineImages:a,recordCanvas:p,preserveWhiteSpace:y,onSerialize:C,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:g,keepIframeSrcFn:v,newlyAddedElement:!1,applyBackgroundColorToBlockedElements:x})}function eo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function to(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function l(){return this instanceof l?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(l){var s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,s.get?s:{enumerable:!0,get:function(){return e[l]}})}),r}var Ge={exports:{}},ts;function ro(){if(ts)return Ge.exports;ts=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Ge.exports=t(),Ge.exports.createColors=t,Ge.exports}const so={},io=Object.freeze(Object.defineProperty({__proto__:null,default:so},Symbol.toStringTag,{value:"Module"})),he=to(io);var Rt,rs;function Pr(){if(rs)return Rt;rs=1;let e=ro(),t=he;class r extends Error{constructor(s,f,u,m,a,p){super(s),this.name="CssSyntaxError",this.reason=s,a&&(this.file=a),m&&(this.source=m),p&&(this.plugin=p),typeof f<"u"&&typeof u<"u"&&(typeof f=="number"?(this.line=f,this.column=u):(this.line=f.line,this.column=f.column,this.endLine=u.line,this.endColumn=u.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(s){if(!this.source)return"";let f=this.source;s==null&&(s=e.isColorSupported),t&&s&&(f=t(f));let u=f.split(/\r?\n/),m=Math.max(this.line-3,0),a=Math.min(this.line+2,u.length),p=String(a).length,i,c;if(s){let{bold:o,gray:n,red:d}=e.createColors(!0);i=h=>o(d(h)),c=h=>n(h)}else i=c=o=>o;return u.slice(m,a).map((o,n)=>{let d=m+1+n,h=" "+(" "+d).slice(-p)+" | ";if(d===this.line){let y=c(h.replace(/\d/g," "))+o.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+c(h)+o+`
 `+y+i("^")}return" "+c(h)+o}).join(`
`)}toString(){let s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s}}return Rt=r,r.default=r,Rt}var Ve={},ss;function _r(){return ss||(ss=1,Ve.isClean=Symbol("isClean"),Ve.my=Symbol("my")),Ve}var Ot,is;function Ei(){if(is)return Ot;is=1;const e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function t(l){return l[0].toUpperCase()+l.slice(1)}class r{constructor(s){this.builder=s}atrule(s,f){let u="@"+s.name,m=s.params?this.rawValue(s,"params"):"";if(typeof s.raws.afterName<"u"?u+=s.raws.afterName:m&&(u+=" "),s.nodes)this.block(s,u+m);else{let a=(s.raws.between||"")+(f?";":"");this.builder(u+m+a,s)}}beforeAfter(s,f){let u;s.type==="decl"?u=this.raw(s,null,"beforeDecl"):s.type==="comment"?u=this.raw(s,null,"beforeComment"):f==="before"?u=this.raw(s,null,"beforeRule"):u=this.raw(s,null,"beforeClose");let m=s.parent,a=0;for(;m&&m.type!=="root";)a+=1,m=m.parent;if(u.includes(`
`)){let p=this.raw(s,null,"indent");if(p.length)for(let i=0;i<a;i++)u+=p}return u}block(s,f){let u=this.raw(s,"between","beforeOpen");this.builder(f+u+"{",s,"start");let m;s.nodes&&s.nodes.length?(this.body(s),m=this.raw(s,"after")):m=this.raw(s,"after","emptyBody"),m&&this.builder(m),this.builder("}",s,"end")}body(s){let f=s.nodes.length-1;for(;f>0&&s.nodes[f].type==="comment";)f-=1;let u=this.raw(s,"semicolon");for(let m=0;m<s.nodes.length;m++){let a=s.nodes[m],p=this.raw(a,"before");p&&this.builder(p),this.stringify(a,f!==m||u)}}comment(s){let f=this.raw(s,"left","commentLeft"),u=this.raw(s,"right","commentRight");this.builder("/*"+f+s.text+u+"*/",s)}decl(s,f){let u=this.raw(s,"between","colon"),m=s.prop+u+this.rawValue(s,"value");s.important&&(m+=s.raws.important||" !important"),f&&(m+=";"),this.builder(m,s)}document(s){this.body(s)}raw(s,f,u){let m;if(u||(u=f),f&&(m=s.raws[f],typeof m<"u"))return m;let a=s.parent;if(u==="before"&&(!a||a.type==="root"&&a.first===s||a&&a.type==="document"))return"";if(!a)return e[u];let p=s.root();if(p.rawCache||(p.rawCache={}),typeof p.rawCache[u]<"u")return p.rawCache[u];if(u==="before"||u==="after")return this.beforeAfter(s,u);{let i="raw"+t(u);this[i]?m=this[i](p,s):p.walk(c=>{if(m=c.raws[f],typeof m<"u")return!1})}return typeof m>"u"&&(m=e[u]),p.rawCache[u]=m,m}rawBeforeClose(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length>0&&typeof u.raws.after<"u")return f=u.raws.after,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawBeforeComment(s,f){let u;return s.walkComments(m=>{if(typeof m.raws.before<"u")return u=m.raws.before,u.includes(`
`)&&(u=u.replace(/[^\n]+$/,"")),!1}),typeof u>"u"?u=this.raw(f,null,"beforeDecl"):u&&(u=u.replace(/\S/g,"")),u}rawBeforeDecl(s,f){let u;return s.walkDecls(m=>{if(typeof m.raws.before<"u")return u=m.raws.before,u.includes(`
`)&&(u=u.replace(/[^\n]+$/,"")),!1}),typeof u>"u"?u=this.raw(f,null,"beforeRule"):u&&(u=u.replace(/\S/g,"")),u}rawBeforeOpen(s){let f;return s.walk(u=>{if(u.type!=="decl"&&(f=u.raws.between,typeof f<"u"))return!1}),f}rawBeforeRule(s){let f;return s.walk(u=>{if(u.nodes&&(u.parent!==s||s.first!==u)&&typeof u.raws.before<"u")return f=u.raws.before,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawColon(s){let f;return s.walkDecls(u=>{if(typeof u.raws.between<"u")return f=u.raws.between.replace(/[^\s:]/g,""),!1}),f}rawEmptyBody(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length===0&&(f=u.raws.after,typeof f<"u"))return!1}),f}rawIndent(s){if(s.raws.indent)return s.raws.indent;let f;return s.walk(u=>{let m=u.parent;if(m&&m!==s&&m.parent&&m.parent===s&&typeof u.raws.before<"u"){let a=u.raws.before.split(`
`);return f=a[a.length-1],f=f.replace(/\S/g,""),!1}}),f}rawSemicolon(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length&&u.last.type==="decl"&&(f=u.raws.semicolon,typeof f<"u"))return!1}),f}rawValue(s,f){let u=s[f],m=s.raws[f];return m&&m.value===u?m.raw:u}root(s){this.body(s),s.raws.after&&this.builder(s.raws.after)}rule(s){this.block(s,this.rawValue(s,"selector")),s.raws.ownSemicolon&&this.builder(s.raws.ownSemicolon,s,"end")}stringify(s,f){if(!this[s.type])throw new Error("Unknown AST node type "+s.type+". Maybe you need to change PostCSS stringifier.");this[s.type](s,f)}}return Ot=r,r.default=r,Ot}var Mt,ns;function ct(){if(ns)return Mt;ns=1;let e=Ei();function t(r,l){new e(l).stringify(r)}return Mt=t,t.default=t,Mt}var Et,os;function ht(){if(os)return Et;os=1;let{isClean:e,my:t}=_r(),r=Pr(),l=Ei(),s=ct();function f(m,a){let p=new m.constructor;for(let i in m){if(!Object.prototype.hasOwnProperty.call(m,i)||i==="proxyCache")continue;let c=m[i],o=typeof c;i==="parent"&&o==="object"?a&&(p[i]=a):i==="source"?p[i]=c:Array.isArray(c)?p[i]=c.map(n=>f(n,p)):(o==="object"&&c!==null&&(c=f(c)),p[i]=c)}return p}class u{constructor(a={}){this.raws={},this[e]=!1,this[t]=!0;for(let p in a)if(p==="nodes"){this.nodes=[];for(let i of a[p])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[p]=a[p]}addToError(a){if(a.postcssNode=this,a.stack&&this.source&&/\n\s{4}at /.test(a.stack)){let p=this.source;a.stack=a.stack.replace(/\n\s{4}at /,`$&${p.input.from}:${p.start.line}:${p.start.column}$&`)}return a}after(a){return this.parent.insertAfter(this,a),this}assign(a={}){for(let p in a)this[p]=a[p];return this}before(a){return this.parent.insertBefore(this,a),this}cleanRaws(a){delete this.raws.before,delete this.raws.after,a||delete this.raws.between}clone(a={}){let p=f(this);for(let i in a)p[i]=a[i];return p}cloneAfter(a={}){let p=this.clone(a);return this.parent.insertAfter(this,p),p}cloneBefore(a={}){let p=this.clone(a);return this.parent.insertBefore(this,p),p}error(a,p={}){if(this.source){let{end:i,start:c}=this.rangeBy(p);return this.source.input.error(a,{column:c.column,line:c.line},{column:i.column,line:i.line},p)}return new r(a)}getProxyProcessor(){return{get(a,p){return p==="proxyOf"?a:p==="root"?()=>a.root().toProxy():a[p]},set(a,p,i){return a[p]===i||(a[p]=i,(p==="prop"||p==="value"||p==="name"||p==="params"||p==="important"||p==="text")&&a.markDirty()),!0}}}markDirty(){if(this[e]){this[e]=!1;let a=this;for(;a=a.parent;)a[e]=!1}}next(){if(!this.parent)return;let a=this.parent.index(this);return this.parent.nodes[a+1]}positionBy(a,p){let i=this.source.start;if(a.index)i=this.positionInside(a.index,p);else if(a.word){p=this.toString();let c=p.indexOf(a.word);c!==-1&&(i=this.positionInside(c,p))}return i}positionInside(a,p){let i=p||this.toString(),c=this.source.start.column,o=this.source.start.line;for(let n=0;n<a;n++)i[n]===`
`?(c=1,o+=1):c+=1;return{column:c,line:o}}prev(){if(!this.parent)return;let a=this.parent.index(this);return this.parent.nodes[a-1]}rangeBy(a){let p={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:p.column+1,line:p.line};if(a.word){let c=this.toString(),o=c.indexOf(a.word);o!==-1&&(p=this.positionInside(o,c),i=this.positionInside(o+a.word.length,c))}else a.start?p={column:a.start.column,line:a.start.line}:a.index&&(p=this.positionInside(a.index)),a.end?i={column:a.end.column,line:a.end.line}:typeof a.endIndex=="number"?i=this.positionInside(a.endIndex):a.index&&(i=this.positionInside(a.index+1));return(i.line<p.line||i.line===p.line&&i.column<=p.column)&&(i={column:p.column+1,line:p.line}),{end:i,start:p}}raw(a,p){return new l().raw(this,a,p)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...a){if(this.parent){let p=this,i=!1;for(let c of a)c===this?i=!0:i?(this.parent.insertAfter(p,c),p=c):this.parent.insertBefore(p,c);i||this.remove()}return this}root(){let a=this;for(;a.parent&&a.parent.type!=="document";)a=a.parent;return a}toJSON(a,p){let i={},c=p==null;p=p||new Map;let o=0;for(let n in this){if(!Object.prototype.hasOwnProperty.call(this,n)||n==="parent"||n==="proxyCache")continue;let d=this[n];if(Array.isArray(d))i[n]=d.map(h=>typeof h=="object"&&h.toJSON?h.toJSON(null,p):h);else if(typeof d=="object"&&d.toJSON)i[n]=d.toJSON(null,p);else if(n==="source"){let h=p.get(d.input);h==null&&(h=o,p.set(d.input,o),o++),i[n]={end:d.end,inputId:h,start:d.start}}else i[n]=d}return c&&(i.inputs=[...p.keys()].map(n=>n.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(a=s){a.stringify&&(a=a.stringify);let p="";return a(this,i=>{p+=i}),p}warn(a,p,i){let c={node:this};for(let o in i)c[o]=i[o];return a.warn(p,c)}get proxyOf(){return this}}return Et=u,u.default=u,Et}var It,as;function ft(){if(as)return It;as=1;let e=ht();class t extends e{constructor(l){l&&typeof l.value<"u"&&typeof l.value!="string"&&(l={...l,value:String(l.value)}),super(l),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return It=t,t.default=t,It}var At,ls;function no(){if(ls)return At;ls=1;let e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return At={nanoid:(l=21)=>{let s="",f=l;for(;f--;)s+=e[Math.random()*64|0];return s},customAlphabet:(l,s=21)=>(f=s)=>{let u="",m=f;for(;m--;)u+=l[Math.random()*l.length|0];return u}},At}var kt,us;function Ii(){if(us)return kt;us=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=he,{existsSync:r,readFileSync:l}=he,{dirname:s,join:f}=he;function u(a){return Buffer?Buffer.from(a,"base64").toString():window.atob(a)}class m{constructor(p,i){if(i.map===!1)return;this.loadAnnotation(p),this.inline=this.startWith(this.annotation,"data:");let c=i.map?i.map.prev:void 0,o=this.loadMap(i.from,c);!this.mapFile&&i.from&&(this.mapFile=i.from),this.mapFile&&(this.root=s(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(p){let i=/^data:application\/json;charset=utf-?8;base64,/,c=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(o.test(p)||n.test(p))return decodeURIComponent(p.substr(RegExp.lastMatch.length));if(i.test(p)||c.test(p))return u(p.substr(RegExp.lastMatch.length));let d=p.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+d)}getAnnotationURL(p){return p.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(p){return typeof p!="object"?!1:typeof p.mappings=="string"||typeof p._mappings=="string"||Array.isArray(p.sections)}loadAnnotation(p){let i=p.match(/\/\*\s*# sourceMappingURL=/gm);if(!i)return;let c=p.lastIndexOf(i.pop()),o=p.indexOf("*/",c);c>-1&&o>-1&&(this.annotation=this.getAnnotationURL(p.substring(c,o)))}loadFile(p){if(this.root=s(p),r(p))return this.mapFile=p,l(p,"utf-8").toString().trim()}loadMap(p,i){if(i===!1)return!1;if(i){if(typeof i=="string")return i;if(typeof i=="function"){let c=i(p);if(c){let o=this.loadFile(c);if(!o)throw new Error("Unable to load previous source map: "+c.toString());return o}}else{if(i instanceof e)return t.fromSourceMap(i).toString();if(i instanceof t)return i.toString();if(this.isMap(i))return JSON.stringify(i);throw new Error("Unsupported previous source map format: "+i.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let c=this.annotation;return p&&(c=f(s(p),c)),this.loadFile(c)}}}startWith(p,i){return p?p.substr(0,i.length)===i:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return kt=m,m.default=m,kt}var Nt,cs;function pt(){if(cs)return Nt;cs=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=he,{fileURLToPath:r,pathToFileURL:l}=he,{isAbsolute:s,resolve:f}=he,{nanoid:u}=no(),m=he,a=Pr(),p=Ii(),i=Symbol("fromOffsetCache"),c=!!(e&&t),o=!!(f&&s);class n{constructor(h,y={}){if(h===null||typeof h>"u"||typeof h=="object"&&!h.toString)throw new Error(`PostCSS received ${h} instead of CSS string`);if(this.css=h.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,y.from&&(!o||/^\w+:\/\//.test(y.from)||s(y.from)?this.file=y.from:this.file=f(y.from)),o&&c){let C=new p(this.css,y);if(C.text){this.map=C;let w=C.consumer().file;!this.file&&w&&(this.file=this.mapResolve(w))}}this.file||(this.id="<input css "+u(6)+">"),this.map&&(this.map.file=this.from)}error(h,y,C,w={}){let S,b,g;if(y&&typeof y=="object"){let x=y,O=C;if(typeof x.offset=="number"){let A=this.fromOffset(x.offset);y=A.line,C=A.col}else y=x.line,C=x.column;if(typeof O.offset=="number"){let A=this.fromOffset(O.offset);b=A.line,g=A.col}else b=O.line,g=O.column}else if(!C){let x=this.fromOffset(y);y=x.line,C=x.col}let v=this.origin(y,C,b,g);return v?S=new a(h,v.endLine===void 0?v.line:{column:v.column,line:v.line},v.endLine===void 0?v.column:{column:v.endColumn,line:v.endLine},v.source,v.file,w.plugin):S=new a(h,b===void 0?y:{column:C,line:y},b===void 0?C:{column:g,line:b},this.css,this.file,w.plugin),S.input={column:C,endColumn:g,endLine:b,line:y,source:this.css},this.file&&(l&&(S.input.url=l(this.file).toString()),S.input.file=this.file),S}fromOffset(h){let y,C;if(this[i])C=this[i];else{let S=this.css.split(`
`);C=new Array(S.length);let b=0;for(let g=0,v=S.length;g<v;g++)C[g]=b,b+=S[g].length+1;this[i]=C}y=C[C.length-1];let w=0;if(h>=y)w=C.length-1;else{let S=C.length-2,b;for(;w<S;)if(b=w+(S-w>>1),h<C[b])S=b-1;else if(h>=C[b+1])w=b+1;else{w=b;break}}return{col:h-C[w]+1,line:w+1}}mapResolve(h){return/^\w+:\/\//.test(h)?h:f(this.map.consumer().sourceRoot||this.map.root||".",h)}origin(h,y,C,w){if(!this.map)return!1;let S=this.map.consumer(),b=S.originalPositionFor({column:y,line:h});if(!b.source)return!1;let g;typeof C=="number"&&(g=S.originalPositionFor({column:w,line:C}));let v;s(b.source)?v=l(b.source):v=new URL(b.source,this.map.consumer().sourceRoot||l(this.map.mapFile));let x={column:b.column,endColumn:g&&g.column,endLine:g&&g.line,line:b.line,url:v.toString()};if(v.protocol==="file:")if(r)x.file=r(v);else throw new Error("file: protocol is not available in this PostCSS build");let O=S.sourceContentFor(b.source);return O&&(x.source=O),x}toJSON(){let h={};for(let y of["hasBOM","css","file","id"])this[y]!=null&&(h[y]=this[y]);return this.map&&(h.map={...this.map},h.map.consumerCache&&(h.map.consumerCache=void 0)),h}get from(){return this.file||this.id}}return Nt=n,n.default=n,m&&m.registerInput&&m.registerInput(n),Nt}var Pt,hs;function Ai(){if(hs)return Pt;hs=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=he,{dirname:r,relative:l,resolve:s,sep:f}=he,{pathToFileURL:u}=he,m=pt(),a=!!(e&&t),p=!!(r&&s&&l&&f);class i{constructor(o,n,d,h){this.stringify=o,this.mapOpts=d.map||{},this.root=n,this.opts=d,this.css=h,this.originalCSS=h,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let o;this.isInline()?o="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?o=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?o=this.mapOpts.annotation(this.opts.to,this.root):o=this.outputFile()+".map";let n=`
`;this.css.includes(`\r
`)&&(n=`\r
`),this.css+=n+"/*# sourceMappingURL="+o+" */"}applyPrevMaps(){for(let o of this.previous()){let n=this.toUrl(this.path(o.file)),d=o.root||r(o.file),h;this.mapOpts.sourcesContent===!1?(h=new e(o.text),h.sourcesContent&&(h.sourcesContent=null)):h=o.consumer(),this.map.applySourceMap(h,n,this.toUrl(this.path(d)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let o;for(let n=this.root.nodes.length-1;n>=0;n--)o=this.root.nodes[n],o.type==="comment"&&o.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),p&&a&&this.isMap())return this.generateMap();{let o="";return this.stringify(this.root,n=>{o+=n}),[o]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let o=this.previous()[0].consumer();o.file=this.outputFile(),this.map=t.fromSourceMap(o,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let o=1,n=1,d="<no source>",h={generated:{column:0,line:0},original:{column:0,line:0},source:""},y,C;this.stringify(this.root,(w,S,b)=>{if(this.css+=w,S&&b!=="end"&&(h.generated.line=o,h.generated.column=n-1,S.source&&S.source.start?(h.source=this.sourcePath(S),h.original.line=S.source.start.line,h.original.column=S.source.start.column-1,this.map.addMapping(h)):(h.source=d,h.original.line=1,h.original.column=0,this.map.addMapping(h))),y=w.match(/\n/g),y?(o+=y.length,C=w.lastIndexOf(`
`),n=w.length-C):n+=w.length,S&&b!=="start"){let g=S.parent||{raws:{}};(!(S.type==="decl"||S.type==="atrule"&&!S.nodes)||S!==g.last||g.raws.semicolon)&&(S.source&&S.source.end?(h.source=this.sourcePath(S),h.original.line=S.source.end.line,h.original.column=S.source.end.column-1,h.generated.line=o,h.generated.column=n-2,this.map.addMapping(h)):(h.source=d,h.original.line=1,h.original.column=0,h.generated.line=o,h.generated.column=n-1,this.map.addMapping(h)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(o=>o.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let o=this.mapOpts.annotation;return typeof o<"u"&&o!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(o=>o.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(o){if(this.mapOpts.absolute||o.charCodeAt(0)===60||/^\w+:\/\//.test(o))return o;let n=this.memoizedPaths.get(o);if(n)return n;let d=this.opts.to?r(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(d=r(s(d,this.mapOpts.annotation)));let h=l(d,o);return this.memoizedPaths.set(o,h),h}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(o=>{if(o.source&&o.source.input.map){let n=o.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let o=new m(this.originalCSS,this.opts);o.map&&this.previousMaps.push(o.map)}return this.previousMaps}setSourcesContent(){let o={};if(this.root)this.root.walk(n=>{if(n.source){let d=n.source.input.from;if(d&&!o[d]){o[d]=!0;let h=this.usesFileUrls?this.toFileUrl(d):this.toUrl(this.path(d));this.map.setSourceContent(h,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(o){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(o.source.input.from):this.toUrl(this.path(o.source.input.from))}toBase64(o){return Buffer?Buffer.from(o).toString("base64"):window.btoa(unescape(encodeURIComponent(o)))}toFileUrl(o){let n=this.memoizedFileURLs.get(o);if(n)return n;if(u){let d=u(o).toString();return this.memoizedFileURLs.set(o,d),d}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(o){let n=this.memoizedURLs.get(o);if(n)return n;f==="\\"&&(o=o.replace(/\\/g,"/"));let d=encodeURI(o).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(o,d),d}}return Pt=i,Pt}var _t,fs;function dt(){if(fs)return _t;fs=1;let e=ht();class t extends e{constructor(l){super(l),this.type="comment"}}return _t=t,t.default=t,_t}var Lt,ps;function xe(){if(ps)return Lt;ps=1;let{isClean:e,my:t}=_r(),r=ft(),l=dt(),s=ht(),f,u,m,a;function p(o){return o.map(n=>(n.nodes&&(n.nodes=p(n.nodes)),delete n.source,n))}function i(o){if(o[e]=!1,o.proxyOf.nodes)for(let n of o.proxyOf.nodes)i(n)}class c extends s{append(...n){for(let d of n){let h=this.normalize(d,this.last);for(let y of h)this.proxyOf.nodes.push(y)}return this.markDirty(),this}cleanRaws(n){if(super.cleanRaws(n),this.nodes)for(let d of this.nodes)d.cleanRaws(n)}each(n){if(!this.proxyOf.nodes)return;let d=this.getIterator(),h,y;for(;this.indexes[d]<this.proxyOf.nodes.length&&(h=this.indexes[d],y=n(this.proxyOf.nodes[h],h),y!==!1);)this.indexes[d]+=1;return delete this.indexes[d],y}every(n){return this.nodes.every(n)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let n=this.lastEach;return this.indexes[n]=0,n}getProxyProcessor(){return{get(n,d){return d==="proxyOf"?n:n[d]?d==="each"||typeof d=="string"&&d.startsWith("walk")?(...h)=>n[d](...h.map(y=>typeof y=="function"?(C,w)=>y(C.toProxy(),w):y)):d==="every"||d==="some"?h=>n[d]((y,...C)=>h(y.toProxy(),...C)):d==="root"?()=>n.root().toProxy():d==="nodes"?n.nodes.map(h=>h.toProxy()):d==="first"||d==="last"?n[d].toProxy():n[d]:n[d]},set(n,d,h){return n[d]===h||(n[d]=h,(d==="name"||d==="params"||d==="selector")&&n.markDirty()),!0}}}index(n){return typeof n=="number"?n:(n.proxyOf&&(n=n.proxyOf),this.proxyOf.nodes.indexOf(n))}insertAfter(n,d){let h=this.index(n),y=this.normalize(d,this.proxyOf.nodes[h]).reverse();h=this.index(n);for(let w of y)this.proxyOf.nodes.splice(h+1,0,w);let C;for(let w in this.indexes)C=this.indexes[w],h<C&&(this.indexes[w]=C+y.length);return this.markDirty(),this}insertBefore(n,d){let h=this.index(n),y=h===0?"prepend":!1,C=this.normalize(d,this.proxyOf.nodes[h],y).reverse();h=this.index(n);for(let S of C)this.proxyOf.nodes.splice(h,0,S);let w;for(let S in this.indexes)w=this.indexes[S],h<=w&&(this.indexes[S]=w+C.length);return this.markDirty(),this}normalize(n,d){if(typeof n=="string")n=p(f(n).nodes);else if(typeof n>"u")n=[];else if(Array.isArray(n)){n=n.slice(0);for(let y of n)y.parent&&y.parent.removeChild(y,"ignore")}else if(n.type==="root"&&this.type!=="document"){n=n.nodes.slice(0);for(let y of n)y.parent&&y.parent.removeChild(y,"ignore")}else if(n.type)n=[n];else if(n.prop){if(typeof n.value>"u")throw new Error("Value field is missed in node creation");typeof n.value!="string"&&(n.value=String(n.value)),n=[new r(n)]}else if(n.selector)n=[new u(n)];else if(n.name)n=[new m(n)];else if(n.text)n=[new l(n)];else throw new Error("Unknown node type in node creation");return n.map(y=>(y[t]||c.rebuild(y),y=y.proxyOf,y.parent&&y.parent.removeChild(y),y[e]&&i(y),typeof y.raws.before>"u"&&d&&typeof d.raws.before<"u"&&(y.raws.before=d.raws.before.replace(/\S/g,"")),y.parent=this.proxyOf,y))}prepend(...n){n=n.reverse();for(let d of n){let h=this.normalize(d,this.first,"prepend").reverse();for(let y of h)this.proxyOf.nodes.unshift(y);for(let y in this.indexes)this.indexes[y]=this.indexes[y]+h.length}return this.markDirty(),this}push(n){return n.parent=this,this.proxyOf.nodes.push(n),this}removeAll(){for(let n of this.proxyOf.nodes)n.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(n){n=this.index(n),this.proxyOf.nodes[n].parent=void 0,this.proxyOf.nodes.splice(n,1);let d;for(let h in this.indexes)d=this.indexes[h],d>=n&&(this.indexes[h]=d-1);return this.markDirty(),this}replaceValues(n,d,h){return h||(h=d,d={}),this.walkDecls(y=>{d.props&&!d.props.includes(y.prop)||d.fast&&!y.value.includes(d.fast)||(y.value=y.value.replace(n,h))}),this.markDirty(),this}some(n){return this.nodes.some(n)}walk(n){return this.each((d,h)=>{let y;try{y=n(d,h)}catch(C){throw d.addToError(C)}return y!==!1&&d.walk&&(y=d.walk(n)),y})}walkAtRules(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="atrule"&&n.test(h.name))return d(h,y)}):this.walk((h,y)=>{if(h.type==="atrule"&&h.name===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="atrule")return d(h,y)}))}walkComments(n){return this.walk((d,h)=>{if(d.type==="comment")return n(d,h)})}walkDecls(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="decl"&&n.test(h.prop))return d(h,y)}):this.walk((h,y)=>{if(h.type==="decl"&&h.prop===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="decl")return d(h,y)}))}walkRules(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="rule"&&n.test(h.selector))return d(h,y)}):this.walk((h,y)=>{if(h.type==="rule"&&h.selector===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="rule")return d(h,y)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return c.registerParse=o=>{f=o},c.registerRule=o=>{u=o},c.registerAtRule=o=>{m=o},c.registerRoot=o=>{a=o},Lt=c,c.default=c,c.rebuild=o=>{o.type==="atrule"?Object.setPrototypeOf(o,m.prototype):o.type==="rule"?Object.setPrototypeOf(o,u.prototype):o.type==="decl"?Object.setPrototypeOf(o,r.prototype):o.type==="comment"?Object.setPrototypeOf(o,l.prototype):o.type==="root"&&Object.setPrototypeOf(o,a.prototype),o[t]=!0,o.nodes&&o.nodes.forEach(n=>{c.rebuild(n)})},Lt}var Dt,ds;function Lr(){if(ds)return Dt;ds=1;let e=xe(),t,r;class l extends e{constructor(f){super({type:"document",...f}),this.nodes||(this.nodes=[])}toResult(f={}){return new t(new r,this,f).stringify()}}return l.registerLazyResult=s=>{t=s},l.registerProcessor=s=>{r=s},Dt=l,l.default=l,Dt}var Tt,ms;function ki(){if(ms)return Tt;ms=1;class e{constructor(r,l={}){if(this.type="warning",this.text=r,l.node&&l.node.source){let s=l.node.rangeBy(l);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(let s in l)this[s]=l[s]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Tt=e,e.default=e,Tt}var Ft,gs;function Dr(){if(gs)return Ft;gs=1;let e=ki();class t{constructor(l,s,f){this.processor=l,this.messages=[],this.root=s,this.opts=f,this.css=void 0,this.map=void 0}toString(){return this.css}warn(l,s={}){s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);let f=new e(l,s);return this.messages.push(f),f}warnings(){return this.messages.filter(l=>l.type==="warning")}get content(){return this.css}}return Ft=t,t.default=t,Ft}var Ut,ys;function oo(){if(ys)return Ut;ys=1;const e=39,t=34,r=92,l=47,s=10,f=32,u=12,m=9,a=13,p=91,i=93,c=40,o=41,n=123,d=125,h=59,y=42,C=58,w=64,S=/[\t\n\f\r "#'()/;[\\\]{}]/g,b=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,g=/.[\r\n"'(/\\]/,v=/[\da-f]/i;return Ut=function(O,A={}){let M=O.css.valueOf(),$=A.ignoreErrors,k,R,Z,N,ee,H,F,Q,W,P,ye=M.length,E=0,pe=[],se=[];function Me(){return E}function de(X){throw O.error("Unclosed "+X,E)}function De(){return se.length===0&&E>=ye}function ae(X){if(se.length)return se.pop();if(E>=ye)return;let ne=X?X.ignoreUnclosed:!1;switch(k=M.charCodeAt(E),k){case s:case f:case m:case a:case u:{R=E;do R+=1,k=M.charCodeAt(R);while(k===f||k===s||k===m||k===a||k===u);P=["space",M.slice(E,R)],E=R-1;break}case p:case i:case n:case d:case C:case h:case o:{let _=String.fromCharCode(k);P=[_,_,E];break}case c:{if(Q=pe.length?pe.pop()[1]:"",W=M.charCodeAt(E+1),Q==="url"&&W!==e&&W!==t&&W!==f&&W!==s&&W!==m&&W!==u&&W!==a){R=E;do{if(H=!1,R=M.indexOf(")",R+1),R===-1)if($||ne){R=E;break}else de("bracket");for(F=R;M.charCodeAt(F-1)===r;)F-=1,H=!H}while(H);P=["brackets",M.slice(E,R+1),E,R],E=R}else R=M.indexOf(")",E+1),N=M.slice(E,R+1),R===-1||g.test(N)?P=["(","(",E]:(P=["brackets",N,E,R],E=R);break}case e:case t:{Z=k===e?"'":'"',R=E;do{if(H=!1,R=M.indexOf(Z,R+1),R===-1)if($||ne){R=E+1;break}else de("string");for(F=R;M.charCodeAt(F-1)===r;)F-=1,H=!H}while(H);P=["string",M.slice(E,R+1),E,R],E=R;break}case w:{S.lastIndex=E+1,S.test(M),S.lastIndex===0?R=M.length-1:R=S.lastIndex-2,P=["at-word",M.slice(E,R+1),E,R],E=R;break}case r:{for(R=E,ee=!0;M.charCodeAt(R+1)===r;)R+=1,ee=!ee;if(k=M.charCodeAt(R+1),ee&&k!==l&&k!==f&&k!==s&&k!==m&&k!==a&&k!==u&&(R+=1,v.test(M.charAt(R)))){for(;v.test(M.charAt(R+1));)R+=1;M.charCodeAt(R+1)===f&&(R+=1)}P=["word",M.slice(E,R+1),E,R],E=R;break}default:{k===l&&M.charCodeAt(E+1)===y?(R=M.indexOf("*/",E+2)+1,R===0&&($||ne?R=M.length:de("comment")),P=["comment",M.slice(E,R+1),E,R],E=R):(b.lastIndex=E+1,b.test(M),b.lastIndex===0?R=M.length-1:R=b.lastIndex-2,P=["word",M.slice(E,R+1),E,R],pe.push(P),E=R);break}}return E++,P}function le(X){se.push(X)}return{back:le,endOfFile:De,nextToken:ae,position:Me}},Ut}var $t,ws;function Tr(){if(ws)return $t;ws=1;let e=xe();class t extends e{constructor(l){super(l),this.type="atrule"}append(...l){return this.proxyOf.nodes||(this.nodes=[]),super.append(...l)}prepend(...l){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...l)}}return $t=t,t.default=t,e.registerAtRule(t),$t}var Bt,bs;function ze(){if(bs)return Bt;bs=1;let e=xe(),t,r;class l extends e{constructor(f){super(f),this.type="root",this.nodes||(this.nodes=[])}normalize(f,u,m){let a=super.normalize(f);if(u){if(m==="prepend")this.nodes.length>1?u.raws.before=this.nodes[1].raws.before:delete u.raws.before;else if(this.first!==u)for(let p of a)p.raws.before=u.raws.before}return a}removeChild(f,u){let m=this.index(f);return!u&&m===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[m].raws.before),super.removeChild(f)}toResult(f={}){return new t(new r,this,f).stringify()}}return l.registerLazyResult=s=>{t=s},l.registerProcessor=s=>{r=s},Bt=l,l.default=l,e.registerRoot(l),Bt}var zt,Ss;function Ni(){if(Ss)return zt;Ss=1;let e={comma(t){return e.split(t,[","],!0)},space(t){let r=[" ",`
`,"	"];return e.split(t,r)},split(t,r,l){let s=[],f="",u=!1,m=0,a=!1,p="",i=!1;for(let c of t)i?i=!1:c==="\\"?i=!0:a?c===p&&(a=!1):c==='"'||c==="'"?(a=!0,p=c):c==="("?m+=1:c===")"?m>0&&(m-=1):m===0&&r.includes(c)&&(u=!0),u?(f!==""&&s.push(f.trim()),f="",u=!1):f+=c;return(l||f!=="")&&s.push(f.trim()),s}};return zt=e,e.default=e,zt}var Wt,vs;function Fr(){if(vs)return Wt;vs=1;let e=xe(),t=Ni();class r extends e{constructor(s){super(s),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(s){let f=this.selector?this.selector.match(/,\s*/):null,u=f?f[0]:","+this.raw("between","beforeOpen");this.selector=s.join(u)}}return Wt=r,r.default=r,e.registerRule(r),Wt}var qt,Cs;function ao(){if(Cs)return qt;Cs=1;let e=ft(),t=oo(),r=dt(),l=Tr(),s=ze(),f=Fr();const u={empty:!0,space:!0};function m(p){for(let i=p.length-1;i>=0;i--){let c=p[i],o=c[3]||c[2];if(o)return o}}class a{constructor(i){this.input=i,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:i,start:{column:1,line:1,offset:0}}}atrule(i){let c=new l;c.name=i[1].slice(1),c.name===""&&this.unnamedAtrule(c,i),this.init(c,i[2]);let o,n,d,h=!1,y=!1,C=[],w=[];for(;!this.tokenizer.endOfFile();){if(i=this.tokenizer.nextToken(),o=i[0],o==="("||o==="["?w.push(o==="("?")":"]"):o==="{"&&w.length>0?w.push("}"):o===w[w.length-1]&&w.pop(),w.length===0)if(o===";"){c.source.end=this.getPosition(i[2]),c.source.end.offset++,this.semicolon=!0;break}else if(o==="{"){y=!0;break}else if(o==="}"){if(C.length>0){for(d=C.length-1,n=C[d];n&&n[0]==="space";)n=C[--d];n&&(c.source.end=this.getPosition(n[3]||n[2]),c.source.end.offset++)}this.end(i);break}else C.push(i);else C.push(i);if(this.tokenizer.endOfFile()){h=!0;break}}c.raws.between=this.spacesAndCommentsFromEnd(C),C.length?(c.raws.afterName=this.spacesAndCommentsFromStart(C),this.raw(c,"params",C),h&&(i=C[C.length-1],c.source.end=this.getPosition(i[3]||i[2]),c.source.end.offset++,this.spaces=c.raws.between,c.raws.between="")):(c.raws.afterName="",c.params=""),y&&(c.nodes=[],this.current=c)}checkMissedSemicolon(i){let c=this.colon(i);if(c===!1)return;let o=0,n;for(let d=c-1;d>=0&&(n=i[d],!(n[0]!=="space"&&(o+=1,o===2)));d--);throw this.input.error("Missed semicolon",n[0]==="word"?n[3]+1:n[2])}colon(i){let c=0,o,n,d;for(let[h,y]of i.entries()){if(o=y,n=o[0],n==="("&&(c+=1),n===")"&&(c-=1),c===0&&n===":")if(!d)this.doubleColon(o);else{if(d[0]==="word"&&d[1]==="progid")continue;return h}d=o}return!1}comment(i){let c=new r;this.init(c,i[2]),c.source.end=this.getPosition(i[3]||i[2]),c.source.end.offset++;let o=i[1].slice(2,-2);if(/^\s*$/.test(o))c.text="",c.raws.left=o,c.raws.right="";else{let n=o.match(/^(\s*)([^]*\S)(\s*)$/);c.text=n[2],c.raws.left=n[1],c.raws.right=n[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(i,c){let o=new e;this.init(o,i[0][2]);let n=i[i.length-1];for(n[0]===";"&&(this.semicolon=!0,i.pop()),o.source.end=this.getPosition(n[3]||n[2]||m(i)),o.source.end.offset++;i[0][0]!=="word";)i.length===1&&this.unknownWord(i),o.raws.before+=i.shift()[1];for(o.source.start=this.getPosition(i[0][2]),o.prop="";i.length;){let w=i[0][0];if(w===":"||w==="space"||w==="comment")break;o.prop+=i.shift()[1]}o.raws.between="";let d;for(;i.length;)if(d=i.shift(),d[0]===":"){o.raws.between+=d[1];break}else d[0]==="word"&&/\w/.test(d[1])&&this.unknownWord([d]),o.raws.between+=d[1];(o.prop[0]==="_"||o.prop[0]==="*")&&(o.raws.before+=o.prop[0],o.prop=o.prop.slice(1));let h=[],y;for(;i.length&&(y=i[0][0],!(y!=="space"&&y!=="comment"));)h.push(i.shift());this.precheckMissedSemicolon(i);for(let w=i.length-1;w>=0;w--){if(d=i[w],d[1].toLowerCase()==="!important"){o.important=!0;let S=this.stringFrom(i,w);S=this.spacesFromEnd(i)+S,S!==" !important"&&(o.raws.important=S);break}else if(d[1].toLowerCase()==="important"){let S=i.slice(0),b="";for(let g=w;g>0;g--){let v=S[g][0];if(b.trim().indexOf("!")===0&&v!=="space")break;b=S.pop()[1]+b}b.trim().indexOf("!")===0&&(o.important=!0,o.raws.important=b,i=S)}if(d[0]!=="space"&&d[0]!=="comment")break}i.some(w=>w[0]!=="space"&&w[0]!=="comment")&&(o.raws.between+=h.map(w=>w[1]).join(""),h=[]),this.raw(o,"value",h.concat(i),c),o.value.includes(":")&&!c&&this.checkMissedSemicolon(i)}doubleColon(i){throw this.input.error("Double colon",{offset:i[2]},{offset:i[2]+i[1].length})}emptyRule(i){let c=new f;this.init(c,i[2]),c.selector="",c.raws.between="",this.current=c}end(i){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(i[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(i)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(i){if(this.spaces+=i[1],this.current.nodes){let c=this.current.nodes[this.current.nodes.length-1];c&&c.type==="rule"&&!c.raws.ownSemicolon&&(c.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(i){let c=this.input.fromOffset(i);return{column:c.col,line:c.line,offset:i}}init(i,c){this.current.push(i),i.source={input:this.input,start:this.getPosition(c)},i.raws.before=this.spaces,this.spaces="",i.type!=="comment"&&(this.semicolon=!1)}other(i){let c=!1,o=null,n=!1,d=null,h=[],y=i[1].startsWith("--"),C=[],w=i;for(;w;){if(o=w[0],C.push(w),o==="("||o==="[")d||(d=w),h.push(o==="("?")":"]");else if(y&&n&&o==="{")d||(d=w),h.push("}");else if(h.length===0)if(o===";")if(n){this.decl(C,y);return}else break;else if(o==="{"){this.rule(C);return}else if(o==="}"){this.tokenizer.back(C.pop()),c=!0;break}else o===":"&&(n=!0);else o===h[h.length-1]&&(h.pop(),h.length===0&&(d=null));w=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(c=!0),h.length>0&&this.unclosedBracket(d),c&&n){if(!y)for(;C.length&&(w=C[C.length-1][0],!(w!=="space"&&w!=="comment"));)this.tokenizer.back(C.pop());this.decl(C,y)}else this.unknownWord(C)}parse(){let i;for(;!this.tokenizer.endOfFile();)switch(i=this.tokenizer.nextToken(),i[0]){case"space":this.spaces+=i[1];break;case";":this.freeSemicolon(i);break;case"}":this.end(i);break;case"comment":this.comment(i);break;case"at-word":this.atrule(i);break;case"{":this.emptyRule(i);break;default:this.other(i);break}this.endFile()}precheckMissedSemicolon(){}raw(i,c,o,n){let d,h,y=o.length,C="",w=!0,S,b;for(let g=0;g<y;g+=1)d=o[g],h=d[0],h==="space"&&g===y-1&&!n?w=!1:h==="comment"?(b=o[g-1]?o[g-1][0]:"empty",S=o[g+1]?o[g+1][0]:"empty",!u[b]&&!u[S]?C.slice(-1)===","?w=!1:C+=d[1]:w=!1):C+=d[1];if(!w){let g=o.reduce((v,x)=>v+x[1],"");i.raws[c]={raw:g,value:C}}i[c]=C}rule(i){i.pop();let c=new f;this.init(c,i[0][2]),c.raws.between=this.spacesAndCommentsFromEnd(i),this.raw(c,"selector",i),this.current=c}spacesAndCommentsFromEnd(i){let c,o="";for(;i.length&&(c=i[i.length-1][0],!(c!=="space"&&c!=="comment"));)o=i.pop()[1]+o;return o}spacesAndCommentsFromStart(i){let c,o="";for(;i.length&&(c=i[0][0],!(c!=="space"&&c!=="comment"));)o+=i.shift()[1];return o}spacesFromEnd(i){let c,o="";for(;i.length&&(c=i[i.length-1][0],c==="space");)o=i.pop()[1]+o;return o}stringFrom(i,c){let o="";for(let n=c;n<i.length;n++)o+=i[n][1];return i.splice(c,i.length-c),o}unclosedBlock(){let i=this.current.source.start;throw this.input.error("Unclosed block",i.line,i.column)}unclosedBracket(i){throw this.input.error("Unclosed bracket",{offset:i[2]},{offset:i[2]+1})}unexpectedClose(i){throw this.input.error("Unexpected }",{offset:i[2]},{offset:i[2]+1})}unknownWord(i){throw this.input.error("Unknown word",{offset:i[0][2]},{offset:i[0][2]+i[0][1].length})}unnamedAtrule(i,c){throw this.input.error("At-rule without name",{offset:c[2]},{offset:c[2]+c[1].length})}}return qt=a,qt}var jt,xs;function Ur(){if(xs)return jt;xs=1;let e=xe(),t=ao(),r=pt();function l(s,f){let u=new r(s,f),m=new t(u);try{m.parse()}catch(a){throw a}return m.root}return jt=l,l.default=l,e.registerParse(l),jt}var Ht,Rs;function Pi(){if(Rs)return Ht;Rs=1;let{isClean:e,my:t}=_r(),r=Ai(),l=ct(),s=xe(),f=Lr(),u=Dr(),m=Ur(),a=ze();const p={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},i={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},c={Once:!0,postcssPlugin:!0,prepare:!0},o=0;function n(S){return typeof S=="object"&&typeof S.then=="function"}function d(S){let b=!1,g=p[S.type];return S.type==="decl"?b=S.prop.toLowerCase():S.type==="atrule"&&(b=S.name.toLowerCase()),b&&S.append?[g,g+"-"+b,o,g+"Exit",g+"Exit-"+b]:b?[g,g+"-"+b,g+"Exit",g+"Exit-"+b]:S.append?[g,o,g+"Exit"]:[g,g+"Exit"]}function h(S){let b;return S.type==="document"?b=["Document",o,"DocumentExit"]:S.type==="root"?b=["Root",o,"RootExit"]:b=d(S),{eventIndex:0,events:b,iterator:0,node:S,visitorIndex:0,visitors:[]}}function y(S){return S[e]=!1,S.nodes&&S.nodes.forEach(b=>y(b)),S}let C={};class w{constructor(b,g,v){this.stringified=!1,this.processed=!1;let x;if(typeof g=="object"&&g!==null&&(g.type==="root"||g.type==="document"))x=y(g);else if(g instanceof w||g instanceof u)x=y(g.root),g.map&&(typeof v.map>"u"&&(v.map={}),v.map.inline||(v.map.inline=!1),v.map.prev=g.map);else{let O=m;v.syntax&&(O=v.syntax.parse),v.parser&&(O=v.parser),O.parse&&(O=O.parse);try{x=O(g,v)}catch(A){this.processed=!0,this.error=A}x&&!x[t]&&s.rebuild(x)}this.result=new u(b,x,v),this.helpers={...C,postcss:C,result:this.result},this.plugins=this.processor.plugins.map(O=>typeof O=="object"&&O.prepare?{...O,...O.prepare(this.result)}:O)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(b){return this.async().catch(b)}finally(b){return this.async().then(b,b)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(b,g){let v=this.result.lastPlugin;try{g&&g.addToError(b),this.error=b,b.name==="CssSyntaxError"&&!b.plugin?(b.plugin=v.postcssPlugin,b.setMessage()):v.postcssVersion}catch(x){console&&console.error&&console.error(x)}return b}prepareVisitors(){this.listeners={};let b=(g,v,x)=>{this.listeners[v]||(this.listeners[v]=[]),this.listeners[v].push([g,x])};for(let g of this.plugins)if(typeof g=="object")for(let v in g){if(!i[v]&&/^[A-Z]/.test(v))throw new Error(`Unknown event ${v} in ${g.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!c[v])if(typeof g[v]=="object")for(let x in g[v])x==="*"?b(g,v,g[v][x]):b(g,v+"-"+x.toLowerCase(),g[v][x]);else typeof g[v]=="function"&&b(g,v,g[v])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let b=0;b<this.plugins.length;b++){let g=this.plugins[b],v=this.runOnRoot(g);if(n(v))try{await v}catch(x){throw this.handleError(x)}}if(this.prepareVisitors(),this.hasListener){let b=this.result.root;for(;!b[e];){b[e]=!0;let g=[h(b)];for(;g.length>0;){let v=this.visitTick(g);if(n(v))try{await v}catch(x){let O=g[g.length-1].node;throw this.handleError(x,O)}}}if(this.listeners.OnceExit)for(let[g,v]of this.listeners.OnceExit){this.result.lastPlugin=g;try{if(b.type==="document"){let x=b.nodes.map(O=>v(O,this.helpers));await Promise.all(x)}else await v(b,this.helpers)}catch(x){throw this.handleError(x)}}}return this.processed=!0,this.stringify()}runOnRoot(b){this.result.lastPlugin=b;try{if(typeof b=="object"&&b.Once){if(this.result.root.type==="document"){let g=this.result.root.nodes.map(v=>b.Once(v,this.helpers));return n(g[0])?Promise.all(g):g}return b.Once(this.result.root,this.helpers)}else if(typeof b=="function")return b(this.result.root,this.result)}catch(g){throw this.handleError(g)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let b=this.result.opts,g=l;b.syntax&&(g=b.syntax.stringify),b.stringifier&&(g=b.stringifier),g.stringify&&(g=g.stringify);let x=new r(g,this.result.root,this.result.opts).generate();return this.result.css=x[0],this.result.map=x[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let b of this.plugins){let g=this.runOnRoot(b);if(n(g))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let b=this.result.root;for(;!b[e];)b[e]=!0,this.walkSync(b);if(this.listeners.OnceExit)if(b.type==="document")for(let g of b.nodes)this.visitSync(this.listeners.OnceExit,g);else this.visitSync(this.listeners.OnceExit,b)}return this.result}then(b,g){return this.async().then(b,g)}toString(){return this.css}visitSync(b,g){for(let[v,x]of b){this.result.lastPlugin=v;let O;try{O=x(g,this.helpers)}catch(A){throw this.handleError(A,g.proxyOf)}if(g.type!=="root"&&g.type!=="document"&&!g.parent)return!0;if(n(O))throw this.getAsyncError()}}visitTick(b){let g=b[b.length-1],{node:v,visitors:x}=g;if(v.type!=="root"&&v.type!=="document"&&!v.parent){b.pop();return}if(x.length>0&&g.visitorIndex<x.length){let[A,M]=x[g.visitorIndex];g.visitorIndex+=1,g.visitorIndex===x.length&&(g.visitors=[],g.visitorIndex=0),this.result.lastPlugin=A;try{return M(v.toProxy(),this.helpers)}catch($){throw this.handleError($,v)}}if(g.iterator!==0){let A=g.iterator,M;for(;M=v.nodes[v.indexes[A]];)if(v.indexes[A]+=1,!M[e]){M[e]=!0,b.push(h(M));return}g.iterator=0,delete v.indexes[A]}let O=g.events;for(;g.eventIndex<O.length;){let A=O[g.eventIndex];if(g.eventIndex+=1,A===o){v.nodes&&v.nodes.length&&(v[e]=!0,g.iterator=v.getIterator());return}else if(this.listeners[A]){g.visitors=this.listeners[A];return}}b.pop()}walkSync(b){b[e]=!0;let g=d(b);for(let v of g)if(v===o)b.nodes&&b.each(x=>{x[e]||this.walkSync(x)});else{let x=this.listeners[v];if(x&&this.visitSync(x,b.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return w.registerPostcss=S=>{C=S},Ht=w,w.default=w,a.registerLazyResult(w),f.registerLazyResult(w),Ht}var Gt,Os;function lo(){if(Os)return Gt;Os=1;let e=Ai(),t=ct(),r=Ur();const l=Dr();class s{constructor(u,m,a){m=m.toString(),this.stringified=!1,this._processor=u,this._css=m,this._opts=a,this._map=void 0;let p,i=t;this.result=new l(this._processor,p,this._opts),this.result.css=m;let c=this;Object.defineProperty(this.result,"root",{get(){return c.root}});let o=new e(i,p,this._opts,m);if(o.isMap()){let[n,d]=o.generate();n&&(this.result.css=n),d&&(this.result.map=d)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(u){return this.async().catch(u)}finally(u){return this.async().then(u,u)}sync(){if(this.error)throw this.error;return this.result}then(u,m){return this.async().then(u,m)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let u,m=r;try{u=m(this._css,this._opts)}catch(a){this.error=a}if(this.error)throw this.error;return this._root=u,u}get[Symbol.toStringTag](){return"NoWorkResult"}}return Gt=s,s.default=s,Gt}var Vt,Ms;function uo(){if(Ms)return Vt;Ms=1;let e=lo(),t=Pi(),r=Lr(),l=ze();class s{constructor(u=[]){this.version="8.4.38",this.plugins=this.normalize(u)}normalize(u){let m=[];for(let a of u)if(a.postcss===!0?a=a():a.postcss&&(a=a.postcss),typeof a=="object"&&Array.isArray(a.plugins))m=m.concat(a.plugins);else if(typeof a=="object"&&a.postcssPlugin)m.push(a);else if(typeof a=="function")m.push(a);else if(!(typeof a=="object"&&(a.parse||a.stringify)))throw new Error(a+" is not a PostCSS plugin");return m}process(u,m={}){return!this.plugins.length&&!m.parser&&!m.stringifier&&!m.syntax?new e(this,u,m):new t(this,u,m)}use(u){return this.plugins=this.plugins.concat(this.normalize([u])),this}}return Vt=s,s.default=s,l.registerProcessor(s),r.registerProcessor(s),Vt}var Jt,Es;function co(){if(Es)return Jt;Es=1;let e=ft(),t=Ii(),r=dt(),l=Tr(),s=pt(),f=ze(),u=Fr();function m(a,p){if(Array.isArray(a))return a.map(o=>m(o));let{inputs:i,...c}=a;if(i){p=[];for(let o of i){let n={...o,__proto__:s.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),p.push(n)}}if(c.nodes&&(c.nodes=a.nodes.map(o=>m(o,p))),c.source){let{inputId:o,...n}=c.source;c.source=n,o!=null&&(c.source.input=p[o])}if(c.type==="root")return new f(c);if(c.type==="decl")return new e(c);if(c.type==="rule")return new u(c);if(c.type==="comment")return new r(c);if(c.type==="atrule")return new l(c);throw new Error("Unknown node type: "+a.type)}return Jt=m,m.default=m,Jt}var Yt,Is;function ho(){if(Is)return Yt;Is=1;let e=Pr(),t=ft(),r=Pi(),l=xe(),s=uo(),f=ct(),u=co(),m=Lr(),a=ki(),p=dt(),i=Tr(),c=Dr(),o=pt(),n=Ur(),d=Ni(),h=Fr(),y=ze(),C=ht();function w(...S){return S.length===1&&Array.isArray(S[0])&&(S=S[0]),new s(S)}return w.plugin=function(b,g){let v=!1;function x(...A){console&&console.warn&&!v&&(v=!0,console.warn(b+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),rt.LANG&&rt.LANG.startsWith("cn")&&console.warn(b+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));let M=g(...A);return M.postcssPlugin=b,M.postcssVersion=new s().version,M}let O;return Object.defineProperty(x,"postcss",{get(){return O||(O=x()),O}}),x.process=function(A,M,$){return w([x($)]).process(A,M)},x},w.stringify=f,w.parse=n,w.fromJSON=u,w.list=d,w.comment=S=>new p(S),w.atRule=S=>new i(S),w.decl=S=>new t(S),w.rule=S=>new h(S),w.root=S=>new y(S),w.document=S=>new m(S),w.CssSyntaxError=e,w.Declaration=t,w.Container=l,w.Processor=s,w.Document=m,w.Comment=p,w.Warning=a,w.AtRule=i,w.Result=c,w.Input=o,w.Rule=h,w.Root=y,w.Node=C,r.registerPostcss(w),Yt=w,w.default=w,Yt}var fo=ho();const q=eo(fo);q.stringify;q.fromJSON;q.plugin;q.parse;q.list;q.document;q.comment;q.atRule;q.rule;q.decl;q.root;q.CssSyntaxError;q.Declaration;q.Container;q.Processor;q.Document;q.Comment;q.Warning;q.AtRule;q.Result;q.Input;q.Rule;q.Root;q.Node;var po=Object.defineProperty,mo=(e,t,r)=>t in e?po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oe=(e,t,r)=>mo(e,typeof t!="symbol"?t+"":t,r);function go(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yo(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function l(){return this instanceof l?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(l){var s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,s.get?s:{enumerable:!0,get:function(){return e[l]}})}),r}var Je={exports:{}},As;function wo(){if(As)return Je.exports;As=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Je.exports=t(),Je.exports.createColors=t,Je.exports}const bo={},So=Object.freeze(Object.defineProperty({__proto__:null,default:bo},Symbol.toStringTag,{value:"Module"})),fe=yo(So);var Qt,ks;function $r(){if(ks)return Qt;ks=1;let e=wo(),t=fe;class r extends Error{constructor(s,f,u,m,a,p){super(s),this.name="CssSyntaxError",this.reason=s,a&&(this.file=a),m&&(this.source=m),p&&(this.plugin=p),typeof f<"u"&&typeof u<"u"&&(typeof f=="number"?(this.line=f,this.column=u):(this.line=f.line,this.column=f.column,this.endLine=u.line,this.endColumn=u.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(s){if(!this.source)return"";let f=this.source;s==null&&(s=e.isColorSupported),t&&s&&(f=t(f));let u=f.split(/\r?\n/),m=Math.max(this.line-3,0),a=Math.min(this.line+2,u.length),p=String(a).length,i,c;if(s){let{bold:o,gray:n,red:d}=e.createColors(!0);i=h=>o(d(h)),c=h=>n(h)}else i=c=o=>o;return u.slice(m,a).map((o,n)=>{let d=m+1+n,h=" "+(" "+d).slice(-p)+" | ";if(d===this.line){let y=c(h.replace(/\d/g," "))+o.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+c(h)+o+`
 `+y+i("^")}return" "+c(h)+o}).join(`
`)}toString(){let s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s}}return Qt=r,r.default=r,Qt}var Ye={},Ns;function Br(){return Ns||(Ns=1,Ye.isClean=Symbol("isClean"),Ye.my=Symbol("my")),Ye}var Xt,Ps;function _i(){if(Ps)return Xt;Ps=1;const e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function t(l){return l[0].toUpperCase()+l.slice(1)}class r{constructor(s){this.builder=s}atrule(s,f){let u="@"+s.name,m=s.params?this.rawValue(s,"params"):"";if(typeof s.raws.afterName<"u"?u+=s.raws.afterName:m&&(u+=" "),s.nodes)this.block(s,u+m);else{let a=(s.raws.between||"")+(f?";":"");this.builder(u+m+a,s)}}beforeAfter(s,f){let u;s.type==="decl"?u=this.raw(s,null,"beforeDecl"):s.type==="comment"?u=this.raw(s,null,"beforeComment"):f==="before"?u=this.raw(s,null,"beforeRule"):u=this.raw(s,null,"beforeClose");let m=s.parent,a=0;for(;m&&m.type!=="root";)a+=1,m=m.parent;if(u.includes(`
`)){let p=this.raw(s,null,"indent");if(p.length)for(let i=0;i<a;i++)u+=p}return u}block(s,f){let u=this.raw(s,"between","beforeOpen");this.builder(f+u+"{",s,"start");let m;s.nodes&&s.nodes.length?(this.body(s),m=this.raw(s,"after")):m=this.raw(s,"after","emptyBody"),m&&this.builder(m),this.builder("}",s,"end")}body(s){let f=s.nodes.length-1;for(;f>0&&s.nodes[f].type==="comment";)f-=1;let u=this.raw(s,"semicolon");for(let m=0;m<s.nodes.length;m++){let a=s.nodes[m],p=this.raw(a,"before");p&&this.builder(p),this.stringify(a,f!==m||u)}}comment(s){let f=this.raw(s,"left","commentLeft"),u=this.raw(s,"right","commentRight");this.builder("/*"+f+s.text+u+"*/",s)}decl(s,f){let u=this.raw(s,"between","colon"),m=s.prop+u+this.rawValue(s,"value");s.important&&(m+=s.raws.important||" !important"),f&&(m+=";"),this.builder(m,s)}document(s){this.body(s)}raw(s,f,u){let m;if(u||(u=f),f&&(m=s.raws[f],typeof m<"u"))return m;let a=s.parent;if(u==="before"&&(!a||a.type==="root"&&a.first===s||a&&a.type==="document"))return"";if(!a)return e[u];let p=s.root();if(p.rawCache||(p.rawCache={}),typeof p.rawCache[u]<"u")return p.rawCache[u];if(u==="before"||u==="after")return this.beforeAfter(s,u);{let i="raw"+t(u);this[i]?m=this[i](p,s):p.walk(c=>{if(m=c.raws[f],typeof m<"u")return!1})}return typeof m>"u"&&(m=e[u]),p.rawCache[u]=m,m}rawBeforeClose(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length>0&&typeof u.raws.after<"u")return f=u.raws.after,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawBeforeComment(s,f){let u;return s.walkComments(m=>{if(typeof m.raws.before<"u")return u=m.raws.before,u.includes(`
`)&&(u=u.replace(/[^\n]+$/,"")),!1}),typeof u>"u"?u=this.raw(f,null,"beforeDecl"):u&&(u=u.replace(/\S/g,"")),u}rawBeforeDecl(s,f){let u;return s.walkDecls(m=>{if(typeof m.raws.before<"u")return u=m.raws.before,u.includes(`
`)&&(u=u.replace(/[^\n]+$/,"")),!1}),typeof u>"u"?u=this.raw(f,null,"beforeRule"):u&&(u=u.replace(/\S/g,"")),u}rawBeforeOpen(s){let f;return s.walk(u=>{if(u.type!=="decl"&&(f=u.raws.between,typeof f<"u"))return!1}),f}rawBeforeRule(s){let f;return s.walk(u=>{if(u.nodes&&(u.parent!==s||s.first!==u)&&typeof u.raws.before<"u")return f=u.raws.before,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawColon(s){let f;return s.walkDecls(u=>{if(typeof u.raws.between<"u")return f=u.raws.between.replace(/[^\s:]/g,""),!1}),f}rawEmptyBody(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length===0&&(f=u.raws.after,typeof f<"u"))return!1}),f}rawIndent(s){if(s.raws.indent)return s.raws.indent;let f;return s.walk(u=>{let m=u.parent;if(m&&m!==s&&m.parent&&m.parent===s&&typeof u.raws.before<"u"){let a=u.raws.before.split(`
`);return f=a[a.length-1],f=f.replace(/\S/g,""),!1}}),f}rawSemicolon(s){let f;return s.walk(u=>{if(u.nodes&&u.nodes.length&&u.last.type==="decl"&&(f=u.raws.semicolon,typeof f<"u"))return!1}),f}rawValue(s,f){let u=s[f],m=s.raws[f];return m&&m.value===u?m.raw:u}root(s){this.body(s),s.raws.after&&this.builder(s.raws.after)}rule(s){this.block(s,this.rawValue(s,"selector")),s.raws.ownSemicolon&&this.builder(s.raws.ownSemicolon,s,"end")}stringify(s,f){if(!this[s.type])throw new Error("Unknown AST node type "+s.type+". Maybe you need to change PostCSS stringifier.");this[s.type](s,f)}}return Xt=r,r.default=r,Xt}var Kt,_s;function mt(){if(_s)return Kt;_s=1;let e=_i();function t(r,l){new e(l).stringify(r)}return Kt=t,t.default=t,Kt}var Zt,Ls;function gt(){if(Ls)return Zt;Ls=1;let{isClean:e,my:t}=Br(),r=$r(),l=_i(),s=mt();function f(m,a){let p=new m.constructor;for(let i in m){if(!Object.prototype.hasOwnProperty.call(m,i)||i==="proxyCache")continue;let c=m[i],o=typeof c;i==="parent"&&o==="object"?a&&(p[i]=a):i==="source"?p[i]=c:Array.isArray(c)?p[i]=c.map(n=>f(n,p)):(o==="object"&&c!==null&&(c=f(c)),p[i]=c)}return p}class u{constructor(a={}){this.raws={},this[e]=!1,this[t]=!0;for(let p in a)if(p==="nodes"){this.nodes=[];for(let i of a[p])typeof i.clone=="function"?this.append(i.clone()):this.append(i)}else this[p]=a[p]}addToError(a){if(a.postcssNode=this,a.stack&&this.source&&/\n\s{4}at /.test(a.stack)){let p=this.source;a.stack=a.stack.replace(/\n\s{4}at /,`$&${p.input.from}:${p.start.line}:${p.start.column}$&`)}return a}after(a){return this.parent.insertAfter(this,a),this}assign(a={}){for(let p in a)this[p]=a[p];return this}before(a){return this.parent.insertBefore(this,a),this}cleanRaws(a){delete this.raws.before,delete this.raws.after,a||delete this.raws.between}clone(a={}){let p=f(this);for(let i in a)p[i]=a[i];return p}cloneAfter(a={}){let p=this.clone(a);return this.parent.insertAfter(this,p),p}cloneBefore(a={}){let p=this.clone(a);return this.parent.insertBefore(this,p),p}error(a,p={}){if(this.source){let{end:i,start:c}=this.rangeBy(p);return this.source.input.error(a,{column:c.column,line:c.line},{column:i.column,line:i.line},p)}return new r(a)}getProxyProcessor(){return{get(a,p){return p==="proxyOf"?a:p==="root"?()=>a.root().toProxy():a[p]},set(a,p,i){return a[p]===i||(a[p]=i,(p==="prop"||p==="value"||p==="name"||p==="params"||p==="important"||p==="text")&&a.markDirty()),!0}}}markDirty(){if(this[e]){this[e]=!1;let a=this;for(;a=a.parent;)a[e]=!1}}next(){if(!this.parent)return;let a=this.parent.index(this);return this.parent.nodes[a+1]}positionBy(a,p){let i=this.source.start;if(a.index)i=this.positionInside(a.index,p);else if(a.word){p=this.toString();let c=p.indexOf(a.word);c!==-1&&(i=this.positionInside(c,p))}return i}positionInside(a,p){let i=p||this.toString(),c=this.source.start.column,o=this.source.start.line;for(let n=0;n<a;n++)i[n]===`
`?(c=1,o+=1):c+=1;return{column:c,line:o}}prev(){if(!this.parent)return;let a=this.parent.index(this);return this.parent.nodes[a-1]}rangeBy(a){let p={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:p.column+1,line:p.line};if(a.word){let c=this.toString(),o=c.indexOf(a.word);o!==-1&&(p=this.positionInside(o,c),i=this.positionInside(o+a.word.length,c))}else a.start?p={column:a.start.column,line:a.start.line}:a.index&&(p=this.positionInside(a.index)),a.end?i={column:a.end.column,line:a.end.line}:typeof a.endIndex=="number"?i=this.positionInside(a.endIndex):a.index&&(i=this.positionInside(a.index+1));return(i.line<p.line||i.line===p.line&&i.column<=p.column)&&(i={column:p.column+1,line:p.line}),{end:i,start:p}}raw(a,p){return new l().raw(this,a,p)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...a){if(this.parent){let p=this,i=!1;for(let c of a)c===this?i=!0:i?(this.parent.insertAfter(p,c),p=c):this.parent.insertBefore(p,c);i||this.remove()}return this}root(){let a=this;for(;a.parent&&a.parent.type!=="document";)a=a.parent;return a}toJSON(a,p){let i={},c=p==null;p=p||new Map;let o=0;for(let n in this){if(!Object.prototype.hasOwnProperty.call(this,n)||n==="parent"||n==="proxyCache")continue;let d=this[n];if(Array.isArray(d))i[n]=d.map(h=>typeof h=="object"&&h.toJSON?h.toJSON(null,p):h);else if(typeof d=="object"&&d.toJSON)i[n]=d.toJSON(null,p);else if(n==="source"){let h=p.get(d.input);h==null&&(h=o,p.set(d.input,o),o++),i[n]={end:d.end,inputId:h,start:d.start}}else i[n]=d}return c&&(i.inputs=[...p.keys()].map(n=>n.toJSON())),i}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(a=s){a.stringify&&(a=a.stringify);let p="";return a(this,i=>{p+=i}),p}warn(a,p,i){let c={node:this};for(let o in i)c[o]=i[o];return a.warn(p,c)}get proxyOf(){return this}}return Zt=u,u.default=u,Zt}var er,Ds;function yt(){if(Ds)return er;Ds=1;let e=gt();class t extends e{constructor(l){l&&typeof l.value<"u"&&typeof l.value!="string"&&(l={...l,value:String(l.value)}),super(l),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return er=t,t.default=t,er}var tr,Ts;function vo(){if(Ts)return tr;Ts=1;let e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return tr={nanoid:(l=21)=>{let s="",f=l;for(;f--;)s+=e[Math.random()*64|0];return s},customAlphabet:(l,s=21)=>(f=s)=>{let u="",m=f;for(;m--;)u+=l[Math.random()*l.length|0];return u}},tr}var rr,Fs;function Li(){if(Fs)return rr;Fs=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=fe,{existsSync:r,readFileSync:l}=fe,{dirname:s,join:f}=fe;function u(a){return Buffer?Buffer.from(a,"base64").toString():window.atob(a)}class m{constructor(p,i){if(i.map===!1)return;this.loadAnnotation(p),this.inline=this.startWith(this.annotation,"data:");let c=i.map?i.map.prev:void 0,o=this.loadMap(i.from,c);!this.mapFile&&i.from&&(this.mapFile=i.from),this.mapFile&&(this.root=s(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(p){let i=/^data:application\/json;charset=utf-?8;base64,/,c=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(o.test(p)||n.test(p))return decodeURIComponent(p.substr(RegExp.lastMatch.length));if(i.test(p)||c.test(p))return u(p.substr(RegExp.lastMatch.length));let d=p.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+d)}getAnnotationURL(p){return p.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(p){return typeof p!="object"?!1:typeof p.mappings=="string"||typeof p._mappings=="string"||Array.isArray(p.sections)}loadAnnotation(p){let i=p.match(/\/\*\s*# sourceMappingURL=/gm);if(!i)return;let c=p.lastIndexOf(i.pop()),o=p.indexOf("*/",c);c>-1&&o>-1&&(this.annotation=this.getAnnotationURL(p.substring(c,o)))}loadFile(p){if(this.root=s(p),r(p))return this.mapFile=p,l(p,"utf-8").toString().trim()}loadMap(p,i){if(i===!1)return!1;if(i){if(typeof i=="string")return i;if(typeof i=="function"){let c=i(p);if(c){let o=this.loadFile(c);if(!o)throw new Error("Unable to load previous source map: "+c.toString());return o}}else{if(i instanceof e)return t.fromSourceMap(i).toString();if(i instanceof t)return i.toString();if(this.isMap(i))return JSON.stringify(i);throw new Error("Unsupported previous source map format: "+i.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let c=this.annotation;return p&&(c=f(s(p),c)),this.loadFile(c)}}}startWith(p,i){return p?p.substr(0,i.length)===i:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return rr=m,m.default=m,rr}var sr,Us;function wt(){if(Us)return sr;Us=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=fe,{fileURLToPath:r,pathToFileURL:l}=fe,{isAbsolute:s,resolve:f}=fe,{nanoid:u}=vo(),m=fe,a=$r(),p=Li(),i=Symbol("fromOffsetCache"),c=!!(e&&t),o=!!(f&&s);class n{constructor(h,y={}){if(h===null||typeof h>"u"||typeof h=="object"&&!h.toString)throw new Error(`PostCSS received ${h} instead of CSS string`);if(this.css=h.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,y.from&&(!o||/^\w+:\/\//.test(y.from)||s(y.from)?this.file=y.from:this.file=f(y.from)),o&&c){let C=new p(this.css,y);if(C.text){this.map=C;let w=C.consumer().file;!this.file&&w&&(this.file=this.mapResolve(w))}}this.file||(this.id="<input css "+u(6)+">"),this.map&&(this.map.file=this.from)}error(h,y,C,w={}){let S,b,g;if(y&&typeof y=="object"){let x=y,O=C;if(typeof x.offset=="number"){let A=this.fromOffset(x.offset);y=A.line,C=A.col}else y=x.line,C=x.column;if(typeof O.offset=="number"){let A=this.fromOffset(O.offset);b=A.line,g=A.col}else b=O.line,g=O.column}else if(!C){let x=this.fromOffset(y);y=x.line,C=x.col}let v=this.origin(y,C,b,g);return v?S=new a(h,v.endLine===void 0?v.line:{column:v.column,line:v.line},v.endLine===void 0?v.column:{column:v.endColumn,line:v.endLine},v.source,v.file,w.plugin):S=new a(h,b===void 0?y:{column:C,line:y},b===void 0?C:{column:g,line:b},this.css,this.file,w.plugin),S.input={column:C,endColumn:g,endLine:b,line:y,source:this.css},this.file&&(l&&(S.input.url=l(this.file).toString()),S.input.file=this.file),S}fromOffset(h){let y,C;if(this[i])C=this[i];else{let S=this.css.split(`
`);C=new Array(S.length);let b=0;for(let g=0,v=S.length;g<v;g++)C[g]=b,b+=S[g].length+1;this[i]=C}y=C[C.length-1];let w=0;if(h>=y)w=C.length-1;else{let S=C.length-2,b;for(;w<S;)if(b=w+(S-w>>1),h<C[b])S=b-1;else if(h>=C[b+1])w=b+1;else{w=b;break}}return{col:h-C[w]+1,line:w+1}}mapResolve(h){return/^\w+:\/\//.test(h)?h:f(this.map.consumer().sourceRoot||this.map.root||".",h)}origin(h,y,C,w){if(!this.map)return!1;let S=this.map.consumer(),b=S.originalPositionFor({column:y,line:h});if(!b.source)return!1;let g;typeof C=="number"&&(g=S.originalPositionFor({column:w,line:C}));let v;s(b.source)?v=l(b.source):v=new URL(b.source,this.map.consumer().sourceRoot||l(this.map.mapFile));let x={column:b.column,endColumn:g&&g.column,endLine:g&&g.line,line:b.line,url:v.toString()};if(v.protocol==="file:")if(r)x.file=r(v);else throw new Error("file: protocol is not available in this PostCSS build");let O=S.sourceContentFor(b.source);return O&&(x.source=O),x}toJSON(){let h={};for(let y of["hasBOM","css","file","id"])this[y]!=null&&(h[y]=this[y]);return this.map&&(h.map={...this.map},h.map.consumerCache&&(h.map.consumerCache=void 0)),h}get from(){return this.file||this.id}}return sr=n,n.default=n,m&&m.registerInput&&m.registerInput(n),sr}var ir,$s;function Di(){if($s)return ir;$s=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=fe,{dirname:r,relative:l,resolve:s,sep:f}=fe,{pathToFileURL:u}=fe,m=wt(),a=!!(e&&t),p=!!(r&&s&&l&&f);class i{constructor(o,n,d,h){this.stringify=o,this.mapOpts=d.map||{},this.root=n,this.opts=d,this.css=h,this.originalCSS=h,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let o;this.isInline()?o="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?o=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?o=this.mapOpts.annotation(this.opts.to,this.root):o=this.outputFile()+".map";let n=`
`;this.css.includes(`\r
`)&&(n=`\r
`),this.css+=n+"/*# sourceMappingURL="+o+" */"}applyPrevMaps(){for(let o of this.previous()){let n=this.toUrl(this.path(o.file)),d=o.root||r(o.file),h;this.mapOpts.sourcesContent===!1?(h=new e(o.text),h.sourcesContent&&(h.sourcesContent=null)):h=o.consumer(),this.map.applySourceMap(h,n,this.toUrl(this.path(d)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let o;for(let n=this.root.nodes.length-1;n>=0;n--)o=this.root.nodes[n],o.type==="comment"&&o.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),p&&a&&this.isMap())return this.generateMap();{let o="";return this.stringify(this.root,n=>{o+=n}),[o]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let o=this.previous()[0].consumer();o.file=this.outputFile(),this.map=t.fromSourceMap(o,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let o=1,n=1,d="<no source>",h={generated:{column:0,line:0},original:{column:0,line:0},source:""},y,C;this.stringify(this.root,(w,S,b)=>{if(this.css+=w,S&&b!=="end"&&(h.generated.line=o,h.generated.column=n-1,S.source&&S.source.start?(h.source=this.sourcePath(S),h.original.line=S.source.start.line,h.original.column=S.source.start.column-1,this.map.addMapping(h)):(h.source=d,h.original.line=1,h.original.column=0,this.map.addMapping(h))),y=w.match(/\n/g),y?(o+=y.length,C=w.lastIndexOf(`
`),n=w.length-C):n+=w.length,S&&b!=="start"){let g=S.parent||{raws:{}};(!(S.type==="decl"||S.type==="atrule"&&!S.nodes)||S!==g.last||g.raws.semicolon)&&(S.source&&S.source.end?(h.source=this.sourcePath(S),h.original.line=S.source.end.line,h.original.column=S.source.end.column-1,h.generated.line=o,h.generated.column=n-2,this.map.addMapping(h)):(h.source=d,h.original.line=1,h.original.column=0,h.generated.line=o,h.generated.column=n-1,this.map.addMapping(h)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(o=>o.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let o=this.mapOpts.annotation;return typeof o<"u"&&o!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(o=>o.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(o){if(this.mapOpts.absolute||o.charCodeAt(0)===60||/^\w+:\/\//.test(o))return o;let n=this.memoizedPaths.get(o);if(n)return n;let d=this.opts.to?r(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(d=r(s(d,this.mapOpts.annotation)));let h=l(d,o);return this.memoizedPaths.set(o,h),h}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(o=>{if(o.source&&o.source.input.map){let n=o.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let o=new m(this.originalCSS,this.opts);o.map&&this.previousMaps.push(o.map)}return this.previousMaps}setSourcesContent(){let o={};if(this.root)this.root.walk(n=>{if(n.source){let d=n.source.input.from;if(d&&!o[d]){o[d]=!0;let h=this.usesFileUrls?this.toFileUrl(d):this.toUrl(this.path(d));this.map.setSourceContent(h,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(o){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(o.source.input.from):this.toUrl(this.path(o.source.input.from))}toBase64(o){return Buffer?Buffer.from(o).toString("base64"):window.btoa(unescape(encodeURIComponent(o)))}toFileUrl(o){let n=this.memoizedFileURLs.get(o);if(n)return n;if(u){let d=u(o).toString();return this.memoizedFileURLs.set(o,d),d}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(o){let n=this.memoizedURLs.get(o);if(n)return n;f==="\\"&&(o=o.replace(/\\/g,"/"));let d=encodeURI(o).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(o,d),d}}return ir=i,ir}var nr,Bs;function bt(){if(Bs)return nr;Bs=1;let e=gt();class t extends e{constructor(l){super(l),this.type="comment"}}return nr=t,t.default=t,nr}var or,zs;function Re(){if(zs)return or;zs=1;let{isClean:e,my:t}=Br(),r=yt(),l=bt(),s=gt(),f,u,m,a;function p(o){return o.map(n=>(n.nodes&&(n.nodes=p(n.nodes)),delete n.source,n))}function i(o){if(o[e]=!1,o.proxyOf.nodes)for(let n of o.proxyOf.nodes)i(n)}class c extends s{append(...n){for(let d of n){let h=this.normalize(d,this.last);for(let y of h)this.proxyOf.nodes.push(y)}return this.markDirty(),this}cleanRaws(n){if(super.cleanRaws(n),this.nodes)for(let d of this.nodes)d.cleanRaws(n)}each(n){if(!this.proxyOf.nodes)return;let d=this.getIterator(),h,y;for(;this.indexes[d]<this.proxyOf.nodes.length&&(h=this.indexes[d],y=n(this.proxyOf.nodes[h],h),y!==!1);)this.indexes[d]+=1;return delete this.indexes[d],y}every(n){return this.nodes.every(n)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let n=this.lastEach;return this.indexes[n]=0,n}getProxyProcessor(){return{get(n,d){return d==="proxyOf"?n:n[d]?d==="each"||typeof d=="string"&&d.startsWith("walk")?(...h)=>n[d](...h.map(y=>typeof y=="function"?(C,w)=>y(C.toProxy(),w):y)):d==="every"||d==="some"?h=>n[d]((y,...C)=>h(y.toProxy(),...C)):d==="root"?()=>n.root().toProxy():d==="nodes"?n.nodes.map(h=>h.toProxy()):d==="first"||d==="last"?n[d].toProxy():n[d]:n[d]},set(n,d,h){return n[d]===h||(n[d]=h,(d==="name"||d==="params"||d==="selector")&&n.markDirty()),!0}}}index(n){return typeof n=="number"?n:(n.proxyOf&&(n=n.proxyOf),this.proxyOf.nodes.indexOf(n))}insertAfter(n,d){let h=this.index(n),y=this.normalize(d,this.proxyOf.nodes[h]).reverse();h=this.index(n);for(let w of y)this.proxyOf.nodes.splice(h+1,0,w);let C;for(let w in this.indexes)C=this.indexes[w],h<C&&(this.indexes[w]=C+y.length);return this.markDirty(),this}insertBefore(n,d){let h=this.index(n),y=h===0?"prepend":!1,C=this.normalize(d,this.proxyOf.nodes[h],y).reverse();h=this.index(n);for(let S of C)this.proxyOf.nodes.splice(h,0,S);let w;for(let S in this.indexes)w=this.indexes[S],h<=w&&(this.indexes[S]=w+C.length);return this.markDirty(),this}normalize(n,d){if(typeof n=="string")n=p(f(n).nodes);else if(typeof n>"u")n=[];else if(Array.isArray(n)){n=n.slice(0);for(let y of n)y.parent&&y.parent.removeChild(y,"ignore")}else if(n.type==="root"&&this.type!=="document"){n=n.nodes.slice(0);for(let y of n)y.parent&&y.parent.removeChild(y,"ignore")}else if(n.type)n=[n];else if(n.prop){if(typeof n.value>"u")throw new Error("Value field is missed in node creation");typeof n.value!="string"&&(n.value=String(n.value)),n=[new r(n)]}else if(n.selector)n=[new u(n)];else if(n.name)n=[new m(n)];else if(n.text)n=[new l(n)];else throw new Error("Unknown node type in node creation");return n.map(y=>(y[t]||c.rebuild(y),y=y.proxyOf,y.parent&&y.parent.removeChild(y),y[e]&&i(y),typeof y.raws.before>"u"&&d&&typeof d.raws.before<"u"&&(y.raws.before=d.raws.before.replace(/\S/g,"")),y.parent=this.proxyOf,y))}prepend(...n){n=n.reverse();for(let d of n){let h=this.normalize(d,this.first,"prepend").reverse();for(let y of h)this.proxyOf.nodes.unshift(y);for(let y in this.indexes)this.indexes[y]=this.indexes[y]+h.length}return this.markDirty(),this}push(n){return n.parent=this,this.proxyOf.nodes.push(n),this}removeAll(){for(let n of this.proxyOf.nodes)n.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(n){n=this.index(n),this.proxyOf.nodes[n].parent=void 0,this.proxyOf.nodes.splice(n,1);let d;for(let h in this.indexes)d=this.indexes[h],d>=n&&(this.indexes[h]=d-1);return this.markDirty(),this}replaceValues(n,d,h){return h||(h=d,d={}),this.walkDecls(y=>{d.props&&!d.props.includes(y.prop)||d.fast&&!y.value.includes(d.fast)||(y.value=y.value.replace(n,h))}),this.markDirty(),this}some(n){return this.nodes.some(n)}walk(n){return this.each((d,h)=>{let y;try{y=n(d,h)}catch(C){throw d.addToError(C)}return y!==!1&&d.walk&&(y=d.walk(n)),y})}walkAtRules(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="atrule"&&n.test(h.name))return d(h,y)}):this.walk((h,y)=>{if(h.type==="atrule"&&h.name===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="atrule")return d(h,y)}))}walkComments(n){return this.walk((d,h)=>{if(d.type==="comment")return n(d,h)})}walkDecls(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="decl"&&n.test(h.prop))return d(h,y)}):this.walk((h,y)=>{if(h.type==="decl"&&h.prop===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="decl")return d(h,y)}))}walkRules(n,d){return d?n instanceof RegExp?this.walk((h,y)=>{if(h.type==="rule"&&n.test(h.selector))return d(h,y)}):this.walk((h,y)=>{if(h.type==="rule"&&h.selector===n)return d(h,y)}):(d=n,this.walk((h,y)=>{if(h.type==="rule")return d(h,y)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return c.registerParse=o=>{f=o},c.registerRule=o=>{u=o},c.registerAtRule=o=>{m=o},c.registerRoot=o=>{a=o},or=c,c.default=c,c.rebuild=o=>{o.type==="atrule"?Object.setPrototypeOf(o,m.prototype):o.type==="rule"?Object.setPrototypeOf(o,u.prototype):o.type==="decl"?Object.setPrototypeOf(o,r.prototype):o.type==="comment"?Object.setPrototypeOf(o,l.prototype):o.type==="root"&&Object.setPrototypeOf(o,a.prototype),o[t]=!0,o.nodes&&o.nodes.forEach(n=>{c.rebuild(n)})},or}var ar,Ws;function zr(){if(Ws)return ar;Ws=1;let e=Re(),t,r;class l extends e{constructor(f){super({type:"document",...f}),this.nodes||(this.nodes=[])}toResult(f={}){return new t(new r,this,f).stringify()}}return l.registerLazyResult=s=>{t=s},l.registerProcessor=s=>{r=s},ar=l,l.default=l,ar}var lr,qs;function Ti(){if(qs)return lr;qs=1;class e{constructor(r,l={}){if(this.type="warning",this.text=r,l.node&&l.node.source){let s=l.node.rangeBy(l);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(let s in l)this[s]=l[s]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return lr=e,e.default=e,lr}var ur,js;function Wr(){if(js)return ur;js=1;let e=Ti();class t{constructor(l,s,f){this.processor=l,this.messages=[],this.root=s,this.opts=f,this.css=void 0,this.map=void 0}toString(){return this.css}warn(l,s={}){s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);let f=new e(l,s);return this.messages.push(f),f}warnings(){return this.messages.filter(l=>l.type==="warning")}get content(){return this.css}}return ur=t,t.default=t,ur}var cr,Hs;function Co(){if(Hs)return cr;Hs=1;const e=39,t=34,r=92,l=47,s=10,f=32,u=12,m=9,a=13,p=91,i=93,c=40,o=41,n=123,d=125,h=59,y=42,C=58,w=64,S=/[\t\n\f\r "#'()/;[\\\]{}]/g,b=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,g=/.[\r\n"'(/\\]/,v=/[\da-f]/i;return cr=function(O,A={}){let M=O.css.valueOf(),$=A.ignoreErrors,k,R,Z,N,ee,H,F,Q,W,P,ye=M.length,E=0,pe=[],se=[];function Me(){return E}function de(X){throw O.error("Unclosed "+X,E)}function De(){return se.length===0&&E>=ye}function ae(X){if(se.length)return se.pop();if(E>=ye)return;let ne=X?X.ignoreUnclosed:!1;switch(k=M.charCodeAt(E),k){case s:case f:case m:case a:case u:{R=E;do R+=1,k=M.charCodeAt(R);while(k===f||k===s||k===m||k===a||k===u);P=["space",M.slice(E,R)],E=R-1;break}case p:case i:case n:case d:case C:case h:case o:{let _=String.fromCharCode(k);P=[_,_,E];break}case c:{if(Q=pe.length?pe.pop()[1]:"",W=M.charCodeAt(E+1),Q==="url"&&W!==e&&W!==t&&W!==f&&W!==s&&W!==m&&W!==u&&W!==a){R=E;do{if(H=!1,R=M.indexOf(")",R+1),R===-1)if($||ne){R=E;break}else de("bracket");for(F=R;M.charCodeAt(F-1)===r;)F-=1,H=!H}while(H);P=["brackets",M.slice(E,R+1),E,R],E=R}else R=M.indexOf(")",E+1),N=M.slice(E,R+1),R===-1||g.test(N)?P=["(","(",E]:(P=["brackets",N,E,R],E=R);break}case e:case t:{Z=k===e?"'":'"',R=E;do{if(H=!1,R=M.indexOf(Z,R+1),R===-1)if($||ne){R=E+1;break}else de("string");for(F=R;M.charCodeAt(F-1)===r;)F-=1,H=!H}while(H);P=["string",M.slice(E,R+1),E,R],E=R;break}case w:{S.lastIndex=E+1,S.test(M),S.lastIndex===0?R=M.length-1:R=S.lastIndex-2,P=["at-word",M.slice(E,R+1),E,R],E=R;break}case r:{for(R=E,ee=!0;M.charCodeAt(R+1)===r;)R+=1,ee=!ee;if(k=M.charCodeAt(R+1),ee&&k!==l&&k!==f&&k!==s&&k!==m&&k!==a&&k!==u&&(R+=1,v.test(M.charAt(R)))){for(;v.test(M.charAt(R+1));)R+=1;M.charCodeAt(R+1)===f&&(R+=1)}P=["word",M.slice(E,R+1),E,R],E=R;break}default:{k===l&&M.charCodeAt(E+1)===y?(R=M.indexOf("*/",E+2)+1,R===0&&($||ne?R=M.length:de("comment")),P=["comment",M.slice(E,R+1),E,R],E=R):(b.lastIndex=E+1,b.test(M),b.lastIndex===0?R=M.length-1:R=b.lastIndex-2,P=["word",M.slice(E,R+1),E,R],pe.push(P),E=R);break}}return E++,P}function le(X){se.push(X)}return{back:le,endOfFile:De,nextToken:ae,position:Me}},cr}var hr,Gs;function qr(){if(Gs)return hr;Gs=1;let e=Re();class t extends e{constructor(l){super(l),this.type="atrule"}append(...l){return this.proxyOf.nodes||(this.nodes=[]),super.append(...l)}prepend(...l){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...l)}}return hr=t,t.default=t,e.registerAtRule(t),hr}var fr,Vs;function We(){if(Vs)return fr;Vs=1;let e=Re(),t,r;class l extends e{constructor(f){super(f),this.type="root",this.nodes||(this.nodes=[])}normalize(f,u,m){let a=super.normalize(f);if(u){if(m==="prepend")this.nodes.length>1?u.raws.before=this.nodes[1].raws.before:delete u.raws.before;else if(this.first!==u)for(let p of a)p.raws.before=u.raws.before}return a}removeChild(f,u){let m=this.index(f);return!u&&m===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[m].raws.before),super.removeChild(f)}toResult(f={}){return new t(new r,this,f).stringify()}}return l.registerLazyResult=s=>{t=s},l.registerProcessor=s=>{r=s},fr=l,l.default=l,e.registerRoot(l),fr}var pr,Js;function Fi(){if(Js)return pr;Js=1;let e={comma(t){return e.split(t,[","],!0)},space(t){let r=[" ",`
`,"	"];return e.split(t,r)},split(t,r,l){let s=[],f="",u=!1,m=0,a=!1,p="",i=!1;for(let c of t)i?i=!1:c==="\\"?i=!0:a?c===p&&(a=!1):c==='"'||c==="'"?(a=!0,p=c):c==="("?m+=1:c===")"?m>0&&(m-=1):m===0&&r.includes(c)&&(u=!0),u?(f!==""&&s.push(f.trim()),f="",u=!1):f+=c;return(l||f!=="")&&s.push(f.trim()),s}};return pr=e,e.default=e,pr}var dr,Ys;function jr(){if(Ys)return dr;Ys=1;let e=Re(),t=Fi();class r extends e{constructor(s){super(s),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(s){let f=this.selector?this.selector.match(/,\s*/):null,u=f?f[0]:","+this.raw("between","beforeOpen");this.selector=s.join(u)}}return dr=r,r.default=r,e.registerRule(r),dr}var mr,Qs;function xo(){if(Qs)return mr;Qs=1;let e=yt(),t=Co(),r=bt(),l=qr(),s=We(),f=jr();const u={empty:!0,space:!0};function m(p){for(let i=p.length-1;i>=0;i--){let c=p[i],o=c[3]||c[2];if(o)return o}}class a{constructor(i){this.input=i,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:i,start:{column:1,line:1,offset:0}}}atrule(i){let c=new l;c.name=i[1].slice(1),c.name===""&&this.unnamedAtrule(c,i),this.init(c,i[2]);let o,n,d,h=!1,y=!1,C=[],w=[];for(;!this.tokenizer.endOfFile();){if(i=this.tokenizer.nextToken(),o=i[0],o==="("||o==="["?w.push(o==="("?")":"]"):o==="{"&&w.length>0?w.push("}"):o===w[w.length-1]&&w.pop(),w.length===0)if(o===";"){c.source.end=this.getPosition(i[2]),c.source.end.offset++,this.semicolon=!0;break}else if(o==="{"){y=!0;break}else if(o==="}"){if(C.length>0){for(d=C.length-1,n=C[d];n&&n[0]==="space";)n=C[--d];n&&(c.source.end=this.getPosition(n[3]||n[2]),c.source.end.offset++)}this.end(i);break}else C.push(i);else C.push(i);if(this.tokenizer.endOfFile()){h=!0;break}}c.raws.between=this.spacesAndCommentsFromEnd(C),C.length?(c.raws.afterName=this.spacesAndCommentsFromStart(C),this.raw(c,"params",C),h&&(i=C[C.length-1],c.source.end=this.getPosition(i[3]||i[2]),c.source.end.offset++,this.spaces=c.raws.between,c.raws.between="")):(c.raws.afterName="",c.params=""),y&&(c.nodes=[],this.current=c)}checkMissedSemicolon(i){let c=this.colon(i);if(c===!1)return;let o=0,n;for(let d=c-1;d>=0&&(n=i[d],!(n[0]!=="space"&&(o+=1,o===2)));d--);throw this.input.error("Missed semicolon",n[0]==="word"?n[3]+1:n[2])}colon(i){let c=0,o,n,d;for(let[h,y]of i.entries()){if(o=y,n=o[0],n==="("&&(c+=1),n===")"&&(c-=1),c===0&&n===":")if(!d)this.doubleColon(o);else{if(d[0]==="word"&&d[1]==="progid")continue;return h}d=o}return!1}comment(i){let c=new r;this.init(c,i[2]),c.source.end=this.getPosition(i[3]||i[2]),c.source.end.offset++;let o=i[1].slice(2,-2);if(/^\s*$/.test(o))c.text="",c.raws.left=o,c.raws.right="";else{let n=o.match(/^(\s*)([^]*\S)(\s*)$/);c.text=n[2],c.raws.left=n[1],c.raws.right=n[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(i,c){let o=new e;this.init(o,i[0][2]);let n=i[i.length-1];for(n[0]===";"&&(this.semicolon=!0,i.pop()),o.source.end=this.getPosition(n[3]||n[2]||m(i)),o.source.end.offset++;i[0][0]!=="word";)i.length===1&&this.unknownWord(i),o.raws.before+=i.shift()[1];for(o.source.start=this.getPosition(i[0][2]),o.prop="";i.length;){let w=i[0][0];if(w===":"||w==="space"||w==="comment")break;o.prop+=i.shift()[1]}o.raws.between="";let d;for(;i.length;)if(d=i.shift(),d[0]===":"){o.raws.between+=d[1];break}else d[0]==="word"&&/\w/.test(d[1])&&this.unknownWord([d]),o.raws.between+=d[1];(o.prop[0]==="_"||o.prop[0]==="*")&&(o.raws.before+=o.prop[0],o.prop=o.prop.slice(1));let h=[],y;for(;i.length&&(y=i[0][0],!(y!=="space"&&y!=="comment"));)h.push(i.shift());this.precheckMissedSemicolon(i);for(let w=i.length-1;w>=0;w--){if(d=i[w],d[1].toLowerCase()==="!important"){o.important=!0;let S=this.stringFrom(i,w);S=this.spacesFromEnd(i)+S,S!==" !important"&&(o.raws.important=S);break}else if(d[1].toLowerCase()==="important"){let S=i.slice(0),b="";for(let g=w;g>0;g--){let v=S[g][0];if(b.trim().indexOf("!")===0&&v!=="space")break;b=S.pop()[1]+b}b.trim().indexOf("!")===0&&(o.important=!0,o.raws.important=b,i=S)}if(d[0]!=="space"&&d[0]!=="comment")break}i.some(w=>w[0]!=="space"&&w[0]!=="comment")&&(o.raws.between+=h.map(w=>w[1]).join(""),h=[]),this.raw(o,"value",h.concat(i),c),o.value.includes(":")&&!c&&this.checkMissedSemicolon(i)}doubleColon(i){throw this.input.error("Double colon",{offset:i[2]},{offset:i[2]+i[1].length})}emptyRule(i){let c=new f;this.init(c,i[2]),c.selector="",c.raws.between="",this.current=c}end(i){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(i[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(i)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(i){if(this.spaces+=i[1],this.current.nodes){let c=this.current.nodes[this.current.nodes.length-1];c&&c.type==="rule"&&!c.raws.ownSemicolon&&(c.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(i){let c=this.input.fromOffset(i);return{column:c.col,line:c.line,offset:i}}init(i,c){this.current.push(i),i.source={input:this.input,start:this.getPosition(c)},i.raws.before=this.spaces,this.spaces="",i.type!=="comment"&&(this.semicolon=!1)}other(i){let c=!1,o=null,n=!1,d=null,h=[],y=i[1].startsWith("--"),C=[],w=i;for(;w;){if(o=w[0],C.push(w),o==="("||o==="[")d||(d=w),h.push(o==="("?")":"]");else if(y&&n&&o==="{")d||(d=w),h.push("}");else if(h.length===0)if(o===";")if(n){this.decl(C,y);return}else break;else if(o==="{"){this.rule(C);return}else if(o==="}"){this.tokenizer.back(C.pop()),c=!0;break}else o===":"&&(n=!0);else o===h[h.length-1]&&(h.pop(),h.length===0&&(d=null));w=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(c=!0),h.length>0&&this.unclosedBracket(d),c&&n){if(!y)for(;C.length&&(w=C[C.length-1][0],!(w!=="space"&&w!=="comment"));)this.tokenizer.back(C.pop());this.decl(C,y)}else this.unknownWord(C)}parse(){let i;for(;!this.tokenizer.endOfFile();)switch(i=this.tokenizer.nextToken(),i[0]){case"space":this.spaces+=i[1];break;case";":this.freeSemicolon(i);break;case"}":this.end(i);break;case"comment":this.comment(i);break;case"at-word":this.atrule(i);break;case"{":this.emptyRule(i);break;default:this.other(i);break}this.endFile()}precheckMissedSemicolon(){}raw(i,c,o,n){let d,h,y=o.length,C="",w=!0,S,b;for(let g=0;g<y;g+=1)d=o[g],h=d[0],h==="space"&&g===y-1&&!n?w=!1:h==="comment"?(b=o[g-1]?o[g-1][0]:"empty",S=o[g+1]?o[g+1][0]:"empty",!u[b]&&!u[S]?C.slice(-1)===","?w=!1:C+=d[1]:w=!1):C+=d[1];if(!w){let g=o.reduce((v,x)=>v+x[1],"");i.raws[c]={raw:g,value:C}}i[c]=C}rule(i){i.pop();let c=new f;this.init(c,i[0][2]),c.raws.between=this.spacesAndCommentsFromEnd(i),this.raw(c,"selector",i),this.current=c}spacesAndCommentsFromEnd(i){let c,o="";for(;i.length&&(c=i[i.length-1][0],!(c!=="space"&&c!=="comment"));)o=i.pop()[1]+o;return o}spacesAndCommentsFromStart(i){let c,o="";for(;i.length&&(c=i[0][0],!(c!=="space"&&c!=="comment"));)o+=i.shift()[1];return o}spacesFromEnd(i){let c,o="";for(;i.length&&(c=i[i.length-1][0],c==="space");)o=i.pop()[1]+o;return o}stringFrom(i,c){let o="";for(let n=c;n<i.length;n++)o+=i[n][1];return i.splice(c,i.length-c),o}unclosedBlock(){let i=this.current.source.start;throw this.input.error("Unclosed block",i.line,i.column)}unclosedBracket(i){throw this.input.error("Unclosed bracket",{offset:i[2]},{offset:i[2]+1})}unexpectedClose(i){throw this.input.error("Unexpected }",{offset:i[2]},{offset:i[2]+1})}unknownWord(i){throw this.input.error("Unknown word",{offset:i[0][2]},{offset:i[0][2]+i[0][1].length})}unnamedAtrule(i,c){throw this.input.error("At-rule without name",{offset:c[2]},{offset:c[2]+c[1].length})}}return mr=a,mr}var gr,Xs;function Hr(){if(Xs)return gr;Xs=1;let e=Re(),t=xo(),r=wt();function l(s,f){let u=new r(s,f),m=new t(u);try{m.parse()}catch(a){throw a}return m.root}return gr=l,l.default=l,e.registerParse(l),gr}var yr,Ks;function Ui(){if(Ks)return yr;Ks=1;let{isClean:e,my:t}=Br(),r=Di(),l=mt(),s=Re(),f=zr(),u=Wr(),m=Hr(),a=We();const p={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},i={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},c={Once:!0,postcssPlugin:!0,prepare:!0},o=0;function n(S){return typeof S=="object"&&typeof S.then=="function"}function d(S){let b=!1,g=p[S.type];return S.type==="decl"?b=S.prop.toLowerCase():S.type==="atrule"&&(b=S.name.toLowerCase()),b&&S.append?[g,g+"-"+b,o,g+"Exit",g+"Exit-"+b]:b?[g,g+"-"+b,g+"Exit",g+"Exit-"+b]:S.append?[g,o,g+"Exit"]:[g,g+"Exit"]}function h(S){let b;return S.type==="document"?b=["Document",o,"DocumentExit"]:S.type==="root"?b=["Root",o,"RootExit"]:b=d(S),{eventIndex:0,events:b,iterator:0,node:S,visitorIndex:0,visitors:[]}}function y(S){return S[e]=!1,S.nodes&&S.nodes.forEach(b=>y(b)),S}let C={};class w{constructor(b,g,v){this.stringified=!1,this.processed=!1;let x;if(typeof g=="object"&&g!==null&&(g.type==="root"||g.type==="document"))x=y(g);else if(g instanceof w||g instanceof u)x=y(g.root),g.map&&(typeof v.map>"u"&&(v.map={}),v.map.inline||(v.map.inline=!1),v.map.prev=g.map);else{let O=m;v.syntax&&(O=v.syntax.parse),v.parser&&(O=v.parser),O.parse&&(O=O.parse);try{x=O(g,v)}catch(A){this.processed=!0,this.error=A}x&&!x[t]&&s.rebuild(x)}this.result=new u(b,x,v),this.helpers={...C,postcss:C,result:this.result},this.plugins=this.processor.plugins.map(O=>typeof O=="object"&&O.prepare?{...O,...O.prepare(this.result)}:O)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(b){return this.async().catch(b)}finally(b){return this.async().then(b,b)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(b,g){let v=this.result.lastPlugin;try{g&&g.addToError(b),this.error=b,b.name==="CssSyntaxError"&&!b.plugin?(b.plugin=v.postcssPlugin,b.setMessage()):v.postcssVersion}catch(x){console&&console.error&&console.error(x)}return b}prepareVisitors(){this.listeners={};let b=(g,v,x)=>{this.listeners[v]||(this.listeners[v]=[]),this.listeners[v].push([g,x])};for(let g of this.plugins)if(typeof g=="object")for(let v in g){if(!i[v]&&/^[A-Z]/.test(v))throw new Error(`Unknown event ${v} in ${g.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!c[v])if(typeof g[v]=="object")for(let x in g[v])x==="*"?b(g,v,g[v][x]):b(g,v+"-"+x.toLowerCase(),g[v][x]);else typeof g[v]=="function"&&b(g,v,g[v])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let b=0;b<this.plugins.length;b++){let g=this.plugins[b],v=this.runOnRoot(g);if(n(v))try{await v}catch(x){throw this.handleError(x)}}if(this.prepareVisitors(),this.hasListener){let b=this.result.root;for(;!b[e];){b[e]=!0;let g=[h(b)];for(;g.length>0;){let v=this.visitTick(g);if(n(v))try{await v}catch(x){let O=g[g.length-1].node;throw this.handleError(x,O)}}}if(this.listeners.OnceExit)for(let[g,v]of this.listeners.OnceExit){this.result.lastPlugin=g;try{if(b.type==="document"){let x=b.nodes.map(O=>v(O,this.helpers));await Promise.all(x)}else await v(b,this.helpers)}catch(x){throw this.handleError(x)}}}return this.processed=!0,this.stringify()}runOnRoot(b){this.result.lastPlugin=b;try{if(typeof b=="object"&&b.Once){if(this.result.root.type==="document"){let g=this.result.root.nodes.map(v=>b.Once(v,this.helpers));return n(g[0])?Promise.all(g):g}return b.Once(this.result.root,this.helpers)}else if(typeof b=="function")return b(this.result.root,this.result)}catch(g){throw this.handleError(g)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let b=this.result.opts,g=l;b.syntax&&(g=b.syntax.stringify),b.stringifier&&(g=b.stringifier),g.stringify&&(g=g.stringify);let x=new r(g,this.result.root,this.result.opts).generate();return this.result.css=x[0],this.result.map=x[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let b of this.plugins){let g=this.runOnRoot(b);if(n(g))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let b=this.result.root;for(;!b[e];)b[e]=!0,this.walkSync(b);if(this.listeners.OnceExit)if(b.type==="document")for(let g of b.nodes)this.visitSync(this.listeners.OnceExit,g);else this.visitSync(this.listeners.OnceExit,b)}return this.result}then(b,g){return this.async().then(b,g)}toString(){return this.css}visitSync(b,g){for(let[v,x]of b){this.result.lastPlugin=v;let O;try{O=x(g,this.helpers)}catch(A){throw this.handleError(A,g.proxyOf)}if(g.type!=="root"&&g.type!=="document"&&!g.parent)return!0;if(n(O))throw this.getAsyncError()}}visitTick(b){let g=b[b.length-1],{node:v,visitors:x}=g;if(v.type!=="root"&&v.type!=="document"&&!v.parent){b.pop();return}if(x.length>0&&g.visitorIndex<x.length){let[A,M]=x[g.visitorIndex];g.visitorIndex+=1,g.visitorIndex===x.length&&(g.visitors=[],g.visitorIndex=0),this.result.lastPlugin=A;try{return M(v.toProxy(),this.helpers)}catch($){throw this.handleError($,v)}}if(g.iterator!==0){let A=g.iterator,M;for(;M=v.nodes[v.indexes[A]];)if(v.indexes[A]+=1,!M[e]){M[e]=!0,b.push(h(M));return}g.iterator=0,delete v.indexes[A]}let O=g.events;for(;g.eventIndex<O.length;){let A=O[g.eventIndex];if(g.eventIndex+=1,A===o){v.nodes&&v.nodes.length&&(v[e]=!0,g.iterator=v.getIterator());return}else if(this.listeners[A]){g.visitors=this.listeners[A];return}}b.pop()}walkSync(b){b[e]=!0;let g=d(b);for(let v of g)if(v===o)b.nodes&&b.each(x=>{x[e]||this.walkSync(x)});else{let x=this.listeners[v];if(x&&this.visitSync(x,b.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return w.registerPostcss=S=>{C=S},yr=w,w.default=w,a.registerLazyResult(w),f.registerLazyResult(w),yr}var wr,Zs;function Ro(){if(Zs)return wr;Zs=1;let e=Di(),t=mt(),r=Hr();const l=Wr();class s{constructor(u,m,a){m=m.toString(),this.stringified=!1,this._processor=u,this._css=m,this._opts=a,this._map=void 0;let p,i=t;this.result=new l(this._processor,p,this._opts),this.result.css=m;let c=this;Object.defineProperty(this.result,"root",{get(){return c.root}});let o=new e(i,p,this._opts,m);if(o.isMap()){let[n,d]=o.generate();n&&(this.result.css=n),d&&(this.result.map=d)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(u){return this.async().catch(u)}finally(u){return this.async().then(u,u)}sync(){if(this.error)throw this.error;return this.result}then(u,m){return this.async().then(u,m)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let u,m=r;try{u=m(this._css,this._opts)}catch(a){this.error=a}if(this.error)throw this.error;return this._root=u,u}get[Symbol.toStringTag](){return"NoWorkResult"}}return wr=s,s.default=s,wr}var br,ei;function Oo(){if(ei)return br;ei=1;let e=Ro(),t=Ui(),r=zr(),l=We();class s{constructor(u=[]){this.version="8.4.38",this.plugins=this.normalize(u)}normalize(u){let m=[];for(let a of u)if(a.postcss===!0?a=a():a.postcss&&(a=a.postcss),typeof a=="object"&&Array.isArray(a.plugins))m=m.concat(a.plugins);else if(typeof a=="object"&&a.postcssPlugin)m.push(a);else if(typeof a=="function")m.push(a);else if(!(typeof a=="object"&&(a.parse||a.stringify)))throw new Error(a+" is not a PostCSS plugin");return m}process(u,m={}){return!this.plugins.length&&!m.parser&&!m.stringifier&&!m.syntax?new e(this,u,m):new t(this,u,m)}use(u){return this.plugins=this.plugins.concat(this.normalize([u])),this}}return br=s,s.default=s,l.registerProcessor(s),r.registerProcessor(s),br}var Sr,ti;function Mo(){if(ti)return Sr;ti=1;let e=yt(),t=Li(),r=bt(),l=qr(),s=wt(),f=We(),u=jr();function m(a,p){if(Array.isArray(a))return a.map(o=>m(o));let{inputs:i,...c}=a;if(i){p=[];for(let o of i){let n={...o,__proto__:s.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),p.push(n)}}if(c.nodes&&(c.nodes=a.nodes.map(o=>m(o,p))),c.source){let{inputId:o,...n}=c.source;c.source=n,o!=null&&(c.source.input=p[o])}if(c.type==="root")return new f(c);if(c.type==="decl")return new e(c);if(c.type==="rule")return new u(c);if(c.type==="comment")return new r(c);if(c.type==="atrule")return new l(c);throw new Error("Unknown node type: "+a.type)}return Sr=m,m.default=m,Sr}var vr,ri;function Eo(){if(ri)return vr;ri=1;let e=$r(),t=yt(),r=Ui(),l=Re(),s=Oo(),f=mt(),u=Mo(),m=zr(),a=Ti(),p=bt(),i=qr(),c=Wr(),o=wt(),n=Hr(),d=Fi(),h=jr(),y=We(),C=gt();function w(...S){return S.length===1&&Array.isArray(S[0])&&(S=S[0]),new s(S)}return w.plugin=function(b,g){let v=!1;function x(...A){console&&console.warn&&!v&&(v=!0,console.warn(b+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),rt.LANG&&rt.LANG.startsWith("cn")&&console.warn(b+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));let M=g(...A);return M.postcssPlugin=b,M.postcssVersion=new s().version,M}let O;return Object.defineProperty(x,"postcss",{get(){return O||(O=x()),O}}),x.process=function(A,M,$){return w([x($)]).process(A,M)},x},w.stringify=f,w.parse=n,w.fromJSON=u,w.list=d,w.comment=S=>new p(S),w.atRule=S=>new i(S),w.decl=S=>new t(S),w.rule=S=>new h(S),w.root=S=>new y(S),w.document=S=>new m(S),w.CssSyntaxError=e,w.Declaration=t,w.Container=l,w.Processor=s,w.Document=m,w.Comment=p,w.Warning=a,w.AtRule=i,w.Result=c,w.Input=o,w.Rule=h,w.Root=y,w.Node=C,r.registerPostcss(w),vr=w,w.default=w,vr}var Io=Eo();const j=go(Io);j.stringify;j.fromJSON;j.plugin;j.parse;j.list;j.document;j.comment;j.atRule;j.rule;j.decl;j.root;j.CssSyntaxError;j.Declaration;j.Container;j.Processor;j.Document;j.Comment;j.Warning;j.AtRule;j.Result;j.Input;j.Rule;j.Root;j.Node;class Gr{constructor(...t){oe(this,"parentElement",null),oe(this,"parentNode",null),oe(this,"ownerDocument"),oe(this,"firstChild",null),oe(this,"lastChild",null),oe(this,"previousSibling",null),oe(this,"nextSibling",null),oe(this,"ELEMENT_NODE",1),oe(this,"TEXT_NODE",3),oe(this,"nodeType"),oe(this,"nodeName"),oe(this,"RRNodeType")}get childNodes(){const t=[];let r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof Gr){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const si={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ii={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Qe={};function Ao(e){var t,r;const l=(r=(t=globalThis?.Zone)==null?void 0:t.__symbol__)==null?void 0:r.call(t,e);if(l&&globalThis[l])return globalThis[l]}function Vr(e){if(Qe[e])return Qe[e];const t=Ao(e)||globalThis[e],r=t.prototype,l=e in si?si[e]:void 0,s=!!(l&&l.every(m=>{var a,p;return!!((p=(a=Object.getOwnPropertyDescriptor(r,m))==null?void 0:a.get)!=null&&p.toString().includes("[native code]"))})),f=e in ii?ii[e]:void 0,u=!!(f&&f.every(m=>{var a;return typeof r[m]=="function"&&((a=r[m])==null?void 0:a.toString().includes("[native code]"))}));if(s&&u)return Qe[e]=t.prototype,t.prototype;try{const m=document.createElement("iframe");document.body.appendChild(m);const a=m.contentWindow;if(!a)return t.prototype;const p=a[e].prototype;return document.body.removeChild(m),p?Qe[e]=p:r}catch{return r}}const Cr={};function Se(e,t,r){var l;const s=`${e}.${String(r)}`;if(Cr[s])return Cr[s].call(t);const f=Vr(e),u=(l=Object.getOwnPropertyDescriptor(f,r))==null?void 0:l.get;return u?(Cr[s]=u,u.call(t)):t[r]}const xr={};function $i(e,t,r){const l=`${e}.${String(r)}`;if(xr[l])return xr[l].bind(t);const f=Vr(e)[r];return typeof f!="function"?t[r]:(xr[l]=f,f.bind(t))}function ko(e){return Se("Node",e,"childNodes")}function No(e){return Se("Node",e,"parentNode")}function Po(e){return Se("Node",e,"parentElement")}function _o(e){return Se("Node",e,"textContent")}function Lo(e,t){return $i("Node",e,"contains")(t)}function Do(e){return $i("Node",e,"getRootNode")()}function To(e){return!e||!("host"in e)?null:Se("ShadowRoot",e,"host")}function Fo(e){return e.styleSheets}function Uo(e){return!e||!("shadowRoot"in e)?null:Se("Element",e,"shadowRoot")}function $o(e,t){return Se("Element",e,"querySelector")(t)}function Bo(e,t){return Se("Element",e,"querySelectorAll")(t)}function Bi(){return Vr("MutationObserver").constructor}const L={childNodes:ko,parentNode:No,parentElement:Po,textContent:_o,contains:Lo,getRootNode:Do,host:To,styleSheets:Fo,shadowRoot:Uo,querySelector:$o,querySelectorAll:Bo,mutationObserver:Bi};function te(e,t,r=document){const l={capture:!0,passive:!0};return r.addEventListener(e,t,l),()=>r.removeEventListener(e,t,l)}const Ie=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let ni={map:{},getId(){return console.error(Ie),-1},getNode(){return console.error(Ie),null},removeNodeFromMap(){console.error(Ie)},has(){return console.error(Ie),!1},reset(){console.error(Ie)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ni=new Proxy(ni,{get(e,t,r){return t==="map"&&console.error(Ie),Reflect.get(e,t,r)}}));function Be(e,t,r={}){let l=null,s=0;return function(...f){const u=Date.now();!s&&r.leading===!1&&(s=u);const m=t-(u-s),a=this;m<=0||m>t?(l&&(clearTimeout(l),l=null),s=u,e.apply(a,f)):!l&&r.trailing!==!1&&(l=setTimeout(()=>{s=r.leading===!1?0:Date.now(),l=null,e.apply(a,f)},m))}}function St(e,t,r,l,s=window){const f=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,l?r:{set(u){setTimeout(()=>{r.set.call(this,u)},0),f&&f.set&&f.set.call(this,u)}}),()=>St(e,t,f||{},!0)}function Le(e,t,r){try{if(!(t in e))return()=>{};const l=e[t],s=r(l);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:l}})),e[t]=s,()=>{e[t]=l}}catch{return()=>{}}}let at=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(at=()=>new Date().getTime());function zi(e){var t,r,l,s;const f=e.document;return{left:f.scrollingElement?f.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:f.documentElement.scrollLeft||f?.body&&((t=L.parentElement(f.body))==null?void 0:t.scrollLeft)||((r=f?.body)==null?void 0:r.scrollLeft)||0,top:f.scrollingElement?f.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:f?.documentElement.scrollTop||f?.body&&((l=L.parentElement(f.body))==null?void 0:l.scrollTop)||((s=f?.body)==null?void 0:s.scrollTop)||0}}function Wi(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function qi(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ji(e){return e?e.nodeType===e.ELEMENT_NODE?e:L.parentElement(e):null}function re(e,t,r,l){if(!e)return!1;const s=ji(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||l&&s.closest("."+t)!==null)return!0}else if(ot(s,t,l))return!0}catch{}return!!(r&&(s.matches(r)||l&&s.closest(r)!==null))}function zo(e,t){return t.getId(e)!==-1}function Rr(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===$e}function Hi(e,t){if(Te(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const l=L.parentNode(e);return l&&l.nodeType===e.DOCUMENT_NODE?!1:l?Hi(l,t):!0}function Er(e){return!!e.changedTouches}function Wo(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Gi(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Vi(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ir(e){return e?e instanceof Gr&&"shadowRoot"in e?!!e.shadowRoot:!!L.shadowRoot(e):!1}class qo{constructor(){I(this,"id",1),I(this,"styleIDMap",new WeakMap),I(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let l;return r===void 0?l=this.id++:l=r,this.styleIDMap.set(t,l),this.idStyleMap.set(l,t),l}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ji(e){var t;let r=null;return"getRootNode"in e&&((t=L.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&L.host(L.getRootNode(e))&&(r=L.host(L.getRootNode(e))),r}function jo(e){let t=e,r;for(;r=Ji(t);)t=r;return t}function Ho(e){const t=e.ownerDocument;if(!t)return!1;const r=jo(e);return L.contains(t,r)}function Yi(e){const t=e.ownerDocument;return t?L.contains(t,e)||Ho(e):!1}var U=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(U||{}),D=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(D||{}),ie=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ie||{}),ge=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ge||{}),_e=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(_e||{}),Ae=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ae||{}),Qi=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Qi||{});function oi(e){return"__ln"in e}class Go{constructor(){I(this,"length",0),I(this,"head",null),I(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let l=0;l<t;l++)r=r?.next||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&oi(t.previousSibling)){const l=t.previousSibling.__ln.next;r.next=l,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,l&&(l.previous=r)}else if(t.nextSibling&&oi(t.nextSibling)&&t.nextSibling.__ln.previous){const l=t.nextSibling.__ln.previous;r.previous=l,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,l&&(l.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const ai=(e,t)=>`${e}@${t}`;class Vo{constructor(){I(this,"frozen",!1),I(this,"locked",!1),I(this,"texts",[]),I(this,"attributes",[]),I(this,"attributeMap",new WeakMap),I(this,"removes",[]),I(this,"mapRemoves",[]),I(this,"movedMap",{}),I(this,"addedSet",new Set),I(this,"movedSet",new Set),I(this,"droppedSet",new Set),I(this,"removesSubTreeCache",new Set),I(this,"mutationCb"),I(this,"blockClass"),I(this,"blockSelector"),I(this,"maskTextClass"),I(this,"maskTextSelector"),I(this,"inlineStylesheet"),I(this,"maskInputOptions"),I(this,"maskTextFn"),I(this,"maskInputFn"),I(this,"maskAttributeFn"),I(this,"keepIframeSrcFn"),I(this,"recordCanvas"),I(this,"inlineImages"),I(this,"slimDOMOptions"),I(this,"dataURLOptions"),I(this,"doc"),I(this,"mirror"),I(this,"iframeManager"),I(this,"stylesheetManager"),I(this,"shadowDomManager"),I(this,"canvasManager"),I(this,"processedNodeManager"),I(this,"unattachedDoc"),I(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),I(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,l=new Go,s=a=>{let p=a,i=$e;for(;i===$e;)p=p&&p.nextSibling,i=p&&this.mirror.getId(p);return i},f=a=>{const p=L.parentNode(a);if(!p||!Yi(a))return;let i=!1;if(a.nodeType===Node.TEXT_NODE){const d=p.tagName;if(d==="TEXTAREA")return;d==="STYLE"&&this.addedSet.has(p)&&(i=!0)}const c=Te(p)?this.mirror.getId(Ji(a)):this.mirror.getId(p),o=s(a);if(c===-1||o===-1)return l.addNode(a);const n=Ne(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:d=>{Gi(d,this.mirror)&&this.iframeManager.addIframe(d),Vi(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),Ir(a)&&this.shadowDomManager.addShadowRoot(L.shadowRoot(a),this.doc)},onIframeLoad:(d,h)=>{this.iframeManager.attachIframe(d,h),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,h)=>{this.stylesheetManager.attachLinkElement(d,h)},cssCaptured:i});n&&(t.push({parentId:c,nextId:o,node:n}),r.add(n.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)li(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(L.parentNode(a))||f(a);for(const a of this.addedSet)!ui(this.droppedSet,a)&&!li(this.removesSubTreeCache,a,this.mirror)||ui(this.movedSet,a)?f(a):this.droppedSet.add(a);let u=null;for(;l.length;){let a=null;if(u){const p=this.mirror.getId(L.parentNode(u.value)),i=s(u.value);p!==-1&&i!==-1&&(a=u)}if(!a){let p=l.tail;for(;p;){const i=p;if(p=p.previous,i){const c=this.mirror.getId(L.parentNode(i.value));if(s(i.value)===-1)continue;if(c!==-1){a=i;break}else{const n=i.value,d=L.parentNode(n);if(d&&d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=L.host(d);if(this.mirror.getId(h)!==-1){a=i;break}}}}}}if(!a){for(;l.head;)l.removeNode(l.head.value);break}u=a.previous,l.removeNode(a.value),f(a.value)}const m={texts:this.texts.map(a=>{const p=a.node,i=L.parentNode(p);return i&&i.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(p),value:a.value}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:p}=a;if(typeof p.style=="string"){const i=JSON.stringify(a.styleDiff),c=JSON.stringify(a._unchangedStyles);i.length<p.style.length&&(i+c).split("var(").length===p.style.split("var(").length&&(p.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:p}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:t};!m.texts.length&&!m.attributes.length&&!m.removes.length&&!m.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(m))}),I(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));const l=Array.from(L.childNodes(t),s=>L.textContent(s)||"").join("");r.attributes.value=st({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:it(t),value:l,maskInputFn:this.maskInputFn})}),I(this,"processMutation",t=>{if(!Rr(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const r=L.textContent(t.target);!re(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Mi(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,ji(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let l=t.attributeName,s=t.target.getAttribute(l);if(l==="value"){const u=it(r);s=st({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:u,value:s,maskInputFn:this.maskInputFn})}if(re(t.target,this.blockClass,this.blockSelector,!1)||s===t.oldValue)return;let f=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&l==="src"&&!this.keepIframeSrcFn(s))if(!r.contentDocument)l="rr_src";else return;if(f||(f={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(f),this.attributeMap.set(t.target,f)),l==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Oi(r.tagName,l)){if(f.attributes[l]=Ri(this.doc,Ce(r.tagName),Ce(l),s),this.maskAttributeFn&&typeof f.attributes[l]=="string"){const u=this.maskAttributeFn(l,f.attributes[l],r);u!==null?f.attributes[l]=u:delete f.attributes[l]}if(l==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const u=this.unattachedDoc.createElement("span");t.oldValue&&u.setAttribute("style",t.oldValue);for(const m of Array.from(r.style)){const a=r.style.getPropertyValue(m),p=r.style.getPropertyPriority(m);a!==u.style.getPropertyValue(m)||p!==u.style.getPropertyPriority(m)?p===""?f.styleDiff[m]=a:f.styleDiff[m]=[a,p]:f._unchangedStyles[m]=[a,p]}for(const m of Array.from(u.style))r.style.getPropertyValue(m)===""&&(f.styleDiff[m]=!1)}else l==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?f.attributes.rr_open_mode="modal":f.attributes.rr_open_mode="non-modal")}break}case"childList":{if(re(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const l=this.mirror.getId(r),s=Te(t.target)?this.mirror.getId(L.host(t.target)):this.mirror.getId(t.target);re(t.target,this.blockClass,this.blockSelector,!1)||Rr(r,this.mirror,this.slimDOMOptions)||!zo(r,this.mirror)||(this.addedSet.has(r)?(Ar(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&l===-1||Hi(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ai(l,s)]?Ar(this.movedSet,r):(this.removes.push({parentId:s,id:l,isShadow:Te(t.target)&&Fe(t.target)?!0:void 0}),Jo(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),I(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Rr(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let l=null;r&&this.mirror.hasNode(r)&&(l=this.mirror.getId(r)),l&&l!==-1&&(this.movedMap[ai(this.mirror.getId(t),l)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);re(t,this.blockClass,this.blockSelector,!1)||(L.childNodes(t).forEach(l=>this.genAdds(l)),Ir(t)&&L.childNodes(L.shadowRoot(t)).forEach(l=>{this.processedNodeManager.add(l,this),this.genAdds(l,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAttributeFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Ar(e,t){e.delete(t),L.childNodes(t).forEach(r=>Ar(e,r))}function Jo(e,t){const r=[e];for(;r.length;){const l=r.pop();t.has(l)||(t.add(l),L.childNodes(l).forEach(s=>r.push(s)))}}function li(e,t,r){return e.size===0?!1:Yo(e,t)}function Yo(e,t,r){const l=L.parentNode(t);return l?e.has(l):!1}function ui(e,t){return e.size===0?!1:Xi(e,t)}function Xi(e,t){const r=L.parentNode(t);return r?e.has(r)?!0:Xi(e,r):!1}let Ue;function Qo(e){Ue=e}function Xo(){Ue=void 0}const T=e=>Ue?((...r)=>{try{return e(...r)}catch(l){if(Ue&&Ue(l)===!0)return;throw l}}):e;function ci(e){return(...t)=>{try{return e(...t)}catch(r){try{r._external_=!0}catch{}throw r}}}const ve=[];function qe(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Ki(e,t){const r=new Vo;ve.push(r),r.init(e);const l=new(Bi())(T(r.processMutations.bind(r)));return l.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function Ko({mousemoveCb:e,sampling:t,doc:r,mirror:l}){if(t.mousemove===!1)return()=>{};const s=typeof t.mousemove=="number"?t.mousemove:50,f=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let u=[],m;const a=Be(T(c=>{const o=Date.now()-m;e(u.map(n=>(n.timeOffset-=o,n)),c),u=[],m=null}),f),p=T(Be(T(c=>{const o=qe(c),{clientX:n,clientY:d}=Er(c)?c.changedTouches[0]:c;m||(m=at()),u.push({x:n,y:d,id:l.getId(o),timeOffset:at()-m}),a(typeof DragEvent<"u"&&c instanceof DragEvent?D.Drag:c instanceof MouseEvent?D.MouseMove:D.TouchMove)}),s,{trailing:!1})),i=[te("mousemove",p,r),te("touchmove",p,r),te("drag",p,r)];return T(()=>{i.forEach(c=>c())})}function Zo({mouseInteractionCb:e,doc:t,mirror:r,blockClass:l,blockSelector:s,sampling:f}){if(f.mouseInteraction===!1)return()=>{};const u=f.mouseInteraction===!0||f.mouseInteraction===void 0?{}:f.mouseInteraction,m=[];let a=null;const p=i=>c=>{const o=qe(c);if(re(o,l,s,!0))return;let n=null,d=i;if("pointerType"in c){switch(c.pointerType){case"mouse":n=ge.Mouse;break;case"touch":n=ge.Touch;break;case"pen":n=ge.Pen;break}n===ge.Touch?ie[i]===ie.MouseDown?d="TouchStart":ie[i]===ie.MouseUp&&(d="TouchEnd"):ge.Pen}else Er(c)&&(n=ge.Touch);n!==null?(a=n,(d.startsWith("Touch")&&n===ge.Touch||d.startsWith("Mouse")&&n===ge.Mouse)&&(n=null)):ie[i]===ie.Click&&(n=a,a=null);const h=Er(c)?c.changedTouches[0]:c;if(!h)return;const y=r.getId(o),{clientX:C,clientY:w}=h;T(e)({type:ie[d],id:y,x:C,y:w,...n!==null&&{pointerType:n}})};return Object.keys(ie).filter(i=>Number.isNaN(Number(i))&&!i.endsWith("_Departed")&&u[i]!==!1).forEach(i=>{let c=Ce(i);const o=p(i);if(window.PointerEvent)switch(ie[i]){case ie.MouseDown:case ie.MouseUp:c=c.replace("mouse","pointer");break;case ie.TouchStart:case ie.TouchEnd:return}m.push(te(c,o,t))}),T(()=>{m.forEach(i=>i())})}function Zi({scrollCb:e,doc:t,mirror:r,blockClass:l,blockSelector:s,sampling:f}){const u=T(Be(T(m=>{const a=qe(m);if(!a||re(a,l,s,!0))return;const p=r.getId(a);if(a===t&&t.defaultView){const i=zi(t.defaultView);e({id:p,x:i.left,y:i.top})}else e({id:p,x:a.scrollLeft,y:a.scrollTop})}),f.scroll||100));return te("scroll",u,t)}function ea({viewportResizeCb:e},{win:t}){let r=-1,l=-1;const s=T(Be(T(()=>{const f=Wi(),u=qi();(r!==f||l!==u)&&(e({width:Number(u),height:Number(f)}),r=f,l=u)}),200));return te("resize",s,t)}const ta=["INPUT","TEXTAREA","SELECT"],hi=new WeakMap;function ra({inputCb:e,doc:t,mirror:r,blockClass:l,blockSelector:s,ignoreClass:f,ignoreSelector:u,maskInputOptions:m,maskInputFn:a,sampling:p,userTriggeredOnInput:i}){function c(w){let S=qe(w);const b=w.isTrusted,g=S&&S.tagName;if(S&&g==="OPTION"&&(S=L.parentElement(S)),!S||!g||ta.indexOf(g)<0||re(S,l,s,!0)||S.classList.contains(f)||u&&S.matches(u))return;let v=S.value,x=!1;const O=it(S)||"";O==="radio"||O==="checkbox"?x=S.checked:(m[g.toLowerCase()]||m[O])&&(v=st({element:S,maskInputOptions:m,tagName:g,type:O,value:v,maskInputFn:a})),o(S,i?{text:v,isChecked:x,userTriggered:b}:{text:v,isChecked:x});const A=S.name;O==="radio"&&A&&x&&t.querySelectorAll(`input[type="radio"][name="${A}"]`).forEach(M=>{if(M!==S){const $=M.value;o(M,i?{text:$,isChecked:!x,userTriggered:!1}:{text:$,isChecked:!x})}})}function o(w,S){const b=hi.get(w);if(!b||b.text!==S.text||b.isChecked!==S.isChecked){hi.set(w,S);const g=r.getId(w);T(e)({...S,id:g})}}const d=(p.input==="last"?["change"]:["input","change"]).map(w=>te(w,T(c),t)),h=t.defaultView;if(!h)return()=>{d.forEach(w=>w())};const y=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),C=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&d.push(...C.map(w=>St(w[0],w[1],{set(){T(c)({target:this,isTrusted:!1})}},!1,h))),T(()=>{d.forEach(w=>w())})}function lt(e){const t=[];function r(l,s){if(Xe("CSSGroupingRule")&&l.parentRule instanceof CSSGroupingRule||Xe("CSSMediaRule")&&l.parentRule instanceof CSSMediaRule||Xe("CSSSupportsRule")&&l.parentRule instanceof CSSSupportsRule||Xe("CSSConditionRule")&&l.parentRule instanceof CSSConditionRule){const u=Array.from(l.parentRule.cssRules).indexOf(l);s.unshift(u)}else if(l.parentStyleSheet){const u=Array.from(l.parentStyleSheet.cssRules).indexOf(l);s.unshift(u)}return s}return r(e,t)}function we(e,t,r){let l,s;return e?(e.ownerNode?l=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:l}):{}}function sa({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:l}){if(!l.CSSStyleSheet||!l.CSSStyleSheet.prototype)return()=>{};const s=l.CSSStyleSheet.prototype.insertRule;l.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:T((i,c,o)=>{const[n,d]=o,{id:h,styleId:y}=we(c,t,r.styleMirror);return(h&&h!==-1||y&&y!==-1)&&e({id:h,styleId:y,adds:[{rule:n,index:d}]}),ci(()=>i.apply(c,o))()})}),l.CSSStyleSheet.prototype.addRule=function(i,c,o=this.cssRules.length){const n=`${i} { ${c} }`;return l.CSSStyleSheet.prototype.insertRule.apply(this,[n,o])};const f=l.CSSStyleSheet.prototype.deleteRule;l.CSSStyleSheet.prototype.deleteRule=new Proxy(f,{apply:T((i,c,o)=>{const[n]=o,{id:d,styleId:h}=we(c,t,r.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,removes:[{index:n}]}),ci(()=>i.apply(c,o))()})}),l.CSSStyleSheet.prototype.removeRule=function(i){return l.CSSStyleSheet.prototype.deleteRule.apply(this,[i])};let u;l.CSSStyleSheet.prototype.replace&&(u=l.CSSStyleSheet.prototype.replace,l.CSSStyleSheet.prototype.replace=new Proxy(u,{apply:T((i,c,o)=>{const[n]=o,{id:d,styleId:h}=we(c,t,r.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,replace:n}),i.apply(c,o)})}));let m;l.CSSStyleSheet.prototype.replaceSync&&(m=l.CSSStyleSheet.prototype.replaceSync,l.CSSStyleSheet.prototype.replaceSync=new Proxy(m,{apply:T((i,c,o)=>{const[n]=o,{id:d,styleId:h}=we(c,t,r.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,replaceSync:n}),i.apply(c,o)})}));const a={};Ke("CSSGroupingRule")?a.CSSGroupingRule=l.CSSGroupingRule:(Ke("CSSMediaRule")&&(a.CSSMediaRule=l.CSSMediaRule),Ke("CSSConditionRule")&&(a.CSSConditionRule=l.CSSConditionRule),Ke("CSSSupportsRule")&&(a.CSSSupportsRule=l.CSSSupportsRule));const p={};return Object.entries(a).forEach(([i,c])=>{p[i]={insertRule:c.prototype.insertRule,deleteRule:c.prototype.deleteRule},c.prototype.insertRule=new Proxy(p[i].insertRule,{apply:T((o,n,d)=>{const[h,y]=d,{id:C,styleId:w}=we(n.parentStyleSheet,t,r.styleMirror);return(C&&C!==-1||w&&w!==-1)&&e({id:C,styleId:w,adds:[{rule:h,index:[...lt(n),y||0]}]}),o.apply(n,d)})}),c.prototype.deleteRule=new Proxy(p[i].deleteRule,{apply:T((o,n,d)=>{const[h]=d,{id:y,styleId:C}=we(n.parentStyleSheet,t,r.styleMirror);return(y&&y!==-1||C&&C!==-1)&&e({id:y,styleId:C,removes:[{index:[...lt(n),h]}]}),o.apply(n,d)})})}),T(()=>{l.CSSStyleSheet.prototype.insertRule=s,l.CSSStyleSheet.prototype.deleteRule=f,u&&(l.CSSStyleSheet.prototype.replace=u),m&&(l.CSSStyleSheet.prototype.replaceSync=m),Object.entries(a).forEach(([i,c])=>{c.prototype.insertRule=p[i].insertRule,c.prototype.deleteRule=p[i].deleteRule})})}function en({mirror:e,stylesheetManager:t},r){var l,s,f;let u=null;r.nodeName==="#document"?u=e.getId(r):u=e.getId(L.host(r));const m=r.nodeName==="#document"?(l=r.defaultView)==null?void 0:l.Document:(f=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:f.ShadowRoot,a=m?.prototype?Object.getOwnPropertyDescriptor(m?.prototype,"adoptedStyleSheets"):void 0;return u===null||u===-1||!m||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var p;return(p=a.get)==null?void 0:p.call(this)},set(p){var i;const c=(i=a.set)==null?void 0:i.call(this,p);if(u!==null&&u!==-1)try{t.adoptStyleSheets(p,u)}catch{}return c}}),T(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function ia({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:l},{win:s}){const f=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(f,{apply:T((m,a,p)=>{var i;const[c,o,n]=p;if(r.has(c))return f.apply(a,[c,o,n]);const{id:d,styleId:h}=we((i=a.parentRule)==null?void 0:i.parentStyleSheet,t,l.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,set:{property:c,value:o,priority:n},index:lt(a.parentRule)}),m.apply(a,p)})});const u=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:T((m,a,p)=>{var i;const[c]=p;if(r.has(c))return u.apply(a,[c]);const{id:o,styleId:n}=we((i=a.parentRule)==null?void 0:i.parentStyleSheet,t,l.styleMirror);return(o&&o!==-1||n&&n!==-1)&&e({id:o,styleId:n,remove:{property:c},index:lt(a.parentRule)}),m.apply(a,p)})}),T(()=>{s.CSSStyleDeclaration.prototype.setProperty=f,s.CSSStyleDeclaration.prototype.removeProperty=u})}function na({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:l,sampling:s,doc:f}){const u=T(a=>Be(T(p=>{const i=qe(p);if(!i||re(i,t,r,!0))return;const{currentTime:c,volume:o,muted:n,playbackRate:d,loop:h}=i;e({type:a,id:l.getId(i),currentTime:c,volume:o,muted:n,playbackRate:d,loop:h})}),s.media||500)),m=[te("play",u(Ae.Play),f),te("pause",u(Ae.Pause),f),te("seeked",u(Ae.Seeked),f),te("volumechange",u(Ae.VolumeChange),f),te("ratechange",u(Ae.RateChange),f)];return T(()=>{m.forEach(a=>a())})}function oa({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const l=[],s=new WeakMap,f=r.FontFace;r.FontFace=function(a,p,i){const c=new f(a,p,i);return s.set(c,{family:a,buffer:typeof p!="string",descriptors:i,fontSource:typeof p=="string"?p:JSON.stringify(Array.from(new Uint8Array(p)))}),c};const u=Le(t.fonts,"add",function(m){return function(a){return setTimeout(T(()=>{const p=s.get(a);p&&(e(p),s.delete(a))}),0),m.apply(this,[a])}});return l.push(()=>{r.FontFace=f}),l.push(u),T(()=>{l.forEach(m=>m())})}function aa(e){const{doc:t,mirror:r,blockClass:l,blockSelector:s,selectionCb:f}=e;let u=!0;const m=T(()=>{const a=t.getSelection();if(!a||u&&a?.isCollapsed)return;u=a.isCollapsed||!1;const p=[],i=a.rangeCount||0;for(let c=0;c<i;c++){const o=a.getRangeAt(c),{startContainer:n,startOffset:d,endContainer:h,endOffset:y}=o;re(n,l,s,!0)||re(h,l,s,!0)||p.push({start:r.getId(n),startOffset:d,end:r.getId(h),endOffset:y})}f({ranges:p})});return m(),te("selectionchange",m)}function la({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:Le(r.customElements,"define",function(s){return function(f,u,m){try{t({define:{name:f}})}catch{console.warn(`Custom element callback failed for ${f}`)}return s.apply(this,[f,u,m])}})}function ua(e,t){const{mutationCb:r,mousemoveCb:l,mouseInteractionCb:s,scrollCb:f,viewportResizeCb:u,inputCb:m,mediaInteractionCb:a,styleSheetRuleCb:p,styleDeclarationCb:i,canvasMutationCb:c,fontCb:o,selectionCb:n,customElementCb:d}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),l(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),s(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),f(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),u(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),m(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),a(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),p(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),i(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),c(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),o(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),n(...h)},e.customElementCb=(...h)=>{t.customElement&&t.customElement(...h),d(...h)}}function ca(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};ua(e,t);let l;e.recordDOM&&(l=Ki(e,e.doc));const s=Ko(e),f=Zo(e),u=Zi(e),m=ea(e,{win:r}),a=ra(e),p=na(e);let i=()=>{},c=()=>{},o=()=>{},n=()=>{};e.recordDOM&&(i=sa(e,{win:r}),c=en(e,e.doc),o=ia(e,{win:r}),e.collectFonts&&(n=oa(e)));const d=aa(e),h=la(e),y=[];for(const C of e.plugins)y.push(C.observer(C.callback,r,C.options));return T(()=>{ve.forEach(C=>C.reset()),l?.disconnect(),s(),f(),u(),m(),a(),p(),i(),c(),o(),n(),d(),h(),y.forEach(C=>C())})}function Xe(e){return typeof window[e]<"u"}function Ke(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class fi{constructor(t){I(this,"iframeIdToRemoteIdMap",new WeakMap),I(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,l,s){const f=l||this.getIdToRemoteIdMap(t),u=s||this.getRemoteIdToIdMap(t);let m=f.get(r);return m||(m=this.generateIdFn(),f.set(r,m),u.set(m,r)),m}getIds(t,r){const l=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(f=>this.getId(t,f,l,s))}getRemoteId(t,r,l){const s=l||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const f=s.get(r);return f||-1}getRemoteIds(t,r){const l=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,l))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class ha{constructor(t){I(this,"iframes",new WeakMap),I(this,"crossOriginIframeMap",new WeakMap),I(this,"crossOriginIframeMirror",new fi(xi)),I(this,"crossOriginIframeStyleMirror"),I(this,"crossOriginIframeRootIdMap",new WeakMap),I(this,"mirror"),I(this,"mutationCb"),I(this,"wrappedEmit"),I(this,"loadListener"),I(this,"stylesheetManager"),I(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new fi(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var l,s;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((l=t.contentWindow)==null||l.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const s=this.crossOriginIframeMap.get(t.source);if(!s)return;const f=this.transformCrossOriginEvent(s,r.data.event);f&&this.wrappedEmit(f,r.data.isCheckout)}transformCrossOriginEvent(t,r){var l;switch(r.type){case U.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:U.IncrementalSnapshot,data:{source:D.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case U.Meta:case U.Load:case U.DomContentLoaded:return!1;case U.Plugin:return r;case U.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case U.IncrementalSnapshot:switch(r.data.source){case D.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);const f=this.crossOriginIframeRootIdMap.get(t);f&&this.patchRootIdOnNode(s.node,f)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case D.Drag:case D.TouchMove:case D.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case D.ViewportResize:return!1;case D.MediaInteraction:case D.MouseInteraction:case D.Scroll:case D.CanvasMutation:case D.Input:return this.replaceIds(r.data,t,["id"]),r;case D.StyleSheetRule:case D.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case D.Font:return r;case D.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case D.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(l=r.data.styles)==null||l.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,l,s){for(const f of s)!Array.isArray(r[f])&&typeof r[f]!="number"||(Array.isArray(r[f])?r[f]=t.getIds(l,r[f]):r[f]=t.getId(l,r[f]));return r}replaceIds(t,r,l){return this.replace(this.crossOriginIframeMirror,t,r,l)}replaceStyleIds(t,r,l){return this.replace(this.crossOriginIframeStyleMirror,t,r,l)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(l=>{this.replaceIdOnNode(l,r)})}patchRootIdOnNode(t,r){t.type!==Qi.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(l=>{this.patchRootIdOnNode(l,r)})}}class fa{constructor(t){I(this,"shadowDoms",new WeakSet),I(this,"mutationCb"),I(this,"scrollCb"),I(this,"bypassOptions"),I(this,"mirror"),I(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Fe(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const l=Ki({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>l.disconnect()),this.restoreHandlers.push(Zi({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(L.host(t))),this.restoreHandlers.push(en({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const l=this;this.restoreHandlers.push(Le(t.prototype,"attachShadow",function(s){return function(f){const u=s.call(this,f),m=L.shadowRoot(this);return m&&Yi(this)&&l.addShadowRoot(m,r),u}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ze=0;Ze<Pe.length;Ze++)pa[Pe.charCodeAt(Ze)]=Ze;var da=function(e){var t=new Uint8Array(e),r,l=t.length,s="";for(r=0;r<l;r+=3)s+=Pe[t[r]>>2],s+=Pe[(t[r]&3)<<4|t[r+1]>>4],s+=Pe[(t[r+1]&15)<<2|t[r+2]>>6],s+=Pe[t[r+2]&63];return l%3===2?s=s.substring(0,s.length-1)+"=":l%3===1&&(s=s.substring(0,s.length-2)+"=="),s};const pi=new Map;function ma(e,t){let r=pi.get(e);return r||(r=new Map,pi.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const tn=(e,t,r)=>{if(!e||!(sn(e,t)||typeof e=="object"))return;const l=e.constructor.name,s=ma(r,l);let f=s.indexOf(e);return f===-1&&(f=s.length,s.push(e)),f};function et(e,t,r){if(e instanceof Array)return e.map(l=>et(l,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const l=e.constructor.name,s=da(e);return{rr_type:l,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[et(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const l=e.constructor.name,{src:s}=e;return{rr_type:l,src:s}}else if(e instanceof HTMLCanvasElement){const l="HTMLImageElement",s=e.toDataURL();return{rr_type:l,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[et(e.data,t,r),e.width,e.height]};if(sn(e,t)||typeof e=="object"){const l=e.constructor.name,s=tn(e,t,r);return{rr_type:l,index:s}}}}return e}const rn=(e,t,r)=>e.map(l=>et(l,t,r)),sn=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function ga(e,t,r,l){const s=[],f=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of f)try{if(typeof t.CanvasRenderingContext2D.prototype[u]!="function")continue;const m=Le(t.CanvasRenderingContext2D.prototype,u,function(a){return function(...p){return re(this.canvas,r,l,!0)||setTimeout(()=>{const i=rn(p,t,this);e(this.canvas,{type:_e["2D"],property:u,args:i})},0),a.apply(this,p)}});s.push(m)}catch{const m=St(t.CanvasRenderingContext2D.prototype,u,{set(a){e(this.canvas,{type:_e["2D"],property:u,args:[a],setter:!0})}});s.push(m)}return()=>{s.forEach(u=>u())}}function ya(e){return e==="experimental-webgl"?"webgl":e}function di(e,t,r,l){const s=[];try{const f=Le(e.HTMLCanvasElement.prototype,"getContext",function(u){return function(m,...a){if(!re(this,t,r,!0)){const p=ya(m);if("__context"in this||(this.__context=p),l&&["webgl","webgl2"].includes(p))if(a[0]&&typeof a[0]=="object"){const i=a[0];i.preserveDrawingBuffer||(i.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return u.apply(this,[m,...a])}});s.push(f)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(f=>f())}}function mi(e,t,r,l,s,f){const u=[],m=Object.getOwnPropertyNames(e);for(const a of m)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;const p=Le(e,a,function(i){return function(...c){const o=i.apply(this,c);if(tn(o,f,this),"tagName"in this.canvas&&!re(this.canvas,l,s,!0)){const n=rn(c,f,this),d={type:t,property:a,args:n};r(this.canvas,d)}return o}});u.push(p)}catch{const p=St(e,a,{set(i){r(this.canvas,{type:t,property:a,args:[i],setter:!0})}});u.push(p)}return u}function wa(e,t,r,l){const s=[];return s.push(...mi(t.WebGLRenderingContext.prototype,_e.WebGL,e,r,l,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...mi(t.WebGL2RenderingContext.prototype,_e.WebGL2,e,r,l,t)),()=>{s.forEach(f=>f())}}const nn=`(function() {
  "use strict";
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
  for (var i = 0; i < chars.length; i++) {
    lookup[chars.charCodeAt(i)] = i;
  }
  var encode = function(arraybuffer) {
    var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
    for (i2 = 0; i2 < len; i2 += 3) {
      base64 += chars[bytes[i2] >> 2];
      base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
      base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
      base64 += chars[bytes[i2 + 2] & 63];
    }
    if (len % 3 === 2) {
      base64 = base64.substring(0, base64.length - 1) + "=";
    } else if (len % 3 === 1) {
      base64 = base64.substring(0, base64.length - 2) + "==";
    }
    return base64;
  };
  const lastBlobMap = /* @__PURE__ */ new Map();
  const transparentBlobMap = /* @__PURE__ */ new Map();
  async function getTransparentBlobFor(width, height, dataURLOptions) {
    const id = \`\${width}-\${height}\`;
    if ("OffscreenCanvas" in globalThis) {
      if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
      const offscreen = new OffscreenCanvas(width, height);
      offscreen.getContext("2d");
      const blob = await offscreen.convertToBlob(dataURLOptions);
      const arrayBuffer = await blob.arrayBuffer();
      const base64 = encode(arrayBuffer);
      transparentBlobMap.set(id, base64);
      return base64;
    } else {
      return "";
    }
  }
  const worker = self;
  worker.onmessage = async function(e) {
    if ("OffscreenCanvas" in globalThis) {
      const { id, bitmap, width, height, dataURLOptions } = e.data;
      const transparentBase64 = getTransparentBlobFor(
        width,
        height,
        dataURLOptions
      );
      const offscreen = new OffscreenCanvas(width, height);
      const ctx = offscreen.getContext("2d");
      ctx.drawImage(bitmap, 0, 0);
      bitmap.close();
      const blob = await offscreen.convertToBlob(dataURLOptions);
      const type = blob.type;
      const arrayBuffer = await blob.arrayBuffer();
      const base64 = encode(arrayBuffer);
      if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
        lastBlobMap.set(id, base64);
        return worker.postMessage({ id });
      }
      if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
      worker.postMessage({
        id,
        type,
        base64,
        width,
        height
      });
      lastBlobMap.set(id, base64);
    } else {
      return worker.postMessage({ id: e.data.id });
    }
  };
})();
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
`,gi=typeof self<"u"&&self.Blob&&new Blob([nn],{type:"text/javascript;charset=utf-8"});function ba(e){let t;try{if(t=gi&&(self.URL||self.webkitURL).createObjectURL(gi),!t)throw"";const r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(nn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Sa{constructor(t){I(this,"pendingCanvasMutations",new Map),I(this,"rafStamps",{latestId:0,invokeId:null}),I(this,"mirror"),I(this,"mutationCb"),I(this,"resetObservers"),I(this,"frozen",!1),I(this,"locked",!1),I(this,"processMutation",(a,p)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(p)});const{sampling:r="all",win:l,blockClass:s,blockSelector:f,recordCanvas:u,dataURLOptions:m}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,u&&r==="all"&&this.initCanvasMutationObserver(l,s,f),u&&typeof r=="number"&&this.initCanvasFPSObserver(r,l,s,f,{dataURLOptions:m})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,l,s,f){const u=di(r,l,s,!0),m=new Map,a=new ba;a.onmessage=d=>{const{id:h}=d.data;if(m.set(h,!1),!("base64"in d.data))return;const{base64:y,type:C,width:w,height:S}=d.data;this.mutationCb({id:h,type:_e["2D"],commands:[{property:"clearRect",args:[0,0,w,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:C}]},0,0]}]})};const p=1e3/t;let i=0,c;const o=()=>{const d=[];return r.document.querySelectorAll("canvas").forEach(h=>{re(h,l,s,!0)||d.push(h)}),d},n=d=>{if(i&&d-i<p){c=requestAnimationFrame(n);return}i=d,o().forEach(async h=>{var y;const C=this.mirror.getId(h);if(m.get(C)||h.width===0||h.height===0)return;if(m.set(C,!0),["webgl","webgl2"].includes(h.__context)){const S=h.getContext(h.__context);((y=S?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&S.clear(S.COLOR_BUFFER_BIT)}const w=await createImageBitmap(h);a.postMessage({id:C,bitmap:w,width:h.width,height:h.height,dataURLOptions:f.dataURLOptions},[w])}),c=requestAnimationFrame(n)};c=requestAnimationFrame(n),this.resetObservers=()=>{u(),cancelAnimationFrame(c)}}initCanvasMutationObserver(t,r,l){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=di(t,r,l,!1),f=ga(this.processMutation.bind(this),t,r,l),u=wa(this.processMutation.bind(this),t,r,l);this.resetObservers=()=>{s(),f(),u()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const l=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,l)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const l=this.pendingCanvasMutations.get(t);if(!l||r===-1)return;const s=l.map(u=>{const{type:m,...a}=u;return a}),{type:f}=l[0];this.mutationCb({id:r,type:f,commands:s}),this.pendingCanvasMutations.delete(t)}}class va{constructor(t){I(this,"trackedLinkElements",new WeakSet),I(this,"mutationCb"),I(this,"adoptedStyleSheetCb"),I(this,"styleMirror",new qo),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const l={id:r,styleIds:[]},s=[];for(const f of t){let u;this.styleMirror.has(f)?u=this.styleMirror.getId(f):(u=this.styleMirror.add(f),s.push({styleId:u,rules:Array.from(f.rules||CSSRule,(m,a)=>({rule:Si(m,f.href),index:a}))})),l.styleIds.push(u)}s.length>0&&(l.styles=s),this.adoptedStyleSheetCb(l)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Ca{constructor(){I(this,"nodeMap",new WeakMap),I(this,"active",!1)}inOtherBuffer(t,r){const l=this.nodeMap.get(t);return l&&Array.from(l).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}}let J,tt,Or,ut=!1;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Jr=e.contentWindow)==null?void 0:Jr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const ce=In();function Oe(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:l,blockClass:s="rr-block",blockSelector:f=null,ignoreClass:u="rr-ignore",ignoreSelector:m=null,maskTextClass:a="rr-mask",maskTextSelector:p=null,inlineStylesheet:i=!0,maskAllInputs:c,maskInputOptions:o,slimDOMOptions:n,maskInputFn:d,maskTextFn:h,maskAttributeFn:y,hooks:C,packFn:w,sampling:S={},dataURLOptions:b={},mousemoveWait:g,recordDOM:v=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:A=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:M=!1,collectFonts:$=!1,inlineImages:k=!1,plugins:R,keepIframeSrcFn:Z=()=>!1,ignoreCSSAttributes:N=new Set([]),errorHandler:ee,applyBackgroundColorToBlockedElements:H=!1}=e;Qo(ee);const F=O?window.parent===window:!0;let Q=!1;if(!F)try{window.parent.document&&(Q=!1)}catch{Q=!0}if(F&&!t)throw new Error("emit function is required");if(!F&&!Q)return()=>{};g!==void 0&&S.mousemove===void 0&&(S.mousemove=g),ce.reset();const W=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:o!==void 0?o:{password:!0},P=n===!0||n==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:n==="all",headMetaDescKeywords:n==="all",headTitleMutations:n==="all"}:n||{};Wo();let ye,E=0;const pe=_=>{for(const ue of R||[])ue.eventProcessor&&(_=ue.eventProcessor(_));return w&&!Q&&(_=w(_)),_};J=(_,ue)=>{var G;const V=_;if(V.timestamp=at(),(G=ve[0])!=null&&G.isFrozen()&&V.type!==U.FullSnapshot&&!(V.type===U.IncrementalSnapshot&&V.data.source===D.Mutation)&&ve.forEach(me=>me.unfreeze()),F)t?.(pe(V),ue);else if(Q){const me={type:"rrweb",event:pe(V),origin:window.location.origin,isCheckout:ue};window.parent.postMessage(me,"*")}if(V.type===U.FullSnapshot)ye=V,E=0;else if(V.type===U.IncrementalSnapshot){if(V.data.source===D.Mutation&&V.data.isAttachIframe)return;E++;const me=l&&E>=l,B=r&&V.timestamp-ye.timestamp>r;(me||B)&&tt(!0)}};const se=_=>{J({type:U.IncrementalSnapshot,data:{source:D.Mutation,..._}})},Me=_=>J({type:U.IncrementalSnapshot,data:{source:D.Scroll,..._}}),de=_=>J({type:U.IncrementalSnapshot,data:{source:D.CanvasMutation,..._}}),De=_=>J({type:U.IncrementalSnapshot,data:{source:D.AdoptedStyleSheet,..._}}),ae=new va({mutationCb:se,adoptedStyleSheetCb:De}),le=new ha({mirror:ce,mutationCb:se,stylesheetManager:ae,recordCrossOriginIframes:O,wrappedEmit:J});for(const _ of R||[])_.getMirror&&_.getMirror({nodeMirror:ce,crossOriginIframeMirror:le.crossOriginIframeMirror,crossOriginIframeStyleMirror:le.crossOriginIframeStyleMirror});const X=new Ca;Or=new Sa({recordCanvas:x,mutationCb:de,win:window,blockClass:s,blockSelector:f,mirror:ce,sampling:S.canvas,dataURLOptions:b});const ne=new fa({mutationCb:se,scrollCb:Me,bypassOptions:{blockClass:s,blockSelector:f,maskTextClass:a,maskTextSelector:p,inlineStylesheet:i,maskInputOptions:W,dataURLOptions:b,maskTextFn:h,maskInputFn:d,maskAttributeFn:y,recordCanvas:x,inlineImages:k,sampling:S,slimDOMOptions:P,iframeManager:le,stylesheetManager:ae,canvasManager:Or,keepIframeSrcFn:Z,processedNodeManager:X},mirror:ce});tt=(_=!1)=>{if(!v)return;J({type:U.Meta,data:{href:window.location.href,width:qi(),height:Wi()}},_),ae.reset(),ne.init(),ve.forEach(G=>G.lock());const ue=Zn(document,{mirror:ce,blockClass:s,blockSelector:f,maskTextClass:a,maskTextSelector:p,inlineStylesheet:i,maskAllInputs:W,maskTextFn:h,maskInputFn:d,maskAttributeFn:y,slimDOM:P,dataURLOptions:b,recordCanvas:x,inlineImages:k,applyBackgroundColorToBlockedElements:H,onSerialize:G=>{Gi(G,ce)&&le.addIframe(G),Vi(G,ce)&&ae.trackLinkElement(G),Ir(G)&&ne.addShadowRoot(L.shadowRoot(G),document)},onIframeLoad:(G,V)=>{le.attachIframe(G,V),ne.observeAttachShadow(G)},onStylesheetLoad:(G,V)=>{ae.attachLinkElement(G,V)},keepIframeSrcFn:Z});if(!ue)return console.warn("Failed to snapshot the document");J({type:U.FullSnapshot,data:{node:ue,initialOffset:zi(window)}},_),ve.forEach(G=>G.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ae.adoptStyleSheets(document.adoptedStyleSheets,ce.getId(document))};try{const _=[],ue=V=>{var me;return T(ca)({mutationCb:se,mousemoveCb:(B,vt)=>J({type:U.IncrementalSnapshot,data:{source:vt,positions:B}}),mouseInteractionCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.MouseInteraction,...B}}),scrollCb:Me,viewportResizeCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.ViewportResize,...B}}),inputCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.Input,...B}}),mediaInteractionCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.MediaInteraction,...B}}),styleSheetRuleCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.StyleSheetRule,...B}}),styleDeclarationCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.StyleDeclaration,...B}}),canvasMutationCb:de,fontCb:B=>J({type:U.IncrementalSnapshot,data:{source:D.Font,...B}}),selectionCb:B=>{J({type:U.IncrementalSnapshot,data:{source:D.Selection,...B}})},customElementCb:B=>{J({type:U.IncrementalSnapshot,data:{source:D.CustomElement,...B}})},blockClass:s,ignoreClass:u,ignoreSelector:m,maskTextClass:a,maskTextSelector:p,maskInputOptions:W,inlineStylesheet:i,sampling:S,recordDOM:v,recordCanvas:x,inlineImages:k,userTriggeredOnInput:M,collectFonts:$,doc:V,maskInputFn:d,maskTextFn:h,maskAttributeFn:y,keepIframeSrcFn:Z,blockSelector:f,slimDOMOptions:P,dataURLOptions:b,mirror:ce,iframeManager:le,stylesheetManager:ae,shadowDomManager:ne,processedNodeManager:X,canvasManager:Or,ignoreCSSAttributes:N,plugins:((me=R?.filter(B=>B.observer))==null?void 0:me.map(B=>({observer:B.observer,options:B.options,callback:vt=>J({type:U.Plugin,data:{plugin:B.name,payload:vt}})})))||[]},C)};le.addLoadListener(V=>{try{_.push(ue(V.contentDocument))}catch(me){console.warn(me)}});const G=()=>{tt(),_.push(ue(document)),ut=!0};return document.readyState==="interactive"||document.readyState==="complete"?G():(_.push(te("DOMContentLoaded",()=>{J({type:U.DomContentLoaded,data:{}}),A==="DOMContentLoaded"&&G()})),_.push(te("load",()=>{J({type:U.Load,data:{}}),A==="load"&&G()},window))),()=>{_.forEach(V=>V()),X.destroy(),ut=!1,Xo()}}catch(_){console.warn(_)}}Oe.addCustomEvent=(e,t)=>{if(!ut)throw new Error("please add custom event after start recording");J({type:U.Custom,data:{tag:e,payload:t}})};Oe.freezePage=()=>{ve.forEach(e=>e.freeze())};Oe.takeFullSnapshot=e=>{if(!ut)throw new Error("please take full snapshot after start recording");tt(e)};Oe.mirror=ce;var yi;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(yi||(yi={}));const{addCustomEvent:xa}=Oe,{freezePage:Ra}=Oe,{takeFullSnapshot:Oa}=Oe;export{Oe as record};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/DqeYcxy-.js

```js
import{_ as N,a as A,o as U,c as O}from"./HWAjEwF5.js";var L=function(a,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])},L(a,e)};function k(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");L(a,e);function r(){this.constructor=a}a.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var d=function(){return d=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},d.apply(this,arguments)};function y(a){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&a[e],t=0;if(r)return r.call(a);if(a&&typeof a.length=="number")return{next:function(){return a&&t>=a.length&&(a=void 0),{value:a&&a[t++],done:!a}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(a,e){var r=typeof Symbol=="function"&&a[Symbol.iterator];if(!r)return a;var t=r.call(a),n,o=[],i;try{for(;(e===void 0||e-- >0)&&!(n=t.next()).done;)o.push(n.value)}catch(c){i={error:c}}finally{try{n&&!n.done&&(r=t.return)&&r.call(t)}finally{if(i)throw i.error}}return o}function P(a,e,r){if(arguments.length===2)for(var t=0,n=e.length,o;t<n;t++)(o||!(t in e))&&(o||(o=Array.prototype.slice.call(e,0,t)),o[t]=e[t]);return a.concat(o||Array.prototype.slice.call(e))}var s={IS:"is",IS_NOT:"is not",CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",LESS_THAN:"less",LESS_THAN_EQUALS:"less or equal",GREATER_THAN:"greater",GREATER_THAN_EQUALS:"greater or equal",VERSION_LESS_THAN:"version less",VERSION_LESS_THAN_EQUALS:"version less or equal",VERSION_GREATER_THAN:"version greater",VERSION_GREATER_THAN_EQUALS:"version greater or equal",SET_IS:"set is",SET_IS_NOT:"set is not",SET_CONTAINS:"set contains",SET_DOES_NOT_CONTAIN:"set does not contain",SET_CONTAINS_ANY:"set contains any",SET_DOES_NOT_CONTAIN_ANY:"set does not contain any",REGEX_MATCH:"regex match",REGEX_DOES_NOT_MATCH:"regex does not match"},j=function(a){for(var e=[],r=0,t=0;t<a.length;t++){var n=a.charCodeAt(t);n<128?e[r++]=n:n<2048?(e[r++]=n>>6|192,e[r++]=n&63|128):(n&64512)==55296&&t+1<a.length&&(a.charCodeAt(t+1)&64512)==56320?(n=65536+((n&1023)<<10)+(a.charCodeAt(++t)&1023),e[r++]=n>>18|240,e[r++]=n>>12&63|128,e[r++]=n>>6&63|128,e[r++]=n&63|128):(e[r++]=n>>12|224,e[r++]=n>>6&63|128,e[r++]=n&63|128)}return Uint8Array.from(e)},R=-862048943,I=461845907,x=15,M=13,Q=5,B=-430675100,F=function(a,e){e===void 0&&(e=0);for(var r=j(a),t=r.length,n=t>>2,o=e,i=0;i<n;i++){var c=i<<2,v=q(r,c);o=X(v,o)}var f=n<<2,u=0;switch(t-f){case 3:u^=r[f+2]<<16,u^=r[f+1]<<8,u^=r[f],u=Math.imul(u,R),u=m(u,x),u=Math.imul(u,I),o^=u;break;case 2:u^=r[f+1]<<8,u^=r[f],u=Math.imul(u,R),u=m(u,x),u=Math.imul(u,I),o^=u;break;case 1:u^=r[f],u=Math.imul(u,R),u=m(u,x),u=Math.imul(u,I),o^=u;break}return o^=t,Y(o)>>>0},X=function(a,e){var r=a,t=e;return r=Math.imul(r,R),r=m(r,x),r=Math.imul(r,I),t^=r,t=m(t,M),t=Math.imul(t,Q),t+B|0},Y=function(a){var e=a;return e^=e>>>16,e=Math.imul(e,-2048144789),e^=e>>>13,e=Math.imul(e,-1028477387),e^=e>>>16,e},m=function(a,e,r){r===void 0&&(r=32),e>r&&(e=e%r);var t=4294967295<<r-e>>>0,n=(a&t)>>>0>>>r-e>>>0;return(a<<e|n)>>>0},q=function(a,e){e===void 0&&(e=0);var r=a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3];return J(r)},J=function(a){return(a&-16777216)>>>24|(a&16711680)>>>8|(a&65280)<<8|(a&255)<<24},H=function(a,e){var r,t;if(!(!e||e.length===0)){try{for(var n=y(e),o=n.next();!o.done;o=n.next()){var i=o.value;if(!i||!a||typeof a!="object")return;a=a[i]}}catch(c){r={error:c}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(r)throw r.error}}if(a)return a}},z="(\\d+)\\.(\\d+)",K="(\\d+)",$="(-(([-\\w]+\\.?)*))?",W="^".concat(z,"(\\.").concat(K).concat($,")?$"),Z=(function(){function a(e,r,t,n){n===void 0&&(n=void 0),this.major=e,this.minor=r,this.patch=t,this.preRelease=n}return a.parse=function(e){if(e){var r=new RegExp(W).exec(e);if(r){var t=Number(r[1]),n=Number(r[2]);if(!(isNaN(t)||isNaN(n))){var o=Number(r[4])||0,i=r[5]||void 0;return new a(t,n,o,i)}}}},a.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},a})(),V=(function(){function a(){}return a.prototype.evaluate=function(e,r){var t,n,o={},i={context:e,result:o};try{for(var c=y(r),v=c.next();!v.done;v=c.next()){var f=v.value,u=this.evaluateFlag(i,f);u&&(o[f.key]=u)}}catch(S){t={error:S}}finally{try{v&&!v.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},a.prototype.evaluateFlag=function(e,r){var t,n,o;try{for(var i=y(r.segments),c=i.next();!c.done;c=i.next()){var v=c.value;if(o=this.evaluateSegment(e,r,v),o){var f=d(d(d({},r.metadata),v.metadata),o.metadata);o=d(d({},o),{metadata:f});break}}}catch(u){t={error:u}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},a.prototype.evaluateSegment=function(e,r,t){var n,o,i,c;if(!t.conditions){var v=this.bucket(e,t);return v!==void 0?r.variants[v]:void 0}try{for(var f=y(t.conditions),u=f.next();!u.done;u=f.next()){var S=u.value,h=!0;try{for(var E=(i=void 0,y(S)),T=E.next();!T.done;T=E.next()){var l=T.value;if(h=this.matchCondition(e,l),!h)break}}catch(p){i={error:p}}finally{try{T&&!T.done&&(c=E.return)&&c.call(E)}finally{if(i)throw i.error}}if(h){var v=this.bucket(e,t);return v!==void 0?r.variants[v]:void 0}}}catch(p){n={error:p}}finally{try{u&&!u.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}},a.prototype.matchCondition=function(e,r){var t=H(e,r.selector);if(t)if(this.isSetOperator(r.op)){var n=this.coerceStringArray(t);return n?this.matchSet(n,r.op,r.values):!1}else{var o=this.coerceString(t);return o!==void 0?this.matchString(o,r.op,r.values):!1}else return this.matchNull(r.op,r.values)},a.prototype.getHash=function(e){return F(e)},a.prototype.bucket=function(e,r){var t,n,o,i;if(!r.bucket)return r.variant;var c=this.coerceString(H(e,r.bucket.selector));if(!c||c.length===0)return r.variant;var v="".concat(r.bucket.salt,"/").concat(c),f=this.getHash(v),u=f%100,S=Math.floor(f/100);try{for(var h=y(r.bucket.allocations),E=h.next();!E.done;E=h.next()){var T=E.value,l=T.range[0],p=T.range[1];if(u>=l&&u<p)try{for(var g=(o=void 0,y(T.distributions)),_=g.next();!_.done;_=g.next()){var C=_.value,b=C.range[0],G=C.range[1];if(S>=b&&S<G)return C.variant}}catch(w){o={error:w}}finally{try{_&&!_.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}}}catch(w){t={error:w}}finally{try{E&&!E.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return r.variant},a.prototype.matchNull=function(e,r){var t=this.containsNone(r);switch(e){case s.IS:case s.CONTAINS:case s.LESS_THAN:case s.LESS_THAN_EQUALS:case s.GREATER_THAN:case s.GREATER_THAN_EQUALS:case s.VERSION_LESS_THAN:case s.VERSION_LESS_THAN_EQUALS:case s.VERSION_GREATER_THAN:case s.VERSION_GREATER_THAN_EQUALS:case s.SET_IS:case s.SET_CONTAINS:case s.SET_CONTAINS_ANY:return t;case s.IS_NOT:case s.DOES_NOT_CONTAIN:case s.SET_DOES_NOT_CONTAIN:case s.SET_DOES_NOT_CONTAIN_ANY:return!t;default:return!1}},a.prototype.matchSet=function(e,r,t){switch(r){case s.SET_IS:return this.setEquals(e,t);case s.SET_IS_NOT:return!this.setEquals(e,t);case s.SET_CONTAINS:return this.matchesSetContainsAll(e,t);case s.SET_DOES_NOT_CONTAIN:return!this.matchesSetContainsAll(e,t);case s.SET_CONTAINS_ANY:return this.matchesSetContainsAny(e,t);case s.SET_DOES_NOT_CONTAIN_ANY:return!this.matchesSetContainsAny(e,t);default:return!1}},a.prototype.matchString=function(e,r,t){var n=this;switch(r){case s.IS:return this.matchesIs(e,t);case s.IS_NOT:return!this.matchesIs(e,t);case s.CONTAINS:return this.matchesContains(e,t);case s.DOES_NOT_CONTAIN:return!this.matchesContains(e,t);case s.LESS_THAN:case s.LESS_THAN_EQUALS:case s.GREATER_THAN:case s.GREATER_THAN_EQUALS:return this.matchesComparable(e,r,t,function(o){return n.parseNumber(o)},this.comparator);case s.VERSION_LESS_THAN:case s.VERSION_LESS_THAN_EQUALS:case s.VERSION_GREATER_THAN:case s.VERSION_GREATER_THAN_EQUALS:return this.matchesComparable(e,r,t,function(o){return Z.parse(o)},this.versionComparator);case s.REGEX_MATCH:return this.matchesRegex(e,t);case s.REGEX_DOES_NOT_MATCH:return!this.matchesRegex(e,t);default:return!1}},a.prototype.matchesIs=function(e,r){if(this.containsBooleans(r)){var t=e.toLowerCase();if(t==="true"||t==="false")return r.some(function(n){return n.toLowerCase()===t})}return r.some(function(n){return e===n})},a.prototype.matchesContains=function(e,r){var t,n;try{for(var o=y(r),i=o.next();!i.done;i=o.next()){var c=i.value;if(e.toLowerCase().includes(c.toLowerCase()))return!0}}catch(v){t={error:v}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!1},a.prototype.matchesComparable=function(e,r,t,n,o){var i=this,c=n(e),v=t.map(function(f){return n(f)}).filter(function(f){return f!==void 0});return c===void 0||v.length===0?t.some(function(f){return i.comparator(e,r,f)}):v.some(function(f){return o(c,r,f)})},a.prototype.comparator=function(e,r,t){switch(r){case s.LESS_THAN:case s.VERSION_LESS_THAN:return e<t;case s.LESS_THAN_EQUALS:case s.VERSION_LESS_THAN_EQUALS:return e<=t;case s.GREATER_THAN:case s.VERSION_GREATER_THAN:return e>t;case s.GREATER_THAN_EQUALS:case s.VERSION_GREATER_THAN_EQUALS:return e>=t;default:return!1}},a.prototype.versionComparator=function(e,r,t){var n=e.compareTo(t);switch(r){case s.LESS_THAN:case s.VERSION_LESS_THAN:return n<0;case s.LESS_THAN_EQUALS:case s.VERSION_LESS_THAN_EQUALS:return n<=0;case s.GREATER_THAN:case s.VERSION_GREATER_THAN:return n>0;case s.GREATER_THAN_EQUALS:case s.VERSION_GREATER_THAN_EQUALS:return n>=0;default:return!1}},a.prototype.matchesRegex=function(e,r){return r.some(function(t){return!!new RegExp(t).exec(e)})},a.prototype.containsNone=function(e){return e.some(function(r){return r==="(none)"})},a.prototype.containsBooleans=function(e){return e.some(function(r){switch(r.toLowerCase()){case"true":case"false":return!0;default:return!1}})},a.prototype.parseNumber=function(e){var r;return(r=Number(e))!==null&&r!==void 0?r:void 0},a.prototype.coerceString=function(e){if(e)return typeof e=="object"?JSON.stringify(e):String(e)},a.prototype.coerceStringArray=function(e){var r=this;if(Array.isArray(e)){var t=e;return t.map(function(i){return r.coerceString(i)}).filter(Boolean)}var n=String(e);try{var o=JSON.parse(n);if(Array.isArray(o)){var t=e;return t.map(function(c){return r.coerceString(c)}).filter(Boolean)}else return}catch{return}},a.prototype.isSetOperator=function(e){switch(e){case s.SET_IS:case s.SET_IS_NOT:case s.SET_CONTAINS:case s.SET_DOES_NOT_CONTAIN:case s.SET_CONTAINS_ANY:case s.SET_DOES_NOT_CONTAIN_ANY:return!0;default:return!1}},a.prototype.setEquals=function(e,r){var t=new Set(e),n=new Set(r);return t.size===n.size&&P([],D(n),!1).every(function(o){return t.has(o)})},a.prototype.matchesSetContainsAll=function(e,r){var t,n;if(e.length<r.length)return!1;try{for(var o=y(r),i=o.next();!i.done;i=o.next()){var c=i.value;if(!this.matchesIs(c,e))return!1}}catch(v){t={error:v}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!0},a.prototype.matchesSetContainsAny=function(e,r){var t,n;try{for(var o=y(r),i=o.next();!i.done;i=o.next()){var c=i.value;if(this.matchesIs(c,e))return!0}}catch(v){t={error:v}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!1},a})();typeof TextDecoder=="function"&&new TextDecoder;typeof TextEncoder=="function"&&new TextEncoder;const ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",re=Array.prototype.slice.call(ee);(a=>{let e={};return a.forEach((r,t)=>e[r]=t),e})(re);String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);(function(a){k(e,a);function e(r,t){var n=a.call(this,t)||this;return n.statusCode=r,Object.setPrototypeOf(n,e.prototype),n}return e})(Error);var te=1e3*60*60*24*2,ne=(function(){function a(){var e=this;this.dbs={},this.createStore=function(r){return N(e,void 0,void 0,function(){return A(this,function(t){switch(t.label){case 0:return[4,U(r,1,{upgrade:function(n){n.objectStoreNames.contains("eventTypesForSession")||n.createObjectStore("eventTypesForSession",{keyPath:"sessionId"})}})];case 1:return[2,t.sent()]}})})},this.openOrCreateDB=function(r){return N(e,void 0,void 0,function(){var t,n;return A(this,function(o){switch(o.label){case 0:return this.dbs&&this.dbs[r]?[2,this.dbs[r]]:(t="".concat(r.substring(0,10),"_amp_targeting"),[4,this.createStore(t)]);case 1:return n=o.sent(),this.dbs[r]=n,[2,n]}})})},this.updateEventListForSession=function(r){var t=r.sessionId,n=r.eventType,o=r.eventTime,i=r.loggerProvider,c=r.tx;return N(e,void 0,void 0,function(){var v,f,u,S,h,E,T;return A(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),[4,c.store.get(t)];case 1:return v=l.sent(),f=v?v.eventTypes:{},u=f[n]||{},S=O(O({},f),(E={},E[n]=O(O({},u),(T={},T[o]={event_type:n},T)),E)),[4,c.store.put({sessionId:t,eventTypes:S})];case 2:return l.sent(),[2,S];case 3:return h=l.sent(),i.warn("Failed to store events for targeting ".concat(t,": ").concat(h)),[3,4];case 4:return[2,void 0]}})})},this.deleteOldSessionEventTypes=function(r){var t=r.currentSessionId,n=r.loggerProvider,o=r.tx;return N(e,void 0,void 0,function(){var i,c,v,f,u;return A(this,function(S){switch(S.label){case 0:return S.trys.push([0,6,,7]),[4,o.store.getAll()];case 1:i=S.sent(),c=0,S.label=2;case 2:return c<i.length?(v=i[c],f=Date.now()-v.sessionId,v.sessionId!==t&&f>te?[4,o.store.delete(v.sessionId)]:[3,4]):[3,5];case 3:S.sent(),S.label=4;case 4:return c++,[3,2];case 5:return[3,7];case 6:return u=S.sent(),n.warn("Failed to clear old session events for targeting: ".concat(u)),[3,7];case 7:return[2]}})})},this.storeEventTypeForSession=function(r){var t=r.loggerProvider,n=r.sessionId,o=r.eventType,i=r.eventTime,c=r.apiKey;return N(e,void 0,void 0,function(){var v,f,u,S;return A(this,function(h){switch(h.label){case 0:return h.trys.push([0,5,,6]),[4,this.openOrCreateDB(c)];case 1:return v=h.sent(),f=v.transaction("eventTypesForSession","readwrite"),f?[4,this.updateEventListForSession({sessionId:n,tx:f,loggerProvider:t,eventType:o,eventTime:i})]:[2];case 2:return u=h.sent(),[4,this.deleteOldSessionEventTypes({currentSessionId:n,tx:f,loggerProvider:t})];case 3:return h.sent(),[4,f.done];case 4:return h.sent(),[2,u];case 5:return S=h.sent(),t.warn("Failed to store events for targeting ".concat(n,": ").concat(S)),[3,6];case 6:return[2,void 0]}})})}}return a})(),ae=new ne,oe=(function(){function a(){var e=this;this.evaluateTargeting=function(r){var t=r.apiKey,n=r.loggerProvider,o=r.event,i=r.sessionId,c=r.userProperties,v=r.deviceId,f=r.flag;return N(e,void 0,void 0,function(){var u,S,h,E,T;return A(this,function(l){switch(l.label){case 0:return o&&o.time?[4,ae.storeEventTypeForSession({loggerProvider:n,apiKey:t,sessionId:i,eventType:o.event_type,eventTime:o.time})]:[3,2];case 1:return S=l.sent(),[3,3];case 2:S=void 0,l.label=3;case 3:return u=S,h=u&&new Set(Object.keys(u)),E={session_id:i,event:o,event_types:h&&Array.from(h),user:{device_id:v,user_properties:c}},T=this.evaluationEngine.evaluate(E,[f]),[2,T]}})})},this.evaluationEngine=new V}return a})(),ie=function(){var a=new oe;return{evaluateTargeting:a.evaluateTargeting.bind(a)}};const se=ie();var ce=se.evaluateTargeting;export{ce as evaluateTargeting};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/HWAjEwF5.js

```js
import{aS as nl,ac as ln,a2 as il,A as Vi,a1 as ji,w as ol,m as Mn,J as Ha,a3 as al,aT as sl,z as ul,Z as ll,E as cl,aA as dl,ad as fl,G as vl,F as Hi}from"./3TW-MQft.js";function hl(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}class gl{anchor;#t=new Map;#r=new Map;#e=new Map;#n=new Set;#i=!0;constructor(e,r=!0){this.anchor=e,this.#i=r}#o=e=>{if(this.#t.has(e)){var r=this.#t.get(e),n=this.#r.get(r);if(n)nl(n),this.#n.delete(r);else{var i=this.#e.get(r);i&&(this.#r.set(r,i.effect),this.#e.delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[o,a]of this.#t){if(this.#t.delete(o),o===e)break;const s=this.#e.get(a);s&&(ln(s.effect),this.#e.delete(a))}for(const[o,a]of this.#r){if(o===r||this.#n.has(o))continue;const s=()=>{if(Array.from(this.#t.values()).includes(o)){var u=document.createDocumentFragment();al(a,u),u.append(Vi()),this.#e.set(o,{effect:a,fragment:u})}else ln(a);this.#n.delete(o),this.#r.delete(o)};this.#i||!n?(this.#n.add(o),il(a,s,!1)):s()}}};#a=e=>{this.#t.delete(e);const r=Array.from(this.#t.values());for(const[n,i]of this.#e)r.includes(n)||(ln(i.effect),this.#e.delete(n))};ensure(e,r){var n=ol,i=sl();if(r&&!this.#r.has(e)&&!this.#e.has(e))if(i){var o=document.createDocumentFragment(),a=Vi();o.append(a),this.#e.set(e,{effect:ji(()=>r(a)),fragment:o})}else this.#r.set(e,ji(()=>r(this.anchor)));if(this.#t.set(n,e),i){for(const[s,l]of this.#r)s===e?n.unskip_effect(l):n.skip_effect(l);for(const[s,l]of this.#e)s===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(this.#o),n.ondiscard(this.#a)}else Mn&&(this.anchor=Ha),this.#o(n)}}function Dm(t,e,r=!1){var n;Mn&&(n=Ha,ll());var i=new gl(t),o=r?cl:0;function a(s,l){if(Mn){var u=dl(n);if(s!==parseInt(u.substring(1))){var c=fl();vl(c),i.anchor=c,Hi(!1),i.ensure(s,l),Hi(!0);return}}i.ensure(s,l)}ul(()=>{var s=!1;e((l,u=0)=>{s=!0,a(u,l)}),s||a(-1,null)},o)}const pl="modulepreload",ml=function(t){return"/"+t},Gi={},Qt=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){let l=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=a?.nonce||a?.getAttribute("nonce");i=l(r.map(u=>{if(u=ml(u),u in Gi)return;Gi[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":pl,c||(d.as="script"),d.crossOrigin="",d.href=u,s&&d.setAttribute("nonce",s),document.head.appendChild(d),c)return new Promise((v,h)=>{d.addEventListener("load",v),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return i.then(a=>{for(const s of a||[])s.status==="rejected"&&o(s.reason);return e().catch(o)})};var Un=function(t,e){return Un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Un(t,e)};function Fe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Un(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var C=function(){return C=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},C.apply(this,arguments)};function Gr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function _(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(c){try{u(n.next(c))}catch(f){a(f)}}function l(c){try{u(n.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})}function T(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function q(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function $(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}var ct;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(ct||(ct={}));var xe;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(xe||(xe={}));var Wi="-",Qr="AMP",yl="".concat(Qr,"_unsent"),Ga="$default_instance",gi="https://api2.amplitude.com/2/httpapi",Wa="https://api.eu.amplitude.com/2/httpapi",Ka="https://api2.amplitude.com/batch",za="https://api.eu.amplitude.com/batch",bl="utm_campaign",El="utm_content",Sl="utm_id",wl="utm_medium",Tl="utm_source",_l="utm_term",Ki="dclid",zi="fbclid",$i="gbraid",Xi="gclid",Yi="ko_click_id",Ji="li_fat_id",Qi="msclkid",Zi="rdt_cid",eo="ttclid",to="twclid",ro="wbraid",Zr={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},Wr=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],Il=["authorization","cookie","set-cookie"],Al=1e3,Fn=function(t){if(Object.keys(t).length>Al)return!1;for(var e in t){var r=t[e];if(!$a(e,r))return!1}return!0},$a=function(t,e){var r,n;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=q(e),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if(typeof s=="object")i=i&&Fn(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(e==null)return!1;if(typeof e=="object")return Fn(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0},tr=(function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return C({},this._properties)},t.prototype.set=function(e,r){return this._safeSet(le.SET,e,r),this},t.prototype.setOnce=function(e,r){return this._safeSet(le.SET_ONCE,e,r),this},t.prototype.append=function(e,r){return this._safeSet(le.APPEND,e,r),this},t.prototype.prepend=function(e,r){return this._safeSet(le.PREPEND,e,r),this},t.prototype.postInsert=function(e,r){return this._safeSet(le.POSTINSERT,e,r),this},t.prototype.preInsert=function(e,r){return this._safeSet(le.PREINSERT,e,r),this},t.prototype.remove=function(e,r){return this._safeSet(le.REMOVE,e,r),this},t.prototype.add=function(e,r){return this._safeSet(le.ADD,e,r),this},t.prototype.unset=function(e){return this._safeSet(le.UNSET,e,Wi),this},t.prototype.clearAll=function(){return this._properties={},this._properties[le.CLEAR_ALL]=Wi,this},t.prototype._safeSet=function(e,r,n){if(this._validate(e,r,n)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[r]=n,this._propertySet.add(r),!0}return!1},t.prototype._validate=function(e,r,n){return this._properties[le.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:e===le.ADD?typeof n=="number":e!==le.UNSET&&e!==le.REMOVE?$a(r,n):!0},t})(),le;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(le||(le={}));var Cl=[le.CLEAR_ALL,le.UNSET,le.SET,le.SET_ONCE,le.ADD,le.APPEND,le.PREPEND,le.PREINSERT,le.POSTINSERT,le.REMOVE],kl="Event tracked successfully",Pl="Unexpected error occurred",Ol="Event rejected due to exceeded retry count",Rl="Event skipped due to optOut config",xl="Event rejected due to missing API key",Nl="Invalid API key",Ll="Client not initialized",pe;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(pe||(pe={}));var xt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=pe.Unknown),{event:t,code:e,message:r}},F=function(){var t="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[t]<"u")return globalThis[t];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},Dl=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Je)},no=$([],D(Array(256).keys()),!1).map(function(t){return t.toString(16).padStart(2,"0")}),Je=function(t){var e,r=F();if(!(!((e=r?.crypto)===null||e===void 0)&&e.getRandomValues))return Dl(t);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,$([],D(n.entries()),!1).map(function(i){var o=D(i,2),a=o[0],s=o[1];return[4,6,8,10].includes(a)?"-".concat(no[s]):no[s]}).join("")},Ml=(function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this._optOutListeners=[]}return t.prototype.register=function(e,r){var n,i;return _(this,void 0,void 0,function(){return T(this,function(o){switch(o.label){case 0:return this.plugins.some(function(a){return a.name===e.name})?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(e.name===void 0&&(e.name=Je(),this.loggerProvider.warn(`Plugin name is undefined. 
      Generating a random UUID for plugin name: `.concat(e.name,`. 
      Set a name for the plugin to prevent it from being added multiple times.`))),e.type=(n=e.type)!==null&&n!==void 0?n:"enrichment",[4,(i=e.setup)===null||i===void 0?void 0:i.call(e,r,this.client)]);case 1:return o.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e,r){var n;return _(this,void 0,void 0,function(){var i,o;return T(this,function(a){switch(a.label){case 0:return i=this.plugins.findIndex(function(s){return s.name===e}),i===-1?(r.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(o=this.plugins[i],this.plugins.splice(i,1),[4,(n=o.teardown)===null||n===void 0?void 0:n.call(o)]);case 1:return a.sent(),[2]}})})},t.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1;var r=this.plugins;r.map(function(n){var i;return(i=n.teardown)===null||i===void 0?void 0:i.call(n)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var r=this;return new Promise(function(n){r.queue.push([e,n]),r.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var r=this;this.applying||(this.applying=!0,setTimeout(function(){r.apply(r.queue.shift()).then(function(){r.applying=!1,r.queue.length>0&&r.scheduleApply(0)})},e))},t.prototype.apply=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a,s,l,v,h,u,c,f,d,v,h,g,m,E,p,y,b,S;return T(this,function(w){switch(w.label){case 0:if(!e)return[2];r=D(e,1),n=r[0],i=D(e,2),o=i[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(A){return A.type==="before"}),w.label=1;case 1:w.trys.push([1,6,7,8]),s=q(a),l=s.next(),w.label=2;case 2:return l.done?[3,5]:(v=l.value,v.execute?[4,v.execute(C({},n))]:[3,4]);case 3:if(h=w.sent(),h===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),w.label=4;case 4:return l=s.next(),[3,2];case 5:return[3,8];case 6:return u=w.sent(),p={error:u},[3,8];case 7:try{l&&!l.done&&(y=s.return)&&y.call(s)}finally{if(p)throw p.error}return[7];case 8:c=this.plugins.filter(function(A){return A.type==="enrichment"||A.type===void 0}),w.label=9;case 9:w.trys.push([9,14,15,16]),f=q(c),d=f.next(),w.label=10;case 10:return d.done?[3,13]:(v=d.value,v.execute?[4,v.execute(C({},n))]:[3,12]);case 11:if(h=w.sent(),h===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),w.label=12;case 12:return d=f.next(),[3,10];case 13:return[3,16];case 14:return g=w.sent(),b={error:g},[3,16];case 15:try{d&&!d.done&&(S=f.return)&&S.call(f)}finally{if(b)throw b.error}return[7];case 16:return m=this.plugins.filter(function(A){return A.type==="destination"}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),E=m.map(function(A){var I=C({},n);return A.execute(I).catch(function(k){return xt(I,0,String(k))})}),Promise.all(E).then(function(A){var I=D(A,1),k=I[0],x=k||xt(n,100,"Event not tracked, no destination plugins on the instance");o(x)}),[2]}})})},t.prototype.flush=function(){return _(this,void 0,void 0,function(){var e,r,n,i=this;return T(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(a){return i.apply(a)}))];case 1:return o.sent(),r=this.plugins.filter(function(a){return a.type==="destination"}),n=r.map(function(a){return a.flush&&a.flush()}),[4,Promise.all(n)];case 2:return o.sent(),[2]}})})},t.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},t.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},t.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onIdentityChanged)===null||n===void 0||n.call(r,e)})},t.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onSessionIdChanged)===null||n===void 0||n.call(r,e)})},t.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onOptOutChanged)===null||n===void 0||n.call(r,e)}),this._callOptOutListeners(e)},t.prototype._callOptOutListeners=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a,s,l;return T(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),r=q(this._optOutListeners),n=r.next(),u.label=1;case 1:if(n.done)return[3,6];i=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,i(e)];case 3:return u.sent(),[3,5];case 4:return o=u.sent(),this.loggerProvider.error("Error calling optOut listener",o),[3,5];case 5:return n=r.next(),[3,1];case 6:return[3,9];case 7:return a=u.sent(),s={error:a},[3,9];case 8:try{n&&!n.done&&(l=r.return)&&l.call(r)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},t.prototype.onReset=function(){this.plugins.forEach(function(e){var r;(r=e.onReset)===null||r===void 0||r.call(e)})},t})(),Ul=function(t,e,r){var n=typeof t=="string"?{event_type:t}:t;return C(C(C({},n),r),e&&{event_properties:e})},pi=function(t,e){var r=C(C({},e),{event_type:xe.IDENTIFY,user_properties:t.getUserProperties()});return r},Fl=function(t,e,r,n){var i,o=C(C({},n),{event_type:xe.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[t]=e,i)});return o},ql=function(t,e,r){var n,i=new tr;i.set(t,e);var o=C(C({},r),{event_type:xe.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[t]=e,n)});return o},Bl=function(t,e){return C(C({},e),{event_type:xe.REVENUE,event_properties:t.getEventProperties()})},Te=function(t){return{promise:t||Promise.resolve()}},Vl=(function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Ml(this),this.name=e}return t.prototype._init=function(e){return _(this,void 0,void 0,function(){return T(this,function(r){switch(r.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return r.sent(),this.isReady=!0,[2]}})})},t.prototype.runQueuedFunctions=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a,s,l,u;return T(this,function(c){switch(c.label){case 0:r=this[e],this[e]=[],c.label=1;case 1:c.trys.push([1,8,9,10]),n=q(r),i=n.next(),c.label=2;case 2:return i.done?[3,7]:(o=i.value,a=o(),a&&"promise"in a?[4,a.promise]:[3,4]);case 3:return c.sent(),[3,6];case 4:return[4,a];case 5:c.sent(),c.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return s=c.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:c.sent(),c.label=12;case 12:return[2]}})})},t.prototype.track=function(e,r,n){var i=Ul(e,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),Te(this.dispatch(i))},t.prototype.identify=function(e,r){var n=pi(e,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),Te(this.dispatch(n))},t.prototype.groupIdentify=function(e,r,n,i){var o=Fl(e,r,n,i);return Te(this.dispatch(o))},t.prototype.setGroup=function(e,r,n){var i=ql(e,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),Te(this.dispatch(i))},t.prototype.revenue=function(e,r){var n=Bl(e,r);return Te(this.dispatch(n))},t.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),Te())},t.prototype._addPlugin=function(e){return Te(this.timeline.register(e,this.config))},t.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),Te())},t.prototype._removePlugin=function(e){return Te(this.timeline.deregister(e,this.config))},t.prototype.dispatchWithCallback=function(e,r){if(!this.isReady)return r(xt(e,0,Ll));this.process(e).then(r)},t.prototype.dispatch=function(e){return _(this,void 0,void 0,function(){var r=this;return T(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,e,i))})]})})},t.prototype.getOperationAppliedUserProperties=function(e){var r,n=(r=this.userProperties)!==null&&r!==void 0?r:{},i=C({},n);if(e===void 0)return i;var o={};return Object.keys(e).forEach(function(a){Object.values(ct).includes(a)||(o[a]=e[a])}),Cl.forEach(function(a){if(Object.keys(e).includes(a)){var s=e[a];switch(a){case ct.CLEAR_ALL:Object.keys(i).forEach(function(l){delete i[l]});break;case ct.UNSET:Object.keys(s).forEach(function(l){delete i[l]});break;case ct.SET:Object.assign(i,s);break}}}),Object.assign(i,o),i},t.prototype.process=function(e){return _(this,void 0,void 0,function(){var i,r,n,i;return T(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,xt(e,0,Rl)]:(e.event_type===xe.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return r=o.sent(),n=String(r),this.config.loggerProvider.error(n),i=xt(e,0,n),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},t.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},t.prototype.flush=function(){return Te(this.timeline.flush())},t.prototype.plugin=function(e){var r=this.timeline.plugins.find(function(n){return n.name===e});if(r===void 0){this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e));return}return r},t.prototype.plugins=function(e){return this.timeline.plugins.filter(function(r){return r instanceof e})},t})(),jl=(function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setCurrency=function(e){return this.currency=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setReceipt=function(e){return this.receipt=e,this},t.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},t.prototype.setEventProperties=function(e){try{var r=JSON.parse(JSON.stringify(e));Fn(r)&&(this.properties=r)}catch{}return this},t.prototype.getEventProperties=function(){var e=this.properties?C({},this.properties):{};return e[$e.REVENUE_PRODUCT_ID]=this.productId,e[$e.REVENUE_QUANTITY]=this.quantity,e[$e.REVENUE_PRICE]=this.price,e[$e.REVENUE_TYPE]=this.revenueType,e[$e.REVENUE_CURRENCY]=this.currency,e[$e.REVENUE]=this.revenue,e[$e.RECEIPT]=this.receipt,e[$e.RECEIPT_SIG]=this.receiptSig,e},t})(),$e;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE_CURRENCY="$currency",t.REVENUE="$revenue",t.RECEIPT="$receipt",t.RECEIPT_SIG="$receiptSig"})($e||($e={}));var Hl=function(t,e){var r=Math.max(e,1);return t.reduce(function(n,i,o){var a=Math.floor(o/r);return n[a]||(n[a]=[]),n[a].push(i),n},[])},ke;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(ke||(ke={}));var pr="Amplitude Logger ",Dt=(function(){function t(){this.logLevel=ke.None}return t.prototype.disable=function(){this.logLevel=ke.None},t.prototype.enable=function(e){e===void 0&&(e=ke.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ke.Verbose||console.log("".concat(pr,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ke.Warn||console.warn("".concat(pr,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ke.Error||console.error("".concat(pr,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ke.Debug||console.log("".concat(pr,"[Debug]: ").concat(e.join(" ")))},t})(),Or=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:Ga,logLevel:ke.Warn,loggerProvider:new Dt,offline:!1,optOut:!1,serverUrl:gi,serverZone:"US",useBatch:!1}},Xa=(function(){function t(e){var r,n,i,o;this._optOut=!1;var a=Or();this.apiKey=e.apiKey,this.flushIntervalMillis=(r=e.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||a.flushQueueSize,this.instanceName=e.instanceName||a.instanceName,this.loggerProvider=e.loggerProvider||a.loggerProvider,this.logLevel=(n=e.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:a.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:a.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||a.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:a.useBatch,this.loggerProvider.enable(this.logLevel);var s=Ya(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t})(),Gl=function(t,e){return t==="EU"?e?za:Wa:e?Ka:gi},Ya=function(t,e,r){if(t===void 0&&(t=""),e===void 0&&(e=Or().serverZone),r===void 0&&(r=Or().useBatch),t)return{serverUrl:t,serverZone:void 0};var n=["US","EU"].includes(e)?e:Or().serverZone;return{serverZone:n,serverUrl:Gl(n,r)}},Wl=(function(){function t(){this.sdk={metrics:{histogram:{}}}}return t.prototype.recordHistogram=function(e,r){this.sdk.metrics.histogram[e]=r},t})();function qn(t){return t>=200&&t<300}var Rr=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(`
`).slice(2+t).map(function(r){return r.trim()})},ae=function(t){return function(){var e=C({},t.config),r=e.loggerProvider,n=e.logLevel;return{logger:r,logLevel:n}}},Kl=function(t,e){var r,n;e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,"");try{for(var i=q(e.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in t)t=t[a];else return}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},se=function(t,e){return function(){var r,n,i={};try{for(var o=q(e),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=Kl(t,s)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},Q=function(t,e,r,n,i){return i===void 0&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=r(),l=s.logger,u=s.logLevel;if(u&&u<ke.Debug||!u||!l)return t.apply(i,o);var c={type:"invoke public method",name:e,args:o,stacktrace:Rr(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var f=t.apply(i,o);return f&&f.promise?f.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))),f}},zl=new Set([gi,Wa,Ka,za]),$l=function(t,e){return e===void 0&&(e=!1),zl.has(t)?!0:e};function Xl(t){return t instanceof Error?t.message:String(t)}function jt(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var Yl=(function(){function t(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=e?.diagnosticsClient}return t.prototype.setup=function(e){var r;return _(this,void 0,void 0,function(){var n,i=this;return T(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(yl,"_").concat(this.config.apiKey.substring(0,10)),[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:return n=o.sent(),n&&n.length>0&&Promise.all(n.map(function(a){return i.execute(a)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var r=this;return e.insert_id||(e.insert_id=Je()),new Promise(function(n){var i={event:e,attempts:0,callback:function(o){return n(o)},timeout:0};r.queue.push(i),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})},t.prototype.removeEventsExceedFlushMaxRetries=function(e){var r=this;return e.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,Ol),!1)})},t.prototype.scheduleEvents=function(e){var r=this;e.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},t.prototype.schedule=function(e){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},e);return}},t.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},t.prototype.flush=function(e){return e===void 0&&(e=!1),_(this,void 0,void 0,function(){var r,n,i,o=this;return T(this,function(a){switch(a.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),r=[],n=[],this.queue.forEach(function(s){return s.timeout===0?r.push(s):n.push(s)}),i=Hl(r,this.config.flushQueueSize),[4,i.reduce(function(s,l){return _(o,void 0,void 0,function(){return T(this,function(u){switch(u.label){case 0:return[4,s];case 1:return u.sent(),[4,this.send(l,e)];case 2:return[2,u.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},t.prototype.send=function(e,r){var n;return r===void 0&&(r=!0),_(this,void 0,void 0,function(){var i,o,a,s,l,u;return T(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,xl)];i={api_key:this.config.apiKey,events:e.map(function(f){var d=f.event;d.extra;var v=Gr(d,["extra"]);return v}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new Wl,c.label=1;case 1:return c.trys.push([1,3,,4]),o=Ya(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,a=$l(o,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(o,i,this.config._enableRequestBodyCompressionExperimental&&a)];case 2:return s=c.sent(),s===null?(this.fulfillRequest(e,0,Pl),[2]):r?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(jt(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return l=c.sent(),u=Xl(l),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(f){return f.event.event_type}),message:u,stack_trace:Rr()}),this.handleResponse({status:pe.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,r){var n;qn(e.statusCode)||(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful",{events:r.map(function(o){return o.event.event_type}),code:e.statusCode,status:e.status,body:jt(e),stack_trace:Rr()});var i=e.status;switch(i){case pe.Success:{this.handleSuccessResponse(e,r);break}case pe.Invalid:{this.handleInvalidResponse(e,r);break}case pe.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,r);break}case pe.RateLimit:{this.handleRateLimitResponse(e,r);break}default:{this.config.loggerProvider.warn(`{code: 0, error: "Status '`.concat(i,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},t.prototype.handleSuccessResponse=function(e,r){this.fulfillRequest(r,e.statusCode,kl)},t.prototype.handleInvalidResponse=function(e,r){var n=this;if(e.body.missingField||e.body.error.startsWith(Nl)){this.fulfillRequest(r,e.statusCode,e.body.error);return}var i=$($($($([],D(Object.values(e.body.eventsWithInvalidFields)),!1),D(Object.values(e.body.eventsWithMissingFields)),!1),D(Object.values(e.body.eventsWithInvalidIdLengths)),!1),D(e.body.silencedEvents),!1).flat(),o=new Set(i),a=r.filter(function(l,u){if(o.has(u)){n.fulfillRequest([l],e.statusCode,e.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(jt(e));var s=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(s)},t.prototype.handlePayloadTooLargeResponse=function(e,r){if(r.length===1){this.fulfillRequest(r,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(jt(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},t.prototype.handleRateLimitResponse=function(e,r){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),a=e.body.throttledEvents,s=new Set(i),l=new Set(o),u=new Set(a),c=r.filter(function(d,v){if(d.event.user_id&&s.has(d.event.user_id)||d.event.device_id&&l.has(d.event.device_id)){n.fulfillRequest([d],e.statusCode,e.body.error);return}return u.has(v)&&(d.timeout=n.throttleTimeout),!0});c.length>0&&this.config.loggerProvider.warn(jt(e));var f=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(f)},t.prototype.handleOtherResponse=function(e){var r=this,n=e.map(function(o){return o.timeout=o.attempts*r.retryTimeout,o}),i=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(i)},t.prototype.fulfillRequest=function(e,r,n){var i,o,a;qn(r)?(a=this.diagnosticsClient)===null||a===void 0||a.increment("analytics.events.sent",e.length):((i=this.diagnosticsClient)===null||i===void 0||i.increment("analytics.events.dropped",e.length),(o=this.diagnosticsClient)===null||o===void 0||o.recordEvent("analytics.events.dropped",{events:e.map(function(s){return s.event.event_type}),code:r,message:n,stack_trace:Rr()})),this.removeEvents(e),e.forEach(function(s){return s.callback(xt(s.event,r,n))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,e)}},t.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(r){return!e.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},t})(),Jl=(function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Ql(),platform:"Web",os:void 0,deviceModel:void 0}},t})(),Ql=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Zl=(function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(r){e(r)}),this.queue=[])},t})(),ot=function(){return ot=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ot.apply(this,arguments)};function xr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function io(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}var Nr=function(t,e){var r,n,i=["string","number","boolean","undefined"],o=typeof t,a=typeof e;if(o!==a)return!1;try{for(var s=xr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(u===o)return t===e}}catch(m){r={error:m}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),f=Array.isArray(e);if(c!==f)return!1;if(c&&f){for(var d=0;d<t.length;d++)if(!Nr(t[d],e[d]))return!1}else{var v=Object.keys(t).sort(),h=Object.keys(e).sort();if(!Nr(v,h))return!1;var g=!0;return Object.keys(t).forEach(function(m){Nr(t[m],e[m])||(g=!1)}),g}return!0},ec="$set",tc="$unset",rc="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n});var nc=(function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,r=ot({},this.identity.userProperties),n=ot(ot({},this.identity),{userProperties:r});return{setUserId:function(i){return n.userId=i,this},setDeviceId:function(i){return n.deviceId=i,this},setUserProperties:function(i){return n.userProperties=i,this},setOptOut:function(i){return n.optOut=i,this},updateUserProperties:function(i){var o,a,s,l,u,c,f=n.userProperties||{};try{for(var d=xr(Object.entries(i)),v=d.next();!v.done;v=d.next()){var h=io(v.value,2),g=h[0],m=h[1];switch(g){case ec:try{for(var E=(s=void 0,xr(Object.entries(m))),p=E.next();!p.done;p=E.next()){var y=io(p.value,2),b=y[0],S=y[1];f[b]=S}}catch(I){s={error:I}}finally{try{p&&!p.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}break;case tc:try{for(var w=(u=void 0,xr(Object.keys(m))),A=w.next();!A.done;A=w.next()){var b=A.value;delete f[b]}}catch(I){u={error:I}}finally{try{A&&!A.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}break;case rc:f={};break}}}catch(I){o={error:I}}finally{try{v&&!v.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}return n.userProperties=f,this},commit:function(){return e.setIdentity(n),this}}},t.prototype.getIdentity=function(){return ot({},this.identity)},t.prototype.setIdentity=function(e){var r=ot({},this.identity);this.identity=ot({},e),Nr(r,this.identity)||this.listeners.forEach(function(n){n(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t})(),Ht=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,mi=(function(){function t(){this.identityStore=new nc,this.eventBridge=new Zl,this.applicationContextProvider=new Jl}return t.getInstance=function(e){return Ht.analyticsConnectorInstances||(Ht.analyticsConnectorInstances={}),Ht.analyticsConnectorInstances[e]||(Ht.analyticsConnectorInstances[e]=new t),Ht.analyticsConnectorInstances[e]},t})(),Mt=function(t){return t===void 0&&(t=Ga),mi.getInstance(t)},ic=function(t,e){Mt(e).identityStore.editIdentity().setUserId(t).commit()},oc=function(t,e){Mt(e).identityStore.editIdentity().setDeviceId(t).commit()},ac=(function(){function t(){this.name="identity",this.type="before",this.identityStore=Mt().identityStore}return t.prototype.execute=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){return r=e.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,e]})})},t.prototype.setup=function(e){return _(this,void 0,void 0,function(){return T(this,function(r){return e.instanceName&&(this.identityStore=Mt(e.instanceName).identityStore),[2]})})},t})(),Ja=function(t,e){e===void 0&&(e=Date.now());var r=Date.now(),n=r-e;return n>t},Qa=function(t,e,r){return e===void 0&&(e=""),r===void 0&&(r=10),[Qr,e,t.substring(0,r)].filter(Boolean).join("_")},sc=function(t){return"".concat(Qr.toLowerCase(),"_").concat(t.substring(0,6))},uc=function(){var t,e,r,n;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(n=(r=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""},Kr=function(){var t,e=F();if(!(!((t=e?.location)===null||t===void 0)&&t.search))return{};var r=e.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(i,o){var a=o.split("=",2),s=oo(a[0]),l=oo(a[1]);return l&&(i[s]=l),i},{});return n},oo=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}},Bn=function(t,e){return!e||!e.length?!0:e.some(function(r){return typeof r=="string"?t===r:t.match(r)})},dt=function(t,e){var r=t;try{r=decodeURI(t)}catch(n){e?.error("Malformed URI sequence: ",n)}return r},Vn=function(t){var e=0;if(t.length===0)return e;for(var r=0;r<t.length;r++){var n=t.charCodeAt(r);e=(e<<5)-e+n,e|=0}return e},ao=function(t,e){var r=Vn(t.toString()),n=Math.abs(r),i=n*31,o=i%1e5;return o/1e5<e},yi=(function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return _(this,void 0,void 0,function(){return T(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return _(this,void 0,void 0,function(){return T(this,function(r){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},t.prototype.set=function(e,r){return _(this,void 0,void 0,function(){return T(this,function(n){return this.memoryStorage.set(e,r),[2]})})},t.prototype.remove=function(e){return _(this,void 0,void 0,function(){return T(this,function(r){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return _(this,void 0,void 0,function(){return T(this,function(e){return this.memoryStorage.clear(),[2]})})},t})(),lc=function(){var t,e=F();return(t=e?.navigator)===null||t===void 0?void 0:t.locks},zr=(function(){function t(e,r){r===void 0&&(r={}),this.options=C({},e),this.config=r}return t.prototype.isEnabled=function(){return _(this,void 0,void 0,function(){var e,r,n,i,o=this;return T(this,function(a){switch(a.label){case 0:return e="AMP_TEST",r=C({},this.options),n=new t(r),i=String(Date.now()),[4,n.transaction(e,function(s){var l,u;try{s.set(i);var c=s.get(),f=c===i;return!f&&o.config.diagnosticsClient&&((l=o.config.diagnosticsClient)===null||l===void 0||l.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:e,testValue:i,sync:!0})),f}catch(v){if(o.config.diagnosticsClient){var d=v instanceof Error?v.message:String(v);(u=o.config.diagnosticsClient)===null||u===void 0||u.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:e,testValue:i,error:d,sync:!0})}return!1}finally{s.set(null)}})];case 1:return[2,a.sent()]}})})},t.prototype.get=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return r=n.sent(),[2,this.decodeCookieValue(e,r)]}})})},t.prototype.decodeCookieValue=function(e,r){if(r)try{var n=Za(r);if(n===void 0){console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(r));return}return JSON.parse(n)}catch{console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(r));return}},t.prototype.getSync=function(e){var r=this.getRawSync(e);return this.decodeCookieValue(e,r)},t.prototype.getRaw=function(e){var r,n;return _(this,void 0,void 0,function(){var i,o,a,s,l,u,c,f,d;return T(this,function(v){switch(v.label){case 0:i=F(),o=i,v.label=1;case 1:return v.trys.push([1,4,,5]),a=o?.cookieStore,a?[4,a.getAll(e)]:[3,3];case 2:if(s=v.sent(),s){s.length>1&&((r=this.config.diagnosticsClient)===null||r===void 0||r.recordEvent("cookies.duplicate",{cookies:s.map(function(h){return h.domain})}),(n=this.config.diagnosticsClient)===null||n===void 0||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(l=q(s),u=l.next();!u.done;u=l.next())if(c=u.value,es(c.domain,this.options.domain))return[2,c.value]}catch(h){f={error:h}}finally{try{u&&!u.done&&(d=l.return)&&d.call(l)}finally{if(f)throw f.error}}}v.label=3;case 3:return[3,5];case 4:return v.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},t.prototype.getRawSync=function(e){var r=this,n,i,o=F(),a=((i=(n=o?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&i!==void 0?i:[]).filter(function(u){return u.indexOf(e+"=")===0}),s=void 0,l=this.config.duplicateResolverFn;if(typeof l=="function"&&a.length>1&&(s=a.find(function(u){var c;try{var f=l(u.substring(e.length+1));return f||(c=r.config.diagnosticsClient)===null||c===void 0||c.increment("cookies.duplicate.occurrence.document.cookie"),f}catch{return!1}})),s||(s=a[0]),!!s)return s.substring(e.length+1)},t.prototype.set=function(e,r){return _(this,void 0,void 0,function(){return T(this,function(n){return this.setSync(e,r),[2]})})},t.prototype.setSync=function(e,r){var n;try{var i=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,o=r!==null?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+o*24*60*60*1e3),a=s}var l="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(r))));a&&(l+="; expires=".concat(a.toUTCString())),l+="; path=/",this.options.domain&&(l+="; domain=".concat(this.options.domain)),this.options.secure&&(l+="; Secure"),this.options.sameSite&&(l+="; SameSite=".concat(this.options.sameSite));var u=F();u?.document&&(u.document.cookie=l)}catch(f){var c=f instanceof Error?f.message:String(f);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},t.prototype.remove=function(e){return _(this,void 0,void 0,function(){return T(this,function(r){switch(r.label){case 0:return[4,this.set(e,null)];case 1:return r.sent(),[2]}})})},t.prototype.reset=function(){return _(this,void 0,void 0,function(){return T(this,function(e){return[2]})})},t.isDomainWritable=function(e){return _(this,void 0,void 0,function(){var r,n,i,o;return T(this,function(a){switch(a.label){case 0:if(t.cachedTlds[e])return[2,!0];r={domain:"."+e},n="AMP_TLDTEST",i=new t(r),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.transaction(n,function(s){if(t.cachedTlds[e])return!0;try{s.set(1);var l=!!s.get();return l&&(t.cachedTlds[e]=!0),l}finally{s.set(null)}})];case 2:return o=a.sent(),[2,!!o];case 3:return a.sent(),[2,!1];case 4:return[2]}})})},t.prototype.transaction=function(e,r){return _(this,void 0,void 0,function(){var n,i,o=this;return T(this,function(a){switch(a.label){case 0:if(n=lc(),i=function(){var s={get:function(){return o.getSync(e)},set:function(l){return o.setSync(e,l)}};return r(s)},!n)return[2,i()];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),i)];case 2:return[2,a.sent()];case 3:return a.sent(),[2,i()];case 4:return[2]}})})},t.cachedTlds={},t})(),cc=function(t){try{return decodeURIComponent(atob(t))}catch{return}},dc=function(t){try{return decodeURIComponent(atob(decodeURIComponent(t)))}catch{return}},Za=function(t){var e;return(e=cc(t))!==null&&e!==void 0?e:dc(t)},es=function(t,e){if(t===""&&e==="")return!0;if(!t||!e)return!1;var r=t.startsWith(".")?t.substring(1):t,n=e.startsWith(".")?e.substring(1):e;return r.toLowerCase()===n.toLowerCase()},so=function(t,e,r){return e===void 0&&(e=""),r===void 0&&(r=10),[Qr,e,t.substring(0,r)].filter(Boolean).join("_")},en=(function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return _(this,void 0,void 0,function(){var e,r,n,i;return T(this,function(o){switch(o.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),r=new t(this.storage),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,r.set(n,e)];case 2:return o.sent(),[4,r.get(n)];case 3:return i=o.sent(),[2,i===e];case 4:return o.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return r=n.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var r;return _(this,void 0,void 0,function(){return T(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(e))||void 0]})})},t.prototype.set=function(e,r){var n;return _(this,void 0,void 0,function(){return T(this,function(i){try{(n=this.storage)===null||n===void 0||n.setItem(e,JSON.stringify(r))}catch{}return[2]})})},t.prototype.remove=function(e){var r;return _(this,void 0,void 0,function(){return T(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return _(this,void 0,void 0,function(){return T(this,function(r){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t})(),fc=10,vc=1,re={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},uo={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},lo=(function(){function t(e,r){this.dbPromise=null,this.logger=r,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return t.isSupported=function(){var e;return((e=F())===null||e===void 0?void 0:e.indexedDB)!==void 0},t.prototype.getDB=function(){return _(this,void 0,void 0,function(){return T(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},t.prototype.openDB=function(){var e=this;return new Promise(function(r,n){var i=indexedDB.open(e.dbName,vc);i.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},i.onsuccess=function(){var o=i.result;o.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},o.onerror=function(a){e.logger.debug("DiagnosticsStorage: A global database error occurred.",a),o.close()},r(o)},i.onupgradeneeded=function(o){var a=o.target.result;e.createTables(a)}})},t.prototype.createTables=function(e){if(e.objectStoreNames.contains(re.TAGS)||e.createObjectStore(re.TAGS,{keyPath:"key"}),e.objectStoreNames.contains(re.COUNTERS)||e.createObjectStore(re.COUNTERS,{keyPath:"key"}),e.objectStoreNames.contains(re.HISTOGRAMS)||e.createObjectStore(re.HISTOGRAMS,{keyPath:"key"}),!e.objectStoreNames.contains(re.EVENTS)){var r=e.createObjectStore(re.EVENTS,{keyPath:"id",autoIncrement:!0});r.createIndex("time_idx","time",{unique:!1})}e.objectStoreNames.contains(re.INTERNAL)||e.createObjectStore(re.INTERNAL,{keyPath:"key"})},t.prototype.setTags=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([re.TAGS],"readwrite"),i=n.objectStore(re.TAGS),[2,new Promise(function(l){var u=Object.entries(e);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set tags",c),l()},u.forEach(function(c){var f=D(c,2),d=f[0],v=f[1],h=i.put({key:d,value:v});h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to set tag",d,v,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",o),[3,3];case 3:return[2]}})})},t.prototype.incrementCounters=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([re.COUNTERS],"readwrite"),i=n.objectStore(re.COUNTERS),[2,new Promise(function(l){var u=Object.entries(e);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to increment counters",c),l()},u.forEach(function(c){var f=D(c,2),d=f[0],v=f[1],h=i.get(d);h.onsuccess=function(){var g=h.result,m=g?g.value:0,E=i.put({key:d,value:m+v});E.onerror=function(p){a.logger.debug("DiagnosticsStorage: Failed to update counter",d,p)}},h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to read existing counter",d,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",o),[3,3];case 3:return[2]}})})},t.prototype.setHistogramStats=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([re.HISTOGRAMS],"readwrite"),i=n.objectStore(re.HISTOGRAMS),[2,new Promise(function(l){var u=Object.entries(e);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",c),l()},u.forEach(function(c){var f=D(c,2),d=f[0],v=f[1],h=i.get(d);h.onsuccess=function(){var g=h.result,m;g?m={key:d,count:g.count+v.count,min:Math.min(g.min,v.min),max:Math.max(g.max,v.max),sum:g.sum+v.sum}:m={key:d,count:v.count,min:v.min,max:v.max,sum:v.sum};var E=i.put(m);E.onerror=function(p){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",d,p)}},h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",d,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",o),[3,3];case 3:return[2]}})})},t.prototype.addEventRecords=function(e){return _(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),e.length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([re.EVENTS],"readwrite"),i=n.objectStore(re.EVENTS),[2,new Promise(function(l){n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to add event records",c),l()};var u=i.count();u.onsuccess=function(){var c=u.result,f=Math.max(0,fc-c);f<e.length&&a.logger.debug("DiagnosticsStorage: Only added ".concat(f," of ").concat(e.length," events due to storage limit")),e.slice(0,f).forEach(function(d){var v=i.add(d);v.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to add event record",h)}})},u.onerror=function(c){a.logger.debug("DiagnosticsStorage: Failed to count existing events",c)}})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",o),[3,3];case 3:return[2]}})})},t.prototype.setInternal=function(e,r){return _(this,void 0,void 0,function(){var n,i,o,a;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=s.sent(),i=n.transaction([re.INTERNAL],"readwrite"),o=i.objectStore(re.INTERNAL),[2,new Promise(function(l,u){i.onabort=function(){return u(new Error("Failed to set internal value"))};var c=o.put({key:e,value:r});c.onsuccess=function(){return l()},c.onerror=function(){return u(new Error("Failed to set internal value"))}})];case 2:return a=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",a),[3,3];case 3:return[2]}})})},t.prototype.getInternal=function(e){return _(this,void 0,void 0,function(){var r,n,i,o;return T(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=a.sent(),n=r.transaction([re.INTERNAL],"readonly"),i=n.objectStore(re.INTERNAL),[2,new Promise(function(s,l){n.onabort=function(){return l(new Error("Failed to get internal value"))};var u=i.get(e);u.onsuccess=function(){return s(u.result)},u.onerror=function(){return l(new Error("Failed to get internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",o),[2,void 0];case 3:return[2]}})})},t.prototype.getLastFlushTimestamp=function(){return _(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(uo.LAST_FLUSH_TIMESTAMP)];case 1:return e=n.sent(),[2,e?parseInt(e.value,10):void 0];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",r),[2,void 0];case 3:return[2]}})})},t.prototype.setLastFlushTimestamp=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(uo.LAST_FLUSH_TIMESTAMP,e.toString())];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",r),[3,3];case 3:return[2]}})})},t.prototype.clearTable=function(e,r){return new Promise(function(n,i){var o=e.objectStore(r),a=o.clear();a.onsuccess=function(){return n()},a.onerror=function(){return i(new Error("Failed to clear table ".concat(r)))}})},t.prototype.getAllAndClear=function(){return _(this,void 0,void 0,function(){var e,r,n,i,o,a,s,l;return T(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),r=e.transaction([re.TAGS,re.COUNTERS,re.HISTOGRAMS,re.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(r,re.TAGS),this.getAllFromStore(r,re.COUNTERS),this.getAllFromStore(r,re.HISTOGRAMS),this.getAllFromStore(r,re.EVENTS)])];case 2:return n=D.apply(void 0,[u.sent(),4]),i=n[0],o=n[1],a=n[2],s=n[3],[4,Promise.all([this.clearTable(r,re.COUNTERS),this.clearTable(r,re.HISTOGRAMS),this.clearTable(r,re.EVENTS)])];case 3:return u.sent(),[2,{tags:i,counters:o,histogramStats:a,events:s}];case 4:return l=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",l),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},t.prototype.getAllFromStore=function(e,r){return new Promise(function(n,i){var o=e.objectStore(r),a=o.getAll();a.onsuccess=function(){return n(a.result)},a.onerror=function(){return i(new Error("Failed to get all from ".concat(r)))}})},t})(),hc="__AMPLITUDE_SCRIPT_URL__",gc="sdk.error.uncaught",pc=function(){var t=F();if(!t)return[];var e=t[hc];return Array.isArray(e)?e:typeof e=="string"?[e]:[]},mc=function(t){var e=F();if(!(!e||typeof e.addEventListener!="function")){var r=function(o){var a=o.error instanceof Error?o.error:void 0,s=a?.stack,l=co({filename:o.filename,stack:s});l&&i({type:"error",message:o.message,stack:s,filename:o.filename,errorName:a?.name,metadata:{colno:o.colno,lineno:o.lineno,isTrusted:o.isTrusted,matchReason:l}})},n=function(o){var a,s=o.reason instanceof Error?o.reason:void 0,l=s?.stack,u=yc(l),c=co({filename:u,stack:l});c&&i({type:"unhandledrejection",message:(a=s?.message)!==null&&a!==void 0?a:bc(o.reason),stack:l,filename:u,errorName:s?.name,metadata:{isTrusted:o.isTrusted,matchReason:c}})},i=function(o){t.recordEvent(gc,C({type:o.type,message:o.message,filename:o.filename,error_name:o.errorName,stack:o.stack},o.metadata))};e.addEventListener("error",r,!0),e.addEventListener("unhandledrejection",n,!0)}},co=function(t){var e,r,n=pc();if(n.length!==0)try{for(var i=q(n),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.filename&&t.filename.includes(a))return"filename";if(t.stack&&t.stack.includes(a))return"stack"}}catch(s){e={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},yc=function(t){if(t){var e=t.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return e?e[1]:void 0}},bc=function(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return"[object Object]"}},Ec=1e3,mr=300*1e3,Sc="https://diagnostics.prod.us-west-2.amplitude.com/v1/capture",wc="https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",cn=1e4,Tc=10,_c=(function(){function t(e,r,n,i){n===void 0&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=r,this.serverUrl=n==="US"?Sc:wc,this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(i,null,2)),this.config=C({enabled:!0,sampleRate:0},i),this.startTimestamp=Date.now(),this.shouldTrack=ao(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,lo.isSupported()?this.storage=new lo(e,r):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),mc(this))}return t.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},t.prototype.setTag=function(e,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=cn){this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");return}this.inMemoryTags[e]=r,this.startTimersIfNeeded()}},t.prototype.increment=function(e,r){if(r===void 0&&(r=1),!!this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=cn){this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");return}this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+r,this.startTimersIfNeeded()}},t.prototype.recordHistogram=function(e,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=cn){this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");return}var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,r),n.max=Math.max(n.max,r),n.sum+=r):this.inMemoryHistograms[e]={count:1,min:r,max:r,sum:r},this.startTimersIfNeeded()}},t.prototype.recordEvent=function(e,r){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=Tc){this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");return}this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:r}),this.startTimersIfNeeded()}},t.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(r){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",r)}).finally(function(){e.saveTimer=null})},Ec)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(r){e.logger.debug("DiagnosticsClient: Failed to flush",r)}).finally(function(){e.flushTimer=null})},mr))},t.prototype.saveAllDataToStorage=function(){return _(this,void 0,void 0,function(){var e,r,n,i;return T(this,function(o){switch(o.label){case 0:return this.storage?(e=C({},this.inMemoryTags),r=C({},this.inMemoryCounters),n=C({},this.inMemoryHistograms),i=$([],D(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(r),this.storage.setHistogramStats(n),this.storage.addEventRecords(i)])]):[2];case 1:return o.sent(),[2]}})})},t.prototype._flush=function(){return _(this,void 0,void 0,function(){var e,r,n,i,o,a,s,l,u,c;return T(this,function(f){switch(f.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return f.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=f.sent(),r=e.tags,n=e.counters,i=e.histogramStats,o=e.events,this.storage.setLastFlushTimestamp(Date.now()),a={},r.forEach(function(d){a[d.key]=d.value}),s={},n.forEach(function(d){s[d.key]=d.value}),l={},i.forEach(function(d){l[d.key]={count:d.count,min:d.min,max:d.max,avg:Math.round(d.sum/d.count*100)/100}}),u=o.map(function(d){return{event_name:d.event_name,time:d.time,event_properties:d.event_properties}}),Object.keys(s).length===0&&Object.keys(l).length===0&&u.length===0?[2]:(c={tags:a,histogram:l,counters:s,events:u},this.fetch(c),[2])}})})},t.prototype.fetch=function(e){return _(this,void 0,void 0,function(){var r,n;return T(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),!F())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return r=i.sent(),r.ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return n=i.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",n),[3,3];case 3:return[2]}})})},t.prototype.initializeFlushInterval=function(){return _(this,void 0,void 0,function(){var e,r,n;return T(this,function(i){switch(i.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return r=i.sent()||-1,r===-1?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(mr),[2]):(n=e-r,n>=mr?(this._flush(),[2]):(this._setFlushTimer(mr-n),[2]))}})})},t.prototype._setFlushTimer=function(e){var r=this;this.flushTimer=setTimeout(function(){r._flush().catch(function(n){r.logger.debug("DiagnosticsClient: Failed to flush",n)}).finally(function(){r.flushTimer=null})},e)},t.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=ao(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},t})(),dr=(function(){function t(){}return t.prototype.send=function(e,r,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var r,n,i,o,a,s,l,u,c,f,d,v,h,g,m,E,p,y,b,S,w,A;if(typeof e!="object")return null;var I=e.code||0,k=this.buildStatus(I);switch(k){case pe.Success:return{status:k,statusCode:I,body:{eventsIngested:(r=e.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=e.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case pe.Invalid:return{status:k,statusCode:I,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(a=e.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(s=e.events_with_invalid_fields)!==null&&s!==void 0?s:{},eventsWithMissingFields:(l=e.events_with_missing_fields)!==null&&l!==void 0?l:{},eventsWithInvalidIdLengths:(u=e.events_with_invalid_id_lengths)!==null&&u!==void 0?u:{},epsThreshold:(c=e.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(f=e.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=e.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(v=e.silenced_events)!==null&&v!==void 0?v:[],throttledDevices:(h=e.throttled_devices)!==null&&h!==void 0?h:{},throttledEvents:(g=e.throttled_events)!==null&&g!==void 0?g:[]}};case pe.PayloadTooLarge:return{status:k,statusCode:I,body:{error:(m=e.error)!==null&&m!==void 0?m:""}};case pe.RateLimit:return{status:k,statusCode:I,body:{error:(E=e.error)!==null&&E!==void 0?E:"",epsThreshold:(p=e.eps_threshold)!==null&&p!==void 0?p:0,throttledDevices:(y=e.throttled_devices)!==null&&y!==void 0?y:{},throttledUsers:(b=e.throttled_users)!==null&&b!==void 0?b:{},exceededDailyQuotaDevices:(S=e.exceeded_daily_quota_devices)!==null&&S!==void 0?S:{},exceededDailyQuotaUsers:(w=e.exceeded_daily_quota_users)!==null&&w!==void 0?w:{},throttledEvents:(A=e.throttled_events)!==null&&A!==void 0?A:[]}};case pe.Timeout:default:return{status:k,statusCode:I}}},t.prototype.buildStatus=function(e){return qn(e)?pe.Success:e===429?pe.RateLimit:e===413?pe.PayloadTooLarge:e===408?pe.Timeout:e>=400&&e<500?pe.Invalid:e>=500?pe.Failed:pe.Unknown},t})(),Ic=(function(t){Fe(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.customHeaders=r,n}return e.prototype.send=function(r,n){return _(this,void 0,void 0,function(){var i,o,a;return T(this,function(s){switch(s.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:C({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(n),method:"POST"},[4,fetch(r,i)];case 1:return o=s.sent(),[4,o.text()];case 2:a=s.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch{return[2,this.buildResponse({code:o.status})]}return[2]}})})},e})(dr),ts=2*1024;function rs(){return typeof CompressionStream<"u"}function ns(t){return _(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:if(e=CompressionStream,typeof e>"u")return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),r=new Blob([t]).stream().pipeThrough(new e("gzip")),[4,new Response(r).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var Ac=(function(){function t(e,r){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=r}return t.prototype.fetchConfig=function(){var e=null,r={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(i){return this.logger.debug("Remote config localstorage failed to access: ",i),Promise.resolve(r)}if(e===null)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(r);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(i){return this.logger.debug("Remote config localstorage failed to parse: ",i),localStorage.removeItem(this.key),Promise.resolve(r)}},t.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(r){this.logger.debug("Remote config localstorage failed to set: ",r)}return Promise.resolve(!1)},t})(),Cc="https://sr-client-cfg.amplitude.com/config",kc="https://sr-client-cfg.eu.amplitude.com/config",Pc=3,dn={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},Oc=1e3,Rc=300*1e3,is=(function(){function t(e,r,n,i){n===void 0&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=i||(n==="US"?Cc:kc),this.logger=r,this.storage=new Ac(e,r)}return t.prototype.subscribe=function(e,r,n){var i=Je(),o={id:i,key:e,deliveryMode:r,callback:n};return this.callbackInfos.push(o),r==="all"?this.subscribeAll(o):this.subscribeWaitForRemote(o,r.timeout),i},t.prototype.unsubscribe=function(e){var r=this.callbackInfos.findIndex(function(n){return n.id===e});return r===-1?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(r,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},t.prototype.updateConfigs=function(){return _(this,void 0,void 0,function(){var e,r,n=this;return T(this,function(i){switch(i.label){case 0:return this.lastSuccessfulFetch&&(e=Date.now()-this.lastSuccessfulFetch,e<Rc)?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return r=i.sent(),this.storage.setConfig(r),this.callbackInfos.forEach(function(o){n.sendCallback(o,r,"remote")}),[2]}})})},t.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(r){return r.remoteConfig!==null&&(e.lastSuccessfulFetch=Date.now()),r}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},t.prototype.subscribeAll=function(e){return _(this,void 0,void 0,function(){var r,n,i,o=this;return T(this,function(a){switch(a.label){case 0:return r=this.getOrCreateFetchPromise().then(function(s){o.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(s))),o.sendCallback(e,s,"remote"),o.storage.setConfig(s)}),n=this.storage.fetchConfig().then(function(s){return s}),[4,Promise.race([r,n])];case 1:return i=a.sent(),i!==void 0&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(i))),i.remoteConfig!==null?this.sendCallback(e,i,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,r];case 2:return a.sent(),[2]}})})},t.prototype.subscribeWaitForRemote=function(e,r){return _(this,void 0,void 0,function(){var n,i,i;return T(this,function(o){switch(o.label){case 0:n=new Promise(function(a,s){setTimeout(function(){s("Timeout exceeded")},r)}),o.label=1;case 1:return o.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return i=o.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,i,"remote"),this.storage.setConfig(i),[3,5];case 3:return o.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return i=o.sent(),i.remoteConfig!==null?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,i,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,i,"remote")),[3,5];case 5:return[2]}})})},t.prototype.sendCallback=function(e,r,n){e.lastCallback=new Date;var i;e.key?i=e.key.split(".").reduce(function(o,a){return o===null?o:a in o?o[a]:null},r.remoteConfig):i=r.remoteConfig,e.callback(i,n,r.lastFetch)},t.prototype.fetch=function(e,r){return e===void 0&&(e=Pc),r===void 0&&(r=Oc),_(this,void 0,void 0,function(){var n,i,o,a,s,l,u=this;return T(this,function(c){switch(c.label){case 0:n=r/e,i={remoteConfig:null,lastFetch:new Date},o=function(f){var d,v,h,g,m,E,p;return T(this,function(y){switch(y.label){case 0:d=!0,v=new AbortController,h=setTimeout(function(){return v.abort()},r),y.label=1;case 1:return y.trys.push([1,7,8,9]),[4,fetch(a.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:v.signal})];case 2:return g=y.sent(),g.ok?[3,4]:[4,g.text()];case 3:return m=y.sent(),a.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(g.status,": ").concat(m)),g.status===dn.INVALID_API_KEY||g.status===dn.FORBIDDEN?(a.logger.error("Remote config client fetch failed with ".concat(g.status,". Invalid API key; future fetches will be skipped.")),a.isLastFetchInvalidApiKey=!0,d=!1):g.status>=400&&g.status<500&&g.status!==dn.RATE_LIMIT&&(d=!1),[3,6];case 4:return[4,g.json()];case 5:return E=y.sent(),[2,{value:{remoteConfig:E,lastFetch:new Date}}];case 6:return[3,9];case 7:return p=y.sent(),p instanceof Error&&p.name==="AbortError"?a.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(r,"ms")):a.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),p),[3,9];case 8:return clearTimeout(h),[7];case 9:return d?f<e-1?[4,new Promise(function(b){return setTimeout(b,u.getJitterDelay(n))})]:[3,11]:[2,"break"];case 10:y.sent(),y.label=11;case 11:return[2]}})},a=this,s=0,c.label=1;case 1:return s<e?[5,o(s)]:[3,4];case 2:if(l=c.sent(),typeof l=="object")return[2,l.value];if(l==="break")return[3,4];c.label=3;case 3:return s++,[3,1];case 4:return[2,i]}})})},t.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},t.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",t.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(e,"?").concat(r.toString())},t.CONFIG_GROUP="browser",t})(),fn=F(),kt=fn?.console,yt={},rr={},vn=!1;function xc(t){if(!kt||typeof kt[t]!="function")return!1;if(rr[t])return!0;var e=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{if(yt[t]&&!vn){vn=!0;var i=yt[t];i&&i.forEach(function(o){try{o(t,r)}catch{}})}}catch{}return vn=!1,rr[t].apply(kt,r)};return rr[t]=kt[t],kt[t]=e,!0}function Nc(t,e){var r=xc(t);if(!r)return new Error("Console override failed");yt[t]?yt[t].push(e):yt[t]=[e]}function Lc(t){var e,r;try{for(var n=q(Object.values(yt)),i=n.next();!i.done;i=n.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===t){o.splice(a,1);break}}catch(s){e={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}}function Dc(){var t,e;try{for(var r=q(Object.entries(rr)),n=r.next();!n.done;n=r.next()){var i=D(n.value,2),o=i[0],a=i[1];a&&(kt[o]=a)}}catch(s){t={error:s}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}rr={},yt={}}var fo={addListener:Nc,removeListener:Lc,_restoreConsole:Dc},lr;(function(t){t.US="US",t.EU="EU",t.STAGING="STAGING"})(lr||(lr={}));var Mc=null,Uc=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],os="data-amp-track-",Fc=["div","span","h1","h2","h3","h4","h5","h6"],as=150,qc=["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]'],ss=$(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],D(qc),!1),Bc=ss,Vc=ss,jc=["*"],Hc=1e3,Gc=4,Wc=50;function Kc(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null||t===void 0}function us(t,e,r){if(t){var n=e.map(vo),i=r.map(vo);ls({json:t,allowlist:n,excludelist:i,ancestors:[]})}}function ls(t){var e,r,n=t.json,i=t.targetObject,o=t.allowlist,a=t.excludelist,s=t.ancestors,l=t.parentObject,u=t.targetKey;i||(i=n);var c=Object.keys(i);try{for(var f=q(c),d=f.next();!d.done;d=f.next()){var v=d.value,h=$($([],D(s),!1),[v],!1);Kc(i[v])?(!ho(h,o)||ho(h,a))&&delete i[v]:ls({json:n,targetObject:i[v],allowlist:o,excludelist:a,ancestors:h,parentObject:i,targetKey:v})}}catch(g){e={error:g}}finally{try{d&&!d.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}Object.keys(i).length===0&&l&&u&&delete l[u]}function vo(t){return t.startsWith("/")&&(t=t.slice(1)),t.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function jn(t,e,r,n){if(r===void 0&&(r=0),n===void 0&&(n=0),n===e.length)return r===t.length;if(r===t.length){for(;n<e.length&&e[n]==="**";)n++;return n===e.length}var i=e[n];if(i==="**"){if(n+1===e.length)return!0;for(var o=r;o<=t.length;o++)if(jn(t,e,o,n+1))return!0;return!1}else return i==="*"||i===t[r]?jn(t,e,r+1,n+1):!1}function ho(t,e){return e.some(function(r){return jn(t,r)})}var zc=500,cs=100,$c=(function(){function t(e){this.request=e}return t.prototype.headers=function(e){var r,n;e===void 0&&(e=[]);var i=this.request.headers,o={};if(Array.isArray(i))i.forEach(function(f){var d=D(f,2),v=d[0],h=d[1];o[v]=h});else if(i instanceof Headers)i.forEach(function(f,d){o[d]=f});else if(typeof i=="object"&&i!==null)try{for(var a=q(Object.entries(i)),s=a.next();!s.done;s=a.next()){var l=D(s.value,2),u=l[0],c=l[1];o[u]=c}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return tn(o,{allow:e})},Object.defineProperty(t.prototype,"bodySize",{get:function(){if(typeof this._bodySize=="number")return this._bodySize;var e=F();if(e?.TextEncoder){var r=this.request.body;return this._bodySize=ds(r,cs),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return typeof this.request.body=="string"?this.request.body:null},enumerable:!1,configurable:!0}),t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),_(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.body,[2,bi(n,e,r)])})})},t})(),Xc=(function(){function t(e,r){this.bodyRaw=e,this.requestHeaders=r}return t.prototype.headers=function(e){return e===void 0&&(e=[]),tn(this.requestHeaders,{allow:e})},Object.defineProperty(t.prototype,"bodySize",{get:function(){return ds(this.bodyRaw,cs)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return typeof this.bodyRaw=="string"?this.bodyRaw:null},enumerable:!1,configurable:!0}),t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),_(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.body,[2,bi(n,e,r)])})})},t})();function ds(t,e){var r,n,i,o=F(),a=o?.TextEncoder;if(a){var s;if(typeof t=="string")s=t,i=new a().encode(s).length;else if(t instanceof Blob)s=t,i=s.size;else if(t instanceof URLSearchParams)s=t,i=new a().encode(s.toString()).length;else if(ArrayBuffer.isView(t))s=t,i=s.byteLength;else if(t instanceof ArrayBuffer)s=t,i=s.byteLength;else if(t instanceof FormData){var l=t,u=0,c=0;try{for(var f=q(l.entries()),d=f.next();!d.done;d=f.next()){var v=D(d.value,2),h=v[0],g=v[1];if(u+=h.length,typeof g=="string")u+=new a().encode(g).length;else if(g instanceof Blob)u+=g.size;else return;if(++c>=e)return}}catch(m){r={error:m}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}i=u}else if(t instanceof ReadableStream){s=t;return}return i}}var Yc=(function(){function t(e){this.response=e}return t.prototype.headers=function(e){var r;if(e===void 0&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,i={};return(r=n?.forEach)===null||r===void 0||r.call(n,function(o,a){i[a]=o}),tn(i,{allow:e})}},Object.defineProperty(t.prototype,"bodySize",{get:function(){var e,r;if(this._bodySize!==void 0)return this._bodySize;var n=(r=(e=this.response.headers)===null||e===void 0?void 0:e.get)===null||r===void 0?void 0:r.call(e,"content-length"),i=n?parseInt(n,10):void 0;return this._bodySize=i,i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),t.prototype.text=function(){return _(this,void 0,void 0,function(){var e,r,n;return T(this,function(i){switch(i.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),i.label=1;case 1:return i.trys.push([1,3,,4]),e=this.clonedResponse.text(),r=new Promise(function(o){return setTimeout(function(){return o(null)},zc)}),[4,Promise.race([e,r])];case 2:return n=i.sent(),[2,n];case 3:return i.sent(),[2,null];case 4:return[2]}})})},t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),_(this,void 0,void 0,function(){var n;return T(this,function(i){switch(i.label){case 0:return e.length===0?[2,null]:[4,this.text()];case 1:return n=i.sent(),[2,bi(n,e,r)]}})})},t})(),Jc=(function(){function t(e,r,n,i){this.statusCode=e,this.headersString=r,this.size=n,this.getJson=i}return Object.defineProperty(t.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),t.prototype.headers=function(e){var r,n;if(e===void 0&&(e=[]),!this.headersString)return{};var i={},o=this.headersString.split(`\r
`);try{for(var a=q(o),s=a.next();!s.done;s=a.next()){var l=s.value,u=D(l.split(": "),2),c=u[0],f=u[1];c&&f&&(i[c]=f)}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return tn(i,{allow:e})},t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),_(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.getJson(),n?(us(n,e,r),[2,n]):[2,null])})})},t})();function bi(t,e,r){if(!t)return null;try{var n=JSON.parse(t);return us(n,e,r),n}catch{return null}}var nr;(function(t){t.REDACT="redact",t.REMOVE="remove"})(nr||(nr={}));var go="[REDACTED]",tn=function(t,e){var r,n,i=e.allow,o=i===void 0?[]:i,a=e.strategy,s=a===void 0?nr.REMOVE:a,l=$([],D(Il),!1),u={},c=function(h){var g=h.toLowerCase();l.find(function(m){return m.toLowerCase()===g})?s===nr.REDACT&&(u[h]=go):o.find(function(m){return m.toLowerCase()===g})?u[h]=t[h]:s===nr.REDACT&&(u[h]=go)};try{for(var f=q(Object.keys(t)),d=f.next();!d.done;d=f.next()){var v=d.value;c(v)}}catch(h){r={error:h}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}return u},Qc=(function(){function t(e,r,n,i,o,a,s,l,u,c,f){s===void 0&&(s=0),this.type=e,this.method=r,this.timestamp=n,this.startTime=i,this.url=o,this.requestWrapper=a,this.status=s,this.duration=l,this.responseWrapper=u,this.error=c,this.endTime=f}return t.prototype.toSerializable=function(){var e,r,n,i,o={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:(e=this.requestWrapper)===null||e===void 0?void 0:e.headers($([],D(Wr),!1)),requestBodySize:(r=this.requestWrapper)===null||r===void 0?void 0:r.bodySize,responseHeaders:(n=this.responseWrapper)===null||n===void 0?void 0:n.headers($([],D(Wr),!1)),responseBodySize:(i=this.responseWrapper)===null||i===void 0?void 0:i.bodySize};return Object.fromEntries(Object.entries(o).filter(function(a){var s=D(a,2);s[0];var l=s[1];return l!==void 0}))},t})();function Zc(t){return typeof t=="object"&&t!==null&&"url"in t&&"method"in t}var ed=(function(){function t(e,r){r===void 0&&(r=Je()),this.callback=e,this.id=r}return t})();function ht(t){try{t()}catch{}}var td=(function(){function t(e){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=e;var r=F();t.isSupported()&&(this.globalScope=r)}return t.isSupported=function(){var e=F();return!!e&&!!e.fetch},t.prototype.subscribe=function(e,r){var n,i,o,a,s,l,u,c,f,d;if(this.logger||(this.logger=r),this.eventCallbacks.set(e.id,e),!this.isObserving){var v=(o=(i=(n=this.globalScope)===null||n===void 0?void 0:n.XMLHttpRequest)===null||i===void 0?void 0:i.prototype)===null||o===void 0?void 0:o.open,h=(l=(s=(a=this.globalScope)===null||a===void 0?void 0:a.XMLHttpRequest)===null||s===void 0?void 0:s.prototype)===null||l===void 0?void 0:l.send,g=(f=(c=(u=this.globalScope)===null||u===void 0?void 0:u.XMLHttpRequest)===null||c===void 0?void 0:c.prototype)===null||f===void 0?void 0:f.setRequestHeader;v&&h&&g&&this.observeXhr(v,h,g);var m=(d=this.globalScope)===null||d===void 0?void 0:d.fetch;m&&this.observeFetch(m),this.isObserving=!0}},t.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},t.prototype.triggerEventCallbacks=function(e){var r=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(i){ht(function(){var o;(o=r.logger)===null||o===void 0||o.debug("an unexpected error occurred while triggering event callbacks",i)})}})},t.prototype.handleNetworkRequestEvent=function(e,r,n,i,o,a,s){var l;if(!(a===void 0||s===void 0)){var u,c="GET";if(Zc(r)?(u=r.url,c=r.method):u=(l=r?.toString)===null||l===void 0?void 0:l.call(r),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch{}c=n?.method||c;var d,v;i&&(d=i.status),o&&(v={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},d=0);var h=Math.floor(performance.now()-s),g=Math.floor(a+h),m=new Qc(e,c,a,a,u,n,d,h,i,v,g);this.triggerEventCallbacks(m)}},t.prototype.getTimestamps=function(){var e,r;return{startTime:(e=Date.now)===null||e===void 0?void 0:e.call(Date),durationStart:(r=performance?.now)===null||r===void 0?void 0:r.call(performance)}},t.prototype.observeFetch=function(e){var r=this;!this.globalScope||!e||(this.globalScope.fetch=function(n,i){return _(r,void 0,void 0,function(){var o,a,s,l,u=this;return T(this,function(c){switch(c.label){case 0:try{o=this.getTimestamps()}catch(f){ht(function(){var d;return(d=u.logger)===null||d===void 0?void 0:d.debug("an unexpected error occurred while retrieving timestamps",f)})}c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e(n,i)];case 2:return a=c.sent(),[3,4];case 3:return l=c.sent(),s=l,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,i?new $c(i):void 0,a?new Yc(a):void 0,s,o?.startTime,o?.durationStart)}catch(f){ht(function(){var d;return(d=u.logger)===null||d===void 0?void 0:d.debug("an unexpected error occurred while handling fetch",f)})}if(a)return[2,a];throw s}})})})},t.createXhrJsonParser=function(e,r){return function(){var n;try{if(e.responseType==="json"){if(!((n=r.globalScope)===null||n===void 0)&&n.structuredClone)return r.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(i){return i instanceof Error&&i.name==="InvalidStateError"&&ht(function(){var o;return(o=r.logger)===null||o===void 0?void 0:o.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},t.prototype.observeXhr=function(e,r,n){if(!(!this.globalScope||!e||!r)){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var a,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];var u=this,c=D(s,2),f=c[0],d=c[1];try{u.$$AmplitudeAnalyticsEvent=C({method:f,url:(a=d?.toString)===null||a===void 0?void 0:a.call(d),headers:{}},o.getTimestamps())}catch(v){ht(function(){var h;return(h=o.logger)===null||h===void 0?void 0:h.debug("an unexpected error occurred while calling xhr open",v)})}return e.apply(u,s)},i.send=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var l=this,u=l,c=t.createXhrJsonParser(l,o),f=a[0],d=u.$$AmplitudeAnalyticsEvent;return u.$$AmplitudeAnalyticsEvent&&u.addEventListener("loadend",function(){try{var v=u.getAllResponseHeaders(),h=u.getResponseHeader("content-length"),g=new Jc(u.status,v,h?parseInt(h,10):void 0,c),m=u.$$AmplitudeAnalyticsEvent.headers,E=new Xc(f,m);d.status=u.status,o.handleNetworkRequestEvent("xhr",{url:d.url,method:d.method},E,g,void 0,d.startTime,d.durationStart)}catch(p){ht(function(){var y;return(y=o.logger)===null||y===void 0?void 0:y.debug("an unexpected error occurred while handling xhr send",p)})}}),r.apply(u,a)},i.setRequestHeader=function(a,s){var l=this;try{var u=l.$$AmplitudeAnalyticsEvent;u&&(u.headers[a]=s)}catch(c){ht(function(){var f;return(f=o.logger)===null||f===void 0?void 0:f.debug("an unexpected error occurred while calling xhr setRequestHeader",c)})}n.apply(l,[a,s])}}},t})(),po=new td,fs=(function(){function t(){}return t.prototype.parse=function(){return _(this,void 0,void 0,function(){return T(this,function(e){return[2,C(C(C(C({},Zr),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=Kr(),r=e[bl],n=e[El],i=e[Sl],o=e[wl],a=e[Tl],s=e[_l];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:s}},t.prototype.getReferrer=function(){var e,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(e=n.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},t.prototype.getClickIds=function(){var e,r=Kr();return e={},e[Ki]=r[Ki],e[zi]=r[zi],e[$i]=r[$i],e[Xi]=r[Xi],e[Yi]=r[Yi],e[Ji]=r[Ji],e[Qi]=r[Qi],e[Zi]=r[Zi],e[eo]=r[eo],e[to]=r[to],e[ro]=r[ro],e},t})(),Pt="data-amp-mask",ft="*****",rd=/\b(?:\d[ -]*?){13,16}\b/,nd=/(\d{3}-?\d{2}-?\d{4})/g,id=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Ei=function(t,e){var r,n;if(e===void 0&&(e=[]),typeof t!="string")return"";var i=t;i=i.replace(rd,ft),i=i.replace(nd,ft),i=i.replace(id,ft);try{for(var o=q(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,ft)}catch{}}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},Si=function(t){if(typeof document>"u"||!document.title)return"";var e=document.querySelector("title");return e&&e.hasAttribute(Pt)?ft:t?t(document.title):document.title};function vs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gt={},mo;function od(){if(mo)return Gt;mo=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Observable=void 0;const t=E=>!!Symbol[E],e=E=>t(E)?Symbol[E]:"@@"+E,r=e("iterator"),n=e("observable"),i=e("species");function o(E,p){let y=E[p];if(y!=null){if(typeof y!="function")throw new TypeError(y+" is not a function");return y}}function a(E){let p=E.constructor;return p!==void 0&&(p=p[i],p===null&&(p=void 0)),p!==void 0?p:m}function s(E){return E instanceof m}function l(E){l.log?l.log(E):setTimeout(()=>{throw E})}function u(E){Promise.resolve().then(()=>{try{E()}catch(p){l(p)}})}function c(E){let p=E._cleanup;if(p!==void 0&&(E._cleanup=void 0,!!p))try{if(typeof p=="function")p();else{let y=o(p,"unsubscribe");y&&y.call(p)}}catch(y){l(y)}}function f(E){E._observer=void 0,E._queue=void 0,E._state="closed"}function d(E){let p=E._queue;if(p){E._queue=void 0,E._state="ready";for(let y=0;y<p.length&&(v(E,p[y].type,p[y].value),E._state!=="closed");++y);}}function v(E,p,y){E._state="running";let b=E._observer;try{let S=o(b,p);switch(p){case"next":S&&S.call(b,y);break;case"error":if(f(E),S)S.call(b,y);else throw y;break;case"complete":f(E),S&&S.call(b);break}}catch(S){l(S)}E._state==="closed"?c(E):E._state==="running"&&(E._state="ready")}function h(E,p,y){if(E._state!=="closed"){if(E._state==="buffering"){E._queue.push({type:p,value:y});return}if(E._state!=="ready"){E._state="buffering",E._queue=[{type:p,value:y}],u(()=>d(E));return}v(E,p,y)}}class g{constructor(p,y){this._cleanup=void 0,this._observer=p,this._queue=void 0,this._state="initializing";let b=this,S={get closed(){return b._state==="closed"},next(w){h(b,"next",w)},error(w){h(b,"error",w)},complete(){h(b,"complete")}};try{this._cleanup=y.call(void 0,S)}catch(w){S.error(w)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(f(this),c(this))}}class m{constructor(p){if(!(this instanceof m))throw new TypeError("Observable cannot be called as a function");if(typeof p!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=p}subscribe(p){return(typeof p!="object"||p===null)&&(p={next:p,error:arguments[1],complete:arguments[2]}),new g(p,this._subscriber)}forEach(p){return new Promise((y,b)=>{if(typeof p!="function"){b(new TypeError(p+" is not a function"));return}function S(){w.unsubscribe(),y()}let w=this.subscribe({next(A){try{p(A,S)}catch(I){b(I),w.unsubscribe()}},error:b,complete:y})})}map(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let y=a(this);return new y(b=>this.subscribe({next(S){try{S=p(S)}catch(w){return b.error(w)}b.next(S)},error(S){b.error(S)},complete(){b.complete()}}))}filter(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let y=a(this);return new y(b=>this.subscribe({next(S){try{if(!p(S))return}catch(w){return b.error(w)}b.next(S)},error(S){b.error(S)},complete(){b.complete()}}))}reduce(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let y=a(this),b=arguments.length>1,S=!1,A=arguments[1];return new y(I=>this.subscribe({next(k){let x=!S;if(S=!0,!x||b)try{A=p(A,k)}catch(P){return I.error(P)}else A=k},error(k){I.error(k)},complete(){if(!S&&!b)return I.error(new TypeError("Cannot reduce an empty sequence"));I.next(A),I.complete()}}))}async all(){let p=[];return await this.forEach(y=>p.push(y)),p}concat(...p){let y=a(this);return new y(b=>{let S,w=0;function A(I){S=I.subscribe({next(k){b.next(k)},error(k){b.error(k)},complete(){w===p.length?(S=void 0,b.complete()):A(y.from(p[w++]))}})}return A(this),()=>{S&&(S.unsubscribe(),S=void 0)}})}flatMap(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let y=a(this);return new y(b=>{let S=[],w=this.subscribe({next(I){if(p)try{I=p(I)}catch(x){return b.error(x)}let k=y.from(I).subscribe({next(x){b.next(x)},error(x){b.error(x)},complete(){let x=S.indexOf(k);x>=0&&S.splice(x,1),A()}});S.push(k)},error(I){b.error(I)},complete(){A()}});function A(){w.closed&&S.length===0&&b.complete()}return()=>{S.forEach(I=>I.unsubscribe()),w.unsubscribe()}})}[n](){return this}static from(p){let y=typeof this=="function"?this:m;if(p==null)throw new TypeError(p+" is not an object");let b=o(p,n);if(b){let S=b.call(p);if(Object(S)!==S)throw new TypeError(S+" is not an object");return s(S)&&S.constructor===y?S:new y(w=>S.subscribe(w))}if(t("iterator")&&(b=o(p,r),b))return new y(S=>{u(()=>{if(!S.closed){for(let w of b.call(p))if(S.next(w),S.closed)return;S.complete()}})});if(Array.isArray(p))return new y(S=>{u(()=>{if(!S.closed){for(let w=0;w<p.length;++w)if(S.next(p[w]),S.closed)return;S.complete()}})});throw new TypeError(p+" is not observable")}static of(...p){let y=typeof this=="function"?this:m;return new y(b=>{u(()=>{if(!b.closed){for(let S=0;S<p.length;++S)if(b.next(p[S]),b.closed)return;b.complete()}})})}static get[i](){return this}}return Gt.Observable=m,Object.defineProperty(m,Symbol("extensions"),{value:{symbol:n,hostReportError:l},configurable:!0}),Gt}var hn,yo;function ad(){return yo||(yo=1,hn=od().Observable),hn}var sd=ad();const we=vs(sd);function wi(t,e){return new we(function(r){t.subscribe({next:function(n){e(n).then(function(i){return r.next(i)}).catch(function(i){return r.error(i)})},error:function(n){r.error(n)},complete:function(){r.complete()}})})}function Et(t,e){return new we(function(r){var n=!1,i=new Set,o=function(){var s,l;n=!0;try{for(var u=q(i),c=u.next();!c.done;c=u.next()){var f=c.value;try{f.unsubscribe()}catch{}}}catch(d){s={error:d}}finally{try{c&&!c.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}i.clear()},a=function(s){var l=s.subscribe({next:function(u){n||r.next(u)},error:function(u){n||(n=!0,r.error(u),o())},complete:function(){i.delete(l),!n&&i.size===0&&(r.complete(),o(),n=!0)}});i.add(l)};return a(t),a(e),o})}function Ye(t){var e=new Set,r=null;function n(){r?.unsubscribe(),r=null,e.clear()}return new we(function(i){return e.add(i),r===null&&(r=t.subscribe({next:function(o){var a,s,l;try{for(var u=q(e),c=u.next();!c.done;c=u.next()){var f=c.value;(l=f.next)===null||l===void 0||l.call(f,o)}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}},error:function(o){var a,s,l;try{for(var u=q(e),c=u.next();!c.done;c=u.next()){var f=c.value;(l=f.error)===null||l===void 0||l.call(f,o)}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}n()},complete:function(){var o,a,s;try{for(var l=q(e),u=l.next();!u.done;u=l.next()){var c=u.value;(s=c.complete)===null||s===void 0||s.call(c)}}catch(f){o={error:f}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}n()}})),function(){e.delete(i),e.size===0&&r&&(r.unsubscribe(),r=null)}})}var yr={exports:{}},bo;function ud(){if(bo)return yr.exports;bo=1;var t=Object.prototype.hasOwnProperty;function e(i){return"[Throws: "+(i?i.message:"?")+"]"}function r(i,o){if(t.call(i,o))try{return i[o]}catch(a){return e(a)}return i[o]}function n(i){var o=[];function a(s){if(s===null||typeof s!="object")return s;if(o.indexOf(s)!==-1)return"[Circular]";if(o.push(s),typeof s.toJSON=="function")try{var l=a(s.toJSON());return o.pop(),l}catch(f){return e(f)}if(Array.isArray(s)){var u=s.map(a);return o.pop(),u}var c=Object.keys(s).reduce(function(f,d){return f[d]=a(r(s,d)),f},{});return o.pop(),c}return a(i)}return yr.exports=function(i,o,a){return JSON.stringify(n(i),o,a)},yr.exports.ensureProperties=n,yr.exports}var hs=ud();const gs=vs(hs),ld=hl({__proto__:null,default:gs},[hs]);var cd=gs||ld,Hn="https://app.amplitude.com",dd="https://app.eu.amplitude.com",fd="https://apps.stag2.amplitude.com",ps={US:Hn,EU:dd,STAGING:fd},vd="https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",hd=function(t){var e=document.querySelector('script[src="'.concat(CSS.escape(t),'"]'));return e?Promise.resolve({status:!0}):new Promise(function(r,n){var i;try{var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=t,o.addEventListener("load",function(){r({status:!0})},{once:!0}),o.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(t)})}),(i=document.head)===null||i===void 0||i.appendChild(o)}catch(a){n(a)}})};function gd(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var ms,Gn="__AMPLITUDE_MESSENGER_INSTANCE__",$r="__AMPLITUDE_MESSENGER__",pd=(function(){function t(e){var r=e===void 0?{}:e,n=r.origin,i=n===void 0?Hn:n;this[ms]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=i}return t.prototype.notify=function(e){var r,n,i,o;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0||n.call(r,"Message sent: ",JSON.stringify(e)),(o=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||o===void 0||o.call(i,e,this.endpoint)},t.prototype.sendRequest=function(e,r,n){var i=this;n===void 0&&(n={timeout:15e3});var o=gd(),a={id:o,action:e,args:r},s=new Promise(function(l,u){i.requestCallbacks[o]={resolve:l,reject:u},i.notify(a),n.timeout>0&&setTimeout(function(){u(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete i.requestCallbacks[o]},n.timeout)});return s},t.prototype.handleResponse=function(e){var r;if(!this.requestCallbacks[e.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},t.prototype.registerActionHandler=function(e,r){var n,i,o,a;this.actionHandlers.has(e)&&((a=(o=this.logger)===null||o===void 0?void 0:o.warn)===null||a===void 0||a.call(o,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,r);var s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var l=q(s),u=l.next();!u.done;u=l.next()){var c=u.value;r(c)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}},t.prototype.loadScriptOnce=function(e){return _(this,void 0,void 0,function(){var r,n,i;return T(this,function(o){switch(o.label){case 0:if(r=this.scriptLoadPromises.get(e),r)return[2,r];n=hd(e).then(function(){}),this.scriptLoadPromises.set(e,n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},t.prototype.setup=function(e){var r=this,n,i,o=e===void 0?{}:e,a=o.logger,s=o.endpoint;a&&(this.logger=a),s&&this.endpoint===Hn&&(this.endpoint=s),!this.isSetup&&(this.isSetup=!0,(i=(n=this.logger)===null||n===void 0?void 0:n.debug)===null||i===void 0||i.call(n,"Setting up messenger"),this.messageHandler=function(l){var u,c,f,d,v;if((c=(u=r.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.call(u,"Message received: ",JSON.stringify(l)),r.endpoint===l.origin){var h=l.data,g=h?.action;if(g)if("id"in h&&h.id)(d=(f=r.logger)===null||f===void 0?void 0:f.debug)===null||d===void 0||d.call(f,"Received Response to previous request: ",JSON.stringify(l)),r.handleResponse(h);else{if(g==="ping"){r.notify({action:"pong"});return}var m=r.actionHandlers.get(g);if(m)m(h.data);else{var E=(v=r.pendingMessages.get(g))!==null&&v!==void 0?v:[];E.push(h.data),r.pendingMessages.set(g,E)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},t.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=F();e?.[$r]===this&&delete e[$r]},t})();ms=Gn;function md(t){return typeof t=="object"&&t!==null&&Gn in t&&t[Gn]===!0}function ys(t){var e=F(),r=e?.[$r];if(md(r))return r;var n=new pd(t);return e&&(e[$r]=n),n}var Eo="__AMPLITUDE_BACKGROUND_CAPTURE__";function bs(t,e){var r,n=t;if(n[Eo]!==!0){n[Eo]=!0;var i=(r=void 0)!==null&&r!==void 0?r:vd,o=null,a=function(s,l){var u,c;s==="background-capture-complete"&&((c=(u=t.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.call(u,"Background capture complete"),t.notify({action:"background-capture-complete",data:l}))};t.registerActionHandler("initialize-background-capture",function(){var s,l;(l=(s=t.logger)===null||s===void 0?void 0:s.debug)===null||l===void 0||l.call(s,"Initializing background capture (external script)");var u=new URL(i,t.endpoint).toString();t.loadScriptOnce(u).then(function(){var c,f,d;(f=(c=t.logger)===null||c===void 0?void 0:c.debug)===null||f===void 0||f.call(c,"Background capture script loaded (external)"),o=(d=window?.amplitudeBackgroundCapture)===null||d===void 0?void 0:d.call(window,{messenger:t,onBackgroundCapture:a}),t.notify({action:"background-capture-loaded"})}).catch(function(){var c;(c=t.logger)===null||c===void 0||c.warn("Failed to initialize background capture")})}),t.registerActionHandler("close-background-capture",function(){var s;(s=o?.close)===null||s===void 0||s.call(o),o=null})}}var gn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},Ft=function(t,e){return typeof t=="boolean"?t:t?.[e]!==!1},Es=function(t){return Ft(t,"attribution")},yd=function(t){return Ft(t,"fileDownloads")},Ss=function(t){return Ft(t,"formInteractions")},ws=function(t){return Ft(t,"pageViews")},So=function(t){return Ft(t,"sessions")},bd=function(t){return Ft(t,"pageUrlEnrichment")},Ts=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.networkTracking===!0||typeof t.networkTracking=="object")},_s=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.elementInteractions===!0||typeof t.elementInteractions=="object")},Ed=function(t){return typeof t=="boolean"?t:typeof t=="object"&&t.webVitals===!0},Is=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.frustrationInteractions===!0||typeof t.frustrationInteractions=="object")},Sd=function(t){return typeof t=="boolean"?t:typeof t=="object"&&t!==null&&t.enabled!==!1},wd=function(t){if(_s(t.autocapture)&&typeof t.autocapture=="object"&&typeof t.autocapture.elementInteractions=="object")return t.autocapture.elementInteractions},Td=function(t){if(Is(t.autocapture)&&typeof t.autocapture=="object"&&typeof t.autocapture.frustrationInteractions=="object")return t.autocapture.frustrationInteractions},_d=function(t){var e;if(Ts(t.autocapture)){var r=void 0;return typeof t.autocapture=="object"&&typeof t.autocapture.networkTracking=="object"?r=t.autocapture.networkTracking:t.networkTrackingOptions&&(r=t.networkTrackingOptions),C(C({},r),{captureRules:(e=r?.captureRules)===null||e===void 0?void 0:e.map(function(n){var i,o,a;if(!((i=n.urls)===null||i===void 0)&&i.length&&(!((o=n.hosts)===null||o===void 0)&&o.length)){var s=JSON.stringify(n.hosts),l=JSON.stringify(n.urls);return(a=t.loggerProvider)===null||a===void 0||a.warn("Found network capture rule with both urls='".concat(l,"' and hosts='").concat(s,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),C(C({},n),{hosts:void 0})}return n})})}},wo=function(t){var e=function(){return!1},r=void 0,n,i=t.pageCounter,o=ws(t.defaultTracking);return o&&(e=void 0,n=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(r=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(n=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:r,eventType:n,pageCounter:i}},To=function(t){return Es(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?C({},t.defaultTracking.attribution):{}},Id=function(t){if(Ss(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&typeof t.defaultTracking.formInteractions=="object")return t.defaultTracking.formInteractions},pn=function(t,e){for(var r=0;r<e.length;r++){var n=e[r],i=n.name,o=n.args,a=n.resolve,s=t&&t[i];if(typeof s=="function"){var l=s.apply(t,o);typeof a=="function"&&a(l?.promise)}}return t},mn=function(t){var e=t;return e&&e._q!==void 0},Ti="2.38.1",As="amplitude-ts",Ad="Web",Cd="$remote",kd=(function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(As,"/").concat(Ti),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var r,n;return _(this,void 0,void 0,function(){var i,o,a,s;return T(this,function(l){return i=new Date().getTime(),o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1,a=(n=e.event_id)!==null&&n!==void 0?n:o+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=i),s=C(C(C(C(C(C(C(C({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Ad}),this.config.trackingOptions.language&&{language:uc()}),this.config.trackingOptions.ipAddress&&{ip:Cd}),{insert_id:Je(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent}),[2,s]})})},t})(),br=1e3,Cs=(function(t){Fe(e,t);function e(r){var n=this,i,o,a;try{a=(i=F())===null||i===void 0?void 0:i.localStorage}catch(s){(o=r?.loggerProvider)===null||o===void 0||o.debug("Failed to access localStorage. error=".concat(JSON.stringify(s))),a=void 0}return n=t.call(this,a)||this,n.loggerProvider=r?.loggerProvider,n}return e.prototype.set=function(r,n){var i;return _(this,void 0,void 0,function(){var o;return T(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>br?(o=n.length-br,[4,t.prototype.set.call(this,r,n.slice(0,br))]):[3,2];case 1:return a.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(br,".")),[3,4];case 2:return[4,t.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},e})(en),Pd=(function(t){Fe(e,t);function e(){var r;return t.call(this,(r=F())===null||r===void 0?void 0:r.sessionStorage)||this}return e})(en),Od=(function(t){Fe(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.state={done:4},n.customHeaders=r,n}return e.prototype.send=function(r,n,i){return i===void 0&&(i=!1),_(this,void 0,void 0,function(){var o=this;return T(this,function(a){return[2,new Promise(function(s,l){typeof XMLHttpRequest>"u"&&l(new Error("XHRTransport is not supported."));var u=new XMLHttpRequest;u.open("POST",r,!0),u.onreadystatechange=function(){if(u.readyState===o.state.done){var g=u.responseText;try{s(o.buildResponse(JSON.parse(g)))}catch{s(o.buildResponse({code:u.status}))}}};var c={"Content-Type":"application/json",Accept:"*/*"},f=JSON.stringify(n),d=i&&f.length>=ts&&rs(),v=function(g){var m,E;c=C(C({},o.customHeaders),c);try{for(var p=q(Object.entries(c)),y=p.next();!y.done;y=p.next()){var b=D(y.value,2),S=b[0],w=b[1];u.setRequestHeader(S,w)}}catch(A){m={error:A}}finally{try{y&&!y.done&&(E=p.return)&&E.call(p)}finally{if(m)throw m.error}}u.send(g)},h=function(){return _(o,void 0,void 0,function(){var g;return T(this,function(m){switch(m.label){case 0:return d?[4,ns(f)]:[3,2];case 1:return g=m.sent(),g?(c["Content-Encoding"]="gzip",v(g)):v(f),[3,3];case 2:v(f),m.label=3;case 3:return[2]}})})};h().catch(l)})]})})},e})(dr),Rd=(function(t){Fe(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.customHeaders=r,n}return e.prototype.send=function(r,n,i){return i===void 0&&(i=!1),_(this,void 0,void 0,function(){var o,a,s,l,u,c,f,d;return T(this,function(v){switch(v.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return o=JSON.stringify(n),a=i&&o.length>=ts&&rs(),s=o,l={"Content-Type":"application/json",Accept:"*/*"},a?[4,ns(o)]:[3,2];case 1:u=v.sent(),u&&(l["Content-Encoding"]="gzip",s=u),v.label=2;case 2:return l=C(C({},this.customHeaders),l),c={headers:l,body:s,method:"POST"},[4,fetch(r,c)];case 3:return f=v.sent(),[4,f.text()];case 4:d=v.sent();try{return[2,this.buildResponse(JSON.parse(d))]}catch{return[2,this.buildResponse({code:f.status})]}return[2]}})})},e})(dr),xd=(function(t){Fe(e,t);function e(){return t.call(this)||this}return e.prototype.send=function(r,n,i){return _(this,void 0,void 0,function(){var o=this;return T(this,function(a){return[2,new Promise(function(s,l){var u=F();if(!u?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var c=JSON.stringify(n),f=u.navigator.sendBeacon(r,c);return s(f?o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}):o.buildResponse({code:500}))}catch(d){l(d)}})]})})},e})(dr),Nd=function(t,e,r){return r===void 0&&(r=!0),_(void 0,void 0,void 0,function(){var n,i,o,a,s,l,u,c,f;return T(this,function(d){switch(d.label){case 0:return n=sc(t),[4,e.getRaw(n)];case 1:return i=d.sent(),i?r?[4,e.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:d.sent(),d.label=3;case 3:return o=D(i.split("."),6),a=o[0],s=o[1],l=o[2],u=o[3],c=o[4],f=o[5],[2,{deviceId:a,userId:Ld(s),sessionId:yn(u),lastEventId:yn(f),lastEventTime:yn(c),optOut:!!l}]}})})},yn=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},Ld=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}},Ge="[Amplitude]",_o="".concat(Ge," Form Started"),Dd="".concat(Ge," Form Submitted"),Md="".concat(Ge," File Downloaded"),Io="session_start",Ao="session_end",Ud="".concat(Ge," File Extension"),Fd="".concat(Ge," File Name"),qd="".concat(Ge," Link ID"),Bd="".concat(Ge," Link Text"),Vd="".concat(Ge," Link URL"),bn="".concat(Ge," Form ID"),En="".concat(Ge," Form Name"),Sn="".concat(Ge," Form Destination"),Xr="cookie",ks="US",Co=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},jd=function(t){return Object.values(t).every(function(e){return!e})},Hd=function(t){var e=C(C({},t),{referring_domain:void 0,referrer:void 0});return Object.values(e).every(function(r){return!r})},Gd=function(t,e,r,n,i,o){i===void 0&&(i=!0),t.referrer;var a=t.referring_domain,s=Gr(t,["referrer","referring_domain"]),l=e||{};l.referrer;var u=l.referring_domain,c=Gr(l,["referrer","referring_domain"]),f=r.excludeInternalReferrers;if(f){var d=Xd(f,n);if(!(d instanceof TypeError)&&t.referring_domain&&Yd(t.referring_domain,o)){if(d==="always")return ko(d,t.referring_domain,n),!1;if(d==="ifEmptyCampaign"&&Hd(t))return ko(d,t.referring_domain,n),!1}}if(Wd(r.excludeReferrers,t.referring_domain))return n.debug("This is not a new campaign because ".concat(t.referring_domain," is in the exclude referrer list.")),!1;if(!i&&jd(t)&&e)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var v=JSON.stringify(s)!==JSON.stringify(c),h=Co(a||"")!==Co(u||""),g=!e||v||h;return g?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),g},Wd=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(r){return r instanceof RegExp?r.test(e):r===e})},Kd=function(t,e){var r=e.startsWith(".")?e:".".concat(e),n=t.startsWith(".")?t:".".concat(t);return!!n.endsWith(r)},zd=function(t,e){var r=C(C({},Zr),t),n=Object.entries(r).reduce(function(i,o){var a,s=D(o,2),l=s[0],u=s[1];return i.setOnce("initial_".concat(l),(a=u??e.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY"),u?i.set(l,u):i.unset(l)},new tr);return pi(n)},$d=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\."),"$"))]):[]},Xd=function(t,e){if(t===!0)return gn.always;if(typeof t=="object"){var r=t.condition;if(typeof r=="string"&&Object.keys(gn).includes(r))return r;if(typeof r>"u")return gn.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(t));return e.error(n),new TypeError(n)};function ko(t,e,r){var n="This is not a new campaign because referring_domain=".concat(e," is on the same domain as the current page and it is configured to exclude internal referrers");t==="always"?r.debug(n):t==="ifEmptyCampaign"&&r.debug("".concat(n," with empty campaign parameters"))}var Ps=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],Os=function(t){var e,r,n=t||((r=(e=F())===null||e===void 0?void 0:e.location)===null||r===void 0?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],a=i[i.length-2];return Ps.find(function(s){return n.endsWith(".".concat(s))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Yd=function(t,e){var r=F();if(!r)return!1;var n=(e||"").trim()||Os(r.location.hostname);return Kd(t,n)},Jd=(function(t){Fe(e,t);function e(r,n,i,o,a,s,l,u,c,f,d,v,h,g,m,E,p,y,b,S,w,A,I,k,x,P,R,O,L,B,H,j,ee,M,G,W,te,J,Z,K,ie,oe,fe,ve,me){i===void 0&&(i=new yi),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),u===void 0&&(u=1e3),c===void 0&&(c=5),f===void 0&&(f=30),d===void 0&&(d=Xr),E===void 0&&(E=new Dt),p===void 0&&(p=ke.Warn),b===void 0&&(b=!1),S===void 0&&(S=!1),I===void 0&&(I=""),k===void 0&&(k=ks),R===void 0&&(R=1800*1e3),O===void 0&&(O=new Cs({loggerProvider:E})),L===void 0&&(L={ipAddress:!0,language:!0,platform:!0}),B===void 0&&(B="fetch"),H===void 0&&(H=!1),j===void 0&&(j=!0),J===void 0&&(J=!0),Z===void 0&&(Z=0),fe===void 0&&(fe=!1),ve===void 0&&(ve=!1);var N=this,he;N=t.call(this,{apiKey:r,storageProvider:O,transportProvider:Rs(B)})||this,N.apiKey=r,N.appVersion=n,N.cookieOptions=o,N.defaultTracking=a,N.autocapture=s,N.flushIntervalMillis=u,N.flushMaxRetries=c,N.flushQueueSize=f,N.identityStorage=d,N.ingestionMetadata=v,N.instanceName=h,N.loggerProvider=E,N.logLevel=p,N.minIdLength=y,N.offline=b,N.partnerId=w,N.plan=A,N.serverUrl=I,N.serverZone=k,N.sessionTimeout=R,N.storageProvider=O,N.trackingOptions=L,N.transport=B,N.useBatch=H,N.fetchRemoteConfig=j,N.networkTrackingOptions=W,N.identify=te,N.enableDiagnostics=J,N.diagnosticsSampleRate=Z,N.diagnosticsClient=K,N.remoteConfig=ie,N.topLevelDomain=oe,N.enableRequestBodyCompression=fe,N._enableRequestBodyCompressionExperimental=ve,N.customEnrichment=me,N.version=Ti,N._optOut=!1,N._cookieStorage=i,N.deviceId=l,N.lastEventId=g,N.lastEventTime=m,N.optOut=S,N.deferredSessionId=P,N.sessionId=x,N.pageCounter=M,N.userId=ee,N.debugLogsEnabled=G,N.loggerProvider.enable(G?ke.Debug:N.logLevel),N.networkTrackingOptions=W,N.identify=te,N.enableDiagnostics=J,N.diagnosticsSampleRate=Z,N.diagnosticsClient=K;var qe=(he=ie?.fetchRemoteConfig)!==null&&he!==void 0?he:j;return N.remoteConfig=N.remoteConfig||{},N.remoteConfig.fetchRemoteConfig=qe,N.fetchRemoteConfig=qe,N.topLevelDomain=oe||Os(),N}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,r!==void 0&&this._deferredSessionId!==void 0&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(r){this._deferredSessionId!==r&&r!==this.sessionId&&(this._deferredSessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof zr&&(r.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Qa(this.apiKey),r)},e})(Xa),Qd=function(t,e,r,n,i){return e===void 0&&(e={}),_(void 0,void 0,void 0,function(){var o,a,s,l,u,c,f,d,v,h,g,m,E,p,y,b,S,w,A,I,k,x,P,R,O,L,B,H,j,ee,M,G,W,te,J,Z,K,ie,oe,fe,ve,me,N,he,qe,Ae,Re,Be,Ve,We,Ke;return T(this,function(ge){switch(ge.label){case 0:return o=e.identityStorage||Xr,a="",o===Xr&&!(!((x=e.cookieOptions)===null||x===void 0)&&x.domain)&&((P=e.cookieOptions)===null||P===void 0?void 0:P.domain)!==""?[4,tf(void 0,n)]:[3,2];case 1:a=ge.sent(),ge.label=2;case 2:return s=C({domain:(O=(R=e.cookieOptions)===null||R===void 0?void 0:R.domain)!==null&&O!==void 0?O:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},e.cookieOptions),l={duplicateResolverFn:function(Ne){var nt=Za(Ne);if(!nt)return!1;var V=JSON.parse(nt);return es(V.cookieDomain,s.domain)},diagnosticsClient:n},u=Zd(e.identityStorage,s,l),[4,Nd(t,u,(B=(L=e.cookieOptions)===null||L===void 0?void 0:L.upgrade)!==null&&B!==void 0?B:!0)];case 3:return c=ge.sent(),[4,u.get(Qa(t))];case 4:return f=ge.sent(),d=Kr(),v=d.ampTimestamp?Number(d.ampTimestamp):void 0,h=v?Date.now()<v:!0,g=(G=(M=(ee=(H=e.deviceId)!==null&&H!==void 0?H:h?(j=d.ampDeviceId)!==null&&j!==void 0?j:d.deviceId:void 0)!==null&&ee!==void 0?ee:f?.deviceId)!==null&&M!==void 0?M:c.deviceId)!==null&&G!==void 0?G:Je(),m=(W=f?.lastEventId)!==null&&W!==void 0?W:c.lastEventId,E=(te=f?.lastEventTime)!==null&&te!==void 0?te:c.lastEventTime,p=(Z=(J=e.optOut)!==null&&J!==void 0?J:f?.optOut)!==null&&Z!==void 0?Z:c.optOut,y=(K=f?.sessionId)!==null&&K!==void 0?K:c.sessionId,b=f?.deferredSessionId,S=(oe=(ie=e.userId)!==null&&ie!==void 0?ie:f?.userId)!==null&&oe!==void 0?oe:c.userId,r.previousSessionDeviceId=(fe=f?.deviceId)!==null&&fe!==void 0?fe:c.deviceId,r.previousSessionUserId=(ve=f?.userId)!==null&&ve!==void 0?ve:c.userId,w={ipAddress:(N=(me=e.trackingOptions)===null||me===void 0?void 0:me.ipAddress)!==null&&N!==void 0?N:!0,language:(qe=(he=e.trackingOptions)===null||he===void 0?void 0:he.language)!==null&&qe!==void 0?qe:!0,platform:(Re=(Ae=e.trackingOptions)===null||Ae===void 0?void 0:Ae.platform)!==null&&Re!==void 0?Re:!0},A=f?.pageCounter,I=f?.debugLogsEnabled,e.autocapture!==void 0&&(e.defaultTracking=e.autocapture),k=new Jd(t,e.appVersion,u,s,e.defaultTracking,e.autocapture,g,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,o,e.ingestionMetadata,e.instanceName,m,E,(Be=i?.loggerProvider)!==null&&Be!==void 0?Be:e.loggerProvider,e.logLevel,e.minIdLength,e.offline,p,e.partnerId,e.plan,e.serverUrl,(Ve=i?.serverZone)!==null&&Ve!==void 0?Ve:e.serverZone,y,b,e.sessionTimeout,e.storageProvider,w,e.transport,e.useBatch,e.fetchRemoteConfig,S,A,I,e.networkTrackingOptions,e.identify,(We=i?.enableDiagnostics)!==null&&We!==void 0?We:e.enableDiagnostics,(Ke=i?.diagnosticsSampleRate)!==null&&Ke!==void 0?Ke:r._diagnosticsSampleRate,n,e.remoteConfig,a,e.enableRequestBodyCompression,r._enableRequestBodyCompressionExperimentalValue,e.customEnrichment),[4,k.storageProvider.isEnabled()];case 5:return ge.sent()||(k.loggerProvider.warn("Storage provider ".concat(k.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),k.storageProvider=new yi),[2,k]}})})},Zd=function(t,e,r){switch(t===void 0&&(t=Xr),e===void 0&&(e={}),t){case"localStorage":return new Cs;case"sessionStorage":return new Pd;case"none":return new yi;default:return new zr(C(C({},e),{expirationDays:e.expiration}),r)}},ef=function(t){var e,r;return t===void 0&&(t={}),((e=t.remoteConfig)===null||e===void 0?void 0:e.fetchRemoteConfig)===!0?!0:!(((r=t.remoteConfig)===null||r===void 0?void 0:r.fetchRemoteConfig)===!1||t.fetchRemoteConfig===!1)},Rs=function(t){var e=typeof t=="object"?t.type:t,r=typeof t=="object"?t.headers:void 0;return e==="xhr"?new Od(r):e==="beacon"?new xd:new Rd(r)},tf=function(t,e){return _(void 0,void 0,void 0,function(){var r,n,i,o,a,a,s,l,u;return T(this,function(c){switch(c.label){case 0:return[4,new zr(void 0,{diagnosticsClient:e}).isEnabled()];case 1:if(!c.sent()||typeof location>"u"||!location.hostname)return[2,""];if(r=location.hostname,n=r.split("."),n.length===1)return[2,""];for(i=[],o=1,Ps.find(function(f){return r.endsWith(".".concat(f))})&&(o=2),a=n.length-o-1;a>=0;--a)i.push(n.slice(a).join("."));a=0,c.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],c.label=3;case 3:return c.trys.push([3,5,,6]),[4,zr.isDomainWritable(s)];case 4:return l=c.sent(),l?[2,"."+s]:[3,6];case 5:return u=c.sent(),e&&e.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:u instanceof Error?u.message:String(u)}),[3,6];case 6:return a++,[3,2];case 7:return e&&e.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(r)}),[2,""]}})})},rf=function(t){var e={};for(var r in t){var n=t[r];n&&(e[r]=n)}return e},nf="[Amplitude] Page Viewed",wn="AMP_PAGE_VIEW",Po=function(t){t===void 0&&(t={});var e,r=F(),n=void 0,i=!1,o,a,s=t.trackOn,l=t.trackHistoryChanges,u=t.eventType,c=u===void 0?nf:u,f=function(p){var y=p;try{y=decodeURI(p)}catch(b){n?.error("Malformed URI sequence: ",b)}return y},d=function(p){return _(void 0,void 0,void 0,function(){var y,b,S;return T(this,function(w){switch(w.label){case 0:return y=f(typeof location<"u"&&location.href||""),S={event_type:c},b=[{}],[4,of()];case 1:return[2,(S.event_properties=C.apply(void 0,[C.apply(void 0,b.concat([w.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":y,"[Amplitude] Page Path":typeof location<"u"&&f(location.pathname)||"","[Amplitude] Page Title":Si(Ei),"[Amplitude] Page URL":y.split("?")[0],"[Amplitude] Page View ID":p}]),S)]}})})},v=function(){return typeof s>"u"||typeof s=="function"&&s()},h=typeof location<"u"?location.href:null,g=function(){return _(void 0,void 0,void 0,function(){var p,y,b,S,w;return T(this,function(A){switch(A.label){case 0:return p=location.href,y=sf(l,p,h||"")&&v(),h=p,y?(b=void 0,a&&(b=Je(),a.set(wn,{pageViewId:b})),n?.log("Tracking page view event"),e!=null?[3,1]:[3,3]):[3,4];case 1:return w=(S=e).track,[4,d(b)];case 2:w.apply(S,[A.sent()]),A.label=3;case 3:A.label=4;case 4:return[2]}})})},m=function(){g()},E={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(p,y){return _(void 0,void 0,void 0,function(){var b,S,w;return T(this,function(A){switch(A.label){case 0:if(e=y,o=p,n=p.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),i=!0,r){try{a=new en(r.sessionStorage)}catch{n?.debug("sessionStorage is not available in this environment.")}r.addEventListener("popstate",m),r.history.pushState=new Proxy(r.history.pushState,{apply:function(I,k,x){var P=D(x,3),R=P[0],O=P[1],L=P[2];I.apply(k,[R,O,L]),i&&m()}})}return v()?(n.log("Tracking page view event"),b=void 0,a&&(b=Je(),a.set(wn,{pageViewId:b})),w=(S=e).track,[4,d(b)]):[3,2];case 1:w.apply(S,[A.sent()]),A.label=2;case 2:return[2]}})})},execute:function(p){return _(void 0,void 0,void 0,function(){var y,b,S;return T(this,function(w){switch(w.label){case 0:return s==="attribution"&&af(p)?(n?.log("Enriching campaign event to page view event with campaign parameters"),y=void 0,a?[4,a.get(wn)]:[3,2]):[3,4];case 1:b=w.sent(),y=b?.pageViewId,w.label=2;case 2:return[4,d(y)];case 3:S=w.sent(),p.event_type=S.event_type,p.event_properties=C(C({},p.event_properties),S.event_properties),w.label=4;case 4:return o&&p.event_type===c&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,p.event_properties=C(C({},p.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,p]}})})},teardown:function(){return _(void 0,void 0,void 0,function(){return T(this,function(p){return r&&(r.removeEventListener("popstate",m),i=!1),[2]})})}};return E},of=function(){return _(void 0,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return t=rf,[4,new fs().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},af=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,r=e[ct.SET]||{},n=e[ct.UNSET]||{},i=$($([],D(Object.keys(r)),!1),D(Object.keys(n)),!1);return Object.keys(Zr).every(function(o){return i.includes(o)})}return!1},sf=function(t,e,r){switch(t){case"pathOnly":{if(r=="")return!0;var n=new URL(e),i=new URL(r),o=n.origin+n.pathname,a=i.origin+i.pathname;return o!==a}default:return e!==r}},uf=function(){var t,e=[],r=function(c,f,d){c.addEventListener(f,d),e.push({element:c,type:f,handler:d})},n=function(){e.forEach(function(c){var f=c.element,d=c.type,v=c.handler;f?.removeEventListener(d,v)}),e=[]},i,o="@amplitude/plugin-form-interaction-tracking-browser",a="enrichment",s=function(c,f){return _(void 0,void 0,void 0,function(){var d,v;return T(this,function(h){return i=Id(c),d=function(){if(!f){c.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var g=new WeakSet,m=function(p){if(!g.has(p)){g.add(p);var y=!1;r(p,"change",function(){var b,S=Oo(p);y||f.track(_o,(b={},b[bn]=It(p.id),b[En]=It(p.name),b[Sn]=S,b)),y=!0}),r(p,"submit",function(b){var S,w,A=Oo(p);if(y||f.track(_o,(S={},S[bn]=It(p.id),S[En]=It(p.name),S[Sn]=A,S)),y=!0,i?.shouldTrackSubmit!==void 0)if(typeof i.shouldTrackSubmit=="function"&&typeof SubmitEvent<"u"&&b instanceof SubmitEvent)try{var I=i.shouldTrackSubmit(b);if(!I)return}catch{c.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else c.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");f.track(Dd,(w={},w[bn]=It(p.id),w[En]=It(p.name),w[Sn]=A,w)),y=!1})}},E=Array.from(document.getElementsByTagName("form"));E.forEach(m),typeof MutationObserver<"u"&&(t=new MutationObserver(function(p){p.forEach(function(y){y.addedNodes.forEach(function(b){b.nodeName==="FORM"&&m(b),"querySelectorAll"in b&&typeof b.querySelectorAll=="function"&&Array.from(b.querySelectorAll("form")).map(m)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?d():(v=F(),v?v.addEventListener("load",d):c.loggerProvider.debug("Form interaction tracking is not installed because global is undefined.")),[2]})})},l=function(c){return _(void 0,void 0,void 0,function(){return T(this,function(f){return[2,c]})})},u=function(){return _(void 0,void 0,void 0,function(){return T(this,function(c){return t?.disconnect(),n(),[2]})})};return{name:o,type:a,setup:s,execute:l,teardown:u}},It=function(t){if(typeof t=="string")return t},Oo=function(t){var e=t.getAttribute("action");try{e=new URL(encodeURI(e??""),window.location.href).href}catch{}return e},lf=function(){var t,e=[],r=function(u,c,f){u.addEventListener(c,f),e.push({element:u,type:c,handler:f})},n=function(){e.forEach(function(u){var c=u.element,f=u.type,d=u.handler;c?.removeEventListener(f,d)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",a=function(u,c){return _(void 0,void 0,void 0,function(){var f,d;return T(this,function(v){return f=function(){if(!c){u.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var h=function(E){var p;try{p=new URL(E.href,window.location.href)}catch{return}var y=g.exec(p.href),b=y?.[1];b&&r(E,"click",function(){var S;b&&c.track(Md,(S={},S[Ud]=b,S[Fd]=p.pathname,S[qd]=E.id,S[Bd]=E.text,S[Vd]=E.href,S))})},g=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/,m=Array.from(document.getElementsByTagName("a"));m.forEach(h),typeof MutationObserver<"u"&&(t=new MutationObserver(function(E){E.forEach(function(p){p.addedNodes.forEach(function(y){y.nodeName==="A"&&h(y),"querySelectorAll"in y&&typeof y.querySelectorAll=="function"&&Array.from(y.querySelectorAll("a")).map(h)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?f():(d=F(),d?d.addEventListener("load",f):u.loggerProvider.debug("File download tracking is not installed because global is undefined.")),[2]})})},s=function(u){return _(void 0,void 0,void 0,function(){return T(this,function(c){return[2,u]})})},l=function(){return _(void 0,void 0,void 0,function(){return T(this,function(u){return t?.disconnect(),n(),[2]})})};return{name:i,type:o,setup:a,execute:s,teardown:l}},Ro=!1,cf=function(t){if(!(Ro||t.defaultTracking!==void 0)){var e=`\`options.defaultTracking\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \`options.defaultTracking\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:

amplitude.init(<YOUR_API_KEY>, {
  defaultTracking: true,
});

Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;t.loggerProvider.warn(e),Ro=!0}},df=function(){var t="@amplitude/plugin-network-checker-browser",e="before",r=F(),n=[],i=function(l,u){r?.addEventListener&&(r?.addEventListener(l,u),n.push({type:l,handler:u}))},o=function(){n.forEach(function(l){var u=l.type,c=l.handler;r?.removeEventListener(u,c)}),n=[]},a=function(l,u){return _(void 0,void 0,void 0,function(){return T(this,function(c){return typeof navigator>"u"?(l.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),l.offline=!1,[2]):(l.offline=!navigator.onLine,i("online",function(){l.loggerProvider.debug("Network connectivity changed to online."),l.offline=!1,setTimeout(function(){u.flush()},l.flushIntervalMillis)}),i("offline",function(){l.loggerProvider.debug("Network connectivity changed to offline."),l.offline=!0}),[2])})})},s=function(){return _(void 0,void 0,void 0,function(){return T(this,function(l){return o(),[2]})})};return{name:t,type:e,setup:a,teardown:s}};function xs(t){var e,r,n,i,o,a,s,l,u,c,f,d;if(!(typeof t!="object"||t===null)&&!Array.isArray(t)){var v=Object.keys(t);try{for(var h=q(v),g=h.next();!g.done;g=h.next()){var m=g.value;try{var E=t[m];typeof E?.enabled=="boolean"&&(E.enabled?(delete E.enabled,Object.keys(E).length===0&&(t[m]=!0)):t[m]=!1),xs(E)}catch{}}}catch(L){e={error:L}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}try{if(!((u=(l=(s=t.autocapture)===null||s===void 0?void 0:s.networkTracking)===null||l===void 0?void 0:l.captureRules)===null||u===void 0)&&u.length)try{for(var p=q(t.autocapture.networkTracking.captureRules),y=p.next();!y.done;y=p.next()){var b=y.value;try{for(var S=(o=void 0,q(["responseHeaders","requestHeaders"])),w=S.next();!w.done;w=S.next()){var A=w.value,I=(c=b[A])!==null&&c!==void 0?c:{},k=I.captureSafeHeaders,x=I.allowlist;if(!(!k&&!x)){if(x!==void 0&&!Array.isArray(x)){delete b[A];continue}b[A]=$($([],D(k?Wr:[]),!1),D(x??[]),!1)}}}catch(L){o={error:L}}finally{try{w&&!w.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}}}catch(L){n={error:L}}finally{try{y&&!y.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}catch{}var P=(f=t.autocapture)===null||f===void 0?void 0:f.frustrationInteractions;P&&(P.rageClick&&(P.rageClicks=P.rageClick,delete P.rageClick),P.deadClick&&(P.deadClicks=P.deadClick,delete P.deadClick));try{var R=(d=t.autocapture)===null||d===void 0?void 0:d.elementInteractions;if(R&&typeof R=="object"&&(R.viewportContentUpdated===!0&&(R.viewportContentUpdated={}),R.viewportContentUpdated===!1&&(R.viewportContentUpdated={enabled:!1}),R.exposureDuration!==void 0)){var O=R.viewportContentUpdated;O===void 0?R.viewportContentUpdated={exposureDuration:R.exposureDuration}:typeof O=="object"&&O.exposureDuration===void 0&&O.enabled!==!1&&(O.exposureDuration=R.exposureDuration),delete R.exposureDuration}}catch{}}}function xo(t,e,r){var n,i,o=[];try{for(var a=q(e??[]),s=a.next();!s.done;s=a.next()){var l=s.value;try{o.push(new RegExp(l))}catch(u){r.loggerProvider.warn("Invalid regex pattern: ".concat(l),u)}}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return t.concat(o)}function ff(t,e){var r,n,i,o,a,s,l;if(t){xs(t);try{e.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(t));var u=t;if(u&&"autocapture"in u){if(typeof u.autocapture=="boolean"&&(e.autocapture=u.autocapture),typeof u.autocapture=="object"&&u.autocapture!==null){var c=C({},u.autocapture);if(e.autocapture===void 0&&(e.autocapture=u.autocapture),typeof u.autocapture.elementInteractions=="object"&&u.autocapture.elementInteractions!==null&&(!((i=u.autocapture.elementInteractions.pageUrlAllowlistRegex)===null||i===void 0)&&i.length)){c.elementInteractions=C({},u.autocapture.elementInteractions);var f=c.elementInteractions,d=(o=f.pageUrlAllowlist)!==null&&o!==void 0?o:[],v=u.autocapture.elementInteractions.pageUrlAllowlistRegex;f.pageUrlAllowlist=xo(d,v,e),delete f.pageUrlAllowlistRegex}if(typeof u.autocapture.networkTracking=="object"&&u.autocapture.networkTracking!==null&&(!((a=u.autocapture.networkTracking.captureRules)===null||a===void 0)&&a.length)){c.networkTracking=C({},u.autocapture.networkTracking);var h=c.networkTracking,g=(s=h.captureRules)!==null&&s!==void 0?s:[];try{for(var m=q(g),E=m.next();!E.done;E=m.next()){var p=E.value;p.urls=xo((l=p.urls)!==null&&l!==void 0?l:[],p.urlsRegex,e),delete p.urlsRegex}}catch(y){r={error:y}}finally{try{E&&!E.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}}typeof e.autocapture=="boolean"&&(e.autocapture=C({attribution:e.autocapture,fileDownloads:e.autocapture,formInteractions:e.autocapture,pageViews:e.autocapture,sessions:e.autocapture,elementInteractions:e.autocapture,webVitals:e.autocapture,frustrationInteractions:e.autocapture},c)),typeof e.autocapture=="object"&&(e.autocapture=C(C({},e.autocapture),c))}e.defaultTracking=e.autocapture}"customEnrichment"in u&&u.customEnrichment!==null&&(e.customEnrichment=u.customEnrichment),e.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(e))}catch(y){e.loggerProvider.error("Failed to apply remote configuration because of error: ",y)}}}var Ns="1.25.1",vf="@amplitude/plugin-autocapture-browser",hf="@amplitude/plugin-frustration-browser",Ls="[Amplitude] Element Clicked",gf="[Amplitude] Dead Click",pf="[Amplitude] Rage Click",mf="[Amplitude] Error Click",yf="[Amplitude] Element Changed",bf="[Amplitude] Thrashed Cursor",Ef="[Amplitude] Element ID",Sf="[Amplitude] Element Class",No="[Amplitude] Element Tag",Lo="[Amplitude] Element Text",wf="[Amplitude] Element Hierarchy",Tf="[Amplitude] Element Href",_f="[Amplitude] Element Position Left",If="[Amplitude] Element Position Top",Af="[Amplitude] Element Aria Label",Cf="[Amplitude] Element Attributes",kf="[Amplitude] Element Path",Pf="[Amplitude] Element Parent Label",Wn="[Amplitude] Page URL",Of="[Amplitude] Page Title",Ds="[Amplitude] Viewport Height",Ms="[Amplitude] Viewport Width",Rf="[Amplitude] Max Page X",xf="[Amplitude] Max Page Y",Us="[Amplitude] Page View ID",Nf="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",Lf="amp-visual-tagging-selector-highlight",Fs="data-amp-mask-attributes",Df=25,qs=128,Mf="AMP_PAGE_VIEW",Uf=18e3,Ff=["input","select","textarea"],Bs=function(t,e){var r,n=(r=window?.getComputedStyle)===null||r===void 0?void 0:r.call(window,t);return n?.getPropertyValue("cursor")==="pointer"&&e==="click"},Vs=function(t){var e=t.pageUrlAllowlist,r=t.pageUrlExcludelist;return!(r&&r.length>0&&Bn(window.location.href,r)||!Bn(window.location.href,e))},Nt=function(t,e,r){return r===void 0&&(r=!1),function(n,i){var o,a,s=t.shouldTrackEventResolver,l=(a=(o=i?.tagName)===null||o===void 0?void 0:o.toLowerCase)===null||a===void 0?void 0:a.call(o);if(!l)return!1;if(s)return s(n,i);if(!Vs(t))return!1;var u=String(i?.getAttribute("type"))||"";if(typeof u=="string")switch(u.toLowerCase()){case"hidden":return!1;case"password":return!1}var c=Bs(i,n);if(r&&c)return!0;if(e){var f=e.some(function(d){var v;return!!(!((v=i?.matches)===null||v===void 0)&&v.call(i,d))});if(!f)return!1}switch(l){case"input":case"select":case"textarea":return n==="change"||n==="click";default:return c?!0:n==="click"}}},qf=function(t){var e,r,n,i=(r=(e=t?.tagName)===null||e===void 0?void 0:e.toLowerCase)===null||r===void 0?void 0:r.call(e),o=t instanceof HTMLElement?((n=t.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":!1;return!Ff.includes(i)&&!o},Bf=function(t){return t?t.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!=="id"&&e!=="class"}):[]},Vf=function(t,e){return Object.entries(t).reduce(function(r,n){var i=D(n,2),o=i[0],a=i[1];if(o.startsWith(e)){var s=o.replace(e,"");s&&(r[s]=a||"")}return r},{})},jf=function(t){return t==null||typeof t=="object"&&Object.keys(t).length===0||typeof t=="string"&&t.trim().length===0},Do=function(t){return Object.keys(t).reduce(function(e,r){var n=t[r];return jf(n)||(e[r]=n),e},{})},js=function(){var t;try{var e=F(),r=(t=e?.sessionStorage)===null||t===void 0?void 0:t.getItem(Mf);if(!r)return;var n=JSON.parse(r);if(typeof n.pageViewId=="string")return n.pageViewId}catch{}},_i=function(t,e){return t?e.some(function(r){var n;return(n=t?.matches)===null||n===void 0?void 0:n.call(t,r)})?t:_i(t?.parentElement,e):null},fr=function(t){return!(t.event.target===null||!t.closestTrackedAncestor)};function Hf(t){return t.type==="click"||t.type==="change"}var Yr;(function(t){t[t.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",t[t.MIDDLE=1]="MIDDLE",t[t.RIGHT=2]="RIGHT"})(Yr||(Yr={}));var Mo="__AMPLITUDE_VISUAL_TAGGING__";function Gf(t,e){var r=t;if(r[Mo]!==!0){r[Mo]=!0;var n=e.dataExtractor,i=e.isElementSelectable,o=e.cssSelectorAllowlist,a=e.actionClickAllowlist,s=null,l=function(c){t.notify({action:"element-selected",data:c})},u=function(c,f){c==="selector-mode-changed"?t.notify({action:"track-selector-mode-changed",data:f}):c==="selector-moved"&&t.notify({action:"track-selector-moved",data:f})};t.registerActionHandler("initialize-visual-tagging-selector",function(c){t.loadScriptOnce(Nf).then(function(){var f;s=(f=window?.amplitudeVisualTaggingSelector)===null||f===void 0?void 0:f.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(d){return i?i(c?.actionType||"click",d):!0},onTrack:u,onSelect:l,visualHighlightClass:Lf,messenger:t,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:Ns}}}),t.notify({action:"selector-loaded"})}).catch(function(){var f;(f=t.logger)===null||f===void 0||f.warn("Failed to initialize visual tagging selector")})}),t.registerActionHandler("close-visual-tagging-selector",function(){var c;(c=s?.close)===null||c===void 0||c.call(s)})}}function Wf(t){var e=t.amplitude,r=t.allObservables,n=t.shouldTrackEvent,i=t.evaluateTriggers,o=r.clickObservable,a=o.filter(fr).filter(function(l){return n("click",l.closestTrackedAncestor)}).map(function(l){return i(l)}),s=a;return s.subscribe(function(l){e?.track(Ls,l.targetElementProperties)})}function Kf(t){var e=t.amplitude,r=t.allObservables,n=t.getEventProperties,i=t.shouldTrackEvent,o=t.evaluateTriggers,a=r.changeObservable,s=a.filter(fr).filter(function(l){return i("change",l.closestTrackedAncestor)}).map(function(l){return o(l)});return s.subscribe(function(l){e?.track(yf,n("change",l.closestTrackedAncestor))})}function zf(t){var e=t.amplitude,r=t.allObservables,n=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,a=t.shouldTrackActionClick,s=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=s.filter(function(m){return!o("click",m.closestTrackedAncestor)}).map(function(m){var E=_i(m.event.target,n.actionClickAllowlist);return m.closestTrackedAncestor=E,m.closestTrackedAncestor!==null&&(m.targetElementProperties=i(m.type,m.closestTrackedAncestor)),m}).filter(fr).filter(function(m){return a("click",m.closestTrackedAncestor)}),f=u?Et(l,u):l,d=Et(c,f),v=null,h=null,g=wi(d,function(m){if(v&&(clearTimeout(v),v=null),m.type==="click")return h=m,v=setTimeout(function(){v=null,h=null},500),Promise.resolve(null);if(h){var E=h;return h=null,Promise.resolve(E)}return Promise.resolve(null)});return g.subscribe(function(m){m&&e?.track(Ls,i("click",m.closestTrackedAncestor))})}function $f(t){var e=t.allObservables,r=e.scrollObservable,n={maxX:0,maxY:0},i=r.subscribe(function(){var o,a,s,l,u=F(),c=Math.floor((a=(o=u?.scrollX)!==null&&o!==void 0?o:u?.pageXOffset)!==null&&a!==void 0?a:0),f=Math.floor((l=(s=u?.scrollY)!==null&&s!==void 0?s:u?.pageYOffset)!==null&&l!==void 0?l:0);n.maxX=Math.max(n.maxX,c),n.maxY=Math.max(n.maxY,f)});return{unsubscribe:function(){i.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}var Ut=F(),Hs=function(){return new we(function(t){var e=new MutationObserver(function(r){t.next(r)});return document.body&&e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}})},Gs=function(t){return t===void 0&&(t="click"),new we(function(e){var r,n=function(i){e.next(i)};return(r=F())===null||r===void 0||r.document.addEventListener(t,n,{capture:!0}),function(){var i;(i=F())===null||i===void 0||i.document.removeEventListener(t,n,{capture:!0})}})},Xf=function(){return new we(function(t){var e,r=function(n){t.next(n)};return(e=F())===null||e===void 0||e.addEventListener("scroll",r),function(){var n;(n=F())===null||n===void 0||n.removeEventListener("scroll",r)}})},Yf=function(){return new we(function(t){var e=function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=void 0;Array.isArray(n[0])&&typeof n[0][0]=="string"&&(o=n[0][0]),t.next({kind:"console",message:o})};return fo.addListener("error",e),function(){fo.removeListener(e)}})},Jf=function(t,e){return new we(function(r){var n,i=F();if(!i?.IntersectionObserver)return function(){};var o=new IntersectionObserver(function(u){u.forEach(function(c){r.next(c)})},{root:null,rootMargin:"0px",threshold:1}),a=e.join(","),s=(n=i?.document.querySelectorAll(a))!==null&&n!==void 0?n:[];s.forEach(function(u){o.observe(u)});var l=t.subscribe(function(u){var c=u.event;return c.forEach(function(f){var d=f.addedNodes;return d.forEach(function(v){v instanceof Element&&(v.matches(a)&&o.observe(v),v.querySelectorAll(a).forEach(function(h){o.observe(h)}))})})});return function(){l.unsubscribe(),o.disconnect()}})},Qf=function(){return new we(function(t){var e=function(r){if(r instanceof ErrorEvent){var n={kind:"error"};r.error instanceof Error||r.error instanceof DOMException?n=C(C({},n),{message:r.error.message,stack:r.error.stack,filename:r.filename,lineNumber:r.lineno,columnNumber:r.colno}):typeof r.error=="string"&&(n.message=r.error),t.next(n)}};return Ut.addEventListener("error",e),function(){Ut.removeEventListener("error",e)}})},Zf=function(){return new we(function(t){var e=function(r){var n={kind:"unhandledrejection"};r.reason instanceof Error||r.reason instanceof DOMException?(n.message=r.reason.message,n.stack=r.reason.stack):typeof r.reason=="string"&&(n.message=r.reason),t.next(n)};return Ut.addEventListener("unhandledrejection",e),function(){Ut.removeEventListener("unhandledrejection",e)}})},ev=function(){var t=Et(Qf(),Zf());return Et(t,Yf())},tv=function(){return new we(function(t){var e=function(n){t.next(n)},r={capture:!0};return Ut.document.addEventListener("mousemove",e,r),function(){Ut.document.removeEventListener("mousemove",e,r)}})},rv=function(t,e){try{if(e.subprop_key==="[Amplitude] Element Text")return e.subprop_op==="is"&&e.subprop_value.includes(t.targetElementProperties["[Amplitude] Element Text"]);if(e.subprop_key==="[Amplitude] Element Hierarchy")return e.subprop_op==="autotrack css match"&&!!t.closestTrackedAncestor.closest(e.subprop_value.toString())}catch(r){return console.error("Error matching event to filter",r),!1}return!1},nv=function(t,e){try{if(t.sourceType==="DOM_ELEMENT"){var r=document.documentElement;return t.scope&&e&&(r=e.closest(t.scope)),r&&t.selector?r.querySelector(t.selector):r}}catch{return}},iv=function(t,e,r){t.forEach(function(n){if(typeof n!="string"&&n.actionType==="ATTACH_EVENT_PROPERTY"){var i=r.extractDataFromDataSource(n.dataSource,e.closestTrackedAncestor);e.targetElementProperties[n.destinationKey]=i}})},Kn={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Uo=function(t){var e,r,n,i,o=Object.values(Kn).reduce(function(v,h){return v[h]=new Set,v},{});if(!t)return o;try{for(var a=q(t),s=a.next();!s.done;s=a.next()){var l=s.value;try{try{for(var u=(n=void 0,q(l.definition)),c=u.next();!c.done;c=u.next()){var f=c.value,d=Kn[f.event_type];d&&o[d].add(l.id)}}catch(v){n={error:v}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(v){console.warn("Skipping Labeled Event due to malformed definition",l?.id,v)}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return o},Fo=function(t){var e,r,n,i,o=new Map;try{for(var a=q(t),s=a.next();!s.done;s=a.next()){var l=s.value;try{for(var u=(n=void 0,q(l.conditions)),c=u.next();!c.done;c=u.next()){var f=c.value;if(f.type==="LABELED_EVENT"){var d=f.match.eventId,v=o.get(d);v||(v=[],o.set(d,v)),v.push(l)}}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(h){e={error:h}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return o},ov=function(t,e){return e.filter(function(r){return r.definition.some(function(n){return Kn[n.event_type]===t.type&&n.filters.every(function(i){return rv(t,i)})})})},av=function(t,e){var r,n,i,o,a=new Set;try{for(var s=q(t),l=s.next();!l.done;l=s.next()){var u=l.value,c=e.get(u.id);if(c)try{for(var f=(i=void 0,q(c)),d=f.next();!d.done;d=f.next()){var v=d.value;a.add(v)}}catch(h){i={error:h}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return Array.from(a)},sv=(function(){function t(e,r,n,i){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=r,this.dataExtractor=n,this.options=i}return t.prototype.evaluate=function(e){var r,n,i=this.options.pageActions;if(!i)return e;var o=ov(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(c){return i.labeledEvents[c]})),a=av(o,this.labeledEventToTriggerMap);try{for(var s=q(a),l=s.next();!l.done;l=s.next()){var u=l.value;iv(u.actions,e,this.dataExtractor)}}catch(c){r={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return e},t.prototype.update=function(e,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=r,this.options=n},t})(),uv=function(t,e,r,n){return new sv(t,e,r,n)},lv=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Fs,Pt]),cv=["type"],dv=["svg","path","g"],fv=["password","hidden"];function vv(t,e){var r,n,i,o,a,s;if(t===null)return null;var l=String(t.tagName).toLowerCase(),u={tag:l},c=Array.from((o=(i=t.parentElement)===null||i===void 0?void 0:i.children)!==null&&o!==void 0?o:[]);c.length&&(u.index=c.indexOf(t),u.indexOfType=c.filter(function(S){return S.tagName===t.tagName}).indexOf(t));var f=(s=(a=t.previousElementSibling)===null||a===void 0?void 0:a.tagName)===null||s===void 0?void 0:s.toLowerCase();f&&(u.prevSib=String(f));var d=t.getAttribute("id");d&&(u.id=String(d));var v=Array.from(t.classList);v.length&&(u.classes=v);var h={},g=Array.from(t.attributes),m=g.filter(function(S){return!lv.has(S.name)}),E=!qf(t);if(!fv.includes(String(t.getAttribute("type")))&&!dv.includes(l))try{for(var p=q(m),y=p.next();!y.done;y=p.next()){var b=y.value;if(!(E&&!cv.includes(b.name))){if(e.has(b.name)){h[b.name]=ft;continue}h[b.name]=String(b.value).substring(0,qs)}}}catch(S){r={error:S}}finally{try{y&&!y.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}return Object.keys(h).length&&(u.attrs=h),u}function hv(t){var e=[];if(!t)return e;e.push(t);for(var r=t.parentElement;r&&r.tagName!=="HTML";)e.push(r),r=r.parentElement;return e}var Wt=(function(){function t(e,r){this.value=e,this.optimized=r}return t.prototype.toString=function(){return this.value},t})(),gv=function(t,e){if(t.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=t;n;){var i=pv(n,!!e,n===t);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},pv=function(t,e,r){var n,i;if(t.nodeType!==Node.ELEMENT_NODE)return null;var o=t.getAttribute("id");if(e){if(o)return new Wt(c(o),!0);var a=t.tagName.toLowerCase();if(a==="body"||a==="head"||a==="html")return new Wt(a,!0)}var s=t.tagName.toLowerCase();if(o)return new Wt(s+c(o),!0);var l=t.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new Wt(s,!0);function u(P){var R=P.getAttribute("class");return R?R.split(/\s+/g).filter(Boolean).map(function(O){return"$"+O}):[]}function c(P){return"#"+CSS.escape(P)}for(var f=u(t),d=!1,v=!1,h=-1,g=-1,m=l.children,E=0;m&&(h===-1||!v)&&E<m.length;++E){var p=m[E];if(p.nodeType===Node.ELEMENT_NODE){if(g+=1,p===t){h=g;continue}if(!v&&p.tagName.toLowerCase()===s){d=!0;var y=new Set(f);if(!y.size){v=!0;continue}for(var b=u(p),S=0;S<b.length;++S){var w=b[S];if(y.has(w)&&(y.delete(w),!y.size)){v=!0;break}}}}}var A=s;if(r&&s.toLowerCase()==="input"&&t.getAttribute("type")&&!t.getAttribute("id")&&!t.getAttribute("class")&&(A+="[type="+CSS.escape(t.getAttribute("type")||"")+"]"),v)A+=":nth-child("+String(h+1)+")";else if(d)try{for(var I=q(f),k=I.next();!k.done;k=I.next()){var x=k.value;A+="."+CSS.escape(x.slice(1))}}catch(P){n={error:P}}finally{try{k&&!k.done&&(i=I.return)&&i.call(I)}finally{if(n)throw n.error}}return new Wt(A,!1)},Ws=(function(){function t(e,r){var n,i,o=this,a;this.replaceSensitiveString=function(d){return Ei(d,o.additionalMaskTextPatterns)},this.getHierarchy=function(d){var v,h,g,m,E=performance.now(),p=[];if(!d)return[];for(var y=hv(d),b=new Map,S=y.length-1;S>=0;S--){var w=y[S];if(w){var A=Bf(w.getAttribute(Fs)),I=S===y.length-1?[]:(g=b.get(y[S+1]))!==null&&g!==void 0?g:new Set,k=new Set($($([],D(I),!1),D(A),!1));b.set(w,k)}}p=y.map(function(B){var H;return vv(B,(H=b.get(B))!==null&&H!==void 0?H:new Set)});var x=function(B){B?.attrs&&Object.entries(B.attrs).forEach(function(H){var j=D(H,2),ee=j[0],M=j[1];B.attrs&&(B.attrs[ee]=o.replaceSensitiveString(M))})};try{for(var P=q(p),R=P.next();!R.done;R=P.next()){var O=R.value;x(O)}}catch(B){v={error:B}}finally{try{R&&!R.done&&(h=P.return)&&h.call(P)}finally{if(v)throw v.error}}var L=performance.now();return(m=o.diagnosticsClient)===null||m===void 0||m.recordHistogram("autocapturePlugin.getHierarchy",L-E),p},this.getNearestLabel=function(d){var v=d.parentElement;if(!v)return"";var h;try{h=v.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{h=null}return h?o.getText(h):o.getNearestLabel(v)},this.getElementPath=function(d){var v;if(!d)return"";var h=performance.now(),g=gv(d),m=performance.now();return(v=o.diagnosticsClient)===null||v===void 0||v.recordHistogram("autocapturePlugin.getElementPath",m-h),g},this.getEventProperties=function(d,v,h){var g,m,E,p,y=(E=(m=v?.tagName)===null||m===void 0?void 0:m.toLowerCase)===null||E===void 0?void 0:E.call(m),b=typeof v.getBoundingClientRect=="function"?v.getBoundingClientRect():{left:null,top:null},S=o.getHierarchy(v),w=(p=S[0])===null||p===void 0?void 0:p.attrs,A=o.getNearestLabel(v),I=Vf(w??{},h),k=(g={},g[wf]=S,g[No]=y,g[Lo]=o.getText(v),g[_f]=b.left==null?null:Math.round(b.left),g[If]=b.top==null?null:Math.round(b.top),g[Cf]=I,g[kf]=o.getElementPath(v),g[Pf]=A,g[Wn]=dt(window.location.href.split("?")[0]),g[Of]=Si(o.replaceSensitiveString),g[Ds]=window.innerHeight,g[Ms]=window.innerWidth,g),x=js();if(x&&(k[Us]=x),k[Ef]=v.getAttribute("id")||"",k[Sf]=v.getAttribute("class"),k[Af]=w?.["aria-label"],y==="a"&&d==="click"&&v instanceof HTMLAnchorElement){var P=v.href.substring(0,qs);k[Tf]=o.replaceSensitiveString(P)}return Do(k)},this.addTypeAndTimestamp=function(d,v){return{event:d,timestamp:Date.now(),type:v}},this.addAdditionalEventProperties=function(d,v,h,g,m){m===void 0&&(m=!1);var E=o.addTypeAndTimestamp(d,v);if(Hf(E)&&E.event.target!==null){if(m){var p=Bs(E.event.target,E.type);if(p)return E.closestTrackedAncestor=E.event.target,E.targetElementProperties=o.getEventProperties(E.type,E.closestTrackedAncestor,g),E}var y=_i(E.event.target,h);return y&&(E.closestTrackedAncestor=y,E.targetElementProperties=o.getEventProperties(E.type,y,g)),E}return E},this.extractDataFromDataSource=function(d,v){if(d.sourceType==="DOM_ELEMENT"){var h=nv(d,v);return h?d.elementExtractType==="TEXT"?o.getText(h):d.elementExtractType==="ATTRIBUTE"&&d.attribute?h.getAttribute(d.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(d){var v,h,g="[".concat(Pt,"], [contenteditable]");if(!d.querySelector(g))return d.innerText;var m="",E=Array.from(d.childNodes);try{for(var p=q(E),y=p.next();!y.done;y=p.next()){var b=y.value;if(b.nodeType===Node.TEXT_NODE){m+=b.textContent||"";continue}if(b instanceof Element){if(b.hasAttribute(Pt)||b.hasAttribute("contenteditable")){m+=ft;continue}m+=o.getTextWithMaskedDescendants(b)}}}catch(S){v={error:S}}finally{try{y&&!y.done&&(h=p.return)&&h.call(p)}finally{if(v)throw v.error}}return m},this.getText=function(d){var v=d.closest("[".concat(Pt,"]"))!==null;if(v)return ft;var h="";return d.querySelector("[".concat(Pt,"], [contenteditable]"))?h=o.getTextWithMaskedDescendants(d):h=d.innerText||"",o.replaceSensitiveString(h.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(d){var v,h,g;if(!d)return{};var m=(g=(h=d?.tagName)===null||h===void 0?void 0:h.toLowerCase)===null||g===void 0?void 0:g.call(h),E=(v={},v[No]=m,v[Lo]=o.getText(d),v[Wn]=window.location.href.split("?")[0],v);return Do(E)},this.diagnosticsClient=r?.diagnosticsClient;var s=(a=e.maskTextRegex)!==null&&a!==void 0?a:[],l=[];try{for(var u=q(s),c=u.next();!c.done;c=u.next()){var f=c.value;if(l.length>=Df)break;if(f instanceof RegExp)l.push(f);else if("pattern"in f&&typeof f.pattern=="string")try{l.push(new RegExp(f.pattern,"i"))}catch{}}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=l}return t})();function mv(t){var e=t.allObservables,r=t.onExposure,n=t.dataExtractor,i=t.exposureDuration,o=i===void 0?as:i,a=new Map,s=new Map,l=e.exposureObservable,u=l.subscribe(function(c){var f=c,d=f.target;if(f.isIntersecting){if(!a.get(d)){var v=setTimeout(function(){a.set(d,!0);var h=n.getElementPath(d);r(h),s.set(d,null)},o);s.set(d,v)}}else if(!f.isIntersecting&&f.intersectionRatio<1){var v=s.get(d);v&&(clearTimeout(v),s.set(d,null))}});return{unsubscribe:function(){u.unsubscribe()},reset:function(){s.forEach(function(c){c&&clearTimeout(c)}),s.clear(),a.clear()}}}function yv(t){var e,r,n,i,o=t.amplitude,a=t.scrollTracker,s=t.currentElementExposed,l=t.elementExposedForPage,u=t.exposureTracker,c=t.isPageEnd,f=t.lastScroll,d=a.getState(),v=F(),h=(r=v?.innerWidth)!==null&&r!==void 0?r:0,g=(n=v?.innerHeight)!==null&&n!==void 0?n:0,m=(e={},e[Wn]=(i=v?.location)===null||i===void 0?void 0:i.href,e[Rf]=d.maxX+h,e[xf]=d.maxY+g,e[Ds]=g,e[Ms]=h,e["[Amplitude] Element Exposed"]=Array.from(s),e),E=js();if(E&&(m[Us]=E),s.size===0&&d.maxX===f.maxX&&d.maxY===f.maxY){c&&(a.reset(),l.clear(),u?.reset());return}o?.track("[Amplitude] Viewport Content Updated",m),f.maxX=d.maxX,f.maxY=d.maxY,s.clear(),c&&(a.reset(),l.clear(),u?.reset())}function bv(t,e,r,n){if(!e.has(t)){e.add(t),r.add(t);var i=Array.from(r),o=JSON.stringify(i);o.length>=Uf&&n(!1)}}var Pe;(function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable",t.ScrollObservable="scrollObservable",t.ExposureObservable="exposureObservable",t.BrowserErrorObservable="browserErrorObservable",t.SelectionObservable="selectionObservable",t.MouseMoveObservable="mouseMoveObservable"})(Pe||(Pe={}));var Ev=function(t,e){var r,n,i,o,a,s,l,u,c,f,d,v;t===void 0&&(t={}),e?.diagnosticsClient.setTag("plugin.autocapture.version",Ns);var h=t.dataAttributePrefix,g=h===void 0?os:h,m=t.visualTaggingOptions,E=m===void 0?{enabled:!0}:m;t.cssSelectorAllowlist=(r=t.cssSelectorAllowlist)!==null&&r!==void 0?r:Uc,t.actionClickAllowlist=(n=t.actionClickAllowlist)!==null&&n!==void 0?n:Fc,t.debounceTime=(i=t.debounceTime)!==null&&i!==void 0?i:0;var p=((o=t.viewportContentUpdated)===null||o===void 0?void 0:o.enabled)!==!1,y=(l=(s=(a=t.viewportContentUpdated)===null||a===void 0?void 0:a.exposureDuration)!==null&&s!==void 0?s:t.exposureDuration)!==null&&l!==void 0?l:as;t.viewportContentUpdated=C(C({},t.viewportContentUpdated),{exposureDuration:y}),t.pageUrlExcludelist=(u=t.pageUrlExcludelist)===null||u===void 0?void 0:u.reduce(function(M,G){if(typeof G=="string"&&M.push(G),G instanceof RegExp&&M.push(G),typeof G=="object"&&G!==null&&"pattern"in G)try{M.push(new RegExp(G.pattern))}catch(W){return console.warn("Invalid regex pattern: ".concat(G.pattern),W),M}return M},[]);var b=vf,S="enrichment",w=[],A=new Ws(t,e),I=new Set,k=new Set,x,P=function(){var M,G=Ye(Gs().map(function(ie){return A.addAdditionalEventProperties(ie,"click",t.cssSelectorAllowlist,g)})),W=Ye(new we(function(ie){var oe,fe=function(ve){var me=A.addAdditionalEventProperties(ve,"change",t.cssSelectorAllowlist,g);ie.next(me)};return(oe=F())===null||oe===void 0||oe.document.addEventListener("change",fe,{capture:!0}),function(){var ve;return(ve=F())===null||ve===void 0?void 0:ve.document.removeEventListener("change",fe)}})),te;window.navigation&&(te=Ye(new we(function(ie){var oe=function(fe){var ve=A.addAdditionalEventProperties(fe,"navigate",t.cssSelectorAllowlist,g);ie.next(ve)};return window.navigation.addEventListener("navigate",oe),function(){window.navigation.removeEventListener("navigate",oe)}})));var J=Ye(Hs().map(function(ie){return A.addAdditionalEventProperties(ie,"mutation",t.cssSelectorAllowlist,g)})),Z=Xf(),K=Jf(J,t.cssSelectorAllowlist);return M={},M[Pe.ChangeObservable]=W,M[Pe.ClickObservable]=G,M[Pe.MutationObservable]=J,M[Pe.NavigateObservable]=te,M[Pe.ScrollObservable]=Z,M[Pe.ExposureObservable]=K,M},R=Uo(Object.values((f=(c=t.pageActions)===null||c===void 0?void 0:c.labeledEvents)!==null&&f!==void 0?f:{})),O=Fo((v=(d=t.pageActions)===null||d===void 0?void 0:d.triggers)!==null&&v!==void 0?v:[]),L=uv(R,O,A,t),B=function(M){var G,W;M&&(t.pageActions=C(C({},t.pageActions),M),R=Uo(Object.values((G=t.pageActions.labeledEvents)!==null&&G!==void 0?G:{})),O=Fo((W=t.pageActions.triggers)!==null&&W!==void 0?W:[]),L.update(R,O,t))},H=function(M,G){return _(void 0,void 0,void 0,function(){var W,te,J,Z,K,ie,oe,fe,ve,me,N,he,qe,Ae,Re,Be,Ve,We,Ke,ge,Ne;return T(this,function(nt){return typeof document>"u"?[2]:(W=!1,te={maxX:void 0,maxY:void 0},M.fetchRemoteConfig&&(M.remoteConfigClient?M.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(V){B(V)}):M.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),J=Nt(t,t.cssSelectorAllowlist),Z=Nt(t,t.actionClickAllowlist),K=P(),ie=Wf({allObservables:K,amplitude:G,shouldTrackEvent:J,evaluateTriggers:L.evaluate.bind(L)}),w.push(ie),oe=Kf({allObservables:K,getEventProperties:function(){for(var V=[],z=0;z<arguments.length;z++)V[z]=arguments[z];return A.getEventProperties.apply(A,$($([],D(V),!1),[g],!1))},amplitude:G,shouldTrackEvent:J,evaluateTriggers:L.evaluate.bind(L)}),w.push(oe),fe=zf({allObservables:K,options:t,getEventProperties:function(){for(var V=[],z=0;z<arguments.length;z++)V[z]=arguments[z];return A.getEventProperties.apply(A,$($([],D(V),!1),[g],!1))},amplitude:G,shouldTrackEvent:J,shouldTrackActionClick:Z}),fe&&w.push(fe),ve=$f({allObservables:K}),w.push(ve),me={},N=F(),he=function(V){V&&W||(setTimeout(function(){W=!1},100),W=!0,yv({amplitude:G,scrollTracker:ve,currentElementExposed:k,elementExposedForPage:I,exposureTracker:me.exposure,isPageEnd:V,lastScroll:te}))},qe=function(V){bv(V,I,k,he)},p&&(me.exposure=mv({allObservables:K,onExposure:qe,dataExtractor:A,exposureDuration:y}),me.exposure&&w.push(me.exposure),Ae=function(){he(!0)},N?.addEventListener("beforeunload",Ae),x=function(){N?.removeEventListener("beforeunload",Ae)},w.push({unsubscribe:function(){return x()}}),Re=K[Pe.NavigateObservable],Re?w.push(Re.subscribe(function(){he(!0)})):N&&(Be=function(){he(!0)},N.addEventListener("popstate",Be),Ve=N.history.pushState,N.history&&Ve&&(N.history.pushState=new Proxy(Ve,{apply:function(V,z,X){var ce=D(X,3),Y=ce[0],_t=ce[1],ue=ce[2];V.apply(z,[Y,_t,ue]),he(!0)}})),w.push({unsubscribe:function(){N.removeEventListener("popstate",Be),N.history&&Ve&&(N.history.pushState=Ve)}}))),(Ne=M?.loggerProvider)===null||Ne===void 0||Ne.log("".concat(b," has been successfully added.")),window.opener&&E.enabled&&(We=t.cssSelectorAllowlist,Ke=t.actionClickAllowlist,ge=ys(),Gf(ge,{dataExtractor:A,isElementSelectable:Nt(t,$($([],D(We),!1),D(Ke),!1)),cssSelectorAllowlist:We,actionClickAllowlist:Ke}),bs(ge),ge.setup(C({logger:M?.loggerProvider},M?.serverZone&&{endpoint:ps[M.serverZone]}))),[2])})})},j=function(M){return _(void 0,void 0,void 0,function(){return T(this,function(G){return[2,M]})})},ee=function(){return _(void 0,void 0,void 0,function(){var M,G,W,te,J;return T(this,function(Z){try{for(M=q(w),G=M.next();!G.done;G=M.next())W=G.value,W.unsubscribe()}catch(K){te={error:K}}finally{try{G&&!G.done&&(J=M.return)&&J.call(M)}finally{if(te)throw te.error}}return[2]})})};return{name:b,type:S,setup:H,execute:j,teardown:ee}},Sv=3e3,wv=["mutation","navigate"];function Tv(t){var e=t.amplitude,r=t.allObservables,n=t.getEventProperties,i=t.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,s=r.navigateObservable,l=o.filter(function(v){return fr(v)&&i("click",v.closestTrackedAncestor)&&v.event.target instanceof Element&&v.event.target.closest('a[target="_blank"]')===null&&v.event.button===Yr.LEFT_OR_TOUCH_CONTACT}),u=s?Et(a,s):a,c=Et(l,u),f=null,d=wi(c,function(v){return f&&wv.includes(v.type)?(clearTimeout(f),f=null,Promise.resolve(null)):v.type==="click"?f?Promise.resolve(null):new Promise(function(h){f=setTimeout(function(){h(v),f=null},Sv)}):Promise.resolve(null)});return d.subscribe(function(v){if(v){var h={"[Amplitude] X":v.event.clientX,"[Amplitude] Y":v.event.clientY};e.track(gf,C(C({},n("click",v.closestTrackedAncestor)),h),{time:v.timestamp})}})}var Ks=Gc,zs=Hc,qo=Wc;function Bo(t,e){var r,n,i,o,a=e.event,s=a.pageX,l=a.pageY;t.yMin=Math.min((r=t.yMin)!==null&&r!==void 0?r:l,l),t.yMax=Math.max((n=t.yMax)!==null&&n!==void 0?n:l,l),t.xMin=Math.min((i=t.xMin)!==null&&i!==void 0?i:s,s),t.xMax=Math.max((o=t.xMax)!==null&&o!==void 0?o:s,s),t.isOutOfBounds=t.yMax-t.yMin>qo||t.xMax-t.xMin>qo}function Vo(t){if(t.length===0)return null;var e=t[0],r=t[t.length-1],n=C({"[Amplitude] Begin Time":new Date(e.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-e.timestamp,"[Amplitude] Clicks":t.map(function(i){return{X:i.event.pageX,Y:i.event.pageY,Time:i.timestamp}}),"[Amplitude] Click Count":t.length},e.targetElementProperties);return{rageClickEvent:n,time:e.timestamp}}function _v(t,e){var r=Math.max(0,t.length-Ks+1),n=t[r];return e.timestamp-n.timestamp>=zs}function Iv(t,e){return t.length>0&&t[t.length-1].closestTrackedAncestor!==e.closestTrackedAncestor}function Av(t){var e=this,r=t.amplitude,n=t.allObservables,i=t.shouldTrackRageClick,o=n.clickObservable,a=n.selectionObservable,s=[],l={},u=null;function c(h){s=[],l={},h&&(Bo(l,h),s.push(h))}var f=wi(o.filter(function(h){return i("click",h.closestTrackedAncestor)}),function(h){return _(e,void 0,void 0,function(){var g;return T(this,function(m){return Bo(l,h),g=null,s.length===0||Iv(s,h)||_v(s,h)||l.isOutOfBounds?(u&&(g=Vo(s)),c(h)):s.push(h),u&&(clearTimeout(u.timerId),u.resolve(g),u=null),s.length>=Ks?[2,new Promise(function(E){u={resolve:E,timerId:setTimeout(function(){E(Vo(s))},zs)}})]:[2,null]})})}),d=a?.subscribe(function(){c()}),v=f.subscribe(function(h){h!==null&&r.track(pf,h.rageClickEvent,{time:h.time})});return{unsubscribe:function(){v.unsubscribe(),d?.unsubscribe()}}}var Cv=2e3;function kv(t){var e=t.amplitude,r=t.allObservables,n=t.shouldTrackErrorClick,i=r.clickObservable,o=r.browserErrorObservable,a=i.filter(function(c){return fr(c)&&n("click",c.closestTrackedAncestor)&&c.event.target instanceof Element&&c.event.target.closest('a[target="_blank"]')===null&&c.event.button===Yr.LEFT_OR_TOUCH_CONTACT}),s=null,l=null,u=function(){s!==null&&(clearTimeout(s),s=null),l=null};return Et(a,o).subscribe(function(c){var f;if(c.type==="click"){u(),l=c,s=setTimeout(u,Cv);return}c.type==="error"&&l&&(e.track(mf,C((f={},f["[Amplitude] Kind"]=c.event.kind,f["[Amplitude] Message"]=c.event.message,f["[Amplitude] Stack"]=c.event.stack,f["[Amplitude] Filename"]=c.event.filename,f["[Amplitude] Line Number"]=c.event.lineNumber,f["[Amplitude] Column Number"]=c.event.columnNumber,f),l.targetElementProperties)),u())})}var Xe;(function(t){t.INCREASING="increasing",t.DECREASING="decreasing"})(Xe||(Xe={}));var mt;(function(t){t.X="x",t.Y="y"})(mt||(mt={}));var Pv=function(t){var e=t.allWindowObservables,r=e.mouseMoveObservable;return new we(function(n){var i=null,o=null,a=null;return r.subscribe(function(s){var l={x:s.clientX,y:s.clientY};if(i===null){i=l;return}l.x>i.x?(o===Xe.DECREASING&&n.next(mt.X),o=Xe.INCREASING):l.x<i.x&&(o===Xe.INCREASING&&n.next(mt.X),o=Xe.DECREASING),l.y>i.y?(a===Xe.DECREASING&&n.next(mt.Y),a=Xe.INCREASING):l.y<i.y&&(a===Xe.INCREASING&&n.next(mt.Y),a=Xe.DECREASING),i=l})})};function Ov(t){var e=+Date.now();t.startTime=t.startTime||e;var r=t.changes,n=t.changesThreshold;r.push(e),r.length>n&&r.shift()}function jo(t){var e=t.changes,r=t.changesThreshold,n=t.thresholdMs;if(e.length<r)return!1;var i=e[e.length-1]-e[0];return i<n}function Ho(t){t.changes=[],t.startTime=void 0}function Go(t){for(var e=t.changes,r=t.thresholdMs,n=0,i=e[e.length-1];n<e.length;n++){var o=i-e[n];if(o<r)break}n!==0&&(t.startTime=e[n],t.changes.splice(0,n))}function Rv(t,e){var r=void 0;if(jo(t)&&(r=t.startTime),jo(e)){var n=e.startTime;n&&(!r||n<r)&&(r=n)}return r}var $s=20,Xs=2e3,xv=function(t){var e=t.mouseDirectionChangeObservable,r=t.directionChanges,n=r===void 0?$s:r,i=t.thresholdMs,o=i===void 0?Xs:i;return new we(function(a){var s={changes:[],changesThreshold:n,thresholdMs:o},l={changes:[],changesThreshold:n,thresholdMs:o},u=void 0,c=null;function f(){u!==void 0&&(a.next(u),u=void 0,c!==null&&clearTimeout(c),Ho(s),Ho(l))}return e.subscribe(function(d){c!==null&&clearTimeout(c),Ov(d===mt.X?s:l);var v=Rv(s,l);return v?(u=u||v,c=setTimeout(function(){f(),c=null},o)):f(),Go(s),Go(l),function(){c!==null&&(clearTimeout(c),c=null)}})})},Nv=function(t){var e=t.amplitude,r=t.options,n=t.allObservables,i=t.directionChanges,o=i===void 0?$s:i,a=t.thresholdMs,s=a===void 0?Xs:a,l=Pv({allWindowObservables:n}),u=xv({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:s});return u.subscribe(function(c){Vs(r)&&e.track(bf,void 0,{time:c})})};function Tn(t,e,r,n){if(!n)return[];var i=t[e];return typeof i=="object"&&i!==null&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var Er=5,Sr=4e3,Lv=function(t){var e;t===void 0&&(t={});var r=hf,n="enrichment",i=[],o=t.errorClicks!==!1;t.errorClicks||(o=!1);var a=t.deadClicks!==!1&&t.deadClicks!==null,s=t.rageClicks!==!1&&t.rageClicks!==null,l=t.thrashedCursor!==!1&&t.thrashedCursor!==null;t.thrashedCursor||(l=!1);var u=Tn(t,"rageClicks",jc,s),c=Tn(t,"deadClicks",Bc,a),f=Tn(t,"errorClicks",Vc,o),d=(e=t.dataAttributePrefix)!==null&&e!==void 0?e:os,v=new Ws(t),h=$([],D(new Set($($($([],D(u),!1),D(c),!1),D(f),!1))),!1),g=function(){var y,b=Ye(Gs("pointerdown").map(function(P){return v.addAdditionalEventProperties(P,"click",h,d,!0)})),S=Ye(ev().map(function(P){return v.addTypeAndTimestamp(P,"error")})),w=Ye(Hs().map(function(P){return v.addAdditionalEventProperties(P,"mutation",h,d)})),A;if(window.navigation){var I=new we(function(P){var R=function(O){P.next(C(C({},O),{type:"navigate"}))};return window.navigation.addEventListener("navigate",R),function(){window.navigation.removeEventListener("navigate",R)}});A=Ye(I.map(function(P){return v.addAdditionalEventProperties(P,"navigate",h,d)}))}var k=Ye(new we(function(P){var R=function(){var O=document.activeElement;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT")){var L=void 0,B=void 0;try{if(L=O.selectionStart,B=O.selectionEnd,L===B)return}catch{return}return P.next()}var H=window.getSelection();if(!(!H||H.isCollapsed))return P.next()};return window.document.addEventListener("selectionchange",R),function(){window.document.removeEventListener("selectionchange",R)}})),x=Ye(tv());return y={},y[Pe.ClickObservable]=b,y[Pe.MutationObservable]=w,y[Pe.NavigateObservable]=A,y[Pe.BrowserErrorObservable]=S,y[Pe.SelectionObservable]=k,y[Pe.MouseMoveObservable]=x,y},m=function(y,b){return _(void 0,void 0,void 0,function(){var S,w,A,I,k,x,P,R,O,L,B;return T(this,function(H){return typeof document>"u"?[2]:(S=g(),s&&(w=Nt(t,u),A=Av({allObservables:S,amplitude:b,shouldTrackRageClick:w}),i.push(A)),a&&(I=Nt(t,c),k=Tv({amplitude:b,allObservables:S,getEventProperties:function(j,ee){return v.getEventProperties(j,ee,d)},shouldTrackDeadClick:I}),i.push(k)),o&&(x=Nt(t,f),P=kv({amplitude:b,allObservables:S,shouldTrackErrorClick:x}),i.push(P)),l&&(R=void 0,O=void 0,typeof t.thrashedCursor=="object"&&(R=t.thrashedCursor.directionChanges,O=t.thrashedCursor.threshold,R&&R<Er&&(y.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(R," is below the minimum of ").concat(Er,", setting to ").concat(Er)),R=Er),O&&O>Sr&&(y.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(O," is above the maximum of ").concat(Sr,", setting to ").concat(Sr)),O=Sr)),L=Nv({amplitude:b,options:t,allObservables:S,directionChanges:R,thresholdMs:O}),i.push(L)),(B=y?.loggerProvider)===null||B===void 0||B.log("".concat(r," has been successfully added.")),[2])})})},E=function(y){return _(void 0,void 0,void 0,function(){return T(this,function(b){return[2,y]})})},p=function(){return _(void 0,void 0,void 0,function(){var y,b,S,w,A;return T(this,function(I){try{for(y=q(i),b=y.next();!b.done;b=y.next())S=b.value,S.unsubscribe()}catch(k){w={error:k}}finally{try{b&&!b.done&&(A=y.return)&&A.call(y)}finally{if(w)throw w.error}}return[2]})})};return{name:r,type:n,setup:m,execute:E,teardown:p}},Dv="@amplitude/plugin-network-capture-browser",Ys="[Amplitude] Network Request",Js="500-599";function Lr(t,e){var r=e.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&"),n="^"+r.replace(/\*/g,".*")+"$",i=new RegExp(n);return i.test(t)}function Qs(t,e){var r,n,i=e.split(",");try{for(var o=q(i),a=o.next();!a.done;a=o.next()){var s=a.value,l=D(s.split("-").map(Number),2),u=l[0],c=l[1];if(t===u&&c===void 0||t>=u&&t<=c)return!0}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function Mv(t,e,r,n,i){if(!(t.hosts&&!t.hosts.find(function(a){return Lr(e,a)}))&&!(n&&t.urls&&!Bn(n,t.urls))&&!(i&&t.methods&&!t.methods.find(function(a){return i.toLowerCase()===a.toLowerCase()||a==="*"}))){if(r||r===0){var o=t.statusCodeRange||Js;if(!Qs(r,o))return!1}return!0}}function Zs(t){var e;if(t)try{var r=(e=F())===null||e===void 0?void 0:e.location.href,n=new URL(t,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),a=n.href,s=n.host;n.hash="",n.search="";var l=n.href;return{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:l,host:s}}catch{return}}function Uv(t,e){if(t.includes("amplitude.com"))try{var r=e.body;if(typeof r!="string")return!1;var n=JSON.parse(r),i=n.events;if(i.find(function(o){return o.event_type===Ys}))return!0}catch{}return!1}function Wo(t){if(typeof t!="object"||t===null){if(t)return $([],D(Wr),!1);if(t===void 0){var e=void 0;return e}return}if(t.length!==0)return t}function Ko(t){var e,r;return!(!((e=t?.allowlist)===null||e===void 0)&&e.length)&&!(!((r=t?.blocklist)===null||r===void 0)&&r.length)}function Fv(t,e){var r;e===void 0&&(e={});var n=Zs(t.url);if(!n)return!1;var i=n.host;if(e.ignoreAmplitudeRequests!==!1&&(Lr(i,"*.amplitude.com")||Lr(i,"amplitude.com"))||!((r=e.ignoreHosts)===null||r===void 0)&&r.find(function(a){return Lr(i,a)})||!e.captureRules&&t.status!==void 0&&!Qs(t.status,Js))return!1;if(e.captureRules){var o;if($([],D(e.captureRules),!1).reverse().find(function(a){if(o=Mv(a,i,t.status,t.url,t.method),o){var s=Wo(a.responseHeaders);if(t.responseWrapper&&s){var l=t.responseWrapper.headers(s);l&&(t.responseHeaders=l)}var u=Wo(a.requestHeaders);if(t.requestWrapper&&u){var c=t.requestWrapper.headers(u);c&&(t.requestHeaders=c)}t.responseWrapper&&a.responseBody&&!Ko(a.responseBody)&&(t.responseBodyJson=t.responseWrapper.json(a.responseBody.allowlist,a.responseBody.blocklist)),t.requestWrapper&&a.requestBody&&!Ko(a.requestBody)&&(t.requestBodyJson=t.requestWrapper.json(a.requestBody.allowlist,a.requestBody.blocklist))}return o!==void 0}),!o)return!1}return!(t.requestWrapper&&Uv(i,t.requestWrapper))}function qv(t,e,r,n){return _(this,void 0,void 0,function(){var i,o,a;return T(this,function(s){switch(s.label){case 0:return e.requestBodyJson||e.responseBodyJson?[4,Promise.all([e.requestBodyJson,e.responseBodyJson])]:[3,2];case 1:if(i=D.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{t["[Amplitude] Request Body"]=JSON.stringify(o)}catch(l){n?.debug("Failed to stringify request body",l)}if(a)try{t["[Amplitude] Response Body"]=JSON.stringify(a)}catch{n?.debug("Failed to stringify response body")}s.label=2;case 2:return r?.track(Ys,t),[2]}})})}function Bv(t){var e=t.allObservables,r=t.networkTrackingOptions,n=t.amplitude,i=t.loggerProvider,o=e.networkObservable,a=o.filter(function(s){return Fv(s.event,r)});return a.subscribe(function(s){var l,u,c,f=s.event,d=Zs(f.url);if(d){var v=(u=f.responseWrapper)===null||u===void 0?void 0:u.bodySize,h=(c=f.requestWrapper)===null||c===void 0?void 0:c.bodySize,g=(l={},l["[Amplitude] URL"]=d.hrefWithoutQueryOrHash,l["[Amplitude] URL Query"]=d.query,l["[Amplitude] URL Fragment"]=d.fragment,l["[Amplitude] Request Method"]=f.method,l["[Amplitude] Status Code"]=f.status,l["[Amplitude] Start Time"]=f.startTime,l["[Amplitude] Completion Time"]=f.endTime,l["[Amplitude] Duration"]=f.duration,l["[Amplitude] Request Body Size"]=h,l["[Amplitude] Response Body Size"]=v,l["[Amplitude] Request Type"]=f.type,l["[Amplitude] Request Headers"]=f.requestHeaders,l["[Amplitude] Response Headers"]=f.responseHeaders,l);qv(g,f,n,i)}})}var zn;(function(t){t.NetworkObservable="networkObservable"})(zn||(zn={}));var zo,Vv=function(t){t===void 0&&(t={});var e=Dv,r="enrichment",n,i=function(u,c){var f={event:u,timestamp:Date.now(),type:c};return f},o=function(){var u,c=new we(function(f){var d=new ed(function(v){var h=i(v,"network");f.next(h)});return po.subscribe(d,n),function(){po.unsubscribe(d)}});return u={},u[zn.NetworkObservable]=c,u},a=function(u,c){return _(void 0,void 0,void 0,function(){var f;return T(this,function(d){return typeof document>"u"?[2]:(f=o(),n=u?.loggerProvider,zo=Bv({allObservables:f,networkTrackingOptions:t,amplitude:c,loggerProvider:n}),n?.log("".concat(e," has been successfully added.")),[2])})})},s=function(u){return _(void 0,void 0,void 0,function(){return T(this,function(c){return[2,u]})})},l=function(){return _(void 0,void 0,void 0,function(){return T(this,function(u){return zo.unsubscribe(),[2]})})};return{name:e,type:r,setup:a,execute:s,teardown:l}},jv="web-vitals-browser",Hv="[Amplitude] Web Vitals";let eu=-1;const qt=t=>{addEventListener("pageshow",(e=>{e.persisted&&(eu=e.timeStamp,t(e))}),!0)},Qe=(t,e,r,n)=>{let i,o;return a=>{e.value>=0&&(a||n)&&(o=e.value-(i??0),(o||i===void 0)&&(i=e.value,e.delta=o,e.rating=((s,l)=>s>l[1]?"poor":s>l[0]?"needs-improvement":"good")(e.value,r),t(e)))}},Ii=t=>{requestAnimationFrame((()=>requestAnimationFrame((()=>t()))))},Ai=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},vr=()=>Ai()?.activationStart??0,Ze=(t,e=-1)=>{const r=Ai();let n="navigate";return eu>=0?n="back-forward-cache":r&&(document.prerendering||vr()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:t,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},_n=new WeakMap;function Ci(t,e){return _n.get(t)||_n.set(t,new e),_n.get(t)}class Gv{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&e.startTime-n.startTime<1e3&&e.startTime-r.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const hr=(t,e,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:t,buffered:!0,...r}),n}}catch{}},ki=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let Ot=-1;const tu=new Set,$o=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,$n=t=>{if(document.visibilityState==="hidden"){if(t.type==="visibilitychange")for(const e of tu)e();isFinite(Ot)||(Ot=t.type==="visibilitychange"?t.timeStamp:0,removeEventListener("prerenderingchange",$n,!0))}},rn=()=>{if(Ot<0){const t=vr();Ot=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((r=>r.name==="hidden"&&r.startTime>t))[0]?.startTime)??$o(),addEventListener("visibilitychange",$n,!0),addEventListener("prerenderingchange",$n,!0),qt((()=>{setTimeout((()=>{Ot=$o()}))}))}return{get firstHiddenTime(){return Ot},onHidden(t){tu.add(t)}}},nn=t=>{document.prerendering?addEventListener("prerenderingchange",(()=>t()),!0):t()},Xo=[1800,3e3],ru=(t,e={})=>{nn((()=>{const r=rn();let n,i=Ze("FCP");const o=hr("paint",(a=>{for(const s of a)s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-vr(),0),i.entries.push(s),n(!0)))}));o&&(n=Qe(t,i,Xo,e.reportAllChanges),qt((a=>{i=Ze("FCP"),n=Qe(t,i,Xo,e.reportAllChanges),Ii((()=>{i.value=performance.now()-a.timeStamp,n(!0)}))})))}))},Yo=[.1,.25],Wv=(t,e={})=>{const r=rn();ru(ki((()=>{let n,i=Ze("CLS",0);const o=Ci(e,Gv),a=l=>{for(const u of l)o.h(u);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},s=hr("layout-shift",a);s&&(n=Qe(t,i,Yo,e.reportAllChanges),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),qt((()=>{o.i=0,i=Ze("CLS",0),n=Qe(t,i,Yo,e.reportAllChanges),Ii((()=>n()))})),setTimeout(n))})))};let nu=0,In=1/0,wr=0;const Kv=t=>{for(const e of t)e.interactionId&&(In=Math.min(In,e.interactionId),wr=Math.max(wr,e.interactionId),nu=wr?(wr-In)/7+1:0)};let Xn;const Jo=()=>Xn?nu:performance.interactionCount??0,zv=()=>{"interactionCount"in performance||Xn||(Xn=hr("event",Kv,{type:"event",buffered:!0,durationThreshold:0}))};let Qo=0,$v=class{u=[];l=new Map;m;p;v(){Qo=Jo(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Jo()-Qo)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>r.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,o)=>o.P-i.P)),this.u.length>10){const i=this.u.splice(10);for(const o of i)this.l.delete(o.id)}this.p?.(n)}}};const iu=t=>{const e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?t():(t=ki(t),addEventListener("visibilitychange",t,{once:!0,capture:!0}),e((()=>{t(),removeEventListener("visibilitychange",t,{capture:!0})})))},Zo=[200,500],Xv=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=rn();nn((()=>{zv();let n,i=Ze("INP");const o=Ci(e,$v),a=l=>{iu((()=>{for(const c of l)o.h(c);const u=o.L();u&&u.P!==i.value&&(i.value=u.P,i.entries=u.entries,n())}))},s=hr("event",a,{durationThreshold:e.durationThreshold??40});n=Qe(t,i,Zo,e.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),qt((()=>{o.v(),i=Ze("INP"),n=Qe(t,i,Zo,e.reportAllChanges)})))}))};let Yv=class{m;h(e){this.m?.(e)}};const ea=[2500,4e3],Jv=(t,e={})=>{nn((()=>{const r=rn();let n,i=Ze("LCP");const o=Ci(e,Yv),a=l=>{e.reportAllChanges||(l=l.slice(-1));for(const u of l)o.h(u),u.startTime<r.firstHiddenTime&&(i.value=Math.max(u.startTime-vr(),0),i.entries=[u],n())},s=hr("largest-contentful-paint",a);if(s){n=Qe(t,i,ea,e.reportAllChanges);const l=ki((()=>{a(s.takeRecords()),s.disconnect(),n(!0)})),u=c=>{c.isTrusted&&(iu(l),removeEventListener(c.type,u,{capture:!0}))};for(const c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});qt((c=>{i=Ze("LCP"),n=Qe(t,i,ea,e.reportAllChanges),Ii((()=>{i.value=performance.now()-c.timeStamp,n(!0)}))}))}}))},ta=[800,1800],Yn=t=>{document.prerendering?nn((()=>Yn(t))):document.readyState!=="complete"?addEventListener("load",(()=>Yn(t)),!0):setTimeout(t)},Qv=(t,e={})=>{let r=Ze("TTFB"),n=Qe(t,r,ta,e.reportAllChanges);Yn((()=>{const i=Ai();i&&(r.value=Math.max(i.responseStart-vr(),0),r.entries=[i],n(!0),qt((()=>{r=Ze("TTFB",0),n=Qe(t,r,ta,e.reportAllChanges),n(!0)})))}))};function Zv(t){var e,r=((e=t.entries[0])===null||e===void 0?void 0:e.startTime)||0;return performance.timeOrigin+r}function Kt(t){return{value:t.value,rating:t.rating,delta:t.delta,navigationType:t.navigationType,id:t.id,timestamp:Math.floor(Zv(t)),navigationStart:Math.floor(performance.timeOrigin)}}var eh=function(){var t=null,e=F(),r=e?.document,n=e?.location,i=function(s,l){return _(void 0,void 0,void 0,function(){var u,c;return T(this,function(f){return r===void 0?[2]:(u=dt(n?.href||"",s.loggerProvider),c={"[Amplitude] Page Domain":n?.hostname||"","[Amplitude] Page Location":u,"[Amplitude] Page Path":dt(n?.pathname||"",s.loggerProvider),"[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":dt(u.split("?")[0],s.loggerProvider)},Jv(function(d){c["[Amplitude] LCP"]=Kt(d)}),ru(function(d){c["[Amplitude] FCP"]=Kt(d)}),Xv(function(d){c["[Amplitude] INP"]=Kt(d)}),Wv(function(d){c["[Amplitude] CLS"]=Kt(d)}),Qv(function(d){c["[Amplitude] TTFB"]=Kt(d)}),t=function(){r.visibilityState==="hidden"&&t&&(l.track(Hv,c),r.removeEventListener("visibilitychange",t),t=null)},r.addEventListener("visibilitychange",t),[2])})})},o=function(s){return _(void 0,void 0,void 0,function(){return T(this,function(l){return[2,s]})})},a=function(){return _(void 0,void 0,void 0,function(){return T(this,function(s){return t&&r?.removeEventListener("visibilitychange",t),[2]})})};return{name:jv,type:"enrichment",setup:i,execute:o,teardown:a}},ra=(function(){function t(e,r){var n;this.shouldTrackNewCampaign=!1,this.options=C({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:$d(((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)||r.topLevelDomain),optOut:r.optOut},e),this.storage=r.cookieStorage,this.storageKey=so(r.apiKey,"MKTG"),this.webExpStorageKey=so(r.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=Zr,this.sessionTimeout=r.sessionTimeout,this.lastEventTime=r.lastEventTime,this.logger=r.loggerProvider,this.topLevelDomain=r.topLevelDomain,r.loggerProvider.log("Installing web attribution tracking.")}return t.prototype.init=function(){return _(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return r=D.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1],e=this.lastEventTime?Ja(this.sessionTimeout,this.lastEventTime):!0,Gd(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.fetchCampaign=function(){return _(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return e=r.sent(),e?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,Promise.all([e||new fs().parse(),this.storage.get(this.storageKey)])];case 4:return[2,r.sent()]}})})},t.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var r=zd(this.currentCampaign,this.options);return e&&(r.event_id=e),r},t.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},t})(),Tr="AMP_CURRENT_PAGE",_r="AMP_PREVIOUS_PAGE",At="AMP_URL_INFO",ir;(function(t){t.Direct="direct",t.Internal="internal",t.External="external"})(ir||(ir={}));var th=new Set([xe.IDENTIFY,xe.GROUP_IDENTIFY,xe.REVENUE]),rh=function(t){var e={},r=e.internalDomains,n=r===void 0?[]:r,i=F(),o=void 0,a=!1,s=void 0,l=!1,u=!1,c=function(g){var m;try{var E=dt(g,s);m=new URL(E).hostname}catch(p){s?.error("Could not parse URL: ",p)}return m},f=function(g){var m=typeof location<"u"&&location.hostname||"",E=g?c(g):void 0;if(!E)return ir.Direct;var p=n.some(function(b){return m.indexOf(b)!==-1}),y=n.some(function(b){return E.indexOf(b)!==-1});return m===E||y&&p?ir.Internal:ir.External},d=function(){return _(void 0,void 0,void 0,function(){var g,m,E,p,y;return T(this,function(b){switch(b.label){case 0:return o&&a?[4,o.get(At)]:[3,3];case 1:return g=b.sent(),m=dt(typeof location<"u"&&location.href||""),E=g?.[Tr]||"",p=void 0,m===E?p=g?.[_r]||"":E?p=E:p=document.referrer||"",[4,o.set(At,(y={},y[Tr]=m,y[_r]=p,y))];case 2:b.sent(),b.label=3;case 3:return[2]}})})},v=function(){d()},h={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(g,m){return _(void 0,void 0,void 0,function(){var E;return T(this,function(p){switch(p.label){case 0:if(s=g.loggerProvider,s.log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!i)return[3,2];try{o=new en(i.sessionStorage)}catch{s?.debug("sessionStorage is not available in this environment.")}return[4,o?.isEnabled()];case 1:a=(E=p.sent())!==null&&E!==void 0?E:!1,i.addEventListener("popstate",v),l||(i.history.pushState=new Proxy(i.history.pushState,{apply:function(y,b,S){var w=D(S,3),A=w[0],I=w[1],k=w[2];y.apply(b,[A,I,k]),u&&v()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(y,b,S){var w=D(S,3),A=w[0],I=w[1],k=w[2];y.apply(b,[A,I,k]),u&&v()}}),l=!0),p.label=2;case 2:return[2]}})})},execute:function(g){return _(void 0,void 0,void 0,function(){var m,E,p,y,b;return T(this,function(S){switch(S.label){case 0:return m=dt(typeof location<"u"&&location.href||""),o&&a?[4,o.get(At)]:[3,5];case 1:return E=S.sent(),E?.[Tr]?[3,3]:[4,o.set(At,(b={},b[Tr]=m,b[_r]=document.referrer||"",b))];case 2:S.sent(),S.label=3;case 3:return[4,o.get(At)];case 4:if(p=S.sent(),y="",p&&(y=p[_r]||""),th.has(g.event_type))return[2,g];g.event_properties=C(C({},g.event_properties||{}),{"[Amplitude] Page Domain":zt(g,"[Amplitude] Page Domain",typeof location<"u"&&location.hostname||""),"[Amplitude] Page Location":zt(g,"[Amplitude] Page Location",m),"[Amplitude] Page Path":zt(g,"[Amplitude] Page Path",typeof location<"u"&&dt(location.pathname)||""),"[Amplitude] Page Title":zt(g,"[Amplitude] Page Title",Si(Ei)),"[Amplitude] Page URL":zt(g,"[Amplitude] Page URL",m.split("?")[0]),"[Amplitude] Previous Page Location":y,"[Amplitude] Previous Page Type":f(y)}),S.label=5;case 5:return[2,g]}})})},teardown:function(){return _(void 0,void 0,void 0,function(){return T(this,function(g){switch(g.label){case 0:return i&&(i.removeEventListener("popstate",v),u=!1),o&&a?[4,o.set(At,{})]:[3,2];case 1:g.sent(),g.label=2;case 2:return[2]}})})}};return h};function zt(t,e,r){return t.event_properties||(t.event_properties={}),t.event_properties[e]===void 0?r:t.event_properties[e]}var nh=function(){var t,e,r;function n(a){return typeof a!="object"||a===null?!1:"body"in a&&typeof a.body=="string"}function i(a){if(a)try{var s=new Function("return "+a)();if(typeof s=="function")return s;t?.error("Custom enrichment body did not evaluate to a function")}catch(l){t?.error("Could not create custom enrichment function",l)}return function(l){return l}}var o={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(a,s){return _(void 0,void 0,void 0,function(){var l,u;return T(this,function(c){return t=a.loggerProvider,t?.log("Installing @amplitude/plugin-custom-enrichment-browser"),!((u=a.remoteConfig)===null||u===void 0)&&u.fetchRemoteConfig&&(a.remoteConfigClient?(l=a.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(f){f&&n(f)?r=i(f.body||""):r=i("")}),e=function(){var f;return(f=a.remoteConfigClient)===null||f===void 0?void 0:f.unsubscribe(l)}):t?.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(a){return _(void 0,void 0,void 0,function(){var s;return T(this,function(l){if(r)try{return[2,(s=r(a))!==null&&s!==void 0?s:null]}catch(u){return t?.error("Could not execute custom enrichment function",u),[2,a]}return[2,a]})})},teardown:function(){return _(void 0,void 0,void 0,function(){return T(this,function(a){return e&&e(),[2]})})}};return o},An=-1,ih=(function(t){Fe(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._diagnosticsSampleRate=0,r._enableRequestBodyCompressionExperimentalValue=!1,r}return e.prototype.init=function(r,n,i){r===void 0&&(r="");var o,a;return arguments.length>2?(o=n,a=i):typeof n=="string"?(o=n,a=void 0):(o=n?.userId,a=n),Te(this._init(C(C({},a),{userId:o,apiKey:r})))},e.prototype._init=function(r){var n,i,o,a,s,l,u,c;return _(this,void 0,void 0,function(){var f,d,v,h,g,m,E,p,y,b,S,w,A,I,k,x=this;return T(this,function(P){switch(P.label){case 0:return this.initializing?[2]:(this.initializing=!0,f=ef(r),d=(n=r.loggerProvider)!==null&&n!==void 0?n:new Dt,r.loggerProvider||d.enable((i=r.logLevel)!==null&&i!==void 0?i:ke.Warn),v=(o=r.serverZone)!==null&&o!==void 0?o:ks,g=this._diagnosticsSampleRate,m=(a=r.enableDiagnostics)!==null&&a!==void 0?a:!0,f?(h=new is(r.apiKey,d,v,(s=r.remoteConfig)===null||s===void 0?void 0:s.serverUrl),[4,new Promise(function(R){h?.subscribe("configs.diagnostics.browserSDK","all",function(O,L,B){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:O,source:L,lastFetch:B},null,2)),O){var H=O.sampleRate;typeof H=="number"&&!isNaN(H)&&(g=H);var j=O.enabled;typeof j=="boolean"&&(m=j)}R()})})]):[3,2]);case 1:P.sent(),P.label=2;case 2:return E=new _c(r.apiKey,d,v,{enabled:m,sampleRate:g}),E.setTag("library","".concat(As,"/").concat(Ti)),typeof navigator<"u"&&E.setTag("user_agent",navigator.userAgent),[4,Qd(r.apiKey,r,this,E,{loggerProvider:d,serverZone:v,enableDiagnostics:m,diagnosticsSampleRate:g})];case 3:return p=P.sent(),f&&h?[4,new Promise(function(R){h?.subscribe("configs.analyticsSDK.browserSDK","all",function(O,L,B){p.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:O,source:L,lastFetch:B},null,2)),O&&ff(O,p),R()})})]:[3,5];case 4:P.sent(),P.label=5;case 5:return[4,t.prototype._init.call(this,p)];case 6:return P.sent(),this.logBrowserOptions(p),this.config.remoteConfigClient=h,Es(this.config.defaultTracking)?(this.config.optOut&&this.timeline.addOptOutListener(function(R){return _(x,void 0,void 0,function(){var O;return T(this,function(L){switch(L.label){case 0:return R?[3,2]:(O=To(this.config),this.webAttribution=new ra(O,this.config),[4,this.webAttribution.init()]);case 1:L.sent(),L.label=2;case 2:return[2]}})})}),y=To(this.config),this.webAttribution=new ra(y,this.config),[4,this.webAttribution.init()]):[3,8];case 7:P.sent(),P.label=8;case 8:return b=Kr(),S=b.ampTimestamp?Number(b.ampTimestamp):void 0,w=S?Date.now()<S:!0,A=w&&!Number.isNaN(Number(b.ampSessionId))?Number(b.ampSessionId):void 0,I=this.config.deferredSessionId,I===An&&!this.config.optOut&&(I=Date.now()),this.setSessionId((c=(u=(l=r.sessionId)!==null&&l!==void 0?l:A)!==null&&u!==void 0?u:I)!==null&&c!==void 0?c:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(R){return _(x,void 0,void 0,function(){return T(this,function(O){return!R&&this.config.deferredSessionId&&(this.config.deferredSessionId===An?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),k=Mt(r.instanceName),k.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Mc?[3,10]:[4,this.add(df()).promise];case 9:P.sent(),P.label=10;case 10:return[4,this.add(new Yl({diagnosticsClient:E})).promise];case 11:return P.sent(),[4,this.add(new kd).promise];case 12:return P.sent(),[4,this.add(new ac).promise];case 13:return P.sent(),cf(this.config),yd(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(lf()).promise]):[3,15];case 14:P.sent(),P.label=15;case 15:return Ss(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(uf()).promise]):[3,17];case 16:P.sent(),P.label=17;case 17:return ws(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Po(wo(this.config))).promise]):[3,20];case 18:return P.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(R){return _(x,void 0,void 0,function(){return T(this,function(O){switch(O.label){case 0:return R?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Po(wo(this.config))).promise]);case 1:return O.sent(),[2]}})})}),P.label=20;case 20:return _s(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Ev(wd(this.config),{diagnosticsClient:E})).promise]):[3,22];case 21:P.sent(),P.label=22;case 22:return Is(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Lv(Td(this.config))).promise]):[3,24];case 23:P.sent(),P.label=24;case 24:return Ts(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Vv(_d(this.config))).promise]):[3,26];case 25:P.sent(),P.label=26;case 26:return Ed(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(eh()).promise]):[3,28];case 27:P.sent(),P.label=28;case 28:return bd(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(rh()).promise]):[3,30];case 29:P.sent(),P.label=30;case 30:return Sd(this.config.customEnrichment)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(nh()).promise]):[3,32];case 31:P.sent(),P.label=32;case 32:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 33:return P.sent(),k.eventBridge.setEventReceiver(function(R){var O=R.eventProperties||{},L=O.time,B=Gr(O,["time"]),H=typeof L=="number"?{time:L}:void 0;x.track(R.eventType,B,H)}),[2]}})})},e.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId},e.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}this.config.loggerProvider.debug("function setUserId: ",r),(r!==this.config.userId||r===void 0)&&(this.config.userId=r,this.timeline.onIdentityChanged({userId:r}),ic(r,this.config.instanceName))},e.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId},e.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.loggerProvider.debug("function setDeviceId: ",r),r!==this.config.deviceId&&(this.config.deviceId=r,this.timeline.onIdentityChanged({deviceId:r}),oc(r,this.config.instanceName))},e.prototype.reset=function(){this.setDeviceId(Je()),this.setUserId(void 0),this.timeline.onReset()},e.prototype.getIdentity=function(){var r,n;return{deviceId:(r=this.config)===null||r===void 0?void 0:r.deviceId,userId:(n=this.config)===null||n===void 0?void 0:n.userId,userProperties:this.userProperties}},e.prototype.setIdentity=function(r){var n,i,o;if("userId"in r&&this.setUserId(r.userId),"deviceId"in r&&r.deviceId&&this.setDeviceId(r.deviceId),"userProperties"in r){this.userProperties=r.userProperties;var a=new tr,s=(o=r.userProperties)!==null&&o!==void 0?o:{};try{for(var l=q(Object.entries(s)),u=l.next();!u.done;u=l.next()){var c=D(u.value,2),f=c[0],d=c[1];a.set(f,d)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}this.identify(a)}},e.prototype.getOptOut=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.optOut},e.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId},e.prototype.setSessionId=function(r){var n,i=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,r)),Te(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=r??An,Te(Promise.resolve());if(r===void 0&&(r=Date.now()),r===this.config.sessionId)return Te(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",r);var o=this.getSessionId();o!==r&&this.timeline.onSessionIdChanged(r);var a=this.config.lastEventTime,s=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r,this.config.lastEventTime=void 0,this.config.pageCounter=0,So(this.config.defaultTracking)&&(o&&a&&i.push(this.track(Ao,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:o,time:a+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var l=this.trackCampaignEventIfNeeded(++s,i);return this.config.identify&&i.push(this.track(pi(this.config.identify)).promise),So(this.config.defaultTracking)&&i.push(this.track(Io,void 0,{event_id:l?++s:s,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,Te(Promise.all(i))},e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},e.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=Rs(r)},e.prototype.identify=function(r,n){if(mn(r)){var i=r._q;r._q=[],r=pn(new tr,i)}return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),t.prototype.identify.call(this,r,n)},e.prototype.groupIdentify=function(r,n,i,o){if(mn(i)){var a=i._q;i._q=[],i=pn(new tr,a)}return t.prototype.groupIdentify.call(this,r,n,i,o)},e.prototype.revenue=function(r,n){if(mn(r)){var i=r._q;r._q=[],r=pn(new jl,i)}return t.prototype.revenue.call(this,r,n)},e.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var i=this.webAttribution.generateCampaignEvent(r);return n?n.push(this.track(i).promise):this.track(i),this.config.loggerProvider.log("Tracking attribution."),!0},e.prototype.process=function(r){return _(this,void 0,void 0,function(){var n,i,o;return T(this,function(a){return n=Date.now(),i=Ja(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),r.event_type!==Io&&r.event_type!==Ao&&(!r.session_id||r.session_id===this.getSessionId())&&(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),[2,t.prototype.process.call(this,r)]})})},e.prototype.logBrowserOptions=function(r){try{var n=C(C({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",cd(n))}catch(i){this.config.loggerProvider.error("Error logging browser config",i)}},e.prototype._setDiagnosticsSampleRate=function(r){if(!(r>1||r<0)&&!this.config){this._diagnosticsSampleRate=r;return}},e.prototype._enableRequestBodyCompressionExperimental=function(r){if(!this.config){this._enableRequestBodyCompressionExperimentalValue=r;return}},e})(Vl),ou="[Amplitude]",oh="".concat(ou," Session Replay ID"),ah=0,sh=lr.US,uh={enabled:!0},Pi=1e3,lh="".concat(ou," Session Replay Debug"),ch="amp-block",au="amp-mask",dh="amp-unmask",su="https://api-sr.amplitude.com/sessions/v2/track",uu="https://api-sr.eu.amplitude.com/sessions/v2/track",lu="https://api-sr.stag2.amplitude.com/sessions/v2/track",fh=1*1e6,vh=3e4,hh=6e4,gh=500,ph=10*1e3,cu=1024,mh=1e3,at;(function(t){t.GET_SR_PROPS="get-sr-props",t.DEBUG_INFO="debug-info",t.FETCH_REQUEST="fetch-request",t.METADATA="metadata",t.TARGETING_DECISION="targeting-decision"})(at||(at={}));var Jn=(function(){function t(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return t.prototype.getSafeMethod=function(e){var r;if(!this.logger)return(function(){});var n=this.logger[e];if(typeof n=="function"){var i=(r=n.__rrweb_original__)!==null&&r!==void 0?r:n;return i.bind(this.logger)}return(function(){})},t.prototype.enable=function(e){this.logger.enable(e)},t.prototype.disable=function(){this.logger.disable()},t})(),Qn="medium";function yh(t){return t.toLowerCase()}function bh(t){var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?yh(e):null}var du=function(t,e,r){switch(e){case"light":{if(t!=="input")return!0;var n=r?bh(r):"";return n?!!(["password","hidden","email","tel"].includes(n)||r.autocomplete.startsWith("cc-")):!1}case"medium":case"conservative":return!0;default:return du(t,Qn,r)}},fu=function(t,e,r){var n,i,o;if(e===void 0&&(e={defaultMaskLevel:Qn}),r){if(r.closest("."+au))return!0;var a=((n=e.maskSelector)!==null&&n!==void 0?n:[]).some(function(l){return r.closest(l)});if(a)return!0;if(r.closest("."+dh))return!1;var s=((i=e.unmaskSelector)!==null&&i!==void 0?i:[]).some(function(l){return r.closest(l)});if(s)return!1}return du(t,(o=e.defaultMaskLevel)!==null&&o!==void 0?o:Qn,r)},na=function(t,e){return function(r,n){return fu(t,e,n)?r.replace(/[^\s]/g,"*"):r}},Eh=function(t){return function(e,r,n){var i;return e==="style"||!((i=t?.maskAttributes)!==null&&i!==void 0?i:[]).includes(e)?r:fu("text",t,n)?r.replace(/[^\s]/g,"*"):r}},Sh=function(){var t=F();return t?.location?t.location.href:""},wh=function(t,e){return"".concat(e,"/").concat(t)},Oi=function(t,e){return e||(t===lr.STAGING?lu:t===lr.EU?uu:su)},Th=function(t){if(typeof t!="string"||t.trim()==="")return!1;var e=/^\/|^https?:\/\/[^\s]+$/;return!!e.test(t)},_h=function(t){var e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(e,"$"))},Ih=function(t){if(!t.every(function(e){return typeof e.selector=="string"&&typeof e.replacement=="string"}))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!t.every(function(e){return Th(e.selector)}))throw new Error("ugcFilterRules must be an array of objects with valid globs")},on=function(t,e){var r,n;try{for(var i=q(e),o=i.next();!o.done;o=i.next()){var a=o.value,s=_h(a.selector);if(s.test(t))return t.replace(s,a.replacement)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},vu=function(){return _(void 0,void 0,void 0,function(){var t,e,r,n,i,o,a;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),t=F(),t?[4,t.navigator.storage.estimate()]:[3,2];case 1:return e=s.sent(),r=e.usage,n=e.quota,i=e.usageDetails,o=r?Math.round(r/cu):0,a=r&&n?Math.round((r/n+Number.EPSILON)*1e3)/1e3:0,[2,{totalStorageSize:o,percentOfQuota:a,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return s.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},hu=function(t){var e=C({},t),r=e.apiKey;return e.apiKey="****".concat(r.substring(r.length-4)),e},gu=function(){return{flushMaxRetries:2,logLevel:ke.Warn,loggerProvider:new Dt,transportProvider:new Ic}},Ah=(function(t){Fe(e,t);function e(r,n){var i=this,o,a,s,l,u,c,f=gu();if(i=t.call(this,C(C({transportProvider:f.transportProvider,loggerProvider:new Jn(n.loggerProvider||f.loggerProvider)},n),{apiKey:r}))||this,i.flushMaxRetries=n.flushMaxRetries!==void 0&&n.flushMaxRetries<=f.flushMaxRetries?n.flushMaxRetries:f.flushMaxRetries,i.apiKey=r,i.sampleRate=n.sampleRate||ah,i.serverZone=n.serverZone||sh,i.configServerUrl=n.configServerUrl,i.trackServerUrl=n.trackServerUrl,i.shouldInlineStylesheet=n.shouldInlineStylesheet,i.version=n.version,i.performanceConfig=n.performanceConfig||uh,i.storeType=(o=n.storeType)!==null&&o!==void 0?o:"idb",i.applyBackgroundColorToBlockedElements=(a=n.applyBackgroundColorToBlockedElements)!==null&&a!==void 0?a:!1,i.enableUrlChangePolling=(s=n.enableUrlChangePolling)!==null&&s!==void 0?s:!1,i.urlChangePollingInterval=(l=n.urlChangePollingInterval)!==null&&l!==void 0?l:Pi,i.captureDocumentTitle=(u=n.captureDocumentTitle)!==null&&u!==void 0?u:!1,n.privacyConfig&&(i.privacyConfig=n.privacyConfig),n.interactionConfig&&(i.interactionConfig=n.interactionConfig,i.interactionConfig.ugcFilterRules&&Ih(i.interactionConfig.ugcFilterRules)),n.debugMode&&(i.debugMode=n.debugMode),n.useWebWorker!==void 0)i.useWebWorker=n.useWebWorker;else{var d=n;((c=d.experimental)===null||c===void 0?void 0:c.useWebWorker)!==void 0&&(i.useWebWorker=d.experimental.useWebWorker)}return n.omitElementTags&&(i.omitElementTags=n.omitElementTags),i}return e})(Xa),pu=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(pu||{}),mu=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(mu||{}),Ch=function(t,e){var r=document.createDocumentFragment(),n=function(i){if(i===void 0&&(i=[]),typeof i=="string"&&(i=[i]),i=i.filter(function(o){try{r.querySelector(o)}catch{return e.warn('[session-replay-browser] omitting selector "'.concat(o,'" because it is invalid')),!1}return!0}),i.length!==0)return i};return t.blockSelector=n(t.blockSelector),t.maskSelector=n(t.maskSelector),t.unmaskSelector=n(t.unmaskSelector),t},kh=(function(){function t(e,r){this.localConfig=r,this.remoteConfigClient=e}return t.prototype.generateJoinedConfig=function(){var e,r,n,i,o;return _(this,void 0,void 0,function(){var a,s,l,u,c,f,d,v,h,g,m,E,p,y,b,S,w,A=this;return T(this,function(I){switch(I.label){case 0:a=C({},this.localConfig),a.optOut=this.localConfig.optOut,a.captureEnabled=!0,I.label=1;case 1:return I.trys.push([1,3,,4]),[4,new Promise(function(k,x){A.remoteConfigClient.subscribe("configs.sessionReplay","all",function(P,R){var O;if(A.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(R,":"),JSON.stringify(P,null,2)),!P){x(new Error("No remote config received"));return}var L=P,B=L.sr_sampling_config,H=L.sr_privacy_config,j=L.sr_targeting_config,ee=(O=a.interactionConfig)===null||O===void 0?void 0:O.ugcFilterRules;a.interactionConfig=L.sr_interaction_config,a.interactionConfig&&ee&&(a.interactionConfig.ugcFilterRules=ee),a.loggingConfig=L.sr_logging_config,(B||H||j)&&(s={},B&&(s.sr_sampling_config=B),H&&(s.sr_privacy_config=H),j&&(s.sr_targeting_config=j)),k()})})];case 2:return I.sent(),[3,4];case 3:return l=I.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",l),a.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:void 0}];case 4:if(!s)return[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:s}];if(u=s.sr_sampling_config,c=s.sr_privacy_config,f=s.sr_targeting_config,u&&Object.keys(u).length>0?(Object.prototype.hasOwnProperty.call(u,"capture_enabled")?a.captureEnabled=u.capture_enabled:a.captureEnabled=!1,Object.prototype.hasOwnProperty.call(u,"sample_rate")&&(a.sampleRate=u.sample_rate)):(a.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),c){d=(e=a.privacyConfig)!==null&&e!==void 0?e:{},v={defaultMaskLevel:(n=(r=c.defaultMaskLevel)!==null&&r!==void 0?r:d.defaultMaskLevel)!==null&&n!==void 0?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:$([],D(new Set($($([],D((i=d.maskAttributes)!==null&&i!==void 0?i:[]),!1),D((o=c.maskAttributes)!==null&&o!==void 0?o:[]),!1))),!1)},h=function(k){var x,P,R,O,L,B,H,j,ee,M={};typeof k.blockSelector=="string"&&(k.blockSelector=[k.blockSelector]);try{for(var G=q((H=k.blockSelector)!==null&&H!==void 0?H:[]),W=G.next();!W.done;W=G.next()){var te=W.value;M[te]="block"}}catch(oe){x={error:oe}}finally{try{W&&!W.done&&(P=G.return)&&P.call(G)}finally{if(x)throw x.error}}try{for(var J=q((j=k.maskSelector)!==null&&j!==void 0?j:[]),Z=J.next();!Z.done;Z=J.next()){var te=Z.value;M[te]="mask"}}catch(oe){R={error:oe}}finally{try{Z&&!Z.done&&(O=J.return)&&O.call(J)}finally{if(R)throw R.error}}try{for(var K=q((ee=k.unmaskSelector)!==null&&ee!==void 0?ee:[]),ie=K.next();!ie.done;ie=K.next()){var te=ie.value;M[te]="unmask"}}catch(oe){L={error:oe}}finally{try{ie&&!ie.done&&(B=K.return)&&B.call(K)}finally{if(L)throw L.error}}return M},g=C(C({},h(d)),h(c));try{for(m=q(Object.entries(g)),E=m.next();!E.done;E=m.next())p=D(E.value,2),y=p[0],b=p[1],b==="mask"?v.maskSelector.push(y):b==="block"?v.blockSelector.push(y):b==="unmask"&&v.unmaskSelector.push(y)}catch(k){S={error:k}}finally{try{E&&!E.done&&(w=m.return)&&w.call(m)}finally{if(S)throw S.error}}a.privacyConfig=Ch(v,this.localConfig.loggerProvider)}return f&&Object.keys(f).length>0&&(a.targetingConfig=f),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:hu(a)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:s}]}})})},t})(),Ph=function(t,e){return _(void 0,void 0,void 0,function(){var r,n;return T(this,function(i){return r=new Ah(t,e),n=new is(t,r.loggerProvider,r.serverZone,e.configServerUrl),[2,new kh(n,r)]})})},Me=Uint8Array,Oe=Uint16Array,cr=Uint32Array,Ri=new Me([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xi=new Me([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ia=new Me([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yu=function(t,e){for(var r=new Oe(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var i=new cr(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},bu=yu(Ri,2),Oh=bu[0],Zn=bu[1];Oh[28]=258,Zn[258]=28;var Rh=yu(xi,0),oa=Rh[1],ei=new Oe(32768);for(var de=0;de<32768;++de){var it=(de&43690)>>>1|(de&21845)<<1;it=(it&52428)>>>2|(it&13107)<<2,it=(it&61680)>>>4|(it&3855)<<4,ei[de]=((it&65280)>>>8|(it&255)<<8)>>>1}var or=(function(t,e,r){for(var n=t.length,i=0,o=new Oe(e);i<n;++i)++o[t[i]-1];var a=new Oe(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;var s;if(r){s=new Oe(1<<e);var l=15-e;for(i=0;i<n;++i)if(t[i])for(var u=i<<4|t[i],c=e-t[i],f=a[t[i]-1]++<<c,d=f|(1<<c)-1;f<=d;++f)s[ei[f]>>>l]=u}else for(s=new Oe(n),i=0;i<n;++i)s[i]=ei[a[t[i]-1]++]>>>15-t[i];return s}),St=new Me(288);for(var de=0;de<144;++de)St[de]=8;for(var de=144;de<256;++de)St[de]=9;for(var de=256;de<280;++de)St[de]=7;for(var de=280;de<288;++de)St[de]=8;var Jr=new Me(32);for(var de=0;de<32;++de)Jr[de]=5;var xh=or(St,9,0),Nh=or(Jr,5,0),Eu=function(t){return(t/8>>0)+(t&7&&1)},Su=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof Oe?Oe:t instanceof cr?cr:Me)(r-e);return n.set(t.subarray(e,r)),n},et=function(t,e,r){r<<=e&7;var n=e/8>>0;t[n]|=r,t[n+1]|=r>>>8},$t=function(t,e,r){r<<=e&7;var n=e/8>>0;t[n]|=r,t[n+1]|=r>>>8,t[n+2]|=r>>>16},Cn=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var i=r.length,o=r.slice();if(!i)return[new Me(0),0];if(i==1){var a=new Me(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(S,w){return S.f-w.f}),r.push({s:-1,f:25001});var s=r[0],l=r[1],u=0,c=1,f=2;for(r[0]={s:-1,f:s.f+l.f,l:s,r:l};c!=i-1;)s=r[r[u].f<r[f].f?u++:f++],l=r[u!=c&&r[u].f<r[f].f?u++:f++],r[c++]={s:-1,f:s.f+l.f,l:s,r:l};for(var d=o[0].s,n=1;n<i;++n)o[n].s>d&&(d=o[n].s);var v=new Oe(d+1),h=ti(r[c-1],v,0);if(h>e){var n=0,g=0,m=h-e,E=1<<m;for(o.sort(function(w,A){return v[A.s]-v[w.s]||w.f-A.f});n<i;++n){var p=o[n].s;if(v[p]>e)g+=E-(1<<h-v[p]),v[p]=e;else break}for(g>>>=m;g>0;){var y=o[n].s;v[y]<e?g-=1<<e-v[y]++-1:++n}for(;n>=0&&g;--n){var b=o[n].s;v[b]==e&&(--v[b],++g)}h=e}return[new Me(v),h]},ti=function(t,e,r){return t.s==-1?Math.max(ti(t.l,e,r+1),ti(t.r,e,r+1)):e[t.s]=r},aa=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Oe(++e),n=0,i=t[0],o=1,a=function(l){r[n++]=l},s=1;s<=e;++s)if(t[s]==i&&s!=e)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=t[s]}return[r.subarray(0,n),e]},Xt=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},ri=function(t,e,r){var n=r.length,i=Eu(e+2);t[i]=n&255,t[i+1]=n>>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var o=0;o<n;++o)t[i+o+4]=r[o];return(i+4+n)*8},sa=function(t,e,r,n,i,o,a,s,l,u,c){et(e,c++,r),++i[256];for(var f=Cn(i,15),d=f[0],v=f[1],h=Cn(o,15),g=h[0],m=h[1],E=aa(d),p=E[0],y=E[1],b=aa(g),S=b[0],w=b[1],A=new Oe(19),I=0;I<p.length;++I)A[p[I]&31]++;for(var I=0;I<S.length;++I)A[S[I]&31]++;for(var k=Cn(A,7),x=k[0],P=k[1],R=19;R>4&&!x[ia[R-1]];--R);var O=u+5<<3,L=Xt(i,St)+Xt(o,Jr)+a,B=Xt(i,d)+Xt(o,g)+a+14+3*R+Xt(A,x)+(2*A[16]+3*A[17]+7*A[18]);if(O<=L&&O<=B)return ri(e,c,t.subarray(l,l+u));var H,j,ee,M;if(et(e,c,1+(B<L)),c+=2,B<L){H=or(d,v,0),j=d,ee=or(g,m,0),M=g;var G=or(x,P,0);et(e,c,y-257),et(e,c+5,w-1),et(e,c+10,R-4),c+=14;for(var I=0;I<R;++I)et(e,c+3*I,x[ia[I]]);c+=3*R;for(var W=[p,S],te=0;te<2;++te)for(var J=W[te],I=0;I<J.length;++I){var Z=J[I]&31;et(e,c,G[Z]),c+=x[Z],Z>15&&(et(e,c,J[I]>>>5&127),c+=J[I]>>>12)}}else H=xh,j=St,ee=Nh,M=Jr;for(var I=0;I<s;++I)if(n[I]>255){var Z=n[I]>>>18&31;$t(e,c,H[Z+257]),c+=j[Z+257],Z>7&&(et(e,c,n[I]>>>23&31),c+=Ri[Z]);var K=n[I]&31;$t(e,c,ee[K]),c+=M[K],K>3&&($t(e,c,n[I]>>>5&8191),c+=xi[K])}else $t(e,c,H[n[I]]),c+=j[n[I]];return $t(e,c,H[256]),c+j[256]},Lh=new cr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Dh=function(t,e,r,n,i,o){var a=t.length,s=new Me(n+a+5*(1+Math.floor(a/7e3))+i),l=s.subarray(n,s.length-i),u=0;if(!e||a<8)for(var c=0;c<=a;c+=65535){var f=c+65535;f<a?u=ri(l,u,t.subarray(c,f)):(l[c]=o,u=ri(l,u,t.subarray(c,a)))}else{for(var d=Lh[e-1],v=d>>>13,h=d&8191,g=(1<<r)-1,m=new Oe(32768),E=new Oe(g+1),p=Math.ceil(r/3),y=2*p,b=function(Ae){return(t[Ae]^t[Ae+1]<<p^t[Ae+2]<<y)&g},S=new cr(25e3),w=new Oe(288),A=new Oe(32),I=0,k=0,c=0,x=0,P=0,R=0;c<a;++c){var O=b(c),L=c&32767,B=E[O];if(m[L]=B,E[O]=L,P<=c){var H=a-c;if((I>7e3||x>24576)&&H>423){u=sa(t,l,0,S,w,A,k,x,R,c-R,u),x=I=k=0,R=c;for(var j=0;j<286;++j)w[j]=0;for(var j=0;j<30;++j)A[j]=0}var ee=2,M=0,G=h,W=L-B&32767;if(H>2&&O==b(c-W))for(var te=Math.min(v,H)-1,J=Math.min(32767,c),Z=Math.min(258,H);W<=J&&--G&&L!=B;){if(t[c+ee]==t[c+ee-W]){for(var K=0;K<Z&&t[c+K]==t[c+K-W];++K);if(K>ee){if(ee=K,M=W,K>te)break;for(var ie=Math.min(W,K-2),oe=0,j=0;j<ie;++j){var fe=c-W+j+32768&32767,ve=m[fe],me=fe-ve+32768&32767;me>oe&&(oe=me,B=fe)}}}L=B,B=m[L],W+=L-B+32768&32767}if(M){S[x++]=268435456|Zn[ee]<<18|oa[M];var N=Zn[ee]&31,he=oa[M]&31;k+=Ri[N]+xi[he],++w[257+N],++A[he],P=c+ee,++I}else S[x++]=t[c],++w[t[c]]}}u=sa(t,l,o,S,w,A,k,x,R,c-R,u)}return Su(s,0,n+Eu(u)+i)},Mh=function(){var t=1,e=0;return{p:function(r){for(var n=t,i=e,o=r.length,a=0;a!=o;){for(var s=Math.min(a+5552,o);a<s;++a)n+=r[a],i+=n;n%=65521,i%=65521}t=n,e=i},d:function(){return(t>>>8<<16|(e&255)<<8|e>>>8)+((t&255)<<23)*2}}},Uh=function(t,e,r,n,i){return Dh(t,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):12+e.mem,r,n,!0)},Fh=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},qh=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;t[0]=120,t[1]=n<<6|(n?32-2*n:1)};function Bh(t,e){e===void 0&&(e={});var r=Mh();r.p(t);var n=Uh(t,e,2,4);return qh(n,e),Fh(n,n.length-4,r.d()),n}function Vh(t,e){var r=t.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var n=new Me(t.length+(t.length>>>1)),i=0,o=function(u){n[i++]=u},a=0;a<r;++a){if(i+5>n.length){var s=new Me(i+8+(r-a<<1));s.set(n),n=s}var l=t.charCodeAt(a);l<128||e?o(l):l<2048?(o(192|l>>>6),o(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|t.charCodeAt(++a)&1023,o(240|l>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|l&63)):(o(224|l>>>12),o(128|l>>>6&63),o(128|l&63))}return Su(n,0,i)}function jh(t,e){for(var r="",n=0;n<t.length;){var i=t[n++];r+=String.fromCharCode(i)}return r}const Hh="v1",Gh=t=>{const e={...t,v:Hh};return jh(Bh(Vh(JSON.stringify(e))))};var Wh=2e3,Kh=(function(){function t(e,r,n,i){var o=this,a;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(f){var d=Gh(f);return JSON.stringify(d)},this.addCompressedEventToManager=function(f,d){o.eventsManager&&o.deviceId&&o.eventsManager.addEvent({event:{type:"replay",data:f},sessionId:d,deviceId:o.deviceId})},this.addCompressedEvent=function(f,d){if(o.worker)try{o.worker.postMessage({event:f,sessionId:d})}catch(h){h.name==="DataCloneError"?o.worker.postMessage(JSON.stringify({event:f,sessionId:d})):o.config.loggerProvider.warn("Unexpected error while posting message to worker:",h)}else{var v=o.compressEvent(f);o.addCompressedEventToManager(v,d)}},this.terminate=function(){var f;(f=o.worker)===null||f===void 0||f.terminate()};var s=F();if(this.canUseIdleCallback=s&&"requestIdleCallback"in s,this.eventsManager=e,this.config=r,this.deviceId=n,this.timeout=((a=r.performanceConfig)===null||a===void 0?void 0:a.timeout)||Wh,i){r.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([i],{type:"application/javascript"}),u=URL.createObjectURL(l),c=new Worker(u);c.onerror=function(f){f.preventDefault(),r.loggerProvider.error("Worker failed, falling back to non-worker compression:",f),c.terminate(),o.worker=void 0},c.onmessage=function(f){var d=f.data,v=d.compressedEvent,h=d.sessionId;o.addCompressedEventToManager(v,h)},this.worker=c}catch(f){r.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",f)}}}return t.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(r){e.processQueue(r)},{timeout:this.timeout}))},t.prototype.enqueueEvent=function(e,r){var n;this.canUseIdleCallback&&(!((n=this.config.performanceConfig)===null||n===void 0)&&n.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:r}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,r))},t.prototype.processQueue=function(e){for(var r=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var i=n.event,o=n.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0?requestIdleCallback(function(a){r.processQueue(a)},{timeout:this.timeout}):this.isProcessing=!1},t})(),zh="Unexpected error occurred",$h="Network error occurred, event batch rejected",ua="Session replay event batch rejected due to exceeded retry count",Ct="Failed to store session replay events in IndexedDB",Xh="Session replay event batch not sent due to missing device ID",Yh="Session replay event batch not sent due to missing api key",ni="1.35.1",Jh=(function(){function t(e){var r=e.trackServerUrl,n=e.loggerProvider,i=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=n,this.payloadBatcher=i||function(o){return o},this.trackServerUrl=r}return t.prototype.sendEventsList=function(e){this.addToQueue(C(C({},e),{attempts:0,timeout:0}))},t.prototype.addToQueue=function(){for(var e=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r.filter(function(o){return o.attempts<(o.flushMaxRetries||0)?(o.attempts+=1,!0):(e.completeRequest({context:o,err:ua}),!1)});i.forEach(function(o){e.queue=e.queue.concat(o),e.schedule(0)})},t.prototype.schedule=function(e){var r=this;this.scheduled||(this.scheduled=setTimeout(function(){r.flush(!0).then(function(){r.queue.length>0&&r.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),_(this,void 0,void 0,function(){var r,n,i,o,a,s,l;return T(this,function(u){switch(u.label){case 0:r=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),u.label=1;case 1:u.trys.push([1,6,7,8]),n=q(r),i=n.next(),u.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,this.send(o,e)]);case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=u.sent(),s={error:a},[3,8];case 7:try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(s)throw s.error}return[7];case 8:return[2]}})})},t.prototype.send=function(e,r){var n,i;return r===void 0&&(r=!0),_(this,void 0,void 0,function(){var o,a,s,l,u,c,f,d,v,h,g,m,E;return T(this,function(p){switch(p.label){case 0:if(o=e.apiKey,!o)return[2,this.completeRequest({context:e,err:Yh})];if(a=e.deviceId,!a)return[2,this.completeRequest({context:e,err:Xh})];if(s=Sh(),l=ni,u=e.sampleRate,c=new URLSearchParams({device_id:a,session_id:"".concat(e.sessionId),type:"".concat(e.type)}),f="".concat(((n=e.version)===null||n===void 0?void 0:n.type)||"standalone","/").concat(((i=e.version)===null||i===void 0?void 0:i.version)||l),d=this.payloadBatcher({version:1,events:e.events}),d.events.length===0)return this.completeRequest({context:e}),[2];p.label=1;case 1:return p.trys.push([1,6,,7]),v={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(o),"X-Client-Version":l,"X-Client-Library":f,"X-Client-Url":s.substring(0,mh),"X-Client-Sample-Rate":"".concat(u),"X-Sampling-Hash-Alg":"xxhash32"},body:JSON.stringify(d),method:"POST"},h="".concat(Oi(e.serverZone,this.trackServerUrl),"?").concat(c.toString()),[4,fetch(h,v)];case 2:if(g=p.sent(),g===null)return this.completeRequest({context:e,err:zh}),[2];if(r)return[3,3];m="";try{m=JSON.stringify(g.body,null,2)}catch{}return this.completeRequest({context:e,success:"".concat(g.status,": ").concat(m)}),[3,5];case 3:return[4,this.handleReponse(g.status,e)];case 4:p.sent(),p.label=5;case 5:return[3,7];case 6:return E=p.sent(),this.completeRequest({context:e,err:E}),[3,7];case 7:return[2]}})})},t.prototype.handleReponse=function(e,r){return _(this,void 0,void 0,function(){var n,i;return T(this,function(o){switch(o.label){case 0:switch(n=new dr().buildStatus(e),i=n,i){case pe.Success:return[3,1];case pe.Failed:return[3,2]}return[3,4];case 1:return this.handleSuccessResponse(r),[3,5];case 2:return[4,this.handleOtherResponse(r)];case 3:return o.sent(),[3,5];case 4:this.completeRequest({context:r,err:$h}),o.label=5;case 5:return[2]}})})},t.prototype.handleSuccessResponse=function(e){var r=Math.round(new Blob(e.events).size/cu);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(r," KB")})},t.prototype.handleOtherResponse=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:ua}),[2]):[4,new Promise(function(i){return setTimeout(i,r)})];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}})})},t.prototype.completeRequest=function(e){var r=e.context,n=e.err,i=e.success;r.onComplete(),n?this.loggerProvider.warn(n):i&&this.loggerProvider.log(i)},t})();const ii=(t,e)=>e.some(r=>t instanceof r);let la,ca;function Qh(){return la||(la=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Zh(){return ca||(ca=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const oi=new WeakMap,kn=new WeakMap,an=new WeakMap;function eg(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",a)},o=()=>{r(bt(t.result)),i()},a=()=>{n(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",a)});return an.set(e,t),e}function tg(t){if(oi.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",a),t.removeEventListener("abort",a)},o=()=>{r(),i()},a=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",a),t.addEventListener("abort",a)});oi.set(t,e)}let ai={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return oi.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return bt(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function wu(t){ai=t(ai)}function rg(t){return Zh().includes(t)?function(...e){return t.apply(si(this),e),bt(this.request)}:function(...e){return bt(t.apply(si(this),e))}}function ng(t){return typeof t=="function"?rg(t):(t instanceof IDBTransaction&&tg(t),ii(t,Qh())?new Proxy(t,ai):t)}function bt(t){if(t instanceof IDBRequest)return eg(t);if(kn.has(t))return kn.get(t);const e=ng(t);return e!==t&&(kn.set(t,e),an.set(e,t)),e}const si=t=>an.get(t);function Tu(t,e,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const a=indexedDB.open(t,e),s=bt(a);return n&&a.addEventListener("upgradeneeded",l=>{n(bt(a.result),l.oldVersion,l.newVersion,bt(a.transaction),l)}),r&&a.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),s.then(l=>{o&&l.addEventListener("close",()=>o()),i&&l.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),s}const ig=["get","getKey","getAll","getAllKeys","count"],og=["put","add","delete","clear"],Pn=new Map;function da(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Pn.get(e))return Pn.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=og.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||ig.includes(r)))return;const o=async function(a,...s){const l=this.transaction(a,i?"readwrite":"readonly");let u=l.store;return n&&(u=u.index(s.shift())),(await Promise.all([u[r](...s),i&&l.done]))[0]};return Pn.set(e,o),o}wu(t=>({...t,get:(e,r,n)=>da(e,r)||t.get(e,r,n),has:(e,r)=>!!da(e,r)||t.has(e,r)}));const ag=["continue","continuePrimaryKey","advance"],fa={},ui=new WeakMap,_u=new WeakMap,sg={get(t,e){if(!ag.includes(e))return t[e];let r=fa[e];return r||(r=fa[e]=function(...n){ui.set(this,_u.get(this)[e](...n))}),r}};async function*ug(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,sg);for(_u.set(r,e),an.set(r,si(e));e;)yield r,e=await(ui.get(r)||e.continue()),ui.delete(r)}function va(t,e){return e===Symbol.asyncIterator&&ii(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&ii(t,[IDBIndex,IDBObjectStore])}wu(t=>({...t,get(e,r,n){return va(e,r)?ug:t.get(e,r,n)},has(e,r){return va(e,r)||t.has(e,r)}}));var Iu=(function(){function t(e){var r=this,n,i,o;this.minInterval=gh,this.maxInterval=ph,this.maxPersistedEventsSize=fh,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(a,s){var l=r.getStringSize(s),u=r.getEventsArraySize(a);return u+l>=r.maxPersistedEventsSize?!0:Date.now()-r.timeAtLastSplit>r.interval&&a.length?(r.interval=Math.min(r.maxInterval,r.interval+r.minInterval),r._timeAtLastSplit=Date.now(),!0):!1},this.loggerProvider=e.loggerProvider,this.minInterval=(n=e.minInterval)!==null&&n!==void 0?n:this.minInterval,this.maxInterval=(i=e.maxInterval)!==null&&i!==void 0?i:this.maxInterval,this.maxPersistedEventsSize=(o=e.maxPersistedEventsSize)!==null&&o!==void 0?o:this.maxPersistedEventsSize}return Object.defineProperty(t.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),t.prototype.getStringSize=function(e){return e.length},t.prototype.getEventsArraySize=function(e){var r,n,i=0;try{for(var o=q(e),a=o.next();!a.done;a=o.next()){var s=a.value;i+=this.getStringSize(s)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var l=2+Math.max(0,e.length-1)+e.length*2;return i+l},t})(),lg=function(t){return typeof t=="object"&&t!==null&&t.name==="AbortError"},tt=function(t,e,r){lg(r)?t.debug(e):t.warn(e)},ar="sessionCurrentSequence",sr="sequencesToSend",cg=function(t){var e,r;return t.objectStoreNames.contains(ar)||(r=t.createObjectStore(ar,{keyPath:"sessionId"})),t.objectStoreNames.contains(sr)||(e=t.createObjectStore(sr,{keyPath:"sequenceId",autoIncrement:!0}),e.createIndex("sessionId","sessionId")),{sequencesStore:e,currentSequenceStore:r}},dg=function(t){return _(void 0,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,Tu(t,1,{upgrade:cg})];case 1:return[2,e.sent()]}})})},fg=(function(t){Fe(e,t);function e(r){var n=t.call(this,r)||this;return n.getSequencesToSend=function(){return _(n,void 0,void 0,function(){var i,o,a,s,l,u;return T(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),i=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:o=c.sent(),c.label=2;case 2:return o?(a=o.value,s=a.sessionId,l=a.events,i.push({events:l,sequenceId:o.key,sessionId:s}),[4,o.continue()]):[3,4];case 3:return o=c.sent(),[3,2];case 4:return[2,i];case 5:return u=c.sent(),tt(this.loggerProvider,"".concat(Ct,": ").concat(u),u),[3,6];case 6:return[2,void 0]}})})},n.storeCurrentSequence=function(i){return _(n,void 0,void 0,function(){var o,a,s;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,this.db.get(ar,i)];case 1:return o=l.sent(),o?[4,this.db.put(sr,{sessionId:i,events:o.events})]:[2,void 0];case 2:return a=l.sent(),[4,this.db.put(ar,{sessionId:i,events:[]})];case 3:return l.sent(),[2,C(C({},o),{sessionId:i,sequenceId:a})];case 4:return s=l.sent(),tt(this.loggerProvider,"".concat(Ct,": ").concat(s),s),[3,5];case 5:return[2,void 0]}})})},n.addEventToCurrentSequence=function(i,o){return _(n,void 0,void 0,function(){var a,s,l,u,c,f;return T(this,function(d){switch(d.label){case 0:return d.trys.push([0,10,,11]),a=this.db.transaction(ar,"readwrite"),[4,a.store.get(i)];case 1:return s=d.sent(),s?[3,3]:[4,a.store.put({sessionId:i,events:[o]})];case 2:return d.sent(),[2];case 3:return l=void 0,this.shouldSplitEventsList(s.events,o)?(l=s.events,[4,a.store.put({sessionId:i,events:[o]})]):[3,5];case 4:return d.sent(),[3,7];case 5:return u=s.events.concat(o),[4,a.store.put({sessionId:i,events:u})];case 6:d.sent(),d.label=7;case 7:return[4,a.done];case 8:return d.sent(),l?[4,this.storeSendingEvents(i,l)]:[2,void 0];case 9:return c=d.sent(),c?[2,{events:l,sessionId:i,sequenceId:c}]:[2,void 0];case 10:return f=d.sent(),tt(this.loggerProvider,"".concat(Ct,": ").concat(f),f),[3,11];case 11:return[2,void 0]}})})},n.storeSendingEvents=function(i,o){return _(n,void 0,void 0,function(){var a,s;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),[4,this.db.put(sr,{sessionId:i,events:o})];case 1:return a=l.sent(),[2,a];case 2:return s=l.sent(),tt(this.loggerProvider,"".concat(Ct,": ").concat(s),s),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(i,o){return _(n,void 0,void 0,function(){var a;return T(this,function(s){switch(s.label){case 0:if(!o)return[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.db.delete(sr,o)];case 2:return s.sent(),[3,4];case 3:return a=s.sent(),tt(this.loggerProvider,"".concat(Ct,": ").concat(a),a),[3,4];case 4:return[2]}})})},n.db=r.db,n}return e.new=function(r,n){return _(this,void 0,void 0,function(){var i,o,a,s;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),i=r==="replay"?"":"_".concat(r),o="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,dg(o)];case 1:return a=l.sent(),[2,new e(C(C({},n),{db:a}))];case 2:return s=l.sent(),tt(n.loggerProvider,"".concat(Ct,": ").concat(s),s),[3,3];case 3:return[2]}})})},e.prototype.getCurrentSequenceEvents=function(r){return _(this,void 0,void 0,function(){var a,n,i,o,a,s,l,u;return T(this,function(c){switch(c.label){case 0:return r?[4,this.db.get("sessionCurrentSequence",r)]:[3,2];case 1:return a=c.sent(),a?[2,[a]]:[2,void 0];case 2:n=[],c.label=3;case 3:return c.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=q.apply(void 0,[c.sent()]),o=i.next(),c.label=5;case 5:if(o.done)return[3,7];a=o.value,n.push(a),c.label=6;case 6:return o=i.next(),[3,5];case 7:return[3,10];case 8:return s=c.sent(),l={error:s},[3,10];case 9:try{o&&!o.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}return[7];case 10:return[2,n]}})})},e})(Iu),vg=(function(t){Fe(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.finalizedSequences={},r.sequences={},r.sequenceId=0,r}return e.prototype.resetCurrentSequence=function(r){this.sequences[r]=[]},e.prototype.addSequence=function(r){var n=this.sequenceId++,i=$([],D(this.sequences[r]),!1);return this.finalizedSequences[n]={sessionId:r,events:i},this.resetCurrentSequence(r),{sequenceId:n,events:i,sessionId:r}},e.prototype.getSequencesToSend=function(){return _(this,void 0,void 0,function(){return T(this,function(r){return[2,Object.entries(this.finalizedSequences).map(function(n){var i=D(n,2),o=i[0],a=i[1],s=a.sessionId,l=a.events;return{sequenceId:Number(o),sessionId:s,events:l}})]})})},e.prototype.storeCurrentSequence=function(r){return _(this,void 0,void 0,function(){return T(this,function(n){return this.sequences[r]?[2,this.addSequence(r)]:[2,void 0]})})},e.prototype.addEventToCurrentSequence=function(r,n){return _(this,void 0,void 0,function(){var i;return T(this,function(o){return this.sequences[r]||this.resetCurrentSequence(r),this.shouldSplitEventsList(this.sequences[r],n)&&(i=this.addSequence(r)),this.sequences[r].push(n),[2,i]})})},e.prototype.storeSendingEvents=function(r,n){return _(this,void 0,void 0,function(){return T(this,function(i){return this.finalizedSequences[this.sequenceId]={sessionId:r,events:n},[2,this.sequenceId++]})})},e.prototype.cleanUpSessionEventsStore=function(r,n){return _(this,void 0,void 0,function(){return T(this,function(i){return n!==void 0&&delete this.finalizedSequences[n],[2]})})},e})(Iu),ha=function(t){var e=t.config,r=t.minInterval,n=t.maxInterval,i=t.type,o=t.payloadBatcher,a=t.storeType;return _(void 0,void 0,void 0,function(){function s(E){return E===void 0&&(E=!1),_(this,void 0,void 0,function(){return T(this,function(p){return[2,l.flush(E)]})})}var l,u,c,f,d,v,h,g,m;return T(this,function(E){switch(E.label){case 0:return l=new Jh(C(C({},e),{loggerProvider:e.loggerProvider,payloadBatcher:o})),u=function(){return new vg({loggerProvider:e.loggerProvider,maxInterval:n,minInterval:r})},c=function(){return _(void 0,void 0,void 0,function(){var p;return T(this,function(y){switch(y.label){case 0:return[4,fg.new(i,{loggerProvider:e.loggerProvider,minInterval:r,maxInterval:n,apiKey:e.apiKey})];case 1:return p=y.sent(),p?[2,p]:(e.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,u()])}})})},a!=="idb"?[3,2]:[4,c()];case 1:return d=E.sent(),[3,3];case 2:d=u(),E.label=3;case 3:return f=d,v=function(p){var y=p.events,b=p.sessionId,S=p.deviceId,w=p.sequenceId;e.debugMode&&vu().then(function(A){var I=A.totalStorageSize,k=A.percentOfQuota,x=A.usageDetails;e.loggerProvider.debug("Total storage size: ".concat(I," KB, percentage of quota: ").concat(k,"%, usage details: ").concat(x))}).catch(function(){}),l.sendEventsList({events:y,sessionId:b,flushMaxRetries:e.flushMaxRetries,apiKey:e.apiKey,deviceId:S,sampleRate:e.sampleRate,serverZone:e.serverZone,version:e.version,type:i,onComplete:function(){return _(void 0,void 0,void 0,function(){return T(this,function(A){switch(A.label){case 0:return[4,f.cleanUpSessionEventsStore(b,w)];case 1:return A.sent(),[2]}})})}})},h=function(p){var y=p.sessionId,b=p.deviceId;f.storeCurrentSequence(y).then(function(S){S&&v({sequenceId:S.sequenceId,events:S.events,sessionId:S.sessionId,deviceId:b})}).catch(function(S){e.loggerProvider.warn("Failed to get current sequence of session replay events for session:",S)})},g=function(p){var y=p.deviceId;return _(void 0,void 0,void 0,function(){var b;return T(this,function(S){switch(S.label){case 0:return[4,f.getSequencesToSend()];case 1:return b=S.sent(),b&&b.forEach(function(w){v({sequenceId:w.sequenceId,events:w.events,sessionId:w.sessionId,deviceId:y})}),[2]}})})},m=function(p){var y=p.event,b=p.sessionId,S=p.deviceId;f.addEventToCurrentSequence(b,y.data).then(function(w){return w&&v({sequenceId:w.sequenceId,events:w.events,sessionId:w.sessionId,deviceId:S})}).catch(function(w){e.loggerProvider.warn("Failed to add event to session replay capture:",w)})},[2,{sendCurrentSequenceEvents:h,addEvent:m,sendStoredEvents:g,flush:s}]}})})},ga=(function(){function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=new Map;e.forEach(function(i){n.set(i.name,i.manager)}),this.managers=n}return t.prototype.sendStoredEvents=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=[],this.managers.forEach(function(i){r.push(i.sendStoredEvents(e))}),[4,Promise.all(r)];case 1:return n.sent(),[2]}})})},t.prototype.addEvent=function(e){var r,n=e.sessionId,i=e.event,o=e.deviceId;(r=this.managers.get(i.type))===null||r===void 0||r.addEvent({sessionId:n,event:i,deviceId:o})},t.prototype.sendCurrentSequenceEvents=function(e){var r=e.sessionId,n=e.deviceId;this.managers.forEach(function(i){i.sendCurrentSequenceEvents({sessionId:r,deviceId:n})})},t.prototype.flush=function(e){return _(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=[],this.managers.forEach(function(i){r.push(i.flush(e))}),[4,Promise.all(r)];case 1:return n.sent(),[2]}})})},t})(),Ue,Ni,Au;function hg(t,e){if(Au=new Date,t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return"html";var r={root:document.body,idName:function(o){return!0},className:function(o){return!0},tagName:function(o){return!0},attr:function(o,a){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};Ue=C(C({},r),e),Ni=gg(Ue.root,r);var n=Ir(t,"all",function(){return Ir(t,"two",function(){return Ir(t,"one",function(){return Ir(t,"none")})})});if(n){var i=Pu(Ou(n,t));return i.length>0&&(n=i[0]),sn(n)}else throw new Error("Selector was not found.")}function gg(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function Ir(t,e,r){for(var n=null,i=[],o=t,a=0,s=function(){var u,c,f=new Date().getTime()-Au.getTime();if(Ue.timeoutMs!==void 0&&f>Ue.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(f,"ms"));var d=Cr(pg(o))||Cr.apply(void 0,$([],D(mg(o)),!1))||Cr.apply(void 0,$([],D(yg(o)),!1))||Cr(bg(o))||[ya()],v=Eg(o);if(e=="all")v&&(d=d.concat(d.filter(On).map(function(p){return Ar(p,v)})));else if(e=="two")d=d.slice(0,1),v&&(d=d.concat(d.filter(On).map(function(p){return Ar(p,v)})));else if(e=="one"){var h=D(d=d.slice(0,1),1),g=h[0];v&&On(g)&&(d=[Ar(g,v)])}else e=="none"&&(d=[ya()],v&&(d=[Ar(d[0],v)]));try{for(var m=(u=void 0,q(d)),E=m.next();!E.done;E=m.next()){var g=E.value;g.level=a}}catch(p){u={error:p}}finally{try{E&&!E.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}if(i.push(d),i.length>=Ue.seedMinLength&&(n=pa(i,r),n))return"break";o=o.parentElement,a++};o;){var l=s();if(l==="break")break}return n||(n=pa(i,r)),!n&&r?r():n}function pa(t,e){var r,n,i=Pu(ku(t));if(i.length>Ue.threshold)return e?e():null;try{for(var o=q(i),a=o.next();!a.done;a=o.next()){var s=a.value;if(Cu(s))return s}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function sn(t){for(var e=t[0],r=e.name,n=1;n<t.length;n++){var i=t[n].level||0;e.level===i-1?r="".concat(t[n].name," > ").concat(r):r="".concat(t[n].name," ").concat(r),e=t[n]}return r}function ma(t){return t.map(function(e){return e.penalty}).reduce(function(e,r){return e+r},0)}function Cu(t){var e=sn(t);switch(Ni.querySelectorAll(e).length){case 0:throw new Error("Can't select any node with this selector: ".concat(e));case 1:return!0;default:return!1}}function pg(t){var e=t.getAttribute("id");return e&&Ue.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null}function mg(t){var e=Array.from(t.attributes).filter(function(r){return Ue.attr(r.name,r.value)});return e.map(function(r){return{name:"[".concat(CSS.escape(r.name),'="').concat(CSS.escape(r.value),'"]'),penalty:.5}})}function yg(t){var e=Array.from(t.classList).filter(Ue.className);return e.map(function(r){return{name:"."+CSS.escape(r),penalty:1}})}function bg(t){var e=t.tagName.toLowerCase();return Ue.tagName(e)?{name:e,penalty:2}:null}function ya(){return{name:"*",penalty:3}}function Eg(t){var e=t.parentNode;if(!e)return null;var r=e.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==t);)r=r.nextSibling;return n}function Ar(t,e){return{name:t.name+":nth-child(".concat(e,")"),penalty:t.penalty+1}}function On(t){return t.name!=="html"&&!t.name.startsWith("#")}function Cr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.filter(Sg);return r.length>0?r:null}function Sg(t){return t!=null}function ku(t,e){var r,n,i,o,a,s;return e===void 0&&(e=[]),T(this,function(l){switch(l.label){case 0:if(!(t.length>0))return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),r=q(t[0]),n=r.next(),l.label=2;case 2:return n.done?[3,5]:(i=n.value,[5,q(ku(t.slice(1,t.length),e.concat(i)))]);case 3:l.sent(),l.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),a={error:o},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}return[7];case 8:return[3,11];case 9:return[4,e];case 10:l.sent(),l.label=11;case 11:return[2]}})}function Pu(t){return $([],D(t),!1).sort(function(e,r){return ma(e)-ma(r)})}function Ou(t,e,r){var n,i,o;return r===void 0&&(r={counter:0,visited:new Map}),T(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>Ue.optimizedMinLength))return[3,5];n=1,a.label=1;case 1:return n<t.length-1?r.counter>Ue.maxNumberOfTries?[2]:(r.counter+=1,i=$([],D(t),!1),i.splice(n,1),o=sn(i),r.visited.has(o)?[2]:Cu(i)&&wg(i,e)?[4,i]:[3,4]):[3,5];case 2:return a.sent(),r.visited.set(o,!0),[5,q(Ou(i,e,r))];case 3:a.sent(),a.label=4;case 4:return n++,[3,1];case 5:return[2]}})}function wg(t,e){return Ni.querySelector(sn(t))===e}var Tg=36e5,_g=function(t){var e=t.version,r=t.events,n=[];return r.forEach(function(i){var o=JSON.parse(i);o.count=1,o.type==="click"&&n.push(o)}),{version:e,events:n}},Ig=function(t){var e=t.version,r=t.events,n=[];r.forEach(function(o){var a=JSON.parse(o);a.type==="click"&&n.push(a)});var i=n.reduce(function(o,a){var s=a.x,l=a.y,u=a.selector,c=a.timestamp,f=c-c%Tg,d="".concat(s,":").concat(l,":").concat(u??"",":").concat(f);return o[d]?o[d].count+=1:o[d]=C(C({},a),{timestamp:f,count:1}),o},{});return{version:e,events:Object.values(i)}},Ag=(function(){function t(e,r){var n=this;this.createHook=function(i){var o=i.eventsManager,a=i.sessionId,s=i.deviceIdFn,l=i.mirror,u=i.ugcFilterRules,c=i.performanceOptions;return function(f){if(f.type===mu.Click){var d=F();if(d){var v=d.location,h=d.innerHeight,g=d.innerWidth;if(v){var m=f.x,E=f.y;if(!(m===void 0||E===void 0)){var p=l.getNode(f.id),y;if(p)try{y=hg(p,c)}catch{n.logger.debug("error resolving selector from finder")}var b=on(v.href,u),S={x:m+n.scrollWatcher.currentScrollX,y:E+n.scrollWatcher.currentScrollY,selector:y,viewportHeight:h,viewportWidth:g,pageUrl:b,timestamp:Date.now(),type:"click"},w=s();w&&o.addEvent({sessionId:a,event:{type:"interaction",data:JSON.stringify(S)},deviceId:w})}}}}}},this.logger=e,this.scrollWatcher=r}return t})();function Rn(){var t=F();return t?.innerHeight||document.documentElement&&document.documentElement.clientHeight||0}function xn(){var t=F();return t?.innerWidth||document.documentElement&&document.documentElement.clientWidth||0}var Cg=(function(){function t(e,r){var n=F();n&&n.navigator&&typeof n.navigator.sendBeacon=="function"?this.sendBeacon=function(i,o){try{if(n.navigator.sendBeacon(i,JSON.stringify(o)))return!0}catch{}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(i,o){var a=new XMLHttpRequest;return a.open("POST",i,!0),a.setRequestHeader("Accept","*/*"),a.send(JSON.stringify(o)),!0},this.basePageUrl=Oi(r.serverZone,r.trackServerUrl),this.apiKey=r.apiKey,this.context=e}return t.prototype.send=function(e,r){var n=this.context,i=n.sessionId,o=n.type,a=new URLSearchParams({device_id:e,session_id:String(i),type:String(o),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(a.toString());this.sendBeacon(s,r)||this.sendXhr(s,r)},t})(),kg=(function(){function t(e,r){var n=this;this.timestamp=Date.now(),this.hook=function(i){n.update(i)},this.send=function(i){return function(o){var a,s,l,u,c=i(),f=F();if(f&&c){var d=(a=f.scrollX)!==null&&a!==void 0?a:0,v=(s=f.scrollY)!==null&&s!==void 0?s:0;(d>0||v>0)&&n.update({id:1,x:d,y:v}),n.transport.send(c,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:Rn(),viewportWidth:xn(),pageUrl:on(f.location.href,(u=(l=n.config.interactionConfig)===null||l===void 0?void 0:l.ugcFilterRules)!==null&&u!==void 0?u:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=xn(),this._maxScrollHeight=Rn(),this.config=r,this.transport=e}return t.default=function(e,r){return new t(new Cg(e,r),r)},Object.defineProperty(t.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),t.prototype.update=function(e){var r=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var n=xn();this._maxScrollX=e.x;var i=e.x+n;i>this._maxScrollWidth&&(this._maxScrollWidth=i),this.timestamp=r}if(e.y>this._maxScrollY){var o=Rn();this._maxScrollY=e.y;var a=e.y+o;a>this._maxScrollHeight&&(this._maxScrollHeight=a),this.timestamp=r}},t})(),ba=(function(){function t(e){var r=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=r,r&&n&&(this.sessionReplayId=wh(r,n))}return t})(),Pg=1e3*60*60*24*2,Og=(function(){function t(){var e=this;this.dbs={},this.createStore=function(r){return _(e,void 0,void 0,function(){return T(this,function(n){switch(n.label){case 0:return[4,Tu(r,1,{upgrade:function(i){i.objectStoreNames.contains("sessionTargetingMatch")||i.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,n.sent()]}})})},this.openOrCreateDB=function(r){return _(e,void 0,void 0,function(){var n,i;return T(this,function(o){switch(o.label){case 0:return this.dbs&&this.dbs[r]?[2,this.dbs[r]]:(n="".concat(r.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(n)]);case 1:return i=o.sent(),this.dbs[r]=i,[2,i]}})})},this.getTargetingMatchForSession=function(r){var n=r.loggerProvider,i=r.apiKey,o=r.sessionId;return _(e,void 0,void 0,function(){var a,s,l,u;return T(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),[4,this.openOrCreateDB(i)];case 1:return a=c.sent(),s=String(o),[4,a.get("sessionTargetingMatch",s)];case 2:return l=c.sent(),[2,l?.targetingMatch];case 3:return u=c.sent(),tt(n,"Failed to get targeting match for session id ".concat(o,": ").concat(u),u),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(r){var n=r.loggerProvider,i=r.apiKey,o=r.sessionId,a=r.targetingMatch;return _(e,void 0,void 0,function(){var s,l,u,c;return T(this,function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),[4,this.openOrCreateDB(i)];case 1:return s=f.sent(),l=String(o),[4,s.put("sessionTargetingMatch",{targetingMatch:a,sessionId:l,lastUpdated:Date.now()})];case 2:return u=f.sent(),[2,u];case 3:return c=f.sent(),tt(n,"Failed to store targeting match for session id ".concat(o,": ").concat(c),c),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(r){var n=r.loggerProvider,i=r.apiKey,o=r.currentSessionId;return _(e,void 0,void 0,function(){var a,s,l,u,c,f,d,v;return T(this,function(h){switch(h.label){case 0:return h.trys.push([0,8,,9]),[4,this.openOrCreateDB(i)];case 1:return a=h.sent(),s=String(o),l=a.transaction("sessionTargetingMatch","readwrite"),[4,l.store.getAll()];case 2:u=h.sent(),c=0,h.label=3;case 3:return c<u.length?(f=u[c],d=Date.now()-f.lastUpdated,f.sessionId!==s&&d>Pg?[4,l.store.delete(f.sessionId)]:[3,5]):[3,6];case 4:h.sent(),h.label=5;case 5:return c++,[3,3];case 6:return[4,l.done];case 7:return h.sent(),[3,9];case 8:return v=h.sent(),tt(n,"Failed to clear old targeting matches for sessions: ".concat(v),v),[3,9];case 9:return[2]}})})}}return t})(),Nn=new Og,Rg=function(t){var e=t.sessionId,r=t.targetingConfig,n=t.loggerProvider,i=t.apiKey,o=t.targetingParams,a=t.urlChange,s=a===void 0?!1:a;return _(void 0,void 0,void 0,function(){var l,u,c,f,d,v,h;return T(this,function(g){switch(g.label){case 0:return[4,Nn.clearStoreOfOldSessions({loggerProvider:n,apiKey:i,currentSessionId:e})];case 1:return g.sent(),[4,Nn.getTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:e})];case 2:if(l=g.sent(),l===!0&&!s)return[2,!0];u=!0,g.label=3;case 3:return g.trys.push([3,6,,7]),[4,Qt(()=>import("./DqeYcxy-.js"),[])];case 4:return c=g.sent().evaluateTargeting,f=C(C({},o),{flag:r,sessionId:typeof e=="string"?parseInt(e,10):e,apiKey:i,loggerProvider:n}),[4,c(f)];case 5:return d=g.sent(),d&&d.sr_targeting_config&&(u=d.sr_targeting_config.key==="on"),Nn.storeTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:e,targetingMatch:u}),[3,7];case 6:return v=g.sent(),h=v,n.warn(h.message),[3,7];case 7:return[2,u]}})})},Dr=2654435761,Mr=2246822519,Ea=3266489917,xg=668265263,Sa=374761393;function pt(t,e){return(t<<e|t>>>32-e)>>>0}function kr(t,e){return t=t+Math.imul(e,Mr)>>>0,t=pt(t,13),t=Math.imul(t,Dr)>>>0,t}function Yt(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function Ng(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<t.length){var i=t.charCodeAt(r+1);i>=56320&&i<=57343&&(n=(n-55296<<10)+(i-56320)+65536,r++)}n<128?e.push(n):n<2048?e.push(192|n>>6,128|n&63):n<65536?e.push(224|n>>12,128|n>>6&63,128|n&63):e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return new Uint8Array(e)}function Lg(t,e){e===void 0&&(e=0);var r=Ng(t),n=r.length,i,o=0;if(n>=16){for(var a=e+Dr+Mr>>>0,s=e+Mr>>>0,l=e>>>0,u=e-Dr>>>0;o<=n-16;)a=kr(a,Yt(r,o)),o+=4,s=kr(s,Yt(r,o)),o+=4,l=kr(l,Yt(r,o)),o+=4,u=kr(u,Yt(r,o)),o+=4;i=pt(a,1)+pt(s,7)+pt(l,12)+pt(u,18)>>>0}else i=e+Sa>>>0;for(i=i+n>>>0;o<=n-4;)i=i+Math.imul(Yt(r,o),Ea)>>>0,i=Math.imul(pt(i,17),xg)>>>0,o+=4;for(;o<n;)i=i+Math.imul(r[o],Sa)>>>0,i=Math.imul(pt(i,11),Dr)>>>0,o++;return i^=i>>>15,i=Math.imul(i,Mr)>>>0,i^=i>>>13,i=Math.imul(i,Ea)>>>0,i^=i>>>16,i>>>0}function Dg(t,e){var r=Lg(t.toString()),n=r%1e6;return n/1e6<e}var Ln="__amplitude_url_tracking_patched__",wa=new WeakMap;function Ru(t,e,r){if(r===void 0&&(r={}),!t?.location)return function(){};var n=r.enablePolling,i=n===void 0?!1:n,o=r.pollingInterval,a=o===void 0?Pi:o;if(i){var s=function(){var b;return(b=t.location.href)!==null&&b!==void 0?b:""},l=s(),u=t.setInterval(function(){var b=s();b!==l&&(l=b,e(b))},a);return function(){u!=null&&t.clearInterval(u)}}var c=wa.get(t);if(!c){var f=void 0,d=new Set,v=function(){var b;return(b=t.location.href)!==null&&b!==void 0?b:""},h=function(){var b=v();f!==void 0&&b===f||(f=b,d.forEach(function(S){return S(b)}))},g=function(b){var S=function(){for(var w=[],A=0;A<arguments.length;A++)w[A]=arguments[A];var I=b.apply(this,w);return h(),I};return S[Ln]=!0,S},m=t.history;if(m?.pushState){var E=Reflect.get(m,"pushState");E[Ln]||(m.pushState=g(E))}if(m?.replaceState){var p=Reflect.get(m,"replaceState");p[Ln]||(m.replaceState=g(p))}c={callbacks:d,notify:h,onPopStateOrHashChange:function(){return h()},listenersAttached:!1},wa.set(t,c)}var y=c;return y.listenersAttached||(t.addEventListener("popstate",y.onPopStateOrHashChange),t.addEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!0),y.callbacks.add(e),function(){y.callbacks.delete(e),y.callbacks.size===0&&y.listenersAttached&&(t.removeEventListener("popstate",y.onPopStateOrHashChange),t.removeEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!1)}}function xu(t){return t===void 0&&(t={}),{name:"amplitude/url-tracking@1",observer:function(e,r,n){var i,o,a,s=C(C({},t),n),l=s.ugcFilterRules||[],u=(i=s.enablePolling)!==null&&i!==void 0?i:!1,c=(o=s.pollingInterval)!==null&&o!==void 0?o:Pi,f=(a=s.captureDocumentTitle)!==null&&a!==void 0?a:!1;if(!r)return function(){};var d=void 0,v=function(){return r.location&&r.location.href||""},h=function(){var E=r.innerHeight,p=r.innerWidth,y=r.document,b=v(),S="";f&&(S=y?.title||"");var w=l.length>0?on(b,l):b;return{href:w,title:S,viewportHeight:E,viewportWidth:p,type:"url-change-event"}},g=function(){var E=v();if(d===void 0||E!==d){d=E;var p=h();e(p)}},m=Ru(r,function(){return g()},u?{enablePolling:!0,pollingInterval:c}:{});return g(),function(){return m()}},options:t}}xu();var Mg=(function(){function t(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.urlChangeCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(r){var n=F();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),!r&&n.addEventListener("blur",e.blurListener),!r&&n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),!r&&n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),!r&&n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(r){e.pageLeaveFns.forEach(function(n){n(r)})},this.evaluateTargetingAndCapture=function(r,n,i,o){return n===void 0&&(n=!1),i===void 0&&(i=!1),o===void 0&&(o=!1),_(e,void 0,void 0,function(){var a,s,l,u,c,f,d,v,h,g,m,E,p;return T(this,function(y){switch(y.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig)if(n)this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");else return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];return this.lastTargetingParams=r,a=this.config.targetingConfig,s=a&&!this.sessionTargetingMatch,s?(l=o?this.latestUrlChangeTargetingEvaluationId:void 0,u=r.event,u&&Object.values(xe).includes(u.event_type)&&(u=void 0),c=(E=(h=(v=r.page)===null||v===void 0?void 0:v.url)!==null&&h!==void 0?h:(m=(g=F())===null||g===void 0?void 0:g.location)===null||m===void 0?void 0:m.href)!==null&&E!==void 0?E:"",f=(p=r.page)!==null&&p!==void 0?p:c!==""?{url:c}:void 0,[4,Rg({sessionId:this.identifiers.sessionId,targetingConfig:a,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:r.userProperties,event:u,page:f},urlChange:o})]):[3,2];case 1:if(d=y.sent(),o&&l!==void 0&&l!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(l,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||d,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:u,targetingParams:r},null,2)),y.label=2;case 2:return n?(this.initialize(!0),[3,5]):[3,3];case 3:return i||!this.recordCancelCallback?(this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()]):[3,5];case 4:y.sent(),y.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(r,n,i){return n===void 0&&(n={}),i===void 0&&(i=!0),_(e,void 0,void 0,function(){var o,a,s,l;return T(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),o=void 0,a=this.config,a&&r!==at.METADATA?(o={config:hu(a),version:ni},i?[4,vu()]:[3,2]):[3,2];case 1:s=u.sent(),o=C(C({},s),o),u.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(r,C(C({},n),o)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(r," due to no ongoing recording.")),[3,4];case 3:return l=u.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",l),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var r;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,(r=e.networkObservers)===null||r===void 0||r.stop()}catch(i){var n=i;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(n.toString()))}},this.loggerProvider=new Jn(new Dt)}return t.prototype.init=function(e,r){return Te(this._init(e,r))},t.prototype.setupUrlChangeListenerForTargeting=function(){var e=this,r;(r=this.urlChangeCleanup)===null||r===void 0||r.call(this);var n=F();if(n?.location){var i=function(a){var s=++e.latestUrlChangeTargetingEvaluationId;e.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:a}},!1,!1,!0),e.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(s," for ").concat(a,"."))},o=Ru(n,i);this.urlChangeCleanup=function(){o(),e.urlChangeCleanup=null}}},t.prototype.getCurrentPageForTargeting=function(){var e,r,n=(r=(e=F())===null||e===void 0?void 0:e.location)===null||r===void 0?void 0:r.href;return n!=null?{url:n}:void 0},t.prototype._init=function(e,r){var n,i,o,a,s,l,u,c;return _(this,void 0,void 0,function(){var f,d,v,h,g,m,E,p,y,b,I,S,w,A,I,k,x,P,R;return T(this,function(O){switch(O.label){case 0:return(n=this.urlChangeCleanup)===null||n===void 0||n.call(this),this.loggerProvider=new Jn(r.loggerProvider||new Dt),Object.prototype.hasOwnProperty.call(r,"logLevel")&&this.loggerProvider.enable(r.logLevel),this.identifiers=new ba({sessionId:r.sessionId,deviceId:r.deviceId}),f=this,[4,Ph(e,r)];case 1:return f.joinedConfigGenerator=O.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:d=O.sent(),v=d.joinedConfig,h=d.localConfig,g=d.remoteConfig,this.config=v,this.setMetadata(r.sessionId,v,h,g,(i=r.version)===null||i===void 0?void 0:i.version,ni,(o=r.version)===null||o===void 0?void 0:o.type),r.sessionId&&(!((a=this.config.interactionConfig)===null||a===void 0)&&a.enabled)&&(m=kg.default({sessionId:r.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[m.send(this.getDeviceId.bind(this)).bind(m)],this.scrollHook=m.hook.bind(m),this.clickHandler=new Ag(this.loggerProvider,m)),E=[],p=this.config.storeType,p==="idb"&&!(!((s=F())===null||s===void 0)&&s.indexedDB)&&(p="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(p," for event storage.")),O.label=3;case 3:return O.trys.push([3,5,,6]),[4,ha({config:this.config,type:"replay",storeType:p})];case 4:return y=O.sent(),E.push({name:"replay",manager:y}),[3,6];case 5:return b=O.sent(),I=b,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(I.toString())),[3,6];case 6:if(!(!((l=this.config.interactionConfig)===null||l===void 0)&&l.enabled))return[3,10];S=this.config.interactionConfig.batch?Ig:_g,O.label=7;case 7:return O.trys.push([7,9,,10]),[4,ha({config:this.config,type:"interaction",minInterval:(u=this.config.interactionConfig.trackEveryNms)!==null&&u!==void 0?u:vh,maxInterval:hh,payloadBatcher:S,storeType:p})];case 8:return w=O.sent(),E.push({name:"interaction",manager:w}),[3,10];case 9:return A=O.sent(),I=A,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(I.toString())),[3,10];case 10:return this.eventsManager=new(ga.bind.apply(ga,$([void 0],D(E),!1))),this.eventCompressor&&this.eventCompressor.terminate(),k=void 0,x=F(),this.config.useWebWorker&&x&&x.Worker?[4,Qt(()=>import("./D7Bf6Say.js"),[])]:[3,12];case 11:P=O.sent().compressionScript,k=P,O.label=12;case 12:return this.eventCompressor=new Kh(this.eventsManager,this.config,this.getDeviceId(),k),[4,this.initializeNetworkObservers()];case 13:return O.sent(),!((c=F())===null||c===void 0)&&c.opener&&(R=ys(),bs(R),R.setup(C({logger:this.loggerProvider},this.config.serverZone&&{endpoint:ps[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:r.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 14:return O.sent(),this.config.targetingConfig&&this.setupUrlChangeListenerForTargeting(),[2]}})})},t.prototype.setSessionId=function(e,r){return Te(this.asyncSetSessionId(e,r))},t.prototype.asyncSetSessionId=function(e,r,n){var i;return _(this,void 0,void 0,function(){var o,a,s;return T(this,function(l){switch(l.label){case 0:return this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,o=this.identifiers&&this.identifiers.sessionId,o&&this.sendEvents(o),a=r||this.getDeviceId(),this.identifiers=new ba({sessionId:e,deviceId:a}),this.joinedConfigGenerator&&o?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2];case 1:s=l.sent().joinedConfig,this.config=s,l.label=2;case 2:return!((i=this.config)===null||i===void 0)&&i.targetingConfig?[4,this.evaluateTargetingAndCapture({userProperties:n?.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return l.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:l.sent(),l.label=6;case 6:return[2]}})})},t.prototype.getSessionReplayProperties=function(){var e,r=this.config,n=this.identifiers;if(!r||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var i=this.getShouldRecord(),o={};return i&&(o=(e={},e[oh]=n.sessionReplayId?n.sessionReplayId:null,e),r.debugMode&&(o[lh]=JSON.stringify({appHash:Vn(r.apiKey).toString()}))),this.addCustomRRWebEvent(at.GET_SR_PROPS,{shouldRecord:i,eventProperties:o},this.eventCount===10),this.eventCount===10&&(this.eventCount=0),this.eventCount++,o},t.prototype.sendEvents=function(e){var r,n=e||((r=this.identifiers)===null||r===void 0?void 0:r.sessionId),i=this.getDeviceId();this.eventsManager&&n&&i&&this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:i})},t.prototype.initialize=function(e){var r;return e===void 0&&(e=!1),_(this,void 0,void 0,function(){var n;return T(this,function(i){return!((r=this.identifiers)===null||r===void 0)&&r.sessionId?(n=this.getDeviceId(),n?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()])):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},t.prototype.shouldOptOut=function(){var e,r,n;if(!((e=this.config)===null||e===void 0)&&e.instanceName){var i=Mt(this.config.instanceName).identityStore;n=i.getIdentity().optOut}return n!==void 0?n:(r=this.config)===null||r===void 0?void 0:r.optOut},t.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e=!1,r="",n=!1;if(this.config.targetingConfig)this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),e=!0,n=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),e=!1,n=!1);else{var i=Dg(this.identifiers.sessionId,this.config.sampleRate);i?(e=!0,n=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),e=!1,n=!1)}return this.lastShouldRecordDecision!==e&&this.config.targetingConfig&&(this.addCustomRRWebEvent(at.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:n,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=e),e},t.prototype.getBlockSelectors=function(){var e,r,n,i=(n=(r=(e=this.config)===null||e===void 0?void 0:e.privacyConfig)===null||r===void 0?void 0:r.blockSelector)!==null&&n!==void 0?n:[];if(i.length!==0)return i},t.prototype.getMaskTextSelectors=function(){var e,r,n,i;if(((r=(e=this.config)===null||e===void 0?void 0:e.privacyConfig)===null||r===void 0?void 0:r.defaultMaskLevel)==="conservative")return"*";var o=(i=(n=this.config)===null||n===void 0?void 0:n.privacyConfig)===null||i===void 0?void 0:i.maskSelector;if(o)return o},t.prototype.getRecordingPlugins=function(e){var r,n,i,o,a,s;return _(this,void 0,void 0,function(){var l,u,c,f;return T(this,function(d){switch(d.label){case 0:l=[];try{u=xu({ugcFilterRules:((n=(r=this.config)===null||r===void 0?void 0:r.interactionConfig)===null||n===void 0?void 0:n.ugcFilterRules)||[],enablePolling:((i=this.config)===null||i===void 0?void 0:i.enableUrlChangePolling)||!1,pollingInterval:(o=this.config)===null||o===void 0?void 0:o.urlChangePollingInterval,captureDocumentTitle:(a=this.config)===null||a===void 0?void 0:a.captureDocumentTitle}),l.push(u)}catch(v){this.loggerProvider.warn("Failed to create URL tracking plugin:",v)}if(!(!((s=e?.console)===null||s===void 0)&&s.enabled))return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,Qt(()=>import("./sPdhR0i8.js"),[])];case 2:return c=d.sent().getRecordConsolePlugin,l.push(c({level:e.console.levels})),[3,4];case 3:return f=d.sent(),this.loggerProvider.warn("Failed to load console plugin:",f),[3,4];case 4:return[2,l.length>0?l:void 0]}})})},t.prototype.getRecordFunction=function(){return _(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Qt(()=>import("./DMrp4Fbu.js"),[])];case 2:return e=n.sent().record,this.recordFunction=e,[2,e];case 3:return r=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",r),[2,null];case 4:return[2]}})})},t.prototype.recordEvents=function(e){var r,n,i,o,a,s,l,u;return e===void 0&&(e=!0),_(this,void 0,void 0,function(){var c,f,d,v,h,g,m,E,p,y,b,S,w,A,I,k,x=this;return T(this,function(P){switch(P.label){case 0:return c=this.config,f=this.getShouldRecord(),d=(r=this.identifiers)===null||r===void 0?void 0:r.sessionId,!f||!d||!c?[2]:(this.stopRecordingEvents(),[4,this.getRecordFunction()]);case 1:return v=P.sent(),v?[4,this.initializeNetworkObservers()]:[2];case 2:P.sent(),h=(n=c.loggingConfig)===null||n===void 0?void 0:n.network,g=Oi(c.serverZone,c.trackServerUrl),m=[su,uu,lu,g],(i=this.networkObservers)===null||i===void 0||i.start(function(R){m.some(function(O){return R.url.startsWith(O)})||x.addCustomRRWebEvent(at.FETCH_REQUEST,R)},h),E=c.privacyConfig,p=c.interactionConfig,y=c.loggingConfig,b=p?.enabled?{mouseInteraction:this.eventsManager&&((o=this.clickHandler)===null||o===void 0?void 0:o.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:v.mirror,ugcFilterRules:(a=p.ugcFilterRules)!==null&&a!==void 0?a:[],performanceOptions:(s=c.performanceConfig)===null||s===void 0?void 0:s.interaction})),scroll:this.scrollHook}:{},S=p?.enabled&&p.ugcFilterRules?p.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),P.label=3;case 3:return P.trys.push([3,5,,6]),w=this,A=v,k={emit:function(R){if(x.shouldOptOut()){x.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),x.stopRecordingEvents(),x.sendEvents();return}R.type===pu.Meta&&(R.data.href=on(R.data.href,S)),x.eventCompressor&&x.eventCompressor.enqueueEvent(R,d)},inlineStylesheet:c.shouldInlineStylesheet,hooks:b,maskAllInputs:!0,maskTextClass:au,blockClass:ch,blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:c.applyBackgroundColorToBlockedElements,maskInputFn:na("input",E),maskTextFn:na("text",E),maskAttributeFn:Eh(E),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:(l=c.omitElementTags)===null||l===void 0?void 0:l.script,comment:(u=c.omitElementTags)===null||u===void 0?void 0:u.comment},errorHandler:function(R){var O=R;if(O.message.includes("insertRule")&&O.message.includes("CSSStyleSheet")||O._external_)throw O;return x.loggerProvider.warn("Error while capturing replay: ",O.toString()),!0}},[4,this.getRecordingPlugins(y)];case 4:return w.recordCancelCallback=A.apply(void 0,[(k.plugins=P.sent(),k)]),this.addCustomRRWebEvent(at.DEBUG_INFO),e&&this.addCustomRRWebEvent(at.METADATA,this.metadata),[3,6];case 5:return I=P.sent(),this.loggerProvider.warn("Failed to initialize session replay:",I),[3,6];case 6:return[2]}})})},t.prototype.getDeviceId=function(){var e;return(e=this.identifiers)===null||e===void 0?void 0:e.deviceId},t.prototype.getSessionId=function(){var e;return(e=this.identifiers)===null||e===void 0?void 0:e.sessionId},t.prototype.flush=function(e){var r;return e===void 0&&(e=!1),_(this,void 0,void 0,function(){return T(this,function(n){return[2,(r=this.eventsManager)===null||r===void 0?void 0:r.flush(e)]})})},t.prototype.shutdown=function(){var e;(e=this.urlChangeCleanup)===null||e===void 0||e.call(this),this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},t.prototype.mapSDKType=function(e){return e==="plugin"?"@amplitude/plugin-session-replay-browser":e==="segment"?"@amplitude/segment-session-replay-plugin":null},t.prototype.setMetadata=function(e,r,n,i,o,a,s){var l=e?.toString()?Vn(e.toString()):void 0;this.metadata={joinedConfig:r,localConfig:n,remoteConfig:i,sessionId:e,hashValue:l,sampleRate:r.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:o,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:a}},t.prototype.initializeNetworkObservers=function(){var e,r,n;return _(this,void 0,void 0,function(){var i,o;return T(this,function(a){switch(a.label){case 0:if(!(!((n=(r=(e=this.config)===null||e===void 0?void 0:e.loggingConfig)===null||r===void 0?void 0:r.network)===null||n===void 0)&&n.enabled&&!this.networkObservers))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Qt(()=>import("./CifMVRjc.js"),[])];case 2:return i=a.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=a.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},t})(),gt=function(t){return function(){var e=t.config,r=e||gu(),n=r.loggerProvider,i=r.logLevel;return{logger:n,logLevel:i}}},Ug=function(){var t=new Mg;return{init:Q(t.init.bind(t),"init",gt(t)),evaluateTargetingAndCapture:Q(t.evaluateTargetingAndCapture.bind(t),"evaluateTargetingAndRecord",gt(t)),setSessionId:Q(t.setSessionId.bind(t),"setSessionId",gt(t)),getSessionId:Q(t.getSessionId.bind(t),"getSessionId",gt(t)),getSessionReplayProperties:Q(t.getSessionReplayProperties.bind(t),"getSessionReplayProperties",gt(t)),flush:Q(t.flush.bind(t),"flush",gt(t)),shutdown:Q(t.shutdown.bind(t),"shutdown",gt(t))}};const wt=Ug();var Fg=wt.init,qg=wt.setSessionId,Bg=wt.getSessionId,Vg=wt.getSessionReplayProperties,jg=wt.flush,Hg=wt.shutdown,Gg=wt.evaluateTargetingAndCapture,Wg=function(t){return t===void 0&&(t="$default_instance"),mi.getInstance(t)},st;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(st||(st={}));var Ta;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE_CURRENCY="$currency",t.REVENUE="$revenue"})(Ta||(Ta={}));var _a;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(_a||(_a={}));var Kg=[st.SET,st.SET_ONCE,st.ADD,st.APPEND,st.PREPEND,st.POSTINSERT],zg=function(t){if(t.user_properties){var e={},r=Object.keys(t.user_properties);return r.forEach(function(n){if(Kg.includes(n)){var i=t.user_properties&&t.user_properties[n];e=C(C({},e),i)}}),e}},Ia="1.27.6",$g="[Amplitude]",Xg="".concat($g," Session Replay ID"),li=(function(){function t(e){this.name=t.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:jg,getSessionId:Bg,getSessionReplayProperties:Vg,init:Fg,setSessionId:qg,shutdown:Hg,evaluateTargetingAndCapture:Gg},this.options=C({forceSessionTracking:!1},e),this.srInitOptions=this.options}return t.prototype.setup=function(e,r){var n,i,o,a,s,l,u,c;return _(this,void 0,void 0,function(){var f,d,v;return T(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),e?.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(Ia,".")),this.config=e,this.options.forceSessionTracking&&(typeof e.defaultTracking=="boolean"?e.defaultTracking===!1&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=C(C({},e.defaultTracking),{sessions:!0})),f=Wg(this.config.instanceName).identityStore,d=f.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:(n=this.options.deviceId)!==null&&n!==void 0?n:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||((i=this.config.remoteConfig)===null||i===void 0?void 0:i.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:(o=this.options.privacyConfig)===null||o===void 0?void 0:o.blockSelector,maskSelector:(a=this.options.privacyConfig)===null||a===void 0?void 0:a.maskSelector,unmaskSelector:(s=this.options.privacyConfig)===null||s===void 0?void 0:s.unmaskSelector,defaultMaskLevel:(l=this.options.privacyConfig)===null||l===void 0?void 0:l.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:Ia},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:(u=this.options.useWebWorker)!==null&&u!==void 0?u:(c=this.options.experimental)===null||c===void 0?void 0:c.useWebWorker,userProperties:d,omitElementTags:this.options.omitElementTags,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return h.sent(),[3,3];case 2:return v=h.sent(),e?.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(v.message)),[3,3];case 3:return[2]}})})},t.prototype.onSessionIdChanged=function(e){var r;return _(this,void 0,void 0,function(){return T(this,function(n){switch(n.label){case 0:return(r=this.config)===null||r===void 0||r.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return n.sent(),[2]}})})},t.prototype.onOptOutChanged=function(e){var r;return _(this,void 0,void 0,function(){var n;return T(this,function(i){switch(i.label){case 0:return(r=this.config)===null||r===void 0||r.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),e?(this.sessionReplay.shutdown(),[3,4]):[3,1];case 1:return n=this.config!=null,n?[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise]:[3,3];case 2:n=i.sent(),i.label=3;case 3:i.label=4;case 4:return[2]}})})},t.prototype.execute=function(e){var r,n,i;return _(this,void 0,void 0,function(){var o,l,o,a,s,l,u;return T(this,function(c){switch(c.label){case 0:return c.trys.push([0,9,,10]),this.options.customSessionId?(o=this.options.customSessionId(e),o?o===this.sessionReplay.getSessionId()?[3,2]:[4,this.sessionReplay.setSessionId(o).promise]:[3,3]):[3,4];case 1:c.sent(),c.label=2;case 2:l=this.sessionReplay.getSessionReplayProperties(),e.event_properties=C(C({},e.event_properties),l),c.label=3;case 3:return[3,8];case 4:return o=(r=this.config)===null||r===void 0?void 0:r.sessionId,o&&o!==this.sessionReplay.getSessionId()?[4,this.sessionReplay.setSessionId(o).promise]:[3,6];case 5:c.sent(),c.label=6;case 6:return o&&o===e.session_id?(a=void 0,e.event_type===xe.IDENTIFY&&(a=zg(e)),s=F(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:((n=s?.location)===null||n===void 0?void 0:n.href)!=null?{url:s.location.href}:void 0})]):[3,8];case 7:c.sent(),l=this.sessionReplay.getSessionReplayProperties(),e.event_properties=C(C({},e.event_properties),l),c.label=8;case 8:return e.event_type===xe.IDENTIFY&&e.event_properties&&delete e.event_properties[Xg],[2,Promise.resolve(e)];case 9:return u=c.sent(),(i=this.config)===null||i===void 0||i.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(u.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},t.prototype.teardown=function(){var e;return _(this,void 0,void 0,function(){return T(this,function(r){try{this.sessionReplay.shutdown(),this.config=null}catch(n){(e=this.config)===null||e===void 0||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(n.message))}return[2]})})},t.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},t.pluginName="@amplitude/plugin-session-replay-browser",t})(),Yg=function(t){return new li(t)},ci=function(t,e){return ci=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},ci(t,e)};function Nu(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ci(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var lt=function(){return lt=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},lt.apply(this,arguments)};function Lu(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(c){try{u(n.next(c))}catch(f){a(f)}}function l(c){try{u(n.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((n=n.apply(t,[])).next())})}function Du(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Le(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Li(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Di(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}var U={IS:"is",IS_NOT:"is not",CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",LESS_THAN:"less",LESS_THAN_EQUALS:"less or equal",GREATER_THAN:"greater",GREATER_THAN_EQUALS:"greater or equal",VERSION_LESS_THAN:"version less",VERSION_LESS_THAN_EQUALS:"version less or equal",VERSION_GREATER_THAN:"version greater",VERSION_GREATER_THAN_EQUALS:"version greater or equal",SET_IS:"set is",SET_IS_NOT:"set is not",SET_CONTAINS:"set contains",SET_DOES_NOT_CONTAIN:"set does not contain",SET_CONTAINS_ANY:"set contains any",SET_DOES_NOT_CONTAIN_ANY:"set does not contain any",REGEX_MATCH:"regex match",REGEX_DOES_NOT_MATCH:"regex does not match"},Jg=function(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)==55296&&n+1<t.length&&(t.charCodeAt(n+1)&64512)==56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++n)&1023),e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128)}return Uint8Array.from(e)},Ur=-862048943,Fr=461845907,qr=15,Qg=13,Zg=5,ep=-430675100,tp=function(t,e){e===void 0&&(e=0);for(var r=Jg(t),n=r.length,i=n>>2,o=e,a=0;a<i;a++){var s=a<<2,l=ip(r,s);o=rp(l,o)}var u=i<<2,c=0;switch(n-u){case 3:c^=r[u+2]<<16,c^=r[u+1]<<8,c^=r[u],c=Math.imul(c,Ur),c=ur(c,qr),c=Math.imul(c,Fr),o^=c;break;case 2:c^=r[u+1]<<8,c^=r[u],c=Math.imul(c,Ur),c=ur(c,qr),c=Math.imul(c,Fr),o^=c;break;case 1:c^=r[u],c=Math.imul(c,Ur),c=ur(c,qr),c=Math.imul(c,Fr),o^=c;break}return o^=n,np(o)>>>0},rp=function(t,e){var r=t,n=e;return r=Math.imul(r,Ur),r=ur(r,qr),r=Math.imul(r,Fr),n^=r,n=ur(n,Qg),n=Math.imul(n,Zg),n+ep|0},np=function(t){var e=t;return e^=e>>>16,e=Math.imul(e,-2048144789),e^=e>>>13,e=Math.imul(e,-1028477387),e^=e>>>16,e},ur=function(t,e,r){r===void 0&&(r=32),e>r&&(e=e%r);var n=4294967295<<r-e>>>0,i=(t&n)>>>0>>>r-e>>>0;return(t<<e|i)>>>0},ip=function(t,e){e===void 0&&(e=0);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return op(r)},op=function(t){return(t&-16777216)>>>24|(t&16711680)>>>8|(t&65280)<<8|(t&255)<<24},Aa=function(t,e){var r,n;if(!(!e||e.length===0)){try{for(var i=Le(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(!a||!t||typeof t!="object")return;t=t[a]}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}if(t!=null)return t}},ap="(\\d+)\\.(\\d+)",sp="(\\d+)",up="(-(([-\\w]+\\.?)*))?",lp="^".concat(ap,"(\\.").concat(sp).concat(up,")?$"),cp=(function(){function t(e,r,n,i){i===void 0&&(i=void 0),this.major=e,this.minor=r,this.patch=n,this.preRelease=i}return t.parse=function(e){if(e){var r=new RegExp(lp).exec(e);if(r){var n=Number(r[1]),i=Number(r[2]);if(!(isNaN(n)||isNaN(i))){var o=Number(r[4])||0,a=r[5]||void 0;return new t(n,i,o,a)}}}},t.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},t})(),dp=(function(){function t(){}return t.prototype.evaluate=function(e,r){var n,i,o={},a={context:e,result:o};try{for(var s=Le(r),l=s.next();!l.done;l=s.next()){var u=l.value,c=this.evaluateFlag(a,u);c&&(o[u.key]=c)}}catch(f){n={error:f}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return o},t.prototype.evaluateFlag=function(e,r){var n,i,o;try{for(var a=Le(r.segments),s=a.next();!s.done;s=a.next()){var l=s.value;if(o=this.evaluateSegment(e,r,l),o){var u=lt(lt(lt({},r.metadata),l.metadata),o.metadata);o=lt(lt({},o),{metadata:u});break}}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o},t.prototype.evaluateSegment=function(e,r,n){if(!n.conditions){var i=this.bucket(e,n);return i!==void 0?r.variants[i]:void 0}var o=this.evaluateConditions(e,n.conditions);if(o){var i=this.bucket(e,n);return i!==void 0?r.variants[i]:void 0}},t.prototype.evaluateConditions=function(e,r){var n,i,o,a;try{for(var s=Le(r),l=s.next();!l.done;l=s.next()){var u=l.value,c=!0;try{for(var f=(o=void 0,Le(u)),d=f.next();!d.done;d=f.next()){var v=d.value;if(c=this.matchCondition(e,v),!c)break}}catch(h){o={error:h}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}if(c)return!0}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return!1},t.prototype.matchCondition=function(e,r){var n=Aa(e,r.selector);if(n==null)return this.matchNull(r.op,r.values);if(this.isSetOperator(r.op)){var i=this.coerceStringArray(n);return i?this.matchSet(i,r.op,r.values):!1}else{var o=this.coerceString(n);return o!==void 0?this.matchString(o,r.op,r.values):!1}},t.prototype.getHash=function(e){return tp(e)},t.prototype.bucket=function(e,r){var n,i,o,a;if(!r.bucket)return r.variant;var s=this.coerceString(Aa(e,r.bucket.selector));if(!s||s.length===0)return r.variant;var l="".concat(r.bucket.salt,"/").concat(s),u=this.getHash(l),c=u%100,f=Math.floor(u/100);try{for(var d=Le(r.bucket.allocations),v=d.next();!v.done;v=d.next()){var h=v.value,g=h.range[0],m=h.range[1];if(c>=g&&c<m)try{for(var E=(o=void 0,Le(h.distributions)),p=E.next();!p.done;p=E.next()){var y=p.value,b=y.range[0],S=y.range[1];if(f>=b&&f<S)return y.variant}}catch(w){o={error:w}}finally{try{p&&!p.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}return r.variant},t.prototype.matchNull=function(e,r){var n=this.containsNone(r);switch(e){case U.IS:case U.CONTAINS:case U.LESS_THAN:case U.LESS_THAN_EQUALS:case U.GREATER_THAN:case U.GREATER_THAN_EQUALS:case U.VERSION_LESS_THAN:case U.VERSION_LESS_THAN_EQUALS:case U.VERSION_GREATER_THAN:case U.VERSION_GREATER_THAN_EQUALS:case U.SET_IS:case U.SET_CONTAINS:case U.SET_CONTAINS_ANY:return n;case U.IS_NOT:case U.DOES_NOT_CONTAIN:case U.SET_DOES_NOT_CONTAIN:case U.SET_DOES_NOT_CONTAIN_ANY:return!n;default:return!1}},t.prototype.matchSet=function(e,r,n){switch(r){case U.SET_IS:return this.setEquals(e,n);case U.SET_IS_NOT:return!this.setEquals(e,n);case U.SET_CONTAINS:return this.matchesSetContainsAll(e,n);case U.SET_DOES_NOT_CONTAIN:return!this.matchesSetContainsAll(e,n);case U.SET_CONTAINS_ANY:return this.matchesSetContainsAny(e,n);case U.SET_DOES_NOT_CONTAIN_ANY:return!this.matchesSetContainsAny(e,n);default:return!1}},t.prototype.matchString=function(e,r,n){var i=this;switch(r){case U.IS:return this.matchesIs(e,n);case U.IS_NOT:return!this.matchesIs(e,n);case U.CONTAINS:return this.matchesContains(e,n);case U.DOES_NOT_CONTAIN:return!this.matchesContains(e,n);case U.LESS_THAN:case U.LESS_THAN_EQUALS:case U.GREATER_THAN:case U.GREATER_THAN_EQUALS:return this.matchesComparable(e,r,n,function(o){return i.parseNumber(o)},this.comparator);case U.VERSION_LESS_THAN:case U.VERSION_LESS_THAN_EQUALS:case U.VERSION_GREATER_THAN:case U.VERSION_GREATER_THAN_EQUALS:return this.matchesComparable(e,r,n,function(o){return cp.parse(o)},this.versionComparator);case U.REGEX_MATCH:return this.matchesRegex(e,n);case U.REGEX_DOES_NOT_MATCH:return!this.matchesRegex(e,n);default:return!1}},t.prototype.matchesIs=function(e,r){if(this.containsBooleans(r)){var n=e.toLowerCase();if(n==="true"||n==="false")return r.some(function(i){return i.toLowerCase()===n})}return r.some(function(i){return e===i})},t.prototype.matchesContains=function(e,r){var n,i;try{for(var o=Le(r),a=o.next();!a.done;a=o.next()){var s=a.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return!1},t.prototype.matchesComparable=function(e,r,n,i,o){var a=this,s=i(e),l=n.map(function(u){return i(u)}).filter(function(u){return u!==void 0});return s===void 0||l.length===0?n.some(function(u){return a.comparator(e,r,u)}):l.some(function(u){return o(s,r,u)})},t.prototype.comparator=function(e,r,n){switch(r){case U.LESS_THAN:case U.VERSION_LESS_THAN:return e<n;case U.LESS_THAN_EQUALS:case U.VERSION_LESS_THAN_EQUALS:return e<=n;case U.GREATER_THAN:case U.VERSION_GREATER_THAN:return e>n;case U.GREATER_THAN_EQUALS:case U.VERSION_GREATER_THAN_EQUALS:return e>=n;default:return!1}},t.prototype.versionComparator=function(e,r,n){var i=e.compareTo(n);switch(r){case U.LESS_THAN:case U.VERSION_LESS_THAN:return i<0;case U.LESS_THAN_EQUALS:case U.VERSION_LESS_THAN_EQUALS:return i<=0;case U.GREATER_THAN:case U.VERSION_GREATER_THAN:return i>0;case U.GREATER_THAN_EQUALS:case U.VERSION_GREATER_THAN_EQUALS:return i>=0;default:return!1}},t.prototype.matchesRegex=function(e,r){return r.some(function(n){return!!new RegExp(n).exec(e)})},t.prototype.containsNone=function(e){return e.some(function(r){return r==="(none)"})},t.prototype.containsBooleans=function(e){return e.some(function(r){switch(r.toLowerCase()){case"true":case"false":return!0;default:return!1}})},t.prototype.parseNumber=function(e){var r;return(r=Number(e))!==null&&r!==void 0?r:void 0},t.prototype.coerceString=function(e){if(e!=null)return typeof e=="object"?JSON.stringify(e):String(e)},t.prototype.coerceStringArray=function(e){var r=this;if(Array.isArray(e)){var n=e;return n.map(function(s){return r.coerceString(s)}).filter(Boolean)}var i=String(e);try{var o=JSON.parse(i);if(Array.isArray(o)){var n=e;return n.map(function(l){return r.coerceString(l)}).filter(Boolean)}else{var a=this.coerceString(i);return a?[a]:void 0}}catch{var a=this.coerceString(i);return a?[a]:void 0}},t.prototype.isSetOperator=function(e){switch(e){case U.SET_IS:case U.SET_IS_NOT:case U.SET_CONTAINS:case U.SET_DOES_NOT_CONTAIN:case U.SET_CONTAINS_ANY:case U.SET_DOES_NOT_CONTAIN_ANY:return!0;default:return!1}},t.prototype.setEquals=function(e,r){var n=new Set(e),i=new Set(r);return n.size===i.size&&Di([],Li(i),!1).every(function(o){return n.has(o)})},t.prototype.matchesSetContainsAll=function(e,r){var n,i;if(e.length<r.length)return!1;try{for(var o=Le(r),a=o.next();!a.done;a=o.next()){var s=a.value;if(!this.matchesIs(s,e))return!1}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return!0},t.prototype.matchesSetContainsAny=function(e,r){var n,i;try{for(var o=Le(r),a=o.next();!a.done;a=o.next()){var s=a.value;if(this.matchesIs(s,e))return!0}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return!1},t})(),fp=function(t,e){var r,n,i=lt({},t),o=[],a=e||Object.keys(i);try{for(var s=Le(a),l=s.next();!l.done;l=s.next()){var u=l.value,c=Mu(u,i);c&&o.push.apply(o,Di([],Li(c),!1))}}catch(f){r={error:f}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o},Mu=function(t,e,r){var n,i;r===void 0&&(r=[]);var o=e[t];if(o){if(!o.dependencies||o.dependencies.length===0)return delete e[o.key],[o]}else return;r.push(o.key);var a=[],s=function(f){if(r.some(function(v){return v===f}))throw Error("Detected a cycle between flags ".concat(r));var d=Mu(f,e,r);d&&a.push.apply(a,Di([],Li(d),!1))};try{for(var l=Le(o.dependencies),u=l.next();!u.done;u=l.next()){var c=u.value;s(c)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return a.push(o),r.pop(),delete e[o.key],a};const Uu="3.7.7",vp=Uu,Bt=typeof Buffer=="function",Ca=typeof TextDecoder=="function"?new TextDecoder:void 0,ka=typeof TextEncoder=="function"?new TextEncoder:void 0,hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Zt=Array.prototype.slice.call(hp),Pr=(t=>{let e={};return t.forEach((r,n)=>e[r]=n),e})(Zt),gp=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_e=String.fromCharCode.bind(String),Pa=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),Fu=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),qu=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),Bu=t=>{let e,r,n,i,o="";const a=t.length%3;for(let s=0;s<t.length;){if((r=t.charCodeAt(s++))>255||(n=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("invalid character found");e=r<<16|n<<8|i,o+=Zt[e>>18&63]+Zt[e>>12&63]+Zt[e>>6&63]+Zt[e&63]}return a?o.slice(0,a-3)+"===".substring(a):o},Mi=typeof btoa=="function"?t=>btoa(t):Bt?t=>Buffer.from(t,"binary").toString("base64"):Bu,di=Bt?t=>Buffer.from(t).toString("base64"):t=>{let r=[];for(let n=0,i=t.length;n<i;n+=4096)r.push(_e.apply(null,t.subarray(n,n+4096)));return Mi(r.join(""))},Br=(t,e=!1)=>e?Fu(di(t)):di(t),pp=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?_e(192|e>>>6)+_e(128|e&63):_e(224|e>>>12&15)+_e(128|e>>>6&63)+_e(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return _e(240|e>>>18&7)+_e(128|e>>>12&63)+_e(128|e>>>6&63)+_e(128|e&63)}},mp=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Vu=t=>t.replace(mp,pp),Oa=Bt?t=>Buffer.from(t,"utf8").toString("base64"):ka?t=>di(ka.encode(t)):t=>Mi(Vu(t)),Lt=(t,e=!1)=>e?Fu(Oa(t)):Oa(t),Ra=t=>Lt(t,!0),yp=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,bp=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),r=e-65536;return _e((r>>>10)+55296)+_e((r&1023)+56320);case 3:return _e((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return _e((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},ju=t=>t.replace(yp,bp),Hu=t=>{if(t=t.replace(/\s+/g,""),!gp.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,r="",n,i;for(let o=0;o<t.length;)e=Pr[t.charAt(o++)]<<18|Pr[t.charAt(o++)]<<12|(n=Pr[t.charAt(o++)])<<6|(i=Pr[t.charAt(o++)]),r+=n===64?_e(e>>16&255):i===64?_e(e>>16&255,e>>8&255):_e(e>>16&255,e>>8&255,e&255);return r},Ui=typeof atob=="function"?t=>atob(qu(t)):Bt?t=>Buffer.from(t,"base64").toString("binary"):Hu,Gu=Bt?t=>Pa(Buffer.from(t,"base64")):t=>Pa(Ui(t).split("").map(e=>e.charCodeAt(0))),Wu=t=>Gu(Ku(t)),Ep=Bt?t=>Buffer.from(t,"base64").toString("utf8"):Ca?t=>Ca.decode(Gu(t)):t=>ju(Ui(t)),Ku=t=>qu(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),fi=t=>Ep(Ku(t)),Sp=t=>{if(typeof t!="string")return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},zu=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),$u=function(){const t=(e,r)=>Object.defineProperty(String.prototype,e,zu(r));t("fromBase64",function(){return fi(this)}),t("toBase64",function(e){return Lt(this,e)}),t("toBase64URI",function(){return Lt(this,!0)}),t("toBase64URL",function(){return Lt(this,!0)}),t("toUint8Array",function(){return Wu(this)})},Xu=function(){const t=(e,r)=>Object.defineProperty(Uint8Array.prototype,e,zu(r));t("toBase64",function(e){return Br(this,e)}),t("toBase64URI",function(){return Br(this,!0)}),t("toBase64URL",function(){return Br(this,!0)})},wp=()=>{$u(),Xu()},vi={version:Uu,VERSION:vp,atob:Ui,atobPolyfill:Hu,btoa:Mi,btoaPolyfill:Bu,fromBase64:fi,toBase64:Lt,encode:Lt,encodeURI:Ra,encodeURL:Ra,utob:Vu,btou:ju,decode:fi,isValid:Sp,fromUint8Array:Br,toUint8Array:Wu,extendString:$u,extendUint8Array:Xu,extendBuiltins:wp};var Yu=(function(t){Nu(e,t);function e(r,n){var i=t.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,e.prototype),i}return e})(Error),hi=(function(t){Nu(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return e})(Error),Tp=(function(){function t(e,r,n){this.deploymentKey=e,this.serverUrl=r,this.httpClient=n}return t.prototype.getVariants=function(e,r){return Lu(this,void 0,void 0,function(){var n,i,o,a;return Du(this,function(s){switch(s.label){case 0:return n=vi.encodeURL(JSON.stringify(e)),i={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":n},r?.flagKeys&&(i["X-Amp-Exp-Flag-Keys"]=vi.encodeURL(JSON.stringify(r.flagKeys))),r?.trackingOption&&(i["X-Amp-Exp-Track"]=r.trackingOption),r?.exposureTrackingOption&&(i["X-Amp-Exp-Exposure-Track"]=r.exposureTrackingOption),o=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),r?.evaluationMode&&o.searchParams.append("eval_mode",r?.evaluationMode),r?.deliveryMethod&&o.searchParams.append("delivery_method",r?.deliveryMethod),[4,this.httpClient.request({requestUrl:o.toString(),method:"GET",headers:i,timeoutMillis:r?.timeoutMillis})];case 1:if(a=s.sent(),a.status!=200)throw new Yu(a.status,"Fetch error response: status=".concat(a.status));return[2,JSON.parse(a.body)]}})})},t})(),_p=(function(){function t(e,r,n){this.deploymentKey=e,this.serverUrl=r,this.httpClient=n}return t.prototype.getFlags=function(e){return Lu(this,void 0,void 0,function(){var r,n,i;return Du(this,function(o){switch(o.label){case 0:return r={Authorization:"Api-Key ".concat(this.deploymentKey)},e?.libraryName&&e?.libraryVersion&&(r["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),e?.user&&(r["X-Amp-Exp-User"]=vi.encodeURL(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+(e?.deliveryMethod?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:r,timeoutMillis:e?.timeoutMillis})];case 1:if(n=o.sent(),n.status!=200)throw Error("Flags error response: status=".concat(n.status));return i=JSON.parse(n.body),[2,i.reduce(function(a,s){return a[s.key]=s,a},{})]}})})},t})(),ye=typeof globalThis<"u"?globalThis:global||self,Tt=function(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},Ip=function(){var t=Tt();if(t)try{var e="EXP_test";return t.localStorage.setItem(e,e),t.localStorage.removeItem(e),!0}catch{return!1}return!1},Ap=(function(){function t(e,r){this.poller=void 0,this.action=e,this.ms=r}return t.prototype.start=function(){this.poller||(this.poller=ye.setInterval(this.action,this.ms),this.action())},t.prototype.stop=function(){this.poller&&(ye.clearInterval(this.poller),this.poller=void 0)},t})(),er={exports:{}},Cp=er.exports,xa;function kp(){return xa||(xa=1,(function(t,e){(function(r,n){var i="0.7.33",o="",a="?",s="function",l="undefined",u="object",c="string",f="major",d="model",v="name",h="type",g="vendor",m="version",E="architecture",p="console",y="mobile",b="tablet",S="smarttv",w="wearable",A="embedded",I=350,k="Amazon",x="Apple",P="ASUS",R="BlackBerry",O="Browser",L="Chrome",B="Edge",H="Firefox",j="Google",ee="Huawei",M="LG",G="Microsoft",W="Motorola",te="Opera",J="Samsung",Z="Sharp",K="Sony",ie="Xiaomi",oe="Zebra",fe="Facebook",ve=function(V,z){var X={};for(var ce in V)z[ce]&&z[ce].length%2===0?X[ce]=z[ce].concat(V[ce]):X[ce]=V[ce];return X},me=function(V){for(var z={},X=0;X<V.length;X++)z[V[X].toUpperCase()]=V[X];return z},N=function(V,z){return typeof V===c?he(z).indexOf(he(V))!==-1:!1},he=function(V){return V.toLowerCase()},qe=function(V){return typeof V===c?V.replace(/[^\d\.]/g,o).split(".")[0]:n},Ae=function(V,z){if(typeof V===c)return V=V.replace(/^\s\s*/,o),typeof z===l?V:V.substring(0,I)},Re=function(V,z){for(var X=0,ce,Y,_t,ue,Vt,ze;X<z.length&&!Vt;){var qi=z[X],Bi=z[X+1];for(ce=Y=0;ce<qi.length&&!Vt;)if(Vt=qi[ce++].exec(V),Vt)for(_t=0;_t<Bi.length;_t++)ze=Vt[++Y],ue=Bi[_t],typeof ue===u&&ue.length>0?ue.length===2?typeof ue[1]==s?this[ue[0]]=ue[1].call(this,ze):this[ue[0]]=ue[1]:ue.length===3?typeof ue[1]===s&&!(ue[1].exec&&ue[1].test)?this[ue[0]]=ze?ue[1].call(this,ze,ue[2]):n:this[ue[0]]=ze?ze.replace(ue[1],ue[2]):n:ue.length===4&&(this[ue[0]]=ze?ue[3].call(this,ze.replace(ue[1],ue[2])):n):this[ue]=ze||n;X+=2}},Be=function(V,z){for(var X in z)if(typeof z[X]===u&&z[X].length>0){for(var ce=0;ce<z[X].length;ce++)if(N(z[X][ce],V))return X===a?n:X}else if(N(z[X],V))return X===a?n:X;return V},Ve={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},We={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ke={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[m,[v,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[m,[v,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[v,m],[/opios[\/ ]+([\w\.]+)/i],[m,[v,te+" Mini"]],[/\bopr\/([\w\.]+)/i],[m,[v,te]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[v,m],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[m,[v,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[m,[v,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[m,[v,"WeChat"]],[/konqueror\/([\w\.]+)/i],[m,[v,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[m,[v,"IE"]],[/yabrowser\/([\w\.]+)/i],[m,[v,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[v,/(.+)/,"$1 Secure "+O],m],[/\bfocus\/([\w\.]+)/i],[m,[v,H+" Focus"]],[/\bopt\/([\w\.]+)/i],[m,[v,te+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[m,[v,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[m,[v,"Dolphin"]],[/coast\/([\w\.]+)/i],[m,[v,te+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[m,[v,"MIUI "+O]],[/fxios\/([-\w\.]+)/i],[m,[v,H]],[/\bqihu|(qi?ho?o?|360)browser/i],[[v,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[v,/(.+)/,"$1 "+O],m],[/(comodo_dragon)\/([\w\.]+)/i],[[v,/_/g," "],m],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[v,m],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[v],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[v,fe],m],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[v,m],[/\bgsa\/([\w\.]+) .*safari\//i],[m,[v,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[m,[v,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[v,L+" WebView"],m],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[m,[v,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[v,m],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[m,[v,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[m,v],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[v,[m,Be,Ve]],[/(webkit|khtml)\/([\w\.]+)/i],[v,m],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[v,"Netscape"],m],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[m,[v,H+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[v,m],[/(cobalt)\/([\w\.]+)/i],[v,[m,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[E,"amd64"]],[/(ia32(?=;))/i],[[E,he]],[/((?:i[346]|x)86)[;\)]/i],[[E,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[E,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[E,"armhf"]],[/windows (ce|mobile); ppc;/i],[[E,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[E,/ower/,o,he]],[/(sun4\w)[;\)]/i],[[E,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[E,he]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[g,J],[h,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[g,J],[h,y]],[/((ipod|iphone)\d+,\d+)/i],[d,[g,x],[h,y]],[/(ipad\d+,\d+)/i],[d,[g,x],[h,b]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[g,x],[h,y]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[g,x],[h,b]],[/(macintosh);/i],[d,[g,x]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[g,ee],[h,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[g,ee],[h,y]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[g,ie],[h,y]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[g,ie],[h,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[g,"OPPO"],[h,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[g,"Vivo"],[h,y]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[g,"Realme"],[h,y]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[g,W],[h,y]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[g,W],[h,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[g,M],[h,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[g,M],[h,y]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[g,"Lenovo"],[h,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[g,"Nokia"],[h,y]],[/(pixel c)\b/i],[d,[g,j],[h,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[g,j],[h,y]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[g,K],[h,y]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[g,K],[h,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[g,"OnePlus"],[h,y]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[g,k],[h,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[g,k],[h,y]],[/(playbook);[-\w\),; ]+(rim)/i],[d,g,[h,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[g,R],[h,y]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[g,P],[h,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[g,P],[h,y]],[/(nexus 9)/i],[d,[g,"HTC"],[h,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[d,/_/g," "],[h,y]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[g,"Acer"],[h,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[g,"Meizu"],[h,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[g,Z],[h,y]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[g,d,[h,y]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,d,[h,b]],[/(surface duo)/i],[d,[g,G],[h,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[g,"Fairphone"],[h,y]],[/(u304aa)/i],[d,[g,"AT&T"],[h,y]],[/\bsie-(\w*)/i],[d,[g,"Siemens"],[h,y]],[/\b(rct\w+) b/i],[d,[g,"RCA"],[h,b]],[/\b(venue[\d ]{2,7}) b/i],[d,[g,"Dell"],[h,b]],[/\b(q(?:mv|ta)\w+) b/i],[d,[g,"Verizon"],[h,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[g,"Barnes & Noble"],[h,b]],[/\b(tm\d{3}\w+) b/i],[d,[g,"NuVision"],[h,b]],[/\b(k88) b/i],[d,[g,"ZTE"],[h,b]],[/\b(nx\d{3}j) b/i],[d,[g,"ZTE"],[h,y]],[/\b(gen\d{3}) b.+49h/i],[d,[g,"Swiss"],[h,y]],[/\b(zur\d{3}) b/i],[d,[g,"Swiss"],[h,b]],[/\b((zeki)?tb.*\b) b/i],[d,[g,"Zeki"],[h,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],d,[h,b]],[/\b(ns-?\w{0,9}) b/i],[d,[g,"Insignia"],[h,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[g,"NextBook"],[h,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],d,[h,y]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],d,[h,y]],[/\b(ph-1) /i],[d,[g,"Essential"],[h,y]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[g,"Envizen"],[h,b]],[/\b(trio[-\w\. ]+) b/i],[d,[g,"MachSpeed"],[h,b]],[/\btu_(1491) b/i],[d,[g,"Rotor"],[h,b]],[/(shield[\w ]+) b/i],[d,[g,"Nvidia"],[h,b]],[/(sprint) (\w+)/i],[g,d,[h,y]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[g,G],[h,y]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[g,oe],[h,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[g,oe],[h,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,d,[h,p]],[/droid.+; (shield) bui/i],[d,[g,"Nvidia"],[h,p]],[/(playstation [345portablevi]+)/i],[d,[g,K],[h,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[g,G],[h,p]],[/smart-tv.+(samsung)/i],[g,[h,S]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[g,J],[h,S]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,M],[h,S]],[/(apple) ?tv/i],[g,[d,x+" TV"],[h,S]],[/crkey/i],[[d,L+"cast"],[g,j],[h,S]],[/droid.+aft(\w)( bui|\))/i],[d,[g,k],[h,S]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[g,Z],[h,S]],[/(bravia[\w ]+)( bui|\))/i],[d,[g,K],[h,S]],[/(mitv-\w{5}) bui/i],[d,[g,ie],[h,S]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[g,Ae],[d,Ae],[h,S]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,S]],[/((pebble))app/i],[g,d,[h,w]],[/droid.+; (glass) \d/i],[d,[g,j],[h,w]],[/droid.+; (wt63?0{2,3})\)/i],[d,[g,oe],[h,w]],[/(quest( 2)?)/i],[d,[g,fe],[h,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[h,A]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[h,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[h,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,y]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[m,[v,B+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[m,[v,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[v,m],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[m,v]],os:[[/microsoft (windows) (vista|xp)/i],[v,m],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[v,[m,Be,We]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[v,"Windows"],[m,Be,We]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[m,/_/g,"."],[v,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[v,"Mac OS"],[m,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[m,v],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[v,m],[/\(bb(10);/i],[m,[v,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[m,[v,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[m,[v,H+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[m,[v,"webOS"]],[/crkey\/([\d\.]+)/i],[m,[v,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[v,"Chromium OS"],m],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[v,m],[/(sunos) ?([\w\.\d]*)/i],[[v,"Solaris"],m],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[v,m]]},ge=function(V,z){if(typeof V===u&&(z=V,V=n),!(this instanceof ge))return new ge(V,z).getResult();var X=V||(typeof r!==l&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:o),ce=z?ve(Ke,z):Ke;return this.getBrowser=function(){var Y={};return Y[v]=n,Y[m]=n,Re.call(Y,X,ce.browser),Y.major=qe(Y.version),Y},this.getCPU=function(){var Y={};return Y[E]=n,Re.call(Y,X,ce.cpu),Y},this.getDevice=function(){var Y={};return Y[g]=n,Y[d]=n,Y[h]=n,Re.call(Y,X,ce.device),Y},this.getEngine=function(){var Y={};return Y[v]=n,Y[m]=n,Re.call(Y,X,ce.engine),Y},this.getOS=function(){var Y={};return Y[v]=n,Y[m]=n,Re.call(Y,X,ce.os),Y},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return X},this.setUA=function(Y){return X=typeof Y===c&&Y.length>I?Ae(Y,I):Y,this},this.setUA(X),this};ge.VERSION=i,ge.BROWSER=me([v,m,f]),ge.CPU=me([E]),ge.DEVICE=me([d,g,h,p,y,S,b,w,A]),ge.ENGINE=ge.OS=me([v,m]),t.exports&&(e=t.exports=ge),e.UAParser=ge;var Ne=typeof r!==l&&(r.jQuery||r.Zepto);if(Ne&&!Ne.ua){var nt=new ge;Ne.ua=nt.getResult(),Ne.ua.get=function(){return nt.getUA()},Ne.ua.set=function(V){nt.setUA(V);var z=nt.getResult();for(var X in z)Ne.ua[X]=z[X]}}})(typeof window=="object"?window:Cp)})(er,er.exports)),er.exports}var Pp=kp(),ne=function(){return ne=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ne.apply(this,arguments)};function Ee(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(c){try{u(n.next(c))}catch(f){a(f)}}function l(c){try{u(n.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})}function Se(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function vt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ie(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function De(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}var Na=function(t,e){var r,n;e===void 0&&(e=!1);var i=Fi(t,e),o=void 0,a=ye.document.cookie.split("; ");try{for(var s=vt(a),l=s.next();!l.done;l=s.next()){var u=l.value,c=Ie(u.split("=",2),2),f=c[0],d=c[1];f===i&&(o=decodeURIComponent(d))}}catch(m){r={error:m}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}if(o)try{if(e){var v=atob(o);return JSON.parse(decodeURIComponent(v))}var h=o.split("."),g=void 0;return h.length>=2&&h[1]&&(g=atob(h[1])),{deviceId:h[0],userId:g}}catch{return}},Op=function(t){var e=Fi(t,!0);try{var r=ye.localStorage.getItem(e);if(!r)return;var n=JSON.parse(r);return typeof n!="object"?void 0:n}catch{return}},Rp=function(t){var e=Fi(t,!0);try{var r=ye.sessionStorage.getItem(e);if(!r)return;var n=JSON.parse(r);return typeof n!="object"?void 0:n}catch{return}},Fi=function(t,e){if(e)return t?.length<10?void 0:"AMP_".concat(t.substring(0,10));if(!(t?.length<6))return"amp_".concat(t.substring(0,6))},xp=(function(){function t(e,r,n){this.type="integration",this.apiKey=e,this.identityStore=r.identityStore,this.eventBridge=r.eventBridge,this.contextProvider=r.applicationContextProvider,this.timeoutMillis=n,this.loadPersistedState(),n<=0&&(this.setup=void 0)}return t.prototype.setup=function(e,r){return Ee(this,void 0,void 0,function(){return Se(this,function(n){return e?.automaticFetchOnAmplitudeIdentityChange&&this.identityStore.addIdentityListener(function(){r?.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},t.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},t.prototype.track=function(e){return this.eventBridge.receiver?(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0):!1},t.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Na(this.apiKey,!0);return e?(this.commitIdentityToConnector(e),!0):(e=Na(this.apiKey,!1),e?(this.commitIdentityToConnector(e),!0):(e=Op(this.apiKey),e?(this.commitIdentityToConnector(e),!0):(e=Rp(this.apiKey),e?(this.commitIdentityToConnector(e),!0):!1)))},t.prototype.commitIdentityToConnector=function(e){var r=this.identityStore.editIdentity();r.setDeviceId(e.deviceId),e.userId&&r.setUserId(e.userId),r.commit()},t.prototype.waitForConnectorIdentity=function(e){return Ee(this,void 0,void 0,function(){var r,n=this;return Se(this,function(i){return r=this.identityStore.getIdentity(),!r.userId&&!r.deviceId?[2,Promise.race([new Promise(function(o){var a=function(){o(),n.identityStore.removeIdentityListener(a)};n.identityStore.addIdentityListener(a)}),new Promise(function(o,a){ye.setTimeout(a,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]:[2]})})},t})();function Np(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],a=[],s={},l=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return o},entries:function(){return a},get:function(c){return s[c.toLowerCase()]},has:function(c){return c.toLowerCase()in s}}}};for(var u in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(c,f,d){o.push(f=f.toLowerCase()),a.push([f,d]),s[f]=s[f]?s[f]+","+d:d}),r(l())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(u,e.headers[u]);i.send(e.body||null)})}var Lp=ye.fetch||Np,Dp=function(t,e){return e==null||e<=0?t:new Promise(function(r,n){ye.setTimeout(function(){n(new hi("Request timeout after "+e+" milliseconds"))},e),t.then(r,n)})},Mp=function(t,e,r,n,i){var o=function(){return Ee(void 0,void 0,void 0,function(){var a,s,l;return Se(this,function(u){switch(u.label){case 0:return[4,Lp(t,{method:e,headers:r,body:n})];case 1:return a=u.sent(),l={status:a.status},[4,a.text()];case 2:return s=(l.body=u.sent(),l),[2,s]}})})};return Dp(o(),i)},Up=(function(){function t(e){this.client=e}return t.prototype.request=function(e){return Ee(this,void 0,void 0,function(){return Se(this,function(r){switch(r.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,r.sent()]}})})},t})(),Ju={request:Mp},He;(function(t){t[t.Disable=0]="Disable",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose"})(He||(He={}));var rt;(function(t){t.LocalStorage="localStorage",t.InitialVariants="initialVariants"})(rt||(rt={}));var be;(function(t){t.LocalStorage="storage",t.InitialVariants="initial",t.SecondaryLocalStorage="secondary-storage",t.SecondaryInitialVariants="secondary-initial",t.FallbackInline="fallback-inline",t.FallbackConfig="fallback-config",t.LocalEvaluation="local-evaluation"})(be||(be={}));var La=function(t){return!t||t===be.FallbackInline||t===be.FallbackConfig||t===be.SecondaryInitialVariants},Rt={debug:!1,logLevel:He.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:rt.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Ju},Da="1.20.4",Fp=512,qp=(function(){function t(e,r){var n=this,i;this.isReady=new Promise(function(a){n.resolve=a}),this.config=e,this.client=r;var o=(i=e.instanceName)!==null&&i!==void 0?i:Rt.instanceName;this.queue=new Vp(o),this.cache=new Bp(o)}return t.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},t.prototype.setIntegration=function(e){var r=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){r.queue.setTracker(r.integration.track.bind(e)),r.resolve()},function(){r.queue.setTracker(r.integration.track.bind(e)),r.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},t.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},t.prototype.track=function(e,r){if(this.cache.shouldTrack(e,r)){var n=this.getExposureEvent(e);this.queue.push(n)}},t.prototype.getExposureEvent=function(e){var r,n,i,o={eventType:"$exposure",eventProperties:e};return!((r=e.metadata)===null||r===void 0)&&r.exposureEvent?o={eventType:(n=e.metadata)===null||n===void 0?void 0:n.exposureEvent,eventProperties:e}:((i=e.metadata)===null||i===void 0?void 0:i.deliveryMethod)==="web"&&(o={eventType:"$impression",eventProperties:e}),o},t})(),Bp=(function(){function t(e){this.isSessionStorageAvailable=jp(),this.inMemoryCache={},this.identity={},this.storageKey="EXP_sent_v3_".concat(e),this.isSessionStorageAvailable&&(ye.sessionStorage.removeItem("EXP_sent_".concat(e)),ye.sessionStorage.removeItem("EXP_sent_v2_".concat(e)))}return t.prototype.shouldTrack=function(e,r){var n,i;if(((n=e.metadata)===null||n===void 0?void 0:n.deliveryMethod)==="web")return!0;var o={userId:r?.user_id,deviceId:r?.device_id};this.identityEquals(this.identity,o)||this.clearCache(),this.identity=o,this.loadCache();var a=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],l=(i=e.variant)!==null&&i!==void 0?i:null,u=s??null,c=!1;return(!a||u!==l)&&(c=!0,this.inMemoryCache[e.flag_key]=l),this.storeCache(),c},t.prototype.clearCache=function(){this.inMemoryCache={},this.isSessionStorageAvailable&&ye.sessionStorage.removeItem(this.storageKey)},t.prototype.identityEquals=function(e,r){return e.userId&&r.userId?e.userId===r.userId:!e.userId&&!r.userId?e.deviceId===r.deviceId:!1},t.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=ye.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},t.prototype.storeCache=function(){if(this.isSessionStorageAvailable)try{ye.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch{}},t})(),Vp=(function(){function t(e,r){r===void 0&&(r=Fp),this.isLocalStorageAvailable=Ip(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=r}return t.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},t.prototype.setTracker=function(e){var r=this;this.tracker=e,this.poller=ye.setInterval(function(){r.loadFlushStore()},1e3),this.loadFlushStore()},t.prototype.flush=function(){if(this.tracker&&this.inMemoryQueue.length!==0){for(var e=0;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch{break}this.inMemoryQueue=this.inMemoryQueue.slice(e),this.inMemoryQueue.length===0&&this.poller&&(ye.clearInterval(this.poller),this.poller=void 0)}},t.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=ye.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},t.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),ye.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},t.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},t})(),jp=function(){var t=Tt();if(t)try{var e="EXP_test";return t.sessionStorage.setItem(e,e),t.sessionStorage.removeItem(e),!0}catch{return!1}return!1},Hp=(function(){function t(e,r){r===void 0&&(r=He.Error),this.logger=e,this.logLevel=r}return t.prototype.error=function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.logLevel>=He.Error&&(r=this.logger).error.apply(r,De([e],Ie(n),!1))},t.prototype.warn=function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.logLevel>=He.Warn&&(r=this.logger).warn.apply(r,De([e],Ie(n),!1))},t.prototype.info=function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.logLevel>=He.Info&&(r=this.logger).info.apply(r,De([e],Ie(n),!1))},t.prototype.debug=function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.logLevel>=He.Debug&&(r=this.logger).debug.apply(r,De([e],Ie(n),!1))},t.prototype.verbose=function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.logLevel>=He.Verbose&&(r=this.logger).verbose.apply(r,De([e],Ie(n),!1))},t})(),Gp=(function(){function t(){}return t.prototype.error=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];console.error.apply(console,De([e],Ie(r),!1))},t.prototype.warn=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];console.warn.apply(console,De([e],Ie(r),!1))},t.prototype.info=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];console.info.apply(console,De([e],Ie(r),!1))},t.prototype.debug=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];console.debug.apply(console,De([e],Ie(r),!1))},t.prototype.verbose=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];console.debug.apply(console,De([e],Ie(r),!1))},t})(),un=(function(){function t(){this.globalScope=Tt()}return t.prototype.get=function(e){var r;return(r=this.globalScope)===null||r===void 0?void 0:r.localStorage.getItem(e)},t.prototype.put=function(e,r){var n;(n=this.globalScope)===null||n===void 0||n.localStorage.setItem(e,r)},t.prototype.delete=function(e){var r;(r=this.globalScope)===null||r===void 0||r.localStorage.removeItem(e)},t})(),Wp=function(t,e,r){var n=t.substring(t.length-6),i="amp-exp-".concat(e,"-").concat(n);return new Qu(i,r,Zu)},Kp=function(t,e,r){r===void 0&&(r=new un);var n=t.substring(t.length-6),i="amp-exp-".concat(e,"-").concat(n,"-flags");return new Qu(i,r)},zp=function(t,e,r){r===void 0&&(r=new un);var n=t.substring(t.length-6),i="amp-exp-".concat(e,"-").concat(n,"-variants-options");return new $p(i,r)},$p=(function(){function t(e,r){this.namespace=e,this.storage=r}return t.prototype.get=function(){return this.value},t.prototype.put=function(e){this.value=e},t.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},t.prototype.store=function(){this.value===void 0?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},t})(),Qu=(function(){function t(e,r,n){this.cache={},this.namespace=e,this.storage=r,this.transformer=n}return t.prototype.get=function(e){return this.cache[e]},t.prototype.getAll=function(){return ne({},this.cache)},t.prototype.put=function(e,r){this.cache[e]=r},t.prototype.putAll=function(e){var r,n;try{for(var i=vt(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;this.cache[a]=e[a]}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.remove=function(e){delete this.cache[e]},t.prototype.clear=function(){this.cache={}},t.prototype.load=function(){var e,r,n=this.storage.get(this.namespace),i;try{i=JSON.parse(n)||{}}catch{return}var o={};try{for(var a=vt(Object.keys(i)),s=a.next();!s.done;s=a.next()){var l=s.value;try{var u=void 0;this.transformer?u=this.transformer(i[l]):u=i[l],u&&(o[l]=u)}catch{}}}catch(c){e={error:c}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}this.clear(),this.putAll(o)},t.prototype.store=function(e){e===void 0&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},t})(),Zu=function(t){if(typeof t=="string")return{key:t,value:t};if(typeof t=="object"){var e=t.key,r=t.value,n=t.payload,i=t.metadata,o=t.expKey;i&&i.experimentKey?o=i.experimentKey:o&&(i=i||{},i.experimentKey=o);var a={};return e?a.key=e:r&&(a.key=r),r&&(a.value=r),i&&(a.metadata=i),n&&(a.payload=n),o&&(a.expKey=o),a}},el=(function(){function t(){this.globalScope=Tt()}return t.prototype.get=function(e){var r;return(r=this.globalScope)===null||r===void 0?void 0:r.sessionStorage.getItem(e)},t.prototype.put=function(e,r){var n;(n=this.globalScope)===null||n===void 0||n.sessionStorage.setItem(e,r)},t.prototype.delete=function(e){var r;(r=this.globalScope)===null||r===void 0||r.sessionStorage.removeItem(e)},t})(),Xp=function(t,e,r,n){var i,o="[Experiment] Exposure",a=r?.value,s="[Experiment] ".concat(e);return{name:o,user:t,key:e,variant:r,userProperty:s,properties:{key:e,variant:a,source:n},userProperties:(i={},i[s]=a,i)}},je=function(t){return t==null},Dn=function(t){return je(t)?!0:t&&Object.keys(t).length===0},Yp=function(t){var e,r;if(!t||typeof t!="object")return{};var n={};try{for(var i=vt(Object.entries(t)),o=i.next();!o.done;o=i.next()){var a=Ie(o.value,2),s=a[0],l=a[1];je(l)||(n[s]=l)}}catch(u){e={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},Ma=function(t){var e;return((e=t?.metadata)===null||e===void 0?void 0:e.evaluationMode)==="local"},Jp=(function(){function t(e,r,n,i){this.started=!1,this.done=!1,this.attempts=e,this.min=r,this.max=n,this.scalar=i}return t.prototype.start=function(e){return Ee(this,void 0,void 0,function(){return Se(this,function(r){switch(r.label){case 0:if(!this.started)this.started=!0;else throw Error("Backoff already started");return[4,this.backoff(e,0,this.min)];case 1:return r.sent(),[2]}})})},t.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},t.prototype.backoff=function(e,r,n){return Ee(this,void 0,void 0,function(){var i=this;return Se(this,function(o){return this.done?[2]:(this.timeoutHandle=ye.setTimeout(function(){return Ee(i,void 0,void 0,function(){var a,s;return Se(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),[4,e()];case 1:return l.sent(),[3,3];case 2:return l.sent(),a=r+1,a<this.attempts&&(s=Math.min(n*this.scalar,this.max),this.backoff(e,a,s)),[3,3];case 3:return[2]}})})},n),[2])})})},t})(),Qp=function(t){var e,r,n,i;if(!t)return{};var o={user:t},a=Tt();a&&(o.page={url:a.location.href});var s={};if(!t.groups)return o;try{for(var l=vt(Object.keys(t.groups)),u=l.next();!u.done;u=l.next()){var c=u.value,f=t.groups[c];if(f.length>0&&f[0]){var d=f[0],v={group_name:d},h=(i=(n=t.group_properties)===null||n===void 0?void 0:n[c])===null||i===void 0?void 0:i[d];h&&Object.keys(h).length>0&&(v.group_properties=h),s[c]=v}}}catch(g){e={error:g}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}return Object.keys(s).length>0&&(o.groups=s),delete o.user.groups,delete o.user.group_properties,o},Ce=function(t){return t==null?{}:typeof t=="string"?{key:t,value:t}:t},Ua=function(t){if(!t)return{};var e=void 0;t.metadata&&(e=t.metadata.experimentKey);var r={};return t.key&&(r.key=t.key),t.value&&(r.value=t.value),t.payload&&(r.payload=t.payload),e&&(r.expKey=e),t.metadata&&(r.metadata=t.metadata),r},Zp=(function(){function t(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return t.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},t.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},t.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},t})(),em=(function(){function t(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return t.prototype.track=function(e,r){var n={userId:r?.user_id,deviceId:r?.device_id};this.identityEquals(this.identity,n)||(this.tracked={}),this.identity=n;var i=e.flag_key in this.tracked,o=this.tracked[e.flag_key];i&&o===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},t.prototype.identityEquals=function(e,r){return e.userId===r.userId&&e.deviceId===r.deviceId},t})(),tm=1e4,rm=8,nm=500,im=1e4,om=1.5,Fa=6e4,am="https://api.lab.eu.amplitude.com",sm="https://flag.lab.eu.amplitude.com",um=(function(){function t(e,r){var n=this,i,o,a,s;this.engine=new dp,this.isRunning=!1,this.apiKey=e,r=Yp(r),this.config=ne(ne(ne({},Rt),r),{serverUrl:r?.serverUrl||(((i=r?.serverZone)===null||i===void 0?void 0:i.toLowerCase())==="eu"?am:Rt.serverUrl),flagsServerUrl:r?.flagsServerUrl||(((o=r?.serverZone)===null||o===void 0?void 0:o.toLowerCase())==="eu"?sm:Rt.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<Fa?Fa:(a=r.flagConfigPollingIntervalMillis)!==null&&a!==void 0?a:Rt.flagConfigPollingIntervalMillis}),this.logger=new Hp(this.config.loggerProvider||new Gp,t.getLogLevel(r));var l=(s=this.config)===null||s===void 0?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment=l==="web",this.poller=new Ap(function(){return Ee(n,void 0,void 0,function(){var v;return Se(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),[4,this.doFlags()];case 1:return h.sent(),[3,3];case 2:return v=h.sent(),this.logger.info(v),[3,3];case 3:return[2]}})})},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var u in this.config.initialVariants)this.config.initialVariants[u]=Zu(this.config.initialVariants[u]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new Zp(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new em(this.config.exposureTrackingProvider)),this.integrationManager=new qp(this.config,this);var c=new Up(this.config.httpClient||Ju);this.flagApi=new _p(this.apiKey,this.config.flagsServerUrl,c),this.evaluationApi=new Tp(this.apiKey,this.config.serverUrl,c);var f,d=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;this.isWebExperiment?f=new el:f=new un,this.variants=Wp(this.apiKey,d,f),this.flags=Kp(this.apiKey,d,f),this.fetchVariantsOptions=zp(this.apiKey,d,f);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch{}this.mergeInitialFlagsWithStorage()}return t.prototype.start=function(e){return Ee(this,void 0,void 0,function(){var r,n,i,o;return Se(this,function(a){switch(a.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),a.label=1;case 1:return a.trys.push([1,6,,7]),r=this.doFlags(),n=(o=this.config.fetchOnStart)!==null&&o!==void 0?o:!0,n?[4,Promise.all([this.fetch(e),r])]:[3,3];case 2:return a.sent(),[3,5];case 3:return[4,r];case 4:a.sent(),a.label=5;case 5:return[3,7];case 6:if(i=a.sent(),this.config.throwOnError)throw i;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},t.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},t.prototype.fetch=function(){return Ee(this,arguments,void 0,function(e,r){var n;return e===void 0&&(e=this.user),Se(this,function(i){switch(i.label){case 0:this.setUser(e||{}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,r)];case 2:return i.sent(),[3,4];case 3:if(n=i.sent(),this.config.throwOnError)throw n;return n instanceof hi?this.logger.debug(n):this.logger.error(n),[3,4];case 4:return[2,this]}})})},t.prototype.variant=function(e,r){var n,i;if(!this.apiKey)return{value:void 0};var o=this.variantAndSource(e,r);return this.config.automaticExposureTracking&&this.exposureInternal(e,o),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat(((n=o.variant)===null||n===void 0?void 0:n.key)||((i=o.variant)===null||i===void 0?void 0:i.value))),o.variant||{}},t.prototype.exposure=function(e){var r=this.variantAndSource(e);this.exposureInternal(e,r)},t.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var r in e){var n=this.flags.get(r);Ma(n)||delete e[r]}return ne(ne(ne({},this.secondaryVariants()),this.sourceVariants()),e)},t.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch{}},t.prototype.getUser=function(){var e;if(!this.user)return this.user;if(!((e=this.user)===null||e===void 0)&&e.user_properties){var r=ne({},this.user.user_properties);return ne(ne({},this.user),{user_properties:r})}else return ne({},this.user)},t.prototype.setUser=function(e){var r;if(!e){this.user=null;return}if(!((r=this.user)===null||r===void 0)&&r.user_properties){var n=ne({},e.user_properties);this.user=ne(ne({},e),{user_properties:n})}else this.user=ne({},e)},t.prototype.getUserProvider=function(){return this.userProvider},t.prototype.setUserProvider=function(e){return this.userProvider=e,this},t.prototype.mergeInitialFlagsWithStorage=function(){var e=this;if(this.config.initialFlags){var r=JSON.parse(this.config.initialFlags);r.forEach(function(n){e.flags.get(n.key)||e.flags.put(n.key,n)})}},t.prototype.evaluate=function(e){var r,n,i=this.addContext(this.user),o=fp(this.flags.getAll(),e),a=Qp(i),s=this.engine.evaluate(a,o),l={};try{for(var u=vt(Object.keys(s)),c=u.next();!c.done;c=u.next()){var f=c.value;l[f]=Ua(s[f])}}catch(d){r={error:d}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return l},t.prototype.variantAndSource=function(e,r){var n={};this.config.source===rt.LocalStorage?n=this.localStorageVariantAndSource(e,r):this.config.source===rt.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,r));var i=this.flags.get(e);return(Ma(i)||!n.variant&&i)&&(n=this.localEvaluationVariantAndSource(e,i,r)),n},t.prototype.localEvaluationVariantAndSource=function(e,r,n){var i,o={},a=this.evaluate([r.key])[e],s=be.LocalEvaluation,l=(i=a?.metadata)===null||i===void 0?void 0:i.default;if(!je(a)&&!l)return{variant:Ce(a),source:s,hasDefaultVariant:!1};if(l&&(o={variant:Ce(a),source:s,hasDefaultVariant:!0}),!je(n))return{variant:Ce(n),source:be.FallbackInline,hasDefaultVariant:o.hasDefaultVariant};var u=this.config.initialVariants[e];if(!je(u))return{variant:Ce(u),source:be.SecondaryInitialVariants,hasDefaultVariant:o.hasDefaultVariant};var c=Ce(this.config.fallbackVariant),f={variant:c,source:be.FallbackConfig,hasDefaultVariant:o.hasDefaultVariant};return Dn(c)?o:f},t.prototype.localStorageVariantAndSource=function(e,r){var n,i={},o=this.variants.get(e),a=(n=o?.metadata)===null||n===void 0?void 0:n.default;if(!je(o)&&!a)return{variant:Ce(o),source:be.LocalStorage,hasDefaultVariant:!1};if(a&&(i={variant:Ce(o),source:be.LocalStorage,hasDefaultVariant:!0}),!je(r))return{variant:Ce(r),source:be.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var s=this.config.initialVariants[e];if(!je(s))return{variant:Ce(s),source:be.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=Ce(this.config.fallbackVariant),u={variant:l,source:be.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return Dn(l)?i:u},t.prototype.initialVariantsVariantAndSource=function(e,r){var n,i={},o=this.config.initialVariants[e];if(!je(o))return{variant:Ce(o),source:be.InitialVariants,hasDefaultVariant:!1};var a=this.variants.get(e),s=(n=a?.metadata)===null||n===void 0?void 0:n.default;if(!je(a)&&!s)return{variant:Ce(a),source:be.LocalStorage,hasDefaultVariant:!1};if(s&&(i={variant:Ce(a),source:be.LocalStorage,hasDefaultVariant:!0}),!je(r))return{variant:Ce(r),source:be.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var l=Ce(this.config.fallbackVariant),u={variant:l,source:be.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return Dn(l)?i:u},t.prototype.fetchInternal=function(e,r,n,i){return Ee(this,void 0,void 0,function(){var o,a,s;return Se(this,function(l){switch(l.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(n)),n&&this.stopRetries(),l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this.doFetch(e,r,ne({trackingOption:(s=this.fetchVariantsOptions.get())===null||s===void 0?void 0:s.trackingOption},i))];case 2:return o=l.sent(),[4,this.storeVariants(o,i)];case 3:return l.sent(),[2,o];case 4:throw a=l.sent(),n&&this.shouldRetryFetch(a)&&this.startRetries(e,i),a;case 5:return[2]}})})},t.prototype.setTracksAssignment=function(e){return Ee(this,void 0,void 0,function(){return Se(this,function(r){return this.fetchVariantsOptions.put(ne(ne({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store(),[2]})})},t.prototype.cleanUserPropsForFetch=function(e){var r=ne({},e);return delete r.cookie,r},t.prototype.doFetch=function(e,r,n){return Ee(this,void 0,void 0,function(){var i,o,a,s,l,u,c;return Se(this,function(f){switch(f.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=f.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,ne({timeoutMillis:r},n))];case 2:i=f.sent(),o={};try{for(a=vt(Object.keys(i)),s=a.next();!s.done;s=a.next())l=s.value,o[l]=Ua(i[l])}catch(d){u={error:d}}finally{try{s&&!s.done&&(c=a.return)&&c.call(a)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",o),[2,o]}})})},t.prototype.doFlags=function(){return Ee(this,void 0,void 0,function(){var e,r,n;return Se(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=i.sent(),i.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Da,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:e?.user_id||e?.device_id?{user_id:e?.user_id,device_id:e?.device_id}:void 0})];case 3:return r=i.sent(),this.flags.clear(),this.flags.putAll(r),[3,5];case 4:if(n=i.sent(),n instanceof hi){if(this.logger.debug(n),this.config.throwOnError)throw n}else throw n;return[3,5];case 5:try{this.flags.store()}catch{}return this.mergeInitialFlagsWithStorage(),[2]}})})},t.prototype.storeVariants=function(e,r){return Ee(this,void 0,void 0,function(){var n,i,o,a,a;return Se(this,function(s){n=r&&r.flagKeys?r.flagKeys:[],n.length===0&&this.variants.clear(),i=function(l){n=n.filter(function(u){return u!==l}),o.variants.put(l,e[l])},o=this;for(a in e)i(a);for(a in n)this.variants.remove(a);try{this.variants.store()}catch{}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},t.prototype.startRetries=function(e,r){return Ee(this,void 0,void 0,function(){var n=this;return Se(this,function(i){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new Jp(rm,nm,im,om),this.retriesBackoff.start(function(){return Ee(n,void 0,void 0,function(){return Se(this,function(o){switch(o.label){case 0:return[4,this.fetchInternal(e,tm,!1,r)];case 1:return o.sent(),[2]}})})}),[2]})})},t.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},t.prototype.addContext=function(e){var r,n=(r=this.userProvider)===null||r===void 0?void 0:r.getUser(),i=this.integrationManager.getUser(),o=ne(ne(ne({},n?.user_properties),i.user_properties),e?.user_properties);return ne(ne(ne(ne({library:"experiment-js-client/".concat(Da)},n),i),e),{user_properties:o})},t.prototype.addContextOrWait=function(e){return Ee(this,void 0,void 0,function(){return Se(this,function(r){switch(r.label){case 0:return[4,this.integrationManager.ready()];case 1:return r.sent(),[2,this.addContext(e)]}})})},t.prototype.sourceVariants=function(){if(this.config.source==rt.LocalStorage)return this.variants.getAll();if(this.config.source==rt.InitialVariants)return this.config.initialVariants},t.prototype.secondaryVariants=function(){if(this.config.source==rt.LocalStorage)return this.config.initialVariants;if(this.config.source==rt.InitialVariants)return this.variants.getAll()},t.prototype.exposureInternal=function(e,r){var n,i,o,a,s,l,u,c,f,d=(o=(i=(n=r.variant)===null||n===void 0?void 0:n.metadata)===null||i===void 0?void 0:i.trackExposure)!==null&&o!==void 0?o:!0;if(d){this.legacyExposureInternal(e,r.variant,r.source);var v={flag_key:e},h=La(r.source);if(!(h&&!r.hasDefaultVariant)){!((a=r.variant)===null||a===void 0)&&a.expKey&&(v.experiment_key=(s=r.variant)===null||s===void 0?void 0:s.expKey);var g=(l=r.variant)===null||l===void 0?void 0:l.metadata;if(!h&&!g?.default&&(!((u=r.variant)===null||u===void 0)&&u.key?v.variant=r.variant.key:!((c=r.variant)===null||c===void 0)&&c.value&&(v.variant=r.variant.value)),g&&(v.metadata=g),this.isWebExperiment&&(v.time=Date.now()),this.isWebExperiment){var m=Tt();if(m?.location)try{var E=m.location.href;v.metadata.url=E.split("?")[0]||""}catch{}}var p=this.addContext(this.getUser());(f=this.userSessionExposureTracker)===null||f===void 0||f.track(v,p),this.integrationManager.track(v,p)}}},t.prototype.legacyExposureInternal=function(e,r,n){var i,o,a,s,l;if(this.analyticsProvider){var u=this.addContext(this.getUser()),c=Xp(u,e,r,n);La(n)||!r?.value?(o=(i=this.analyticsProvider)===null||i===void 0?void 0:i.unsetUserProperty)===null||o===void 0||o.call(i,c):r?.value&&((s=(a=this.analyticsProvider)===null||a===void 0?void 0:a.setUserProperty)===null||s===void 0||s.call(a,c),(l=this.analyticsProvider)===null||l===void 0||l.track(c))}},t.getLogLevel=function(e){var r;return e.debug===!0?He.Debug:(r=e.logLevel)!==null&&r!==void 0?r:He.Error},t.prototype.shouldRetryFetch=function(e){return e instanceof Yu?e.statusCode<400||e.statusCode>=500||e.statusCode===429:!0},t.prototype.addPlugin=function(e){e.type==="integration"&&this.integrationManager.setIntegration(e)},t})(),lm=(function(){function t(e,r){var n,i,o;this.globalScope=Tt(),this.userAgent=typeof((n=this.globalScope)===null||n===void 0?void 0:n.navigator)<"u"?(i=this.globalScope)===null||i===void 0?void 0:i.navigator.userAgent:void 0,this.ua=new Pp.UAParser(this.userAgent).getResult(),this.localStorage=new un,this.sessionStorage=new el,this.userProvider=e,this.apiKey=r,this.storageKey="EXP_".concat((o=this.apiKey)===null||o===void 0?void 0:o.slice(0,10),"_DEFAULT_USER_PROVIDER")}return t.prototype.getUser=function(){var e,r,n,i,o,a=((e=this.userProvider)===null||e===void 0?void 0:e.getUser())||{};return ne({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:(n=(r=this.ua.device)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:"desktop",referring_url:(o=(i=this.globalScope)===null||i===void 0?void 0:i.document)===null||o===void 0?void 0:o.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},a)},t.prototype.getLanguage=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},t.prototype.getOs=function(e){var r,n;return[(r=e.browser)===null||r===void 0?void 0:r.name,(n=e.browser)===null||n===void 0?void 0:n.major].filter(function(i){return i!=null}).join(" ")},t.prototype.getDeviceModel=function(e){var r;return(r=e.os)===null||r===void 0?void 0:r.name},t.prototype.getBrowser=function(e){var r,n=(r=e.browser)===null||r===void 0?void 0:r.name;return n?.includes("Chrom")&&(n="Chrome"),n?.includes("Firefox")&&(n="Firefox"),n?.includes("Safari")&&(n="Safari"),n?.includes("Edge")&&(n="Edge"),n?.includes("Opera")&&(n="Opera"),n},t.prototype.getCookie=function(){var e,r,n,i,o;if(!((r=(e=this.globalScope)===null||e===void 0?void 0:e.document)===null||r===void 0)&&r.cookie)return Object.fromEntries((o=(i=(n=this.globalScope)===null||n===void 0?void 0:n.document)===null||i===void 0?void 0:i.cookie)===null||o===void 0?void 0:o.split("; ").map(function(a){return a.split("=")}))},t.prototype.getLandingUrl=function(){var e,r;try{var n=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return n.landing_url||(n.landing_url=(r=(e=this.globalScope)===null||e===void 0?void 0:e.location)===null||r===void 0?void 0:r.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(n))),n.landing_url}catch{return}},t.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch{return}},t.prototype.getUrlParam=function(){var e,r,n;if(this.globalScope){var i={};try{var o=new URL(this.globalScope.location.href);try{for(var a=vt(o.searchParams),s=a.next();!s.done;s=a.next()){var l=Ie(s.value,2),u=l[0],c=l[1];i[u]=De(De([],Ie((n=i[u])!==null&&n!==void 0?n:[]),!1),Ie(c.split(",")),!1)}}catch(f){e={error:f}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}catch{return}return Object.entries(i).reduce(function(f,d){var v=Ie(d,2),h=v[0],g=v[1];return f[h]=g.length==1?g[0]:g,f},{})}},t})();ye.experimentInstances={};var qa=ye.experimentInstances,cm=function(t,e){var r=function(){return new xp(t,mi.getInstance(tl(e)),1e4)};return vm(t,e,r)},tl=function(t){return t?.instanceName||Rt.instanceName},dm=function(t,e){var r=tl(e),n=e?.internalInstanceNameSuffix;return n?"".concat(r,".").concat(t,".").concat(n):"".concat(r,".").concat(t)},fm=function(t,e){return new um(t,ne(ne({},e),{userProvider:new lm(e?.userProvider,t)}))},vm=function(t,e,r){var n=dm(t,e),i=qa[n];return i||(i=fm(t,e),r&&i.addPlugin(r()),qa[n]=i,i)},Vr=(function(){function t(e){this.name=t.pluginName,this.config=e}return t.prototype.setup=function(e,r){var n;return _(this,void 0,void 0,function(){return T(this,function(i){return this.experiment=cm(((n=this.config)===null||n===void 0?void 0:n.deploymentKey)||e.apiKey,this.config),[2]})})},t.pluginName="@amplitude/experiment-analytics-plugin",t})(),hm=function(t){return new Vr(t)},gm=(function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pm(),platform:"Web",os:void 0,deviceModel:void 0}},t})(),pm=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},mm=(function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(r){e(r)}),this.queue=[])},t})(),ut=function(){return ut=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ut.apply(this,arguments)};function jr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ba(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}var Hr=function(t,e){var r,n,i=["string","number","boolean","undefined"],o=typeof t,a=typeof e;if(o!==a)return!1;try{for(var s=jr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(u===o)return t===e}}catch(m){r={error:m}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),f=Array.isArray(e);if(c!==f)return!1;if(c&&f){for(var d=0;d<t.length;d++)if(!Hr(t[d],e[d]))return!1}else{var v=Object.keys(t).sort(),h=Object.keys(e).sort();if(!Hr(v,h))return!1;var g=!0;return Object.keys(t).forEach(function(m){Hr(t[m],e[m])||(g=!1)}),g}return!0},ym="$set",bm="$unset",Em="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n});var Sm=(function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,r=ut({},this.identity.userProperties),n=ut(ut({},this.identity),{userProperties:r});return{setUserId:function(i){return n.userId=i,this},setDeviceId:function(i){return n.deviceId=i,this},setUserProperties:function(i){return n.userProperties=i,this},setOptOut:function(i){return n.optOut=i,this},updateUserProperties:function(i){var o,a,s,l,u,c,f=n.userProperties||{};try{for(var d=jr(Object.entries(i)),v=d.next();!v.done;v=d.next()){var h=Ba(v.value,2),g=h[0],m=h[1];switch(g){case ym:try{for(var E=(s=void 0,jr(Object.entries(m))),p=E.next();!p.done;p=E.next()){var y=Ba(p.value,2),b=y[0],S=y[1];f[b]=S}}catch(I){s={error:I}}finally{try{p&&!p.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}break;case bm:try{for(var w=(u=void 0,jr(Object.keys(m))),A=w.next();!A.done;A=w.next()){var b=A.value;delete f[b]}}catch(I){u={error:I}}finally{try{A&&!A.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}break;case Em:f={};break}}}catch(I){o={error:I}}finally{try{v&&!v.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}return n.userProperties=f,this},commit:function(){return e.setIdentity(n),this}}},t.prototype.getIdentity=function(){return ut({},this.identity)},t.prototype.setIdentity=function(e){var r=ut({},this.identity);this.identity=ut({},e),Hr(r,this.identity)||this.listeners.forEach(function(n){n(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t})(),Jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:self,wm=(function(){function t(){this.identityStore=new Sm,this.eventBridge=new mm,this.applicationContextProvider=new gm}return t.getInstance=function(e){return Jt.analyticsConnectorInstances||(Jt.analyticsConnectorInstances={}),Jt.analyticsConnectorInstances[e]||(Jt.analyticsConnectorInstances[e]=new t),Jt.analyticsConnectorInstances[e]},t})(),Va=["boot"],Tm="$default_instance";function _m(t){var e,r,n,i,o,a,s,l,u;let c=typeof window<"u"?window.engagement:void 0,f=!1,d={_q:(e=c?._q)!=null?e:[],_configuration:{apiKey:(n=(r=c?._configuration)==null?void 0:r.apiKey)!=null?n:"",serverUrl:(i=c?._configuration)==null?void 0:i.serverUrl,chatUrl:(o=c?._configuration)==null?void 0:o.chatUrl,mediaUrl:(a=c?._configuration)==null?void 0:a.mediaUrl,serverZone:(l=(s=c?._configuration)==null?void 0:s.serverZone)!=null?l:"US",options:{...(u=c?._configuration)==null?void 0:u.options}},init(h,g){var m,E,p,y;if(d._configuration.apiKey){console.log("Engagement SDK has already been initialized. Ignoring additional init call.");return}if(g!=null&&g.useEngagementDomain){let I=((m=g.serverZone)!=null?m:d._configuration.serverZone)==="EU",k="amplitudeengagement.com";g.serverUrl||(g.serverUrl=I?`https://gs.eu.${k}`:`https://gs.${k}`),g.chatUrl||(g.chatUrl=I?`https://houston-chat.eu.${k}`:`https://houston-chat.${k}`),g.mediaUrl||(g.mediaUrl=I?`https://engagement-static.eu.${k}`:`https://engagement-static.${k}`),g.cdnUrl||(g.cdnUrl=I?`https://cdn.eu.${k}`:`https://cdn.${k}`)}d._configuration={...d._configuration,...g,apiKey:h,options:{splitting:!0,...d._configuration.options,...g?.options}},(p=(E=d._configuration)==null?void 0:E.options)!=null&&p.logger&&d._configuration.options.logger.enable((y=d._configuration.options.logLevel)!=null?y:2);let b;if(g!=null&&g.cdnUrl)d._configuration.options.splitting?b=`${g.cdnUrl}/engagement-browser/prod/split/index.js`:b=g.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let I=d._configuration.serverZone==="EU"?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";d._configuration.options.splitting?b=`${I}/engagement-browser/prod/split/index.js`:b=`${I}/engagement-browser/prod/index.min.js.gz`}let S=null,w=()=>{if(f=!0,S&&(clearTimeout(S),S=null),d._q&&d._q.length>0)for(console.warn(`Engagement SDK failed to load within ${A}ms. Resolving pending calls gracefully.`);d._q.length>0;){let I=d._q.shift();if(!I)continue;let k=I[0],x=Va.includes(k);if(console.warn(`Engagement SDK method '${k}' still in queue (isAsyncMethod=${x}); attempting to resolve as no-op.`),x&&I[1]instanceof Function&&I[2]instanceof Function){let P=I[1];console.warn(`Engagement SDK method '${k}' resolved as no-op due to script loading failure`),P(void 0)}}};t(b,d._configuration.options.splitting?"module":void 0,g?.nonce,w);let A=1e4;S=setTimeout(()=>{w()},A)},plugin(h){let g=d.init;return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(m,E){var p;let y=(p=m.instanceName)!=null?p:Tm,b=wm.getInstance(y).identityStore;g(m.apiKey,{serverZone:m.serverZone,...h,options:{logLevel:m.logLevel,logger:m.loggerProvider,...h?.options}});let S=[{track:w=>{E.track(w)}}];await window.engagement.boot({user:()=>{let w=b.getIdentity();return{user_id:E.getUserId(),device_id:E.getDeviceId(),user_properties:w.userProperties,getSessionId:E.getSessionId}},integrations:S}),b.addIdentityListener(w=>{var A,I,k,x;if(!((A=window.engagement)!=null&&A._.user)||!((I=window.engagement)!=null&&I._analytics.hasBooted)){console.warn("Engagement SDK not booted. Ignoring identity change.");return}((x=(k=window.engagement)==null?void 0:k._.user)==null?void 0:x.user_id)!==w.userId?(window.engagement.shutdown(),window.engagement.boot({user:()=>{let P=b.getIdentity();return{user_id:E.getUserId(),device_id:E.getDeviceId(),user_properties:P.userProperties,getSessionId:E.getSessionId}},integrations:S})):window.engagement._setUserProperties(w.userProperties)})},async execute(m){return window.engagement.forwardEvent(m),m}}}},v=d;return new Proxy(d,{get:function(h,g){if(g in v)return v[g];if(g!=="then")return g==="gs"||g==="rc"?new Proxy({},{get:function(m,E){return function(){let p=Array.from(arguments),y=`${g}.${E}`;p.unshift(y),d._q.push(p)}}}):Va.includes(g)?function(){let m=Array.prototype.slice.call(arguments);return new Promise((E,p)=>{m.unshift(g,E,p),d._q.push(m),f&&E(void 0)})}:function(){let m=Array.prototype.slice.call(arguments);m.unshift(g),d._q.push(m)}}})}var rl=(t=>(t.Local="https://local.amplitude.com:3010/",t.Staging="https://apps.stag2.amplitude.com/",t.Production="https://app.amplitude.com/",t.ProductionEU="https://app.eu.amplitude.com/",t))(rl||{}),Im=t=>{if(typeof window<"u"&&window.opener)for(let e of Object.values(rl))window.opener.postMessage({message:t},e)};function Am(t,e,r,n){for(let i of t){let o=document.createElement("script");o.src=i,o.id="engagement-sdk-bundle",r&&o.setAttribute("nonce",r),e&&o.setAttribute("type",e),n&&(o.onerror=n),document.getElementsByTagName("head")[0].appendChild(o)}}var Cm=()=>(Im("ENGAGEMENT_SNIPPET"),_m((t,e,r,n)=>Am([t||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],e,r,n))),ja=Cm(),km=t=>(typeof window<"u"&&!window.engagement&&(window.engagement=ja),ja.plugin(t)),Pm="1.0.15",Om="amplitude-ts-unified",Rm=function(){return{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(t){var e;return _(this,void 0,void 0,function(){return T(this,function(r){return t.library="".concat(Om,"/").concat(Pm,"-").concat((e=t.library)!==null&&e!==void 0?e:""),[2,t]})})}}},xm=(function(t){Fe(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.sessionReplay=function(){return this._sessionReplay},e.prototype.experiment=function(){if(this.config!==void 0){var r=this.plugins(Vr);if(r.length===0){this.config.loggerProvider.debug("".concat(Vr.pluginName," plugin is not found."));return}else{if(r.length===1)return r[0].experiment;this.config.loggerProvider.debug("Multiple instances of ".concat(Vr.pluginName," are found."));return}}},e.prototype.initAll=function(r,n){return _(this,void 0,void 0,function(){var i=this;return T(this,function(o){return this._initAllPromise?[2,this._initAllPromise]:(this._initAllPromise=(function(){return _(i,void 0,void 0,function(){var a,s;return T(this,function(l){switch(l.label){case 0:return a={serverZone:n?.serverZone,instanceName:n?.instanceName},t.prototype.add.call(this,Rm()),[4,t.prototype.init.call(this,r,C(C({},n?.analytics),a)).promise];case 1:return l.sent(),[4,t.prototype.add.call(this,Yg(C(C({},n?.sessionReplay),a))).promise];case 2:return l.sent(),[4,t.prototype.add.call(this,hm(C(C({},n?.experiment),a))).promise];case 3:return l.sent(),s=this.plugin(li.pluginName),s===void 0?this.config.loggerProvider.debug("".concat(li.pluginName," plugin is not found.")):this._sessionReplay=s.sessionReplay,[4,t.prototype.add.call(this,km(C(C({},n?.engagement),a))).promise];case 4:return l.sent(),[2]}})})})().finally(function(){i._initAllPromise=void 0}),[2,this._initAllPromise])})})},e.prototype.init=function(r,n,i){r===void 0&&(r="");var o=t.prototype.init.call(this,r,n,i);return o},e})(ih),Nm=function(){var t=new xm;return{_setDiagnosticsSampleRate:Q(t._setDiagnosticsSampleRate.bind(t),"_setDiagnosticsSampleRate",ae(t),se(t,["config"])),_enableRequestBodyCompressionExperimental:Q(t._enableRequestBodyCompressionExperimental.bind(t),"_enableRequestBodyCompressionExperimental",ae(t),se(t,["config"])),experiment:Q(t.experiment.bind(t),"experiment",ae(t),se(t,["config"])),sessionReplay:Q(t.sessionReplay.bind(t),"sessionReplay",ae(t),se(t,["config"])),initAll:Q(t.initAll.bind(t),"initAll",ae(t),se(t,["config"])),init:Q(t.init.bind(t),"init",ae(t),se(t,["config"])),add:Q(t.add.bind(t),"add",ae(t),se(t,["config.apiKey","timeline.plugins"])),remove:Q(t.remove.bind(t),"remove",ae(t),se(t,["config.apiKey","timeline.plugins"])),track:Q(t.track.bind(t),"track",ae(t),se(t,["config.apiKey","timeline.queue.length"])),logEvent:Q(t.logEvent.bind(t),"logEvent",ae(t),se(t,["config.apiKey","timeline.queue.length"])),identify:Q(t.identify.bind(t),"identify",ae(t),se(t,["config.apiKey","timeline.queue.length"])),groupIdentify:Q(t.groupIdentify.bind(t),"groupIdentify",ae(t),se(t,["config.apiKey","timeline.queue.length"])),setGroup:Q(t.setGroup.bind(t),"setGroup",ae(t),se(t,["config.apiKey","timeline.queue.length"])),revenue:Q(t.revenue.bind(t),"revenue",ae(t),se(t,["config.apiKey","timeline.queue.length"])),flush:Q(t.flush.bind(t),"flush",ae(t),se(t,["config.apiKey","timeline.queue.length"])),getUserId:Q(t.getUserId.bind(t),"getUserId",ae(t),se(t,["config","config.userId"])),setUserId:Q(t.setUserId.bind(t),"setUserId",ae(t),se(t,["config","config.userId"])),getDeviceId:Q(t.getDeviceId.bind(t),"getDeviceId",ae(t),se(t,["config","config.deviceId"])),setDeviceId:Q(t.setDeviceId.bind(t),"setDeviceId",ae(t),se(t,["config","config.deviceId"])),reset:Q(t.reset.bind(t),"reset",ae(t),se(t,["config","config.userId","config.deviceId"])),getSessionId:Q(t.getSessionId.bind(t),"getSessionId",ae(t),se(t,["config"])),setSessionId:Q(t.setSessionId.bind(t),"setSessionId",ae(t),se(t,["config"])),extendSession:Q(t.extendSession.bind(t),"extendSession",ae(t),se(t,["config"])),setOptOut:Q(t.setOptOut.bind(t),"setOptOut",ae(t),se(t,["config"])),getOptOut:Q(t.getOptOut.bind(t),"getOptOut",ae(t),se(t,["config"])),setTransport:Q(t.setTransport.bind(t),"setTransport",ae(t),se(t,["config"])),getIdentity:Q(t.getIdentity.bind(t),"getIdentity",ae(t),se(t,["config"])),setIdentity:Q(t.setIdentity.bind(t),"setIdentity",ae(t),se(t,["config","config.userId","config.deviceId"]))}};const gr=Nm();var Fm=gr.initAll,qm=gr.identify,Bm=gr.reset,Vm=gr.setUserId,jm=gr.track;export{gl as B,tr as I,_,T as a,qm as b,C as c,Fm as d,Qt as e,F as g,Dm as i,Tu as o,Bm as r,Vm as s,jm as t};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/K4hkKKa0.js

```js
import{b as u,g as c,d as l,j as g,k as h}from"./3TW-MQft.js";import{s as d,I as f,b as m,t as o,r as b}from"./HWAjEwF5.js";const y=!0,n=Symbol("auth");class S{#t=u(null);get user(){return c(this.#t)}set user(t){l(this.#t,t,!0)}constructor(){{const t=localStorage.getItem("currentUser");t&&(this.user={username:t,burritoConsiderations:0})}}login=async(t,i)=>{try{const e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:i})});if(e.ok){const{user:a}=await e.json();if(this.user=a,y){localStorage.setItem("currentUser",t),d(t);const s=new f;s.set("username",t),m(s),o("user_logged_in",{username:t})}return!0}return!1}catch(e){return console.error("Login error:",e),!1}};logout=()=>{o("user_logged_out"),b(),localStorage.removeItem("currentUser"),this.user=null};incrementBurritoConsiderations=()=>{this.user&&(this.user={...this.user,burritoConsiderations:this.user.burritoConsiderations+1})}}function I(r){g(n,r)}function U(){return h(n)}export{S as A,U as g,I as s};

```

---

## .svelte-kit/output/client/_app/immutable/chunks/sPdhR0i8.js

```js
var me={},ki=Object.defineProperty,qi=(e,o,p)=>o in e?ki(e,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[o]=p,le=(e,o,p)=>qi(e,typeof o!="symbol"?o+"":o,p),Fi=Object.defineProperty,Bi=(e,o,p)=>o in e?Fi(e,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[o]=p,_e=(e,o,p)=>Bi(e,typeof o!="symbol"?o+"":o,p),tr,zi=Object.defineProperty,ji=(e,o,p)=>o in e?zi(e,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[o]=p,rr=(e,o,p)=>ji(e,typeof o!="symbol"?o+"":o,p);const ir={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},sr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ae={};function Wi(e){var o,p;const d=(p=(o=globalThis?.Zone)==null?void 0:o.__symbol__)==null?void 0:p.call(o,e);if(d&&globalThis[d])return globalThis[d]}function kt(e){if(ae[e])return ae[e];const o=Wi(e)||globalThis[e],p=o.prototype,d=e in ir?ir[e]:void 0,s=!!(d&&d.every(m=>{var n,h;return!!((h=(n=Object.getOwnPropertyDescriptor(p,m))==null?void 0:n.get)!=null&&h.toString().includes("[native code]"))})),f=e in sr?sr[e]:void 0,a=!!(f&&f.every(m=>{var n;return typeof p[m]=="function"&&((n=p[m])==null?void 0:n.toString().includes("[native code]"))}));if(s&&a)return ae[e]=o.prototype,o.prototype;try{const m=document.createElement("iframe");document.body.appendChild(m);const n=m.contentWindow;if(!n)return o.prototype;const h=n[e].prototype;return document.body.removeChild(m),h?ae[e]=h:p}catch{return p}}const Ie={};function W(e,o,p){var d;const s=`${e}.${String(p)}`;if(Ie[s])return Ie[s].call(o);const f=kt(e),a=(d=Object.getOwnPropertyDescriptor(f,p))==null?void 0:d.get;return a?(Ie[s]=a,a.call(o)):o[p]}const Le={};function pi(e,o,p){const d=`${e}.${String(p)}`;if(Le[d])return Le[d].bind(o);const f=kt(e)[p];return typeof f!="function"?o[p]:(Le[d]=f,f.bind(o))}function Hi(e){return W("Node",e,"childNodes")}function Gi(e){return W("Node",e,"parentNode")}function Ji(e){return W("Node",e,"parentElement")}function Vi(e){return W("Node",e,"textContent")}function Ki(e,o){return pi("Node",e,"contains")(o)}function Qi(e){return pi("Node",e,"getRootNode")()}function Yi(e){return!e||!("host"in e)?null:W("ShadowRoot",e,"host")}function Xi(e){return e.styleSheets}function Zi(e){return!e||!("shadowRoot"in e)?null:W("Element",e,"shadowRoot")}function es(e,o){return W("Element",e,"querySelector")(o)}function ts(e,o){return W("Element",e,"querySelectorAll")(o)}function rs(){return kt("MutationObserver").constructor}const ge={childNodes:Hi,parentNode:Gi,parentElement:Ji,textContent:Vi,contains:Ki,getRootNode:Qi,host:Yi,styleSheets:Xi,shadowRoot:Zi,querySelector:es,querySelectorAll:ts,mutationObserver:rs};function is(e){const o=e&&"host"in e&&"mode"in e&&ge.host(e)||null;return!!(o&&"shadowRoot"in o&&ge.shadowRoot(o)===e)}class ss{constructor(){rr(this,"idNodeMap",new Map),rr(this,"nodeMetaMap",new WeakMap)}getId(o){var p;return o?((p=this.getMeta(o))==null?void 0:p.id)??-1:-1}getNode(o){return this.idNodeMap.get(o)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(o){return this.nodeMetaMap.get(o)||null}removeNodeFromMap(o){const p=this.getId(o);this.idNodeMap.delete(p),o.childNodes&&o.childNodes.forEach(d=>this.removeNodeFromMap(d))}has(o){return this.idNodeMap.has(o)}hasNode(o){return this.nodeMetaMap.has(o)}add(o,p){const d=p.id;this.idNodeMap.set(d,o),this.nodeMetaMap.set(o,p)}replace(o,p){const d=this.getNode(o);if(d){const s=this.nodeMetaMap.get(d);s&&this.nodeMetaMap.set(p,s)}this.idNodeMap.set(o,p)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ns(){return new ss}const os=-2;function Tt(e,o,p){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return p?Tt(ge.parentNode(e),o,p):!1;for(let d=e.classList.length;d--;){const s=e.classList[d];if(o.test(s))return!0}return p?Tt(ge.parentNode(e),o,p):!1}function ls(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function as(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var o=e.default;if(typeof o=="function"){var p=function d(){return this instanceof d?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};p.prototype=o.prototype}else p={};return Object.defineProperty(p,"__esModule",{value:!0}),Object.keys(e).forEach(function(d){var s=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(p,d,s.get?s:{enumerable:!0,get:function(){return e[d]}})}),p}var ue={exports:{}},nr;function us(){if(nr)return ue.exports;nr=1;var e=String,o=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return ue.exports=o(),ue.exports.createColors=o,ue.exports}const fs={},hs=Object.freeze(Object.defineProperty({__proto__:null,default:fs},Symbol.toStringTag,{value:"Module"})),F=as(hs);var $e,or;function qt(){if(or)return $e;or=1;let e=us(),o=F;class p extends Error{constructor(s,f,a,m,n,h){super(s),this.name="CssSyntaxError",this.reason=s,n&&(this.file=n),m&&(this.source=m),h&&(this.plugin=h),typeof f<"u"&&typeof a<"u"&&(typeof f=="number"?(this.line=f,this.column=a):(this.line=f.line,this.column=f.column,this.endLine=a.line,this.endColumn=a.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,p)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(s){if(!this.source)return"";let f=this.source;s==null&&(s=e.isColorSupported),o&&s&&(f=o(f));let a=f.split(/\r?\n/),m=Math.max(this.line-3,0),n=Math.min(this.line+2,a.length),h=String(n).length,t,l;if(s){let{bold:i,gray:r,red:c}=e.createColors(!0);t=u=>i(c(u)),l=u=>r(u)}else t=l=i=>i;return a.slice(m,n).map((i,r)=>{let c=m+1+r,u=" "+(" "+c).slice(-h)+" | ";if(c===this.line){let g=l(u.replace(/\d/g," "))+i.slice(0,this.column-1).replace(/[^\t]/g," ");return t(">")+l(u)+i+`
 `+g+t("^")}return" "+l(u)+i}).join(`
`)}toString(){let s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s}}return $e=p,p.default=p,$e}var fe={},lr;function Ft(){return lr||(lr=1,fe.isClean=Symbol("isClean"),fe.my=Symbol("my")),fe}var Te,ar;function di(){if(ar)return Te;ar=1;const e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function o(d){return d[0].toUpperCase()+d.slice(1)}class p{constructor(s){this.builder=s}atrule(s,f){let a="@"+s.name,m=s.params?this.rawValue(s,"params"):"";if(typeof s.raws.afterName<"u"?a+=s.raws.afterName:m&&(a+=" "),s.nodes)this.block(s,a+m);else{let n=(s.raws.between||"")+(f?";":"");this.builder(a+m+n,s)}}beforeAfter(s,f){let a;s.type==="decl"?a=this.raw(s,null,"beforeDecl"):s.type==="comment"?a=this.raw(s,null,"beforeComment"):f==="before"?a=this.raw(s,null,"beforeRule"):a=this.raw(s,null,"beforeClose");let m=s.parent,n=0;for(;m&&m.type!=="root";)n+=1,m=m.parent;if(a.includes(`
`)){let h=this.raw(s,null,"indent");if(h.length)for(let t=0;t<n;t++)a+=h}return a}block(s,f){let a=this.raw(s,"between","beforeOpen");this.builder(f+a+"{",s,"start");let m;s.nodes&&s.nodes.length?(this.body(s),m=this.raw(s,"after")):m=this.raw(s,"after","emptyBody"),m&&this.builder(m),this.builder("}",s,"end")}body(s){let f=s.nodes.length-1;for(;f>0&&s.nodes[f].type==="comment";)f-=1;let a=this.raw(s,"semicolon");for(let m=0;m<s.nodes.length;m++){let n=s.nodes[m],h=this.raw(n,"before");h&&this.builder(h),this.stringify(n,f!==m||a)}}comment(s){let f=this.raw(s,"left","commentLeft"),a=this.raw(s,"right","commentRight");this.builder("/*"+f+s.text+a+"*/",s)}decl(s,f){let a=this.raw(s,"between","colon"),m=s.prop+a+this.rawValue(s,"value");s.important&&(m+=s.raws.important||" !important"),f&&(m+=";"),this.builder(m,s)}document(s){this.body(s)}raw(s,f,a){let m;if(a||(a=f),f&&(m=s.raws[f],typeof m<"u"))return m;let n=s.parent;if(a==="before"&&(!n||n.type==="root"&&n.first===s||n&&n.type==="document"))return"";if(!n)return e[a];let h=s.root();if(h.rawCache||(h.rawCache={}),typeof h.rawCache[a]<"u")return h.rawCache[a];if(a==="before"||a==="after")return this.beforeAfter(s,a);{let t="raw"+o(a);this[t]?m=this[t](h,s):h.walk(l=>{if(m=l.raws[f],typeof m<"u")return!1})}return typeof m>"u"&&(m=e[a]),h.rawCache[a]=m,m}rawBeforeClose(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length>0&&typeof a.raws.after<"u")return f=a.raws.after,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawBeforeComment(s,f){let a;return s.walkComments(m=>{if(typeof m.raws.before<"u")return a=m.raws.before,a.includes(`
`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(f,null,"beforeDecl"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeDecl(s,f){let a;return s.walkDecls(m=>{if(typeof m.raws.before<"u")return a=m.raws.before,a.includes(`
`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(f,null,"beforeRule"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeOpen(s){let f;return s.walk(a=>{if(a.type!=="decl"&&(f=a.raws.between,typeof f<"u"))return!1}),f}rawBeforeRule(s){let f;return s.walk(a=>{if(a.nodes&&(a.parent!==s||s.first!==a)&&typeof a.raws.before<"u")return f=a.raws.before,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawColon(s){let f;return s.walkDecls(a=>{if(typeof a.raws.between<"u")return f=a.raws.between.replace(/[^\s:]/g,""),!1}),f}rawEmptyBody(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length===0&&(f=a.raws.after,typeof f<"u"))return!1}),f}rawIndent(s){if(s.raws.indent)return s.raws.indent;let f;return s.walk(a=>{let m=a.parent;if(m&&m!==s&&m.parent&&m.parent===s&&typeof a.raws.before<"u"){let n=a.raws.before.split(`
`);return f=n[n.length-1],f=f.replace(/\S/g,""),!1}}),f}rawSemicolon(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length&&a.last.type==="decl"&&(f=a.raws.semicolon,typeof f<"u"))return!1}),f}rawValue(s,f){let a=s[f],m=s.raws[f];return m&&m.value===a?m.raw:a}root(s){this.body(s),s.raws.after&&this.builder(s.raws.after)}rule(s){this.block(s,this.rawValue(s,"selector")),s.raws.ownSemicolon&&this.builder(s.raws.ownSemicolon,s,"end")}stringify(s,f){if(!this[s.type])throw new Error("Unknown AST node type "+s.type+". Maybe you need to change PostCSS stringifier.");this[s.type](s,f)}}return Te=p,p.default=p,Te}var Ue,ur;function ye(){if(ur)return Ue;ur=1;let e=di();function o(p,d){new e(d).stringify(p)}return Ue=o,o.default=o,Ue}var De,fr;function we(){if(fr)return De;fr=1;let{isClean:e,my:o}=Ft(),p=qt(),d=di(),s=ye();function f(m,n){let h=new m.constructor;for(let t in m){if(!Object.prototype.hasOwnProperty.call(m,t)||t==="proxyCache")continue;let l=m[t],i=typeof l;t==="parent"&&i==="object"?n&&(h[t]=n):t==="source"?h[t]=l:Array.isArray(l)?h[t]=l.map(r=>f(r,h)):(i==="object"&&l!==null&&(l=f(l)),h[t]=l)}return h}class a{constructor(n={}){this.raws={},this[e]=!1,this[o]=!0;for(let h in n)if(h==="nodes"){this.nodes=[];for(let t of n[h])typeof t.clone=="function"?this.append(t.clone()):this.append(t)}else this[h]=n[h]}addToError(n){if(n.postcssNode=this,n.stack&&this.source&&/\n\s{4}at /.test(n.stack)){let h=this.source;n.stack=n.stack.replace(/\n\s{4}at /,`$&${h.input.from}:${h.start.line}:${h.start.column}$&`)}return n}after(n){return this.parent.insertAfter(this,n),this}assign(n={}){for(let h in n)this[h]=n[h];return this}before(n){return this.parent.insertBefore(this,n),this}cleanRaws(n){delete this.raws.before,delete this.raws.after,n||delete this.raws.between}clone(n={}){let h=f(this);for(let t in n)h[t]=n[t];return h}cloneAfter(n={}){let h=this.clone(n);return this.parent.insertAfter(this,h),h}cloneBefore(n={}){let h=this.clone(n);return this.parent.insertBefore(this,h),h}error(n,h={}){if(this.source){let{end:t,start:l}=this.rangeBy(h);return this.source.input.error(n,{column:l.column,line:l.line},{column:t.column,line:t.line},h)}return new p(n)}getProxyProcessor(){return{get(n,h){return h==="proxyOf"?n:h==="root"?()=>n.root().toProxy():n[h]},set(n,h,t){return n[h]===t||(n[h]=t,(h==="prop"||h==="value"||h==="name"||h==="params"||h==="important"||h==="text")&&n.markDirty()),!0}}}markDirty(){if(this[e]){this[e]=!1;let n=this;for(;n=n.parent;)n[e]=!1}}next(){if(!this.parent)return;let n=this.parent.index(this);return this.parent.nodes[n+1]}positionBy(n,h){let t=this.source.start;if(n.index)t=this.positionInside(n.index,h);else if(n.word){h=this.toString();let l=h.indexOf(n.word);l!==-1&&(t=this.positionInside(l,h))}return t}positionInside(n,h){let t=h||this.toString(),l=this.source.start.column,i=this.source.start.line;for(let r=0;r<n;r++)t[r]===`
`?(l=1,i+=1):l+=1;return{column:l,line:i}}prev(){if(!this.parent)return;let n=this.parent.index(this);return this.parent.nodes[n-1]}rangeBy(n){let h={column:this.source.start.column,line:this.source.start.line},t=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:h.column+1,line:h.line};if(n.word){let l=this.toString(),i=l.indexOf(n.word);i!==-1&&(h=this.positionInside(i,l),t=this.positionInside(i+n.word.length,l))}else n.start?h={column:n.start.column,line:n.start.line}:n.index&&(h=this.positionInside(n.index)),n.end?t={column:n.end.column,line:n.end.line}:typeof n.endIndex=="number"?t=this.positionInside(n.endIndex):n.index&&(t=this.positionInside(n.index+1));return(t.line<h.line||t.line===h.line&&t.column<=h.column)&&(t={column:h.column+1,line:h.line}),{end:t,start:h}}raw(n,h){return new d().raw(this,n,h)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...n){if(this.parent){let h=this,t=!1;for(let l of n)l===this?t=!0:t?(this.parent.insertAfter(h,l),h=l):this.parent.insertBefore(h,l);t||this.remove()}return this}root(){let n=this;for(;n.parent&&n.parent.type!=="document";)n=n.parent;return n}toJSON(n,h){let t={},l=h==null;h=h||new Map;let i=0;for(let r in this){if(!Object.prototype.hasOwnProperty.call(this,r)||r==="parent"||r==="proxyCache")continue;let c=this[r];if(Array.isArray(c))t[r]=c.map(u=>typeof u=="object"&&u.toJSON?u.toJSON(null,h):u);else if(typeof c=="object"&&c.toJSON)t[r]=c.toJSON(null,h);else if(r==="source"){let u=h.get(c.input);u==null&&(u=i,h.set(c.input,i),i++),t[r]={end:c.end,inputId:u,start:c.start}}else t[r]=c}return l&&(t.inputs=[...h.keys()].map(r=>r.toJSON())),t}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(n=s){n.stringify&&(n=n.stringify);let h="";return n(this,t=>{h+=t}),h}warn(n,h,t){let l={node:this};for(let i in t)l[i]=t[i];return n.warn(h,l)}get proxyOf(){return this}}return De=a,a.default=a,De}var ke,hr;function be(){if(hr)return ke;hr=1;let e=we();class o extends e{constructor(d){d&&typeof d.value<"u"&&typeof d.value!="string"&&(d={...d,value:String(d.value)}),super(d),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return ke=o,o.default=o,ke}var qe,cr;function cs(){if(cr)return qe;cr=1;let e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return qe={nanoid:(d=21)=>{let s="",f=d;for(;f--;)s+=e[Math.random()*64|0];return s},customAlphabet:(d,s=21)=>(f=s)=>{let a="",m=f;for(;m--;)a+=d[Math.random()*d.length|0];return a}},qe}var Fe,pr;function mi(){if(pr)return Fe;pr=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=F,{existsSync:p,readFileSync:d}=F,{dirname:s,join:f}=F;function a(n){return Buffer?Buffer.from(n,"base64").toString():window.atob(n)}class m{constructor(h,t){if(t.map===!1)return;this.loadAnnotation(h),this.inline=this.startWith(this.annotation,"data:");let l=t.map?t.map.prev:void 0,i=this.loadMap(t.from,l);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=s(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(h){let t=/^data:application\/json;charset=utf-?8;base64,/,l=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,r=/^data:application\/json,/;if(i.test(h)||r.test(h))return decodeURIComponent(h.substr(RegExp.lastMatch.length));if(t.test(h)||l.test(h))return a(h.substr(RegExp.lastMatch.length));let c=h.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+c)}getAnnotationURL(h){return h.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(h){return typeof h!="object"?!1:typeof h.mappings=="string"||typeof h._mappings=="string"||Array.isArray(h.sections)}loadAnnotation(h){let t=h.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let l=h.lastIndexOf(t.pop()),i=h.indexOf("*/",l);l>-1&&i>-1&&(this.annotation=this.getAnnotationURL(h.substring(l,i)))}loadFile(h){if(this.root=s(h),p(h))return this.mapFile=h,d(h,"utf-8").toString().trim()}loadMap(h,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let l=t(h);if(l){let i=this.loadFile(l);if(!i)throw new Error("Unable to load previous source map: "+l.toString());return i}}else{if(t instanceof e)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let l=this.annotation;return h&&(l=f(s(h),l)),this.loadFile(l)}}}startWith(h,t){return h?h.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Fe=m,m.default=m,Fe}var Be,dr;function ve(){if(dr)return Be;dr=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=F,{fileURLToPath:p,pathToFileURL:d}=F,{isAbsolute:s,resolve:f}=F,{nanoid:a}=cs(),m=F,n=qt(),h=mi(),t=Symbol("fromOffsetCache"),l=!!(e&&o),i=!!(f&&s);class r{constructor(u,g={}){if(u===null||typeof u>"u"||typeof u=="object"&&!u.toString)throw new Error(`PostCSS received ${u} instead of CSS string`);if(this.css=u.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,g.from&&(!i||/^\w+:\/\//.test(g.from)||s(g.from)?this.file=g.from:this.file=f(g.from)),i&&l){let S=new h(this.css,g);if(S.text){this.map=S;let b=S.consumer().file;!this.file&&b&&(this.file=this.mapResolve(b))}}this.file||(this.id="<input css "+a(6)+">"),this.map&&(this.map.file=this.from)}error(u,g,S,b={}){let v,w,y;if(g&&typeof g=="object"){let R=g,P=S;if(typeof R.offset=="number"){let A=this.fromOffset(R.offset);g=A.line,S=A.col}else g=R.line,S=R.column;if(typeof P.offset=="number"){let A=this.fromOffset(P.offset);w=A.line,y=A.col}else w=P.line,y=P.column}else if(!S){let R=this.fromOffset(g);g=R.line,S=R.col}let x=this.origin(g,S,w,y);return x?v=new n(u,x.endLine===void 0?x.line:{column:x.column,line:x.line},x.endLine===void 0?x.column:{column:x.endColumn,line:x.endLine},x.source,x.file,b.plugin):v=new n(u,w===void 0?g:{column:S,line:g},w===void 0?S:{column:y,line:w},this.css,this.file,b.plugin),v.input={column:S,endColumn:y,endLine:w,line:g,source:this.css},this.file&&(d&&(v.input.url=d(this.file).toString()),v.input.file=this.file),v}fromOffset(u){let g,S;if(this[t])S=this[t];else{let v=this.css.split(`
`);S=new Array(v.length);let w=0;for(let y=0,x=v.length;y<x;y++)S[y]=w,w+=v[y].length+1;this[t]=S}g=S[S.length-1];let b=0;if(u>=g)b=S.length-1;else{let v=S.length-2,w;for(;b<v;)if(w=b+(v-b>>1),u<S[w])v=w-1;else if(u>=S[w+1])b=w+1;else{b=w;break}}return{col:u-S[b]+1,line:b+1}}mapResolve(u){return/^\w+:\/\//.test(u)?u:f(this.map.consumer().sourceRoot||this.map.root||".",u)}origin(u,g,S,b){if(!this.map)return!1;let v=this.map.consumer(),w=v.originalPositionFor({column:g,line:u});if(!w.source)return!1;let y;typeof S=="number"&&(y=v.originalPositionFor({column:b,line:S}));let x;s(w.source)?x=d(w.source):x=new URL(w.source,this.map.consumer().sourceRoot||d(this.map.mapFile));let R={column:w.column,endColumn:y&&y.column,endLine:y&&y.line,line:w.line,url:x.toString()};if(x.protocol==="file:")if(p)R.file=p(x);else throw new Error("file: protocol is not available in this PostCSS build");let P=v.sourceContentFor(w.source);return P&&(R.source=P),R}toJSON(){let u={};for(let g of["hasBOM","css","file","id"])this[g]!=null&&(u[g]=this[g]);return this.map&&(u.map={...this.map},u.map.consumerCache&&(u.map.consumerCache=void 0)),u}get from(){return this.file||this.id}}return Be=r,r.default=r,m&&m.registerInput&&m.registerInput(r),Be}var ze,mr;function gi(){if(mr)return ze;mr=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=F,{dirname:p,relative:d,resolve:s,sep:f}=F,{pathToFileURL:a}=F,m=ve(),n=!!(e&&o),h=!!(p&&s&&d&&f);class t{constructor(i,r,c,u){this.stringify=i,this.mapOpts=c.map||{},this.root=r,this.opts=c,this.css=u,this.originalCSS=u,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let i;this.isInline()?i="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?i=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?i=this.mapOpts.annotation(this.opts.to,this.root):i=this.outputFile()+".map";let r=`
`;this.css.includes(`\r
`)&&(r=`\r
`),this.css+=r+"/*# sourceMappingURL="+i+" */"}applyPrevMaps(){for(let i of this.previous()){let r=this.toUrl(this.path(i.file)),c=i.root||p(i.file),u;this.mapOpts.sourcesContent===!1?(u=new e(i.text),u.sourcesContent&&(u.sourcesContent=null)):u=i.consumer(),this.map.applySourceMap(u,r,this.toUrl(this.path(c)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let i;for(let r=this.root.nodes.length-1;r>=0;r--)i=this.root.nodes[r],i.type==="comment"&&i.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),h&&n&&this.isMap())return this.generateMap();{let i="";return this.stringify(this.root,r=>{i+=r}),[i]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let i=this.previous()[0].consumer();i.file=this.outputFile(),this.map=o.fromSourceMap(i,{ignoreInvalidMapping:!0})}else this.map=new o({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new o({file:this.outputFile(),ignoreInvalidMapping:!0});let i=1,r=1,c="<no source>",u={generated:{column:0,line:0},original:{column:0,line:0},source:""},g,S;this.stringify(this.root,(b,v,w)=>{if(this.css+=b,v&&w!=="end"&&(u.generated.line=i,u.generated.column=r-1,v.source&&v.source.start?(u.source=this.sourcePath(v),u.original.line=v.source.start.line,u.original.column=v.source.start.column-1,this.map.addMapping(u)):(u.source=c,u.original.line=1,u.original.column=0,this.map.addMapping(u))),g=b.match(/\n/g),g?(i+=g.length,S=b.lastIndexOf(`
`),r=b.length-S):r+=b.length,v&&w!=="start"){let y=v.parent||{raws:{}};(!(v.type==="decl"||v.type==="atrule"&&!v.nodes)||v!==y.last||y.raws.semicolon)&&(v.source&&v.source.end?(u.source=this.sourcePath(v),u.original.line=v.source.end.line,u.original.column=v.source.end.column-1,u.generated.line=i,u.generated.column=r-2,this.map.addMapping(u)):(u.source=c,u.original.line=1,u.original.column=0,u.generated.line=i,u.generated.column=r-1,this.map.addMapping(u)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(i=>i.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let i=this.mapOpts.annotation;return typeof i<"u"&&i!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(i=>i.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(i){if(this.mapOpts.absolute||i.charCodeAt(0)===60||/^\w+:\/\//.test(i))return i;let r=this.memoizedPaths.get(i);if(r)return r;let c=this.opts.to?p(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(c=p(s(c,this.mapOpts.annotation)));let u=d(c,i);return this.memoizedPaths.set(i,u),u}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(i=>{if(i.source&&i.source.input.map){let r=i.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let i=new m(this.originalCSS,this.opts);i.map&&this.previousMaps.push(i.map)}return this.previousMaps}setSourcesContent(){let i={};if(this.root)this.root.walk(r=>{if(r.source){let c=r.source.input.from;if(c&&!i[c]){i[c]=!0;let u=this.usesFileUrls?this.toFileUrl(c):this.toUrl(this.path(c));this.map.setSourceContent(u,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(i){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(i.source.input.from):this.toUrl(this.path(i.source.input.from))}toBase64(i){return Buffer?Buffer.from(i).toString("base64"):window.btoa(unescape(encodeURIComponent(i)))}toFileUrl(i){let r=this.memoizedFileURLs.get(i);if(r)return r;if(a){let c=a(i).toString();return this.memoizedFileURLs.set(i,c),c}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(i){let r=this.memoizedURLs.get(i);if(r)return r;f==="\\"&&(i=i.replace(/\\/g,"/"));let c=encodeURI(i).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(i,c),c}}return ze=t,ze}var je,gr;function xe(){if(gr)return je;gr=1;let e=we();class o extends e{constructor(d){super(d),this.type="comment"}}return je=o,o.default=o,je}var We,yr;function Q(){if(yr)return We;yr=1;let{isClean:e,my:o}=Ft(),p=be(),d=xe(),s=we(),f,a,m,n;function h(i){return i.map(r=>(r.nodes&&(r.nodes=h(r.nodes)),delete r.source,r))}function t(i){if(i[e]=!1,i.proxyOf.nodes)for(let r of i.proxyOf.nodes)t(r)}class l extends s{append(...r){for(let c of r){let u=this.normalize(c,this.last);for(let g of u)this.proxyOf.nodes.push(g)}return this.markDirty(),this}cleanRaws(r){if(super.cleanRaws(r),this.nodes)for(let c of this.nodes)c.cleanRaws(r)}each(r){if(!this.proxyOf.nodes)return;let c=this.getIterator(),u,g;for(;this.indexes[c]<this.proxyOf.nodes.length&&(u=this.indexes[c],g=r(this.proxyOf.nodes[u],u),g!==!1);)this.indexes[c]+=1;return delete this.indexes[c],g}every(r){return this.nodes.every(r)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let r=this.lastEach;return this.indexes[r]=0,r}getProxyProcessor(){return{get(r,c){return c==="proxyOf"?r:r[c]?c==="each"||typeof c=="string"&&c.startsWith("walk")?(...u)=>r[c](...u.map(g=>typeof g=="function"?(S,b)=>g(S.toProxy(),b):g)):c==="every"||c==="some"?u=>r[c]((g,...S)=>u(g.toProxy(),...S)):c==="root"?()=>r.root().toProxy():c==="nodes"?r.nodes.map(u=>u.toProxy()):c==="first"||c==="last"?r[c].toProxy():r[c]:r[c]},set(r,c,u){return r[c]===u||(r[c]=u,(c==="name"||c==="params"||c==="selector")&&r.markDirty()),!0}}}index(r){return typeof r=="number"?r:(r.proxyOf&&(r=r.proxyOf),this.proxyOf.nodes.indexOf(r))}insertAfter(r,c){let u=this.index(r),g=this.normalize(c,this.proxyOf.nodes[u]).reverse();u=this.index(r);for(let b of g)this.proxyOf.nodes.splice(u+1,0,b);let S;for(let b in this.indexes)S=this.indexes[b],u<S&&(this.indexes[b]=S+g.length);return this.markDirty(),this}insertBefore(r,c){let u=this.index(r),g=u===0?"prepend":!1,S=this.normalize(c,this.proxyOf.nodes[u],g).reverse();u=this.index(r);for(let v of S)this.proxyOf.nodes.splice(u,0,v);let b;for(let v in this.indexes)b=this.indexes[v],u<=b&&(this.indexes[v]=b+S.length);return this.markDirty(),this}normalize(r,c){if(typeof r=="string")r=h(f(r).nodes);else if(typeof r>"u")r=[];else if(Array.isArray(r)){r=r.slice(0);for(let g of r)g.parent&&g.parent.removeChild(g,"ignore")}else if(r.type==="root"&&this.type!=="document"){r=r.nodes.slice(0);for(let g of r)g.parent&&g.parent.removeChild(g,"ignore")}else if(r.type)r=[r];else if(r.prop){if(typeof r.value>"u")throw new Error("Value field is missed in node creation");typeof r.value!="string"&&(r.value=String(r.value)),r=[new p(r)]}else if(r.selector)r=[new a(r)];else if(r.name)r=[new m(r)];else if(r.text)r=[new d(r)];else throw new Error("Unknown node type in node creation");return r.map(g=>(g[o]||l.rebuild(g),g=g.proxyOf,g.parent&&g.parent.removeChild(g),g[e]&&t(g),typeof g.raws.before>"u"&&c&&typeof c.raws.before<"u"&&(g.raws.before=c.raws.before.replace(/\S/g,"")),g.parent=this.proxyOf,g))}prepend(...r){r=r.reverse();for(let c of r){let u=this.normalize(c,this.first,"prepend").reverse();for(let g of u)this.proxyOf.nodes.unshift(g);for(let g in this.indexes)this.indexes[g]=this.indexes[g]+u.length}return this.markDirty(),this}push(r){return r.parent=this,this.proxyOf.nodes.push(r),this}removeAll(){for(let r of this.proxyOf.nodes)r.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(r){r=this.index(r),this.proxyOf.nodes[r].parent=void 0,this.proxyOf.nodes.splice(r,1);let c;for(let u in this.indexes)c=this.indexes[u],c>=r&&(this.indexes[u]=c-1);return this.markDirty(),this}replaceValues(r,c,u){return u||(u=c,c={}),this.walkDecls(g=>{c.props&&!c.props.includes(g.prop)||c.fast&&!g.value.includes(c.fast)||(g.value=g.value.replace(r,u))}),this.markDirty(),this}some(r){return this.nodes.some(r)}walk(r){return this.each((c,u)=>{let g;try{g=r(c,u)}catch(S){throw c.addToError(S)}return g!==!1&&c.walk&&(g=c.walk(r)),g})}walkAtRules(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="atrule"&&r.test(u.name))return c(u,g)}):this.walk((u,g)=>{if(u.type==="atrule"&&u.name===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="atrule")return c(u,g)}))}walkComments(r){return this.walk((c,u)=>{if(c.type==="comment")return r(c,u)})}walkDecls(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="decl"&&r.test(u.prop))return c(u,g)}):this.walk((u,g)=>{if(u.type==="decl"&&u.prop===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="decl")return c(u,g)}))}walkRules(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="rule"&&r.test(u.selector))return c(u,g)}):this.walk((u,g)=>{if(u.type==="rule"&&u.selector===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="rule")return c(u,g)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return l.registerParse=i=>{f=i},l.registerRule=i=>{a=i},l.registerAtRule=i=>{m=i},l.registerRoot=i=>{n=i},We=l,l.default=l,l.rebuild=i=>{i.type==="atrule"?Object.setPrototypeOf(i,m.prototype):i.type==="rule"?Object.setPrototypeOf(i,a.prototype):i.type==="decl"?Object.setPrototypeOf(i,p.prototype):i.type==="comment"?Object.setPrototypeOf(i,d.prototype):i.type==="root"&&Object.setPrototypeOf(i,n.prototype),i[o]=!0,i.nodes&&i.nodes.forEach(r=>{l.rebuild(r)})},We}var He,wr;function Bt(){if(wr)return He;wr=1;let e=Q(),o,p;class d extends e{constructor(f){super({type:"document",...f}),this.nodes||(this.nodes=[])}toResult(f={}){return new o(new p,this,f).stringify()}}return d.registerLazyResult=s=>{o=s},d.registerProcessor=s=>{p=s},He=d,d.default=d,He}var Ge,br;function yi(){if(br)return Ge;br=1;class e{constructor(p,d={}){if(this.type="warning",this.text=p,d.node&&d.node.source){let s=d.node.rangeBy(d);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(let s in d)this[s]=d[s]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Ge=e,e.default=e,Ge}var Je,vr;function zt(){if(vr)return Je;vr=1;let e=yi();class o{constructor(d,s,f){this.processor=d,this.messages=[],this.root=s,this.opts=f,this.css=void 0,this.map=void 0}toString(){return this.css}warn(d,s={}){s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);let f=new e(d,s);return this.messages.push(f),f}warnings(){return this.messages.filter(d=>d.type==="warning")}get content(){return this.css}}return Je=o,o.default=o,Je}var Ve,xr;function ps(){if(xr)return Ve;xr=1;const e=39,o=34,p=92,d=47,s=10,f=32,a=12,m=9,n=13,h=91,t=93,l=40,i=41,r=123,c=125,u=59,g=42,S=58,b=64,v=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,y=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return Ve=function(P,A={}){let E=P.css.valueOf(),T=A.ignoreErrors,N,O,te,G,z,L,U,re,$,M,ie=E.length,C=0,J=[],j=[];function Pe(){return C}function V(D){throw P.error("Unclosed "+D,C)}function Ae(){return j.length===0&&C>=ie}function Ne(D){if(j.length)return j.pop();if(C>=ie)return;let K=D?D.ignoreUnclosed:!1;switch(N=E.charCodeAt(C),N){case s:case f:case m:case n:case a:{O=C;do O+=1,N=E.charCodeAt(O);while(N===f||N===s||N===m||N===n||N===a);M=["space",E.slice(C,O)],C=O-1;break}case h:case t:case r:case c:case S:case u:case i:{let se=String.fromCharCode(N);M=[se,se,C];break}case l:{if(re=J.length?J.pop()[1]:"",$=E.charCodeAt(C+1),re==="url"&&$!==e&&$!==o&&$!==f&&$!==s&&$!==m&&$!==a&&$!==n){O=C;do{if(L=!1,O=E.indexOf(")",O+1),O===-1)if(T||K){O=C;break}else V("bracket");for(U=O;E.charCodeAt(U-1)===p;)U-=1,L=!L}while(L);M=["brackets",E.slice(C,O+1),C,O],C=O}else O=E.indexOf(")",C+1),G=E.slice(C,O+1),O===-1||y.test(G)?M=["(","(",C]:(M=["brackets",G,C,O],C=O);break}case e:case o:{te=N===e?"'":'"',O=C;do{if(L=!1,O=E.indexOf(te,O+1),O===-1)if(T||K){O=C+1;break}else V("string");for(U=O;E.charCodeAt(U-1)===p;)U-=1,L=!L}while(L);M=["string",E.slice(C,O+1),C,O],C=O;break}case b:{v.lastIndex=C+1,v.test(E),v.lastIndex===0?O=E.length-1:O=v.lastIndex-2,M=["at-word",E.slice(C,O+1),C,O],C=O;break}case p:{for(O=C,z=!0;E.charCodeAt(O+1)===p;)O+=1,z=!z;if(N=E.charCodeAt(O+1),z&&N!==d&&N!==f&&N!==s&&N!==m&&N!==n&&N!==a&&(O+=1,x.test(E.charAt(O)))){for(;x.test(E.charAt(O+1));)O+=1;E.charCodeAt(O+1)===f&&(O+=1)}M=["word",E.slice(C,O+1),C,O],C=O;break}default:{N===d&&E.charCodeAt(C+1)===g?(O=E.indexOf("*/",C+2)+1,O===0&&(T||K?O=E.length:V("comment")),M=["comment",E.slice(C,O+1),C,O],C=O):(w.lastIndex=C+1,w.test(E),w.lastIndex===0?O=E.length-1:O=w.lastIndex-2,M=["word",E.slice(C,O+1),C,O],J.push(M),C=O);break}}return C++,M}function Me(D){j.push(D)}return{back:Me,endOfFile:Ae,nextToken:Ne,position:Pe}},Ve}var Ke,Sr;function jt(){if(Sr)return Ke;Sr=1;let e=Q();class o extends e{constructor(d){super(d),this.type="atrule"}append(...d){return this.proxyOf.nodes||(this.nodes=[]),super.append(...d)}prepend(...d){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...d)}}return Ke=o,o.default=o,e.registerAtRule(o),Ke}var Qe,Rr;function ne(){if(Rr)return Qe;Rr=1;let e=Q(),o,p;class d extends e{constructor(f){super(f),this.type="root",this.nodes||(this.nodes=[])}normalize(f,a,m){let n=super.normalize(f);if(a){if(m==="prepend")this.nodes.length>1?a.raws.before=this.nodes[1].raws.before:delete a.raws.before;else if(this.first!==a)for(let h of n)h.raws.before=a.raws.before}return n}removeChild(f,a){let m=this.index(f);return!a&&m===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[m].raws.before),super.removeChild(f)}toResult(f={}){return new o(new p,this,f).stringify()}}return d.registerLazyResult=s=>{o=s},d.registerProcessor=s=>{p=s},Qe=d,d.default=d,e.registerRoot(d),Qe}var Ye,Or;function wi(){if(Or)return Ye;Or=1;let e={comma(o){return e.split(o,[","],!0)},space(o){let p=[" ",`
`,"	"];return e.split(o,p)},split(o,p,d){let s=[],f="",a=!1,m=0,n=!1,h="",t=!1;for(let l of o)t?t=!1:l==="\\"?t=!0:n?l===h&&(n=!1):l==='"'||l==="'"?(n=!0,h=l):l==="("?m+=1:l===")"?m>0&&(m-=1):m===0&&p.includes(l)&&(a=!0),a?(f!==""&&s.push(f.trim()),f="",a=!1):f+=l;return(d||f!=="")&&s.push(f.trim()),s}};return Ye=e,e.default=e,Ye}var Xe,Cr;function Wt(){if(Cr)return Xe;Cr=1;let e=Q(),o=wi();class p extends e{constructor(s){super(s),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return o.comma(this.selector)}set selectors(s){let f=this.selector?this.selector.match(/,\s*/):null,a=f?f[0]:","+this.raw("between","beforeOpen");this.selector=s.join(a)}}return Xe=p,p.default=p,e.registerRule(p),Xe}var Ze,Er;function ds(){if(Er)return Ze;Er=1;let e=be(),o=ps(),p=xe(),d=jt(),s=ne(),f=Wt();const a={empty:!0,space:!0};function m(h){for(let t=h.length-1;t>=0;t--){let l=h[t],i=l[3]||l[2];if(i)return i}}class n{constructor(t){this.input=t,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let l=new d;l.name=t[1].slice(1),l.name===""&&this.unnamedAtrule(l,t),this.init(l,t[2]);let i,r,c,u=!1,g=!1,S=[],b=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),i=t[0],i==="("||i==="["?b.push(i==="("?")":"]"):i==="{"&&b.length>0?b.push("}"):i===b[b.length-1]&&b.pop(),b.length===0)if(i===";"){l.source.end=this.getPosition(t[2]),l.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){g=!0;break}else if(i==="}"){if(S.length>0){for(c=S.length-1,r=S[c];r&&r[0]==="space";)r=S[--c];r&&(l.source.end=this.getPosition(r[3]||r[2]),l.source.end.offset++)}this.end(t);break}else S.push(t);else S.push(t);if(this.tokenizer.endOfFile()){u=!0;break}}l.raws.between=this.spacesAndCommentsFromEnd(S),S.length?(l.raws.afterName=this.spacesAndCommentsFromStart(S),this.raw(l,"params",S),u&&(t=S[S.length-1],l.source.end=this.getPosition(t[3]||t[2]),l.source.end.offset++,this.spaces=l.raws.between,l.raws.between="")):(l.raws.afterName="",l.params=""),g&&(l.nodes=[],this.current=l)}checkMissedSemicolon(t){let l=this.colon(t);if(l===!1)return;let i=0,r;for(let c=l-1;c>=0&&(r=t[c],!(r[0]!=="space"&&(i+=1,i===2)));c--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(t){let l=0,i,r,c;for(let[u,g]of t.entries()){if(i=g,r=i[0],r==="("&&(l+=1),r===")"&&(l-=1),l===0&&r===":")if(!c)this.doubleColon(i);else{if(c[0]==="word"&&c[1]==="progid")continue;return u}c=i}return!1}comment(t){let l=new p;this.init(l,t[2]),l.source.end=this.getPosition(t[3]||t[2]),l.source.end.offset++;let i=t[1].slice(2,-2);if(/^\s*$/.test(i))l.text="",l.raws.left=i,l.raws.right="";else{let r=i.match(/^(\s*)([^]*\S)(\s*)$/);l.text=r[2],l.raws.left=r[1],l.raws.right=r[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(t,l){let i=new e;this.init(i,t[0][2]);let r=t[t.length-1];for(r[0]===";"&&(this.semicolon=!0,t.pop()),i.source.end=this.getPosition(r[3]||r[2]||m(t)),i.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),i.raws.before+=t.shift()[1];for(i.source.start=this.getPosition(t[0][2]),i.prop="";t.length;){let b=t[0][0];if(b===":"||b==="space"||b==="comment")break;i.prop+=t.shift()[1]}i.raws.between="";let c;for(;t.length;)if(c=t.shift(),c[0]===":"){i.raws.between+=c[1];break}else c[0]==="word"&&/\w/.test(c[1])&&this.unknownWord([c]),i.raws.between+=c[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let u=[],g;for(;t.length&&(g=t[0][0],!(g!=="space"&&g!=="comment"));)u.push(t.shift());this.precheckMissedSemicolon(t);for(let b=t.length-1;b>=0;b--){if(c=t[b],c[1].toLowerCase()==="!important"){i.important=!0;let v=this.stringFrom(t,b);v=this.spacesFromEnd(t)+v,v!==" !important"&&(i.raws.important=v);break}else if(c[1].toLowerCase()==="important"){let v=t.slice(0),w="";for(let y=b;y>0;y--){let x=v[y][0];if(w.trim().indexOf("!")===0&&x!=="space")break;w=v.pop()[1]+w}w.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=w,t=v)}if(c[0]!=="space"&&c[0]!=="comment")break}t.some(b=>b[0]!=="space"&&b[0]!=="comment")&&(i.raws.between+=u.map(b=>b[1]).join(""),u=[]),this.raw(i,"value",u.concat(t),l),i.value.includes(":")&&!l&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let l=new f;this.init(l,t[2]),l.selector="",l.raws.between="",this.current=l}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let l=this.current.nodes[this.current.nodes.length-1];l&&l.type==="rule"&&!l.raws.ownSemicolon&&(l.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let l=this.input.fromOffset(t);return{column:l.col,line:l.line,offset:t}}init(t,l){this.current.push(t),t.source={input:this.input,start:this.getPosition(l)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let l=!1,i=null,r=!1,c=null,u=[],g=t[1].startsWith("--"),S=[],b=t;for(;b;){if(i=b[0],S.push(b),i==="("||i==="[")c||(c=b),u.push(i==="("?")":"]");else if(g&&r&&i==="{")c||(c=b),u.push("}");else if(u.length===0)if(i===";")if(r){this.decl(S,g);return}else break;else if(i==="{"){this.rule(S);return}else if(i==="}"){this.tokenizer.back(S.pop()),l=!0;break}else i===":"&&(r=!0);else i===u[u.length-1]&&(u.pop(),u.length===0&&(c=null));b=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(l=!0),u.length>0&&this.unclosedBracket(c),l&&r){if(!g)for(;S.length&&(b=S[S.length-1][0],!(b!=="space"&&b!=="comment"));)this.tokenizer.back(S.pop());this.decl(S,g)}else this.unknownWord(S)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,l,i,r){let c,u,g=i.length,S="",b=!0,v,w;for(let y=0;y<g;y+=1)c=i[y],u=c[0],u==="space"&&y===g-1&&!r?b=!1:u==="comment"?(w=i[y-1]?i[y-1][0]:"empty",v=i[y+1]?i[y+1][0]:"empty",!a[w]&&!a[v]?S.slice(-1)===","?b=!1:S+=c[1]:b=!1):S+=c[1];if(!b){let y=i.reduce((x,R)=>x+R[1],"");t.raws[l]={raw:y,value:S}}t[l]=S}rule(t){t.pop();let l=new f;this.init(l,t[0][2]),l.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(l,"selector",t),this.current=l}spacesAndCommentsFromEnd(t){let l,i="";for(;t.length&&(l=t[t.length-1][0],!(l!=="space"&&l!=="comment"));)i=t.pop()[1]+i;return i}spacesAndCommentsFromStart(t){let l,i="";for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)i+=t.shift()[1];return i}spacesFromEnd(t){let l,i="";for(;t.length&&(l=t[t.length-1][0],l==="space");)i=t.pop()[1]+i;return i}stringFrom(t,l){let i="";for(let r=l;r<t.length;r++)i+=t[r][1];return t.splice(l,t.length-l),i}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,l){throw this.input.error("At-rule without name",{offset:l[2]},{offset:l[2]+l[1].length})}}return Ze=n,Ze}var et,Pr;function Ht(){if(Pr)return et;Pr=1;let e=Q(),o=ds(),p=ve();function d(s,f){let a=new p(s,f),m=new o(a);try{m.parse()}catch(n){throw n}return m.root}return et=d,d.default=d,e.registerParse(d),et}var tt,Ar;function bi(){if(Ar)return tt;Ar=1;let{isClean:e,my:o}=Ft(),p=gi(),d=ye(),s=Q(),f=Bt(),a=zt(),m=Ht(),n=ne();const h={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},t={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},l={Once:!0,postcssPlugin:!0,prepare:!0},i=0;function r(v){return typeof v=="object"&&typeof v.then=="function"}function c(v){let w=!1,y=h[v.type];return v.type==="decl"?w=v.prop.toLowerCase():v.type==="atrule"&&(w=v.name.toLowerCase()),w&&v.append?[y,y+"-"+w,i,y+"Exit",y+"Exit-"+w]:w?[y,y+"-"+w,y+"Exit",y+"Exit-"+w]:v.append?[y,i,y+"Exit"]:[y,y+"Exit"]}function u(v){let w;return v.type==="document"?w=["Document",i,"DocumentExit"]:v.type==="root"?w=["Root",i,"RootExit"]:w=c(v),{eventIndex:0,events:w,iterator:0,node:v,visitorIndex:0,visitors:[]}}function g(v){return v[e]=!1,v.nodes&&v.nodes.forEach(w=>g(w)),v}let S={};class b{constructor(w,y,x){this.stringified=!1,this.processed=!1;let R;if(typeof y=="object"&&y!==null&&(y.type==="root"||y.type==="document"))R=g(y);else if(y instanceof b||y instanceof a)R=g(y.root),y.map&&(typeof x.map>"u"&&(x.map={}),x.map.inline||(x.map.inline=!1),x.map.prev=y.map);else{let P=m;x.syntax&&(P=x.syntax.parse),x.parser&&(P=x.parser),P.parse&&(P=P.parse);try{R=P(y,x)}catch(A){this.processed=!0,this.error=A}R&&!R[o]&&s.rebuild(R)}this.result=new a(w,R,x),this.helpers={...S,postcss:S,result:this.result},this.plugins=this.processor.plugins.map(P=>typeof P=="object"&&P.prepare?{...P,...P.prepare(this.result)}:P)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(w){return this.async().catch(w)}finally(w){return this.async().then(w,w)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(w,y){let x=this.result.lastPlugin;try{y&&y.addToError(w),this.error=w,w.name==="CssSyntaxError"&&!w.plugin?(w.plugin=x.postcssPlugin,w.setMessage()):x.postcssVersion}catch(R){console&&console.error&&console.error(R)}return w}prepareVisitors(){this.listeners={};let w=(y,x,R)=>{this.listeners[x]||(this.listeners[x]=[]),this.listeners[x].push([y,R])};for(let y of this.plugins)if(typeof y=="object")for(let x in y){if(!t[x]&&/^[A-Z]/.test(x))throw new Error(`Unknown event ${x} in ${y.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!l[x])if(typeof y[x]=="object")for(let R in y[x])R==="*"?w(y,x,y[x][R]):w(y,x+"-"+R.toLowerCase(),y[x][R]);else typeof y[x]=="function"&&w(y,x,y[x])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let w=0;w<this.plugins.length;w++){let y=this.plugins[w],x=this.runOnRoot(y);if(r(x))try{await x}catch(R){throw this.handleError(R)}}if(this.prepareVisitors(),this.hasListener){let w=this.result.root;for(;!w[e];){w[e]=!0;let y=[u(w)];for(;y.length>0;){let x=this.visitTick(y);if(r(x))try{await x}catch(R){let P=y[y.length-1].node;throw this.handleError(R,P)}}}if(this.listeners.OnceExit)for(let[y,x]of this.listeners.OnceExit){this.result.lastPlugin=y;try{if(w.type==="document"){let R=w.nodes.map(P=>x(P,this.helpers));await Promise.all(R)}else await x(w,this.helpers)}catch(R){throw this.handleError(R)}}}return this.processed=!0,this.stringify()}runOnRoot(w){this.result.lastPlugin=w;try{if(typeof w=="object"&&w.Once){if(this.result.root.type==="document"){let y=this.result.root.nodes.map(x=>w.Once(x,this.helpers));return r(y[0])?Promise.all(y):y}return w.Once(this.result.root,this.helpers)}else if(typeof w=="function")return w(this.result.root,this.result)}catch(y){throw this.handleError(y)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let w=this.result.opts,y=d;w.syntax&&(y=w.syntax.stringify),w.stringifier&&(y=w.stringifier),y.stringify&&(y=y.stringify);let R=new p(y,this.result.root,this.result.opts).generate();return this.result.css=R[0],this.result.map=R[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let w of this.plugins){let y=this.runOnRoot(w);if(r(y))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let w=this.result.root;for(;!w[e];)w[e]=!0,this.walkSync(w);if(this.listeners.OnceExit)if(w.type==="document")for(let y of w.nodes)this.visitSync(this.listeners.OnceExit,y);else this.visitSync(this.listeners.OnceExit,w)}return this.result}then(w,y){return this.async().then(w,y)}toString(){return this.css}visitSync(w,y){for(let[x,R]of w){this.result.lastPlugin=x;let P;try{P=R(y,this.helpers)}catch(A){throw this.handleError(A,y.proxyOf)}if(y.type!=="root"&&y.type!=="document"&&!y.parent)return!0;if(r(P))throw this.getAsyncError()}}visitTick(w){let y=w[w.length-1],{node:x,visitors:R}=y;if(x.type!=="root"&&x.type!=="document"&&!x.parent){w.pop();return}if(R.length>0&&y.visitorIndex<R.length){let[A,E]=R[y.visitorIndex];y.visitorIndex+=1,y.visitorIndex===R.length&&(y.visitors=[],y.visitorIndex=0),this.result.lastPlugin=A;try{return E(x.toProxy(),this.helpers)}catch(T){throw this.handleError(T,x)}}if(y.iterator!==0){let A=y.iterator,E;for(;E=x.nodes[x.indexes[A]];)if(x.indexes[A]+=1,!E[e]){E[e]=!0,w.push(u(E));return}y.iterator=0,delete x.indexes[A]}let P=y.events;for(;y.eventIndex<P.length;){let A=P[y.eventIndex];if(y.eventIndex+=1,A===i){x.nodes&&x.nodes.length&&(x[e]=!0,y.iterator=x.getIterator());return}else if(this.listeners[A]){y.visitors=this.listeners[A];return}}w.pop()}walkSync(w){w[e]=!0;let y=c(w);for(let x of y)if(x===i)w.nodes&&w.each(R=>{R[e]||this.walkSync(R)});else{let R=this.listeners[x];if(R&&this.visitSync(R,w.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return b.registerPostcss=v=>{S=v},tt=b,b.default=b,n.registerLazyResult(b),f.registerLazyResult(b),tt}var rt,Nr;function ms(){if(Nr)return rt;Nr=1;let e=gi(),o=ye(),p=Ht();const d=zt();class s{constructor(a,m,n){m=m.toString(),this.stringified=!1,this._processor=a,this._css=m,this._opts=n,this._map=void 0;let h,t=o;this.result=new d(this._processor,h,this._opts),this.result.css=m;let l=this;Object.defineProperty(this.result,"root",{get(){return l.root}});let i=new e(t,h,this._opts,m);if(i.isMap()){let[r,c]=i.generate();r&&(this.result.css=r),c&&(this.result.map=c)}else i.clearAnnotation(),this.result.css=i.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(a){return this.async().catch(a)}finally(a){return this.async().then(a,a)}sync(){if(this.error)throw this.error;return this.result}then(a,m){return this.async().then(a,m)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let a,m=p;try{a=m(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=a,a}get[Symbol.toStringTag](){return"NoWorkResult"}}return rt=s,s.default=s,rt}var it,Mr;function gs(){if(Mr)return it;Mr=1;let e=ms(),o=bi(),p=Bt(),d=ne();class s{constructor(a=[]){this.version="8.4.38",this.plugins=this.normalize(a)}normalize(a){let m=[];for(let n of a)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))m=m.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)m.push(n);else if(typeof n=="function")m.push(n);else if(!(typeof n=="object"&&(n.parse||n.stringify)))throw new Error(n+" is not a PostCSS plugin");return m}process(a,m={}){return!this.plugins.length&&!m.parser&&!m.stringifier&&!m.syntax?new e(this,a,m):new o(this,a,m)}use(a){return this.plugins=this.plugins.concat(this.normalize([a])),this}}return it=s,s.default=s,d.registerProcessor(s),p.registerProcessor(s),it}var st,_r;function ys(){if(_r)return st;_r=1;let e=be(),o=mi(),p=xe(),d=jt(),s=ve(),f=ne(),a=Wt();function m(n,h){if(Array.isArray(n))return n.map(i=>m(i));let{inputs:t,...l}=n;if(t){h=[];for(let i of t){let r={...i,__proto__:s.prototype};r.map&&(r.map={...r.map,__proto__:o.prototype}),h.push(r)}}if(l.nodes&&(l.nodes=n.nodes.map(i=>m(i,h))),l.source){let{inputId:i,...r}=l.source;l.source=r,i!=null&&(l.source.input=h[i])}if(l.type==="root")return new f(l);if(l.type==="decl")return new e(l);if(l.type==="rule")return new a(l);if(l.type==="comment")return new p(l);if(l.type==="atrule")return new d(l);throw new Error("Unknown node type: "+n.type)}return st=m,m.default=m,st}var nt,Ir;function ws(){if(Ir)return nt;Ir=1;let e=qt(),o=be(),p=bi(),d=Q(),s=gs(),f=ye(),a=ys(),m=Bt(),n=yi(),h=xe(),t=jt(),l=zt(),i=ve(),r=Ht(),c=wi(),u=Wt(),g=ne(),S=we();function b(...v){return v.length===1&&Array.isArray(v[0])&&(v=v[0]),new s(v)}return b.plugin=function(w,y){let x=!1;function R(...A){console&&console.warn&&!x&&(x=!0,console.warn(w+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),me.LANG&&me.LANG.startsWith("cn")&&console.warn(w+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));let E=y(...A);return E.postcssPlugin=w,E.postcssVersion=new s().version,E}let P;return Object.defineProperty(R,"postcss",{get(){return P||(P=R()),P}}),R.process=function(A,E,T){return b([R(T)]).process(A,E)},R},b.stringify=f,b.parse=r,b.fromJSON=a,b.list=c,b.comment=v=>new h(v),b.atRule=v=>new t(v),b.decl=v=>new o(v),b.rule=v=>new u(v),b.root=v=>new g(v),b.document=v=>new m(v),b.CssSyntaxError=e,b.Declaration=o,b.Container=d,b.Processor=s,b.Document=m,b.Comment=h,b.Warning=n,b.AtRule=t,b.Result=l,b.Input=i,b.Rule=u,b.Root=g,b.Node=S,p.registerPostcss(b),nt=b,b.default=b,nt}var bs=ws();const _=ls(bs);_.stringify;_.fromJSON;_.plugin;_.parse;_.list;_.document;_.comment;_.atRule;_.rule;_.decl;_.root;_.CssSyntaxError;_.Declaration;_.Container;_.Processor;_.Document;_.Comment;_.Warning;_.AtRule;_.Result;_.Input;_.Rule;_.Root;_.Node;var vs=Object.defineProperty,xs=(e,o,p)=>o in e?vs(e,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[o]=p,k=(e,o,p)=>xs(e,typeof o!="symbol"?o+"":o,p);function Ss(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Rs(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var o=e.default;if(typeof o=="function"){var p=function d(){return this instanceof d?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};p.prototype=o.prototype}else p={};return Object.defineProperty(p,"__esModule",{value:!0}),Object.keys(e).forEach(function(d){var s=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(p,d,s.get?s:{enumerable:!0,get:function(){return e[d]}})}),p}var he={exports:{}},Lr;function Os(){if(Lr)return he.exports;Lr=1;var e=String,o=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return he.exports=o(),he.exports.createColors=o,he.exports}const Cs={},Es=Object.freeze(Object.defineProperty({__proto__:null,default:Cs},Symbol.toStringTag,{value:"Module"})),B=Rs(Es);var ot,$r;function Gt(){if($r)return ot;$r=1;let e=Os(),o=B;class p extends Error{constructor(s,f,a,m,n,h){super(s),this.name="CssSyntaxError",this.reason=s,n&&(this.file=n),m&&(this.source=m),h&&(this.plugin=h),typeof f<"u"&&typeof a<"u"&&(typeof f=="number"?(this.line=f,this.column=a):(this.line=f.line,this.column=f.column,this.endLine=a.line,this.endColumn=a.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,p)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(s){if(!this.source)return"";let f=this.source;s==null&&(s=e.isColorSupported),o&&s&&(f=o(f));let a=f.split(/\r?\n/),m=Math.max(this.line-3,0),n=Math.min(this.line+2,a.length),h=String(n).length,t,l;if(s){let{bold:i,gray:r,red:c}=e.createColors(!0);t=u=>i(c(u)),l=u=>r(u)}else t=l=i=>i;return a.slice(m,n).map((i,r)=>{let c=m+1+r,u=" "+(" "+c).slice(-h)+" | ";if(c===this.line){let g=l(u.replace(/\d/g," "))+i.slice(0,this.column-1).replace(/[^\t]/g," ");return t(">")+l(u)+i+`
 `+g+t("^")}return" "+l(u)+i}).join(`
`)}toString(){let s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s}}return ot=p,p.default=p,ot}var ce={},Tr;function Jt(){return Tr||(Tr=1,ce.isClean=Symbol("isClean"),ce.my=Symbol("my")),ce}var lt,Ur;function vi(){if(Ur)return lt;Ur=1;const e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function o(d){return d[0].toUpperCase()+d.slice(1)}class p{constructor(s){this.builder=s}atrule(s,f){let a="@"+s.name,m=s.params?this.rawValue(s,"params"):"";if(typeof s.raws.afterName<"u"?a+=s.raws.afterName:m&&(a+=" "),s.nodes)this.block(s,a+m);else{let n=(s.raws.between||"")+(f?";":"");this.builder(a+m+n,s)}}beforeAfter(s,f){let a;s.type==="decl"?a=this.raw(s,null,"beforeDecl"):s.type==="comment"?a=this.raw(s,null,"beforeComment"):f==="before"?a=this.raw(s,null,"beforeRule"):a=this.raw(s,null,"beforeClose");let m=s.parent,n=0;for(;m&&m.type!=="root";)n+=1,m=m.parent;if(a.includes(`
`)){let h=this.raw(s,null,"indent");if(h.length)for(let t=0;t<n;t++)a+=h}return a}block(s,f){let a=this.raw(s,"between","beforeOpen");this.builder(f+a+"{",s,"start");let m;s.nodes&&s.nodes.length?(this.body(s),m=this.raw(s,"after")):m=this.raw(s,"after","emptyBody"),m&&this.builder(m),this.builder("}",s,"end")}body(s){let f=s.nodes.length-1;for(;f>0&&s.nodes[f].type==="comment";)f-=1;let a=this.raw(s,"semicolon");for(let m=0;m<s.nodes.length;m++){let n=s.nodes[m],h=this.raw(n,"before");h&&this.builder(h),this.stringify(n,f!==m||a)}}comment(s){let f=this.raw(s,"left","commentLeft"),a=this.raw(s,"right","commentRight");this.builder("/*"+f+s.text+a+"*/",s)}decl(s,f){let a=this.raw(s,"between","colon"),m=s.prop+a+this.rawValue(s,"value");s.important&&(m+=s.raws.important||" !important"),f&&(m+=";"),this.builder(m,s)}document(s){this.body(s)}raw(s,f,a){let m;if(a||(a=f),f&&(m=s.raws[f],typeof m<"u"))return m;let n=s.parent;if(a==="before"&&(!n||n.type==="root"&&n.first===s||n&&n.type==="document"))return"";if(!n)return e[a];let h=s.root();if(h.rawCache||(h.rawCache={}),typeof h.rawCache[a]<"u")return h.rawCache[a];if(a==="before"||a==="after")return this.beforeAfter(s,a);{let t="raw"+o(a);this[t]?m=this[t](h,s):h.walk(l=>{if(m=l.raws[f],typeof m<"u")return!1})}return typeof m>"u"&&(m=e[a]),h.rawCache[a]=m,m}rawBeforeClose(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length>0&&typeof a.raws.after<"u")return f=a.raws.after,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawBeforeComment(s,f){let a;return s.walkComments(m=>{if(typeof m.raws.before<"u")return a=m.raws.before,a.includes(`
`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(f,null,"beforeDecl"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeDecl(s,f){let a;return s.walkDecls(m=>{if(typeof m.raws.before<"u")return a=m.raws.before,a.includes(`
`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(f,null,"beforeRule"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeOpen(s){let f;return s.walk(a=>{if(a.type!=="decl"&&(f=a.raws.between,typeof f<"u"))return!1}),f}rawBeforeRule(s){let f;return s.walk(a=>{if(a.nodes&&(a.parent!==s||s.first!==a)&&typeof a.raws.before<"u")return f=a.raws.before,f.includes(`
`)&&(f=f.replace(/[^\n]+$/,"")),!1}),f&&(f=f.replace(/\S/g,"")),f}rawColon(s){let f;return s.walkDecls(a=>{if(typeof a.raws.between<"u")return f=a.raws.between.replace(/[^\s:]/g,""),!1}),f}rawEmptyBody(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length===0&&(f=a.raws.after,typeof f<"u"))return!1}),f}rawIndent(s){if(s.raws.indent)return s.raws.indent;let f;return s.walk(a=>{let m=a.parent;if(m&&m!==s&&m.parent&&m.parent===s&&typeof a.raws.before<"u"){let n=a.raws.before.split(`
`);return f=n[n.length-1],f=f.replace(/\S/g,""),!1}}),f}rawSemicolon(s){let f;return s.walk(a=>{if(a.nodes&&a.nodes.length&&a.last.type==="decl"&&(f=a.raws.semicolon,typeof f<"u"))return!1}),f}rawValue(s,f){let a=s[f],m=s.raws[f];return m&&m.value===a?m.raw:a}root(s){this.body(s),s.raws.after&&this.builder(s.raws.after)}rule(s){this.block(s,this.rawValue(s,"selector")),s.raws.ownSemicolon&&this.builder(s.raws.ownSemicolon,s,"end")}stringify(s,f){if(!this[s.type])throw new Error("Unknown AST node type "+s.type+". Maybe you need to change PostCSS stringifier.");this[s.type](s,f)}}return lt=p,p.default=p,lt}var at,Dr;function Se(){if(Dr)return at;Dr=1;let e=vi();function o(p,d){new e(d).stringify(p)}return at=o,o.default=o,at}var ut,kr;function Re(){if(kr)return ut;kr=1;let{isClean:e,my:o}=Jt(),p=Gt(),d=vi(),s=Se();function f(m,n){let h=new m.constructor;for(let t in m){if(!Object.prototype.hasOwnProperty.call(m,t)||t==="proxyCache")continue;let l=m[t],i=typeof l;t==="parent"&&i==="object"?n&&(h[t]=n):t==="source"?h[t]=l:Array.isArray(l)?h[t]=l.map(r=>f(r,h)):(i==="object"&&l!==null&&(l=f(l)),h[t]=l)}return h}class a{constructor(n={}){this.raws={},this[e]=!1,this[o]=!0;for(let h in n)if(h==="nodes"){this.nodes=[];for(let t of n[h])typeof t.clone=="function"?this.append(t.clone()):this.append(t)}else this[h]=n[h]}addToError(n){if(n.postcssNode=this,n.stack&&this.source&&/\n\s{4}at /.test(n.stack)){let h=this.source;n.stack=n.stack.replace(/\n\s{4}at /,`$&${h.input.from}:${h.start.line}:${h.start.column}$&`)}return n}after(n){return this.parent.insertAfter(this,n),this}assign(n={}){for(let h in n)this[h]=n[h];return this}before(n){return this.parent.insertBefore(this,n),this}cleanRaws(n){delete this.raws.before,delete this.raws.after,n||delete this.raws.between}clone(n={}){let h=f(this);for(let t in n)h[t]=n[t];return h}cloneAfter(n={}){let h=this.clone(n);return this.parent.insertAfter(this,h),h}cloneBefore(n={}){let h=this.clone(n);return this.parent.insertBefore(this,h),h}error(n,h={}){if(this.source){let{end:t,start:l}=this.rangeBy(h);return this.source.input.error(n,{column:l.column,line:l.line},{column:t.column,line:t.line},h)}return new p(n)}getProxyProcessor(){return{get(n,h){return h==="proxyOf"?n:h==="root"?()=>n.root().toProxy():n[h]},set(n,h,t){return n[h]===t||(n[h]=t,(h==="prop"||h==="value"||h==="name"||h==="params"||h==="important"||h==="text")&&n.markDirty()),!0}}}markDirty(){if(this[e]){this[e]=!1;let n=this;for(;n=n.parent;)n[e]=!1}}next(){if(!this.parent)return;let n=this.parent.index(this);return this.parent.nodes[n+1]}positionBy(n,h){let t=this.source.start;if(n.index)t=this.positionInside(n.index,h);else if(n.word){h=this.toString();let l=h.indexOf(n.word);l!==-1&&(t=this.positionInside(l,h))}return t}positionInside(n,h){let t=h||this.toString(),l=this.source.start.column,i=this.source.start.line;for(let r=0;r<n;r++)t[r]===`
`?(l=1,i+=1):l+=1;return{column:l,line:i}}prev(){if(!this.parent)return;let n=this.parent.index(this);return this.parent.nodes[n-1]}rangeBy(n){let h={column:this.source.start.column,line:this.source.start.line},t=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:h.column+1,line:h.line};if(n.word){let l=this.toString(),i=l.indexOf(n.word);i!==-1&&(h=this.positionInside(i,l),t=this.positionInside(i+n.word.length,l))}else n.start?h={column:n.start.column,line:n.start.line}:n.index&&(h=this.positionInside(n.index)),n.end?t={column:n.end.column,line:n.end.line}:typeof n.endIndex=="number"?t=this.positionInside(n.endIndex):n.index&&(t=this.positionInside(n.index+1));return(t.line<h.line||t.line===h.line&&t.column<=h.column)&&(t={column:h.column+1,line:h.line}),{end:t,start:h}}raw(n,h){return new d().raw(this,n,h)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...n){if(this.parent){let h=this,t=!1;for(let l of n)l===this?t=!0:t?(this.parent.insertAfter(h,l),h=l):this.parent.insertBefore(h,l);t||this.remove()}return this}root(){let n=this;for(;n.parent&&n.parent.type!=="document";)n=n.parent;return n}toJSON(n,h){let t={},l=h==null;h=h||new Map;let i=0;for(let r in this){if(!Object.prototype.hasOwnProperty.call(this,r)||r==="parent"||r==="proxyCache")continue;let c=this[r];if(Array.isArray(c))t[r]=c.map(u=>typeof u=="object"&&u.toJSON?u.toJSON(null,h):u);else if(typeof c=="object"&&c.toJSON)t[r]=c.toJSON(null,h);else if(r==="source"){let u=h.get(c.input);u==null&&(u=i,h.set(c.input,i),i++),t[r]={end:c.end,inputId:u,start:c.start}}else t[r]=c}return l&&(t.inputs=[...h.keys()].map(r=>r.toJSON())),t}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(n=s){n.stringify&&(n=n.stringify);let h="";return n(this,t=>{h+=t}),h}warn(n,h,t){let l={node:this};for(let i in t)l[i]=t[i];return n.warn(h,l)}get proxyOf(){return this}}return ut=a,a.default=a,ut}var ft,qr;function Oe(){if(qr)return ft;qr=1;let e=Re();class o extends e{constructor(d){d&&typeof d.value<"u"&&typeof d.value!="string"&&(d={...d,value:String(d.value)}),super(d),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return ft=o,o.default=o,ft}var ht,Fr;function Ps(){if(Fr)return ht;Fr=1;let e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return ht={nanoid:(d=21)=>{let s="",f=d;for(;f--;)s+=e[Math.random()*64|0];return s},customAlphabet:(d,s=21)=>(f=s)=>{let a="",m=f;for(;m--;)a+=d[Math.random()*d.length|0];return a}},ht}var ct,Br;function xi(){if(Br)return ct;Br=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=B,{existsSync:p,readFileSync:d}=B,{dirname:s,join:f}=B;function a(n){return Buffer?Buffer.from(n,"base64").toString():window.atob(n)}class m{constructor(h,t){if(t.map===!1)return;this.loadAnnotation(h),this.inline=this.startWith(this.annotation,"data:");let l=t.map?t.map.prev:void 0,i=this.loadMap(t.from,l);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=s(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(h){let t=/^data:application\/json;charset=utf-?8;base64,/,l=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,r=/^data:application\/json,/;if(i.test(h)||r.test(h))return decodeURIComponent(h.substr(RegExp.lastMatch.length));if(t.test(h)||l.test(h))return a(h.substr(RegExp.lastMatch.length));let c=h.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+c)}getAnnotationURL(h){return h.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(h){return typeof h!="object"?!1:typeof h.mappings=="string"||typeof h._mappings=="string"||Array.isArray(h.sections)}loadAnnotation(h){let t=h.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let l=h.lastIndexOf(t.pop()),i=h.indexOf("*/",l);l>-1&&i>-1&&(this.annotation=this.getAnnotationURL(h.substring(l,i)))}loadFile(h){if(this.root=s(h),p(h))return this.mapFile=h,d(h,"utf-8").toString().trim()}loadMap(h,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let l=t(h);if(l){let i=this.loadFile(l);if(!i)throw new Error("Unable to load previous source map: "+l.toString());return i}}else{if(t instanceof e)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let l=this.annotation;return h&&(l=f(s(h),l)),this.loadFile(l)}}}startWith(h,t){return h?h.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return ct=m,m.default=m,ct}var pt,zr;function Ce(){if(zr)return pt;zr=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=B,{fileURLToPath:p,pathToFileURL:d}=B,{isAbsolute:s,resolve:f}=B,{nanoid:a}=Ps(),m=B,n=Gt(),h=xi(),t=Symbol("fromOffsetCache"),l=!!(e&&o),i=!!(f&&s);class r{constructor(u,g={}){if(u===null||typeof u>"u"||typeof u=="object"&&!u.toString)throw new Error(`PostCSS received ${u} instead of CSS string`);if(this.css=u.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,g.from&&(!i||/^\w+:\/\//.test(g.from)||s(g.from)?this.file=g.from:this.file=f(g.from)),i&&l){let S=new h(this.css,g);if(S.text){this.map=S;let b=S.consumer().file;!this.file&&b&&(this.file=this.mapResolve(b))}}this.file||(this.id="<input css "+a(6)+">"),this.map&&(this.map.file=this.from)}error(u,g,S,b={}){let v,w,y;if(g&&typeof g=="object"){let R=g,P=S;if(typeof R.offset=="number"){let A=this.fromOffset(R.offset);g=A.line,S=A.col}else g=R.line,S=R.column;if(typeof P.offset=="number"){let A=this.fromOffset(P.offset);w=A.line,y=A.col}else w=P.line,y=P.column}else if(!S){let R=this.fromOffset(g);g=R.line,S=R.col}let x=this.origin(g,S,w,y);return x?v=new n(u,x.endLine===void 0?x.line:{column:x.column,line:x.line},x.endLine===void 0?x.column:{column:x.endColumn,line:x.endLine},x.source,x.file,b.plugin):v=new n(u,w===void 0?g:{column:S,line:g},w===void 0?S:{column:y,line:w},this.css,this.file,b.plugin),v.input={column:S,endColumn:y,endLine:w,line:g,source:this.css},this.file&&(d&&(v.input.url=d(this.file).toString()),v.input.file=this.file),v}fromOffset(u){let g,S;if(this[t])S=this[t];else{let v=this.css.split(`
`);S=new Array(v.length);let w=0;for(let y=0,x=v.length;y<x;y++)S[y]=w,w+=v[y].length+1;this[t]=S}g=S[S.length-1];let b=0;if(u>=g)b=S.length-1;else{let v=S.length-2,w;for(;b<v;)if(w=b+(v-b>>1),u<S[w])v=w-1;else if(u>=S[w+1])b=w+1;else{b=w;break}}return{col:u-S[b]+1,line:b+1}}mapResolve(u){return/^\w+:\/\//.test(u)?u:f(this.map.consumer().sourceRoot||this.map.root||".",u)}origin(u,g,S,b){if(!this.map)return!1;let v=this.map.consumer(),w=v.originalPositionFor({column:g,line:u});if(!w.source)return!1;let y;typeof S=="number"&&(y=v.originalPositionFor({column:b,line:S}));let x;s(w.source)?x=d(w.source):x=new URL(w.source,this.map.consumer().sourceRoot||d(this.map.mapFile));let R={column:w.column,endColumn:y&&y.column,endLine:y&&y.line,line:w.line,url:x.toString()};if(x.protocol==="file:")if(p)R.file=p(x);else throw new Error("file: protocol is not available in this PostCSS build");let P=v.sourceContentFor(w.source);return P&&(R.source=P),R}toJSON(){let u={};for(let g of["hasBOM","css","file","id"])this[g]!=null&&(u[g]=this[g]);return this.map&&(u.map={...this.map},u.map.consumerCache&&(u.map.consumerCache=void 0)),u}get from(){return this.file||this.id}}return pt=r,r.default=r,m&&m.registerInput&&m.registerInput(r),pt}var dt,jr;function Si(){if(jr)return dt;jr=1;let{SourceMapConsumer:e,SourceMapGenerator:o}=B,{dirname:p,relative:d,resolve:s,sep:f}=B,{pathToFileURL:a}=B,m=Ce(),n=!!(e&&o),h=!!(p&&s&&d&&f);class t{constructor(i,r,c,u){this.stringify=i,this.mapOpts=c.map||{},this.root=r,this.opts=c,this.css=u,this.originalCSS=u,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let i;this.isInline()?i="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?i=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?i=this.mapOpts.annotation(this.opts.to,this.root):i=this.outputFile()+".map";let r=`
`;this.css.includes(`\r
`)&&(r=`\r
`),this.css+=r+"/*# sourceMappingURL="+i+" */"}applyPrevMaps(){for(let i of this.previous()){let r=this.toUrl(this.path(i.file)),c=i.root||p(i.file),u;this.mapOpts.sourcesContent===!1?(u=new e(i.text),u.sourcesContent&&(u.sourcesContent=null)):u=i.consumer(),this.map.applySourceMap(u,r,this.toUrl(this.path(c)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let i;for(let r=this.root.nodes.length-1;r>=0;r--)i=this.root.nodes[r],i.type==="comment"&&i.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),h&&n&&this.isMap())return this.generateMap();{let i="";return this.stringify(this.root,r=>{i+=r}),[i]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let i=this.previous()[0].consumer();i.file=this.outputFile(),this.map=o.fromSourceMap(i,{ignoreInvalidMapping:!0})}else this.map=new o({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new o({file:this.outputFile(),ignoreInvalidMapping:!0});let i=1,r=1,c="<no source>",u={generated:{column:0,line:0},original:{column:0,line:0},source:""},g,S;this.stringify(this.root,(b,v,w)=>{if(this.css+=b,v&&w!=="end"&&(u.generated.line=i,u.generated.column=r-1,v.source&&v.source.start?(u.source=this.sourcePath(v),u.original.line=v.source.start.line,u.original.column=v.source.start.column-1,this.map.addMapping(u)):(u.source=c,u.original.line=1,u.original.column=0,this.map.addMapping(u))),g=b.match(/\n/g),g?(i+=g.length,S=b.lastIndexOf(`
`),r=b.length-S):r+=b.length,v&&w!=="start"){let y=v.parent||{raws:{}};(!(v.type==="decl"||v.type==="atrule"&&!v.nodes)||v!==y.last||y.raws.semicolon)&&(v.source&&v.source.end?(u.source=this.sourcePath(v),u.original.line=v.source.end.line,u.original.column=v.source.end.column-1,u.generated.line=i,u.generated.column=r-2,this.map.addMapping(u)):(u.source=c,u.original.line=1,u.original.column=0,u.generated.line=i,u.generated.column=r-1,this.map.addMapping(u)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(i=>i.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let i=this.mapOpts.annotation;return typeof i<"u"&&i!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(i=>i.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(i){if(this.mapOpts.absolute||i.charCodeAt(0)===60||/^\w+:\/\//.test(i))return i;let r=this.memoizedPaths.get(i);if(r)return r;let c=this.opts.to?p(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(c=p(s(c,this.mapOpts.annotation)));let u=d(c,i);return this.memoizedPaths.set(i,u),u}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(i=>{if(i.source&&i.source.input.map){let r=i.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let i=new m(this.originalCSS,this.opts);i.map&&this.previousMaps.push(i.map)}return this.previousMaps}setSourcesContent(){let i={};if(this.root)this.root.walk(r=>{if(r.source){let c=r.source.input.from;if(c&&!i[c]){i[c]=!0;let u=this.usesFileUrls?this.toFileUrl(c):this.toUrl(this.path(c));this.map.setSourceContent(u,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(i){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(i.source.input.from):this.toUrl(this.path(i.source.input.from))}toBase64(i){return Buffer?Buffer.from(i).toString("base64"):window.btoa(unescape(encodeURIComponent(i)))}toFileUrl(i){let r=this.memoizedFileURLs.get(i);if(r)return r;if(a){let c=a(i).toString();return this.memoizedFileURLs.set(i,c),c}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(i){let r=this.memoizedURLs.get(i);if(r)return r;f==="\\"&&(i=i.replace(/\\/g,"/"));let c=encodeURI(i).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(i,c),c}}return dt=t,dt}var mt,Wr;function Ee(){if(Wr)return mt;Wr=1;let e=Re();class o extends e{constructor(d){super(d),this.type="comment"}}return mt=o,o.default=o,mt}var gt,Hr;function Y(){if(Hr)return gt;Hr=1;let{isClean:e,my:o}=Jt(),p=Oe(),d=Ee(),s=Re(),f,a,m,n;function h(i){return i.map(r=>(r.nodes&&(r.nodes=h(r.nodes)),delete r.source,r))}function t(i){if(i[e]=!1,i.proxyOf.nodes)for(let r of i.proxyOf.nodes)t(r)}class l extends s{append(...r){for(let c of r){let u=this.normalize(c,this.last);for(let g of u)this.proxyOf.nodes.push(g)}return this.markDirty(),this}cleanRaws(r){if(super.cleanRaws(r),this.nodes)for(let c of this.nodes)c.cleanRaws(r)}each(r){if(!this.proxyOf.nodes)return;let c=this.getIterator(),u,g;for(;this.indexes[c]<this.proxyOf.nodes.length&&(u=this.indexes[c],g=r(this.proxyOf.nodes[u],u),g!==!1);)this.indexes[c]+=1;return delete this.indexes[c],g}every(r){return this.nodes.every(r)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let r=this.lastEach;return this.indexes[r]=0,r}getProxyProcessor(){return{get(r,c){return c==="proxyOf"?r:r[c]?c==="each"||typeof c=="string"&&c.startsWith("walk")?(...u)=>r[c](...u.map(g=>typeof g=="function"?(S,b)=>g(S.toProxy(),b):g)):c==="every"||c==="some"?u=>r[c]((g,...S)=>u(g.toProxy(),...S)):c==="root"?()=>r.root().toProxy():c==="nodes"?r.nodes.map(u=>u.toProxy()):c==="first"||c==="last"?r[c].toProxy():r[c]:r[c]},set(r,c,u){return r[c]===u||(r[c]=u,(c==="name"||c==="params"||c==="selector")&&r.markDirty()),!0}}}index(r){return typeof r=="number"?r:(r.proxyOf&&(r=r.proxyOf),this.proxyOf.nodes.indexOf(r))}insertAfter(r,c){let u=this.index(r),g=this.normalize(c,this.proxyOf.nodes[u]).reverse();u=this.index(r);for(let b of g)this.proxyOf.nodes.splice(u+1,0,b);let S;for(let b in this.indexes)S=this.indexes[b],u<S&&(this.indexes[b]=S+g.length);return this.markDirty(),this}insertBefore(r,c){let u=this.index(r),g=u===0?"prepend":!1,S=this.normalize(c,this.proxyOf.nodes[u],g).reverse();u=this.index(r);for(let v of S)this.proxyOf.nodes.splice(u,0,v);let b;for(let v in this.indexes)b=this.indexes[v],u<=b&&(this.indexes[v]=b+S.length);return this.markDirty(),this}normalize(r,c){if(typeof r=="string")r=h(f(r).nodes);else if(typeof r>"u")r=[];else if(Array.isArray(r)){r=r.slice(0);for(let g of r)g.parent&&g.parent.removeChild(g,"ignore")}else if(r.type==="root"&&this.type!=="document"){r=r.nodes.slice(0);for(let g of r)g.parent&&g.parent.removeChild(g,"ignore")}else if(r.type)r=[r];else if(r.prop){if(typeof r.value>"u")throw new Error("Value field is missed in node creation");typeof r.value!="string"&&(r.value=String(r.value)),r=[new p(r)]}else if(r.selector)r=[new a(r)];else if(r.name)r=[new m(r)];else if(r.text)r=[new d(r)];else throw new Error("Unknown node type in node creation");return r.map(g=>(g[o]||l.rebuild(g),g=g.proxyOf,g.parent&&g.parent.removeChild(g),g[e]&&t(g),typeof g.raws.before>"u"&&c&&typeof c.raws.before<"u"&&(g.raws.before=c.raws.before.replace(/\S/g,"")),g.parent=this.proxyOf,g))}prepend(...r){r=r.reverse();for(let c of r){let u=this.normalize(c,this.first,"prepend").reverse();for(let g of u)this.proxyOf.nodes.unshift(g);for(let g in this.indexes)this.indexes[g]=this.indexes[g]+u.length}return this.markDirty(),this}push(r){return r.parent=this,this.proxyOf.nodes.push(r),this}removeAll(){for(let r of this.proxyOf.nodes)r.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(r){r=this.index(r),this.proxyOf.nodes[r].parent=void 0,this.proxyOf.nodes.splice(r,1);let c;for(let u in this.indexes)c=this.indexes[u],c>=r&&(this.indexes[u]=c-1);return this.markDirty(),this}replaceValues(r,c,u){return u||(u=c,c={}),this.walkDecls(g=>{c.props&&!c.props.includes(g.prop)||c.fast&&!g.value.includes(c.fast)||(g.value=g.value.replace(r,u))}),this.markDirty(),this}some(r){return this.nodes.some(r)}walk(r){return this.each((c,u)=>{let g;try{g=r(c,u)}catch(S){throw c.addToError(S)}return g!==!1&&c.walk&&(g=c.walk(r)),g})}walkAtRules(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="atrule"&&r.test(u.name))return c(u,g)}):this.walk((u,g)=>{if(u.type==="atrule"&&u.name===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="atrule")return c(u,g)}))}walkComments(r){return this.walk((c,u)=>{if(c.type==="comment")return r(c,u)})}walkDecls(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="decl"&&r.test(u.prop))return c(u,g)}):this.walk((u,g)=>{if(u.type==="decl"&&u.prop===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="decl")return c(u,g)}))}walkRules(r,c){return c?r instanceof RegExp?this.walk((u,g)=>{if(u.type==="rule"&&r.test(u.selector))return c(u,g)}):this.walk((u,g)=>{if(u.type==="rule"&&u.selector===r)return c(u,g)}):(c=r,this.walk((u,g)=>{if(u.type==="rule")return c(u,g)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return l.registerParse=i=>{f=i},l.registerRule=i=>{a=i},l.registerAtRule=i=>{m=i},l.registerRoot=i=>{n=i},gt=l,l.default=l,l.rebuild=i=>{i.type==="atrule"?Object.setPrototypeOf(i,m.prototype):i.type==="rule"?Object.setPrototypeOf(i,a.prototype):i.type==="decl"?Object.setPrototypeOf(i,p.prototype):i.type==="comment"?Object.setPrototypeOf(i,d.prototype):i.type==="root"&&Object.setPrototypeOf(i,n.prototype),i[o]=!0,i.nodes&&i.nodes.forEach(r=>{l.rebuild(r)})},gt}var yt,Gr;function Vt(){if(Gr)return yt;Gr=1;let e=Y(),o,p;class d extends e{constructor(f){super({type:"document",...f}),this.nodes||(this.nodes=[])}toResult(f={}){return new o(new p,this,f).stringify()}}return d.registerLazyResult=s=>{o=s},d.registerProcessor=s=>{p=s},yt=d,d.default=d,yt}var wt,Jr;function Ri(){if(Jr)return wt;Jr=1;class e{constructor(p,d={}){if(this.type="warning",this.text=p,d.node&&d.node.source){let s=d.node.rangeBy(d);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(let s in d)this[s]=d[s]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return wt=e,e.default=e,wt}var bt,Vr;function Kt(){if(Vr)return bt;Vr=1;let e=Ri();class o{constructor(d,s,f){this.processor=d,this.messages=[],this.root=s,this.opts=f,this.css=void 0,this.map=void 0}toString(){return this.css}warn(d,s={}){s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);let f=new e(d,s);return this.messages.push(f),f}warnings(){return this.messages.filter(d=>d.type==="warning")}get content(){return this.css}}return bt=o,o.default=o,bt}var vt,Kr;function As(){if(Kr)return vt;Kr=1;const e=39,o=34,p=92,d=47,s=10,f=32,a=12,m=9,n=13,h=91,t=93,l=40,i=41,r=123,c=125,u=59,g=42,S=58,b=64,v=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,y=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return vt=function(P,A={}){let E=P.css.valueOf(),T=A.ignoreErrors,N,O,te,G,z,L,U,re,$,M,ie=E.length,C=0,J=[],j=[];function Pe(){return C}function V(D){throw P.error("Unclosed "+D,C)}function Ae(){return j.length===0&&C>=ie}function Ne(D){if(j.length)return j.pop();if(C>=ie)return;let K=D?D.ignoreUnclosed:!1;switch(N=E.charCodeAt(C),N){case s:case f:case m:case n:case a:{O=C;do O+=1,N=E.charCodeAt(O);while(N===f||N===s||N===m||N===n||N===a);M=["space",E.slice(C,O)],C=O-1;break}case h:case t:case r:case c:case S:case u:case i:{let se=String.fromCharCode(N);M=[se,se,C];break}case l:{if(re=J.length?J.pop()[1]:"",$=E.charCodeAt(C+1),re==="url"&&$!==e&&$!==o&&$!==f&&$!==s&&$!==m&&$!==a&&$!==n){O=C;do{if(L=!1,O=E.indexOf(")",O+1),O===-1)if(T||K){O=C;break}else V("bracket");for(U=O;E.charCodeAt(U-1)===p;)U-=1,L=!L}while(L);M=["brackets",E.slice(C,O+1),C,O],C=O}else O=E.indexOf(")",C+1),G=E.slice(C,O+1),O===-1||y.test(G)?M=["(","(",C]:(M=["brackets",G,C,O],C=O);break}case e:case o:{te=N===e?"'":'"',O=C;do{if(L=!1,O=E.indexOf(te,O+1),O===-1)if(T||K){O=C+1;break}else V("string");for(U=O;E.charCodeAt(U-1)===p;)U-=1,L=!L}while(L);M=["string",E.slice(C,O+1),C,O],C=O;break}case b:{v.lastIndex=C+1,v.test(E),v.lastIndex===0?O=E.length-1:O=v.lastIndex-2,M=["at-word",E.slice(C,O+1),C,O],C=O;break}case p:{for(O=C,z=!0;E.charCodeAt(O+1)===p;)O+=1,z=!z;if(N=E.charCodeAt(O+1),z&&N!==d&&N!==f&&N!==s&&N!==m&&N!==n&&N!==a&&(O+=1,x.test(E.charAt(O)))){for(;x.test(E.charAt(O+1));)O+=1;E.charCodeAt(O+1)===f&&(O+=1)}M=["word",E.slice(C,O+1),C,O],C=O;break}default:{N===d&&E.charCodeAt(C+1)===g?(O=E.indexOf("*/",C+2)+1,O===0&&(T||K?O=E.length:V("comment")),M=["comment",E.slice(C,O+1),C,O],C=O):(w.lastIndex=C+1,w.test(E),w.lastIndex===0?O=E.length-1:O=w.lastIndex-2,M=["word",E.slice(C,O+1),C,O],J.push(M),C=O);break}}return C++,M}function Me(D){j.push(D)}return{back:Me,endOfFile:Ae,nextToken:Ne,position:Pe}},vt}var xt,Qr;function Qt(){if(Qr)return xt;Qr=1;let e=Y();class o extends e{constructor(d){super(d),this.type="atrule"}append(...d){return this.proxyOf.nodes||(this.nodes=[]),super.append(...d)}prepend(...d){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...d)}}return xt=o,o.default=o,e.registerAtRule(o),xt}var St,Yr;function oe(){if(Yr)return St;Yr=1;let e=Y(),o,p;class d extends e{constructor(f){super(f),this.type="root",this.nodes||(this.nodes=[])}normalize(f,a,m){let n=super.normalize(f);if(a){if(m==="prepend")this.nodes.length>1?a.raws.before=this.nodes[1].raws.before:delete a.raws.before;else if(this.first!==a)for(let h of n)h.raws.before=a.raws.before}return n}removeChild(f,a){let m=this.index(f);return!a&&m===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[m].raws.before),super.removeChild(f)}toResult(f={}){return new o(new p,this,f).stringify()}}return d.registerLazyResult=s=>{o=s},d.registerProcessor=s=>{p=s},St=d,d.default=d,e.registerRoot(d),St}var Rt,Xr;function Oi(){if(Xr)return Rt;Xr=1;let e={comma(o){return e.split(o,[","],!0)},space(o){let p=[" ",`
`,"	"];return e.split(o,p)},split(o,p,d){let s=[],f="",a=!1,m=0,n=!1,h="",t=!1;for(let l of o)t?t=!1:l==="\\"?t=!0:n?l===h&&(n=!1):l==='"'||l==="'"?(n=!0,h=l):l==="("?m+=1:l===")"?m>0&&(m-=1):m===0&&p.includes(l)&&(a=!0),a?(f!==""&&s.push(f.trim()),f="",a=!1):f+=l;return(d||f!=="")&&s.push(f.trim()),s}};return Rt=e,e.default=e,Rt}var Ot,Zr;function Yt(){if(Zr)return Ot;Zr=1;let e=Y(),o=Oi();class p extends e{constructor(s){super(s),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return o.comma(this.selector)}set selectors(s){let f=this.selector?this.selector.match(/,\s*/):null,a=f?f[0]:","+this.raw("between","beforeOpen");this.selector=s.join(a)}}return Ot=p,p.default=p,e.registerRule(p),Ot}var Ct,ei;function Ns(){if(ei)return Ct;ei=1;let e=Oe(),o=As(),p=Ee(),d=Qt(),s=oe(),f=Yt();const a={empty:!0,space:!0};function m(h){for(let t=h.length-1;t>=0;t--){let l=h[t],i=l[3]||l[2];if(i)return i}}class n{constructor(t){this.input=t,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let l=new d;l.name=t[1].slice(1),l.name===""&&this.unnamedAtrule(l,t),this.init(l,t[2]);let i,r,c,u=!1,g=!1,S=[],b=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),i=t[0],i==="("||i==="["?b.push(i==="("?")":"]"):i==="{"&&b.length>0?b.push("}"):i===b[b.length-1]&&b.pop(),b.length===0)if(i===";"){l.source.end=this.getPosition(t[2]),l.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){g=!0;break}else if(i==="}"){if(S.length>0){for(c=S.length-1,r=S[c];r&&r[0]==="space";)r=S[--c];r&&(l.source.end=this.getPosition(r[3]||r[2]),l.source.end.offset++)}this.end(t);break}else S.push(t);else S.push(t);if(this.tokenizer.endOfFile()){u=!0;break}}l.raws.between=this.spacesAndCommentsFromEnd(S),S.length?(l.raws.afterName=this.spacesAndCommentsFromStart(S),this.raw(l,"params",S),u&&(t=S[S.length-1],l.source.end=this.getPosition(t[3]||t[2]),l.source.end.offset++,this.spaces=l.raws.between,l.raws.between="")):(l.raws.afterName="",l.params=""),g&&(l.nodes=[],this.current=l)}checkMissedSemicolon(t){let l=this.colon(t);if(l===!1)return;let i=0,r;for(let c=l-1;c>=0&&(r=t[c],!(r[0]!=="space"&&(i+=1,i===2)));c--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(t){let l=0,i,r,c;for(let[u,g]of t.entries()){if(i=g,r=i[0],r==="("&&(l+=1),r===")"&&(l-=1),l===0&&r===":")if(!c)this.doubleColon(i);else{if(c[0]==="word"&&c[1]==="progid")continue;return u}c=i}return!1}comment(t){let l=new p;this.init(l,t[2]),l.source.end=this.getPosition(t[3]||t[2]),l.source.end.offset++;let i=t[1].slice(2,-2);if(/^\s*$/.test(i))l.text="",l.raws.left=i,l.raws.right="";else{let r=i.match(/^(\s*)([^]*\S)(\s*)$/);l.text=r[2],l.raws.left=r[1],l.raws.right=r[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(t,l){let i=new e;this.init(i,t[0][2]);let r=t[t.length-1];for(r[0]===";"&&(this.semicolon=!0,t.pop()),i.source.end=this.getPosition(r[3]||r[2]||m(t)),i.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),i.raws.before+=t.shift()[1];for(i.source.start=this.getPosition(t[0][2]),i.prop="";t.length;){let b=t[0][0];if(b===":"||b==="space"||b==="comment")break;i.prop+=t.shift()[1]}i.raws.between="";let c;for(;t.length;)if(c=t.shift(),c[0]===":"){i.raws.between+=c[1];break}else c[0]==="word"&&/\w/.test(c[1])&&this.unknownWord([c]),i.raws.between+=c[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let u=[],g;for(;t.length&&(g=t[0][0],!(g!=="space"&&g!=="comment"));)u.push(t.shift());this.precheckMissedSemicolon(t);for(let b=t.length-1;b>=0;b--){if(c=t[b],c[1].toLowerCase()==="!important"){i.important=!0;let v=this.stringFrom(t,b);v=this.spacesFromEnd(t)+v,v!==" !important"&&(i.raws.important=v);break}else if(c[1].toLowerCase()==="important"){let v=t.slice(0),w="";for(let y=b;y>0;y--){let x=v[y][0];if(w.trim().indexOf("!")===0&&x!=="space")break;w=v.pop()[1]+w}w.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=w,t=v)}if(c[0]!=="space"&&c[0]!=="comment")break}t.some(b=>b[0]!=="space"&&b[0]!=="comment")&&(i.raws.between+=u.map(b=>b[1]).join(""),u=[]),this.raw(i,"value",u.concat(t),l),i.value.includes(":")&&!l&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let l=new f;this.init(l,t[2]),l.selector="",l.raws.between="",this.current=l}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let l=this.current.nodes[this.current.nodes.length-1];l&&l.type==="rule"&&!l.raws.ownSemicolon&&(l.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let l=this.input.fromOffset(t);return{column:l.col,line:l.line,offset:t}}init(t,l){this.current.push(t),t.source={input:this.input,start:this.getPosition(l)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let l=!1,i=null,r=!1,c=null,u=[],g=t[1].startsWith("--"),S=[],b=t;for(;b;){if(i=b[0],S.push(b),i==="("||i==="[")c||(c=b),u.push(i==="("?")":"]");else if(g&&r&&i==="{")c||(c=b),u.push("}");else if(u.length===0)if(i===";")if(r){this.decl(S,g);return}else break;else if(i==="{"){this.rule(S);return}else if(i==="}"){this.tokenizer.back(S.pop()),l=!0;break}else i===":"&&(r=!0);else i===u[u.length-1]&&(u.pop(),u.length===0&&(c=null));b=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(l=!0),u.length>0&&this.unclosedBracket(c),l&&r){if(!g)for(;S.length&&(b=S[S.length-1][0],!(b!=="space"&&b!=="comment"));)this.tokenizer.back(S.pop());this.decl(S,g)}else this.unknownWord(S)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,l,i,r){let c,u,g=i.length,S="",b=!0,v,w;for(let y=0;y<g;y+=1)c=i[y],u=c[0],u==="space"&&y===g-1&&!r?b=!1:u==="comment"?(w=i[y-1]?i[y-1][0]:"empty",v=i[y+1]?i[y+1][0]:"empty",!a[w]&&!a[v]?S.slice(-1)===","?b=!1:S+=c[1]:b=!1):S+=c[1];if(!b){let y=i.reduce((x,R)=>x+R[1],"");t.raws[l]={raw:y,value:S}}t[l]=S}rule(t){t.pop();let l=new f;this.init(l,t[0][2]),l.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(l,"selector",t),this.current=l}spacesAndCommentsFromEnd(t){let l,i="";for(;t.length&&(l=t[t.length-1][0],!(l!=="space"&&l!=="comment"));)i=t.pop()[1]+i;return i}spacesAndCommentsFromStart(t){let l,i="";for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)i+=t.shift()[1];return i}spacesFromEnd(t){let l,i="";for(;t.length&&(l=t[t.length-1][0],l==="space");)i=t.pop()[1]+i;return i}stringFrom(t,l){let i="";for(let r=l;r<t.length;r++)i+=t[r][1];return t.splice(l,t.length-l),i}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,l){throw this.input.error("At-rule without name",{offset:l[2]},{offset:l[2]+l[1].length})}}return Ct=n,Ct}var Et,ti;function Xt(){if(ti)return Et;ti=1;let e=Y(),o=Ns(),p=Ce();function d(s,f){let a=new p(s,f),m=new o(a);try{m.parse()}catch(n){throw n}return m.root}return Et=d,d.default=d,e.registerParse(d),Et}var Pt,ri;function Ci(){if(ri)return Pt;ri=1;let{isClean:e,my:o}=Jt(),p=Si(),d=Se(),s=Y(),f=Vt(),a=Kt(),m=Xt(),n=oe();const h={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},t={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},l={Once:!0,postcssPlugin:!0,prepare:!0},i=0;function r(v){return typeof v=="object"&&typeof v.then=="function"}function c(v){let w=!1,y=h[v.type];return v.type==="decl"?w=v.prop.toLowerCase():v.type==="atrule"&&(w=v.name.toLowerCase()),w&&v.append?[y,y+"-"+w,i,y+"Exit",y+"Exit-"+w]:w?[y,y+"-"+w,y+"Exit",y+"Exit-"+w]:v.append?[y,i,y+"Exit"]:[y,y+"Exit"]}function u(v){let w;return v.type==="document"?w=["Document",i,"DocumentExit"]:v.type==="root"?w=["Root",i,"RootExit"]:w=c(v),{eventIndex:0,events:w,iterator:0,node:v,visitorIndex:0,visitors:[]}}function g(v){return v[e]=!1,v.nodes&&v.nodes.forEach(w=>g(w)),v}let S={};class b{constructor(w,y,x){this.stringified=!1,this.processed=!1;let R;if(typeof y=="object"&&y!==null&&(y.type==="root"||y.type==="document"))R=g(y);else if(y instanceof b||y instanceof a)R=g(y.root),y.map&&(typeof x.map>"u"&&(x.map={}),x.map.inline||(x.map.inline=!1),x.map.prev=y.map);else{let P=m;x.syntax&&(P=x.syntax.parse),x.parser&&(P=x.parser),P.parse&&(P=P.parse);try{R=P(y,x)}catch(A){this.processed=!0,this.error=A}R&&!R[o]&&s.rebuild(R)}this.result=new a(w,R,x),this.helpers={...S,postcss:S,result:this.result},this.plugins=this.processor.plugins.map(P=>typeof P=="object"&&P.prepare?{...P,...P.prepare(this.result)}:P)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(w){return this.async().catch(w)}finally(w){return this.async().then(w,w)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(w,y){let x=this.result.lastPlugin;try{y&&y.addToError(w),this.error=w,w.name==="CssSyntaxError"&&!w.plugin?(w.plugin=x.postcssPlugin,w.setMessage()):x.postcssVersion}catch(R){console&&console.error&&console.error(R)}return w}prepareVisitors(){this.listeners={};let w=(y,x,R)=>{this.listeners[x]||(this.listeners[x]=[]),this.listeners[x].push([y,R])};for(let y of this.plugins)if(typeof y=="object")for(let x in y){if(!t[x]&&/^[A-Z]/.test(x))throw new Error(`Unknown event ${x} in ${y.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!l[x])if(typeof y[x]=="object")for(let R in y[x])R==="*"?w(y,x,y[x][R]):w(y,x+"-"+R.toLowerCase(),y[x][R]);else typeof y[x]=="function"&&w(y,x,y[x])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let w=0;w<this.plugins.length;w++){let y=this.plugins[w],x=this.runOnRoot(y);if(r(x))try{await x}catch(R){throw this.handleError(R)}}if(this.prepareVisitors(),this.hasListener){let w=this.result.root;for(;!w[e];){w[e]=!0;let y=[u(w)];for(;y.length>0;){let x=this.visitTick(y);if(r(x))try{await x}catch(R){let P=y[y.length-1].node;throw this.handleError(R,P)}}}if(this.listeners.OnceExit)for(let[y,x]of this.listeners.OnceExit){this.result.lastPlugin=y;try{if(w.type==="document"){let R=w.nodes.map(P=>x(P,this.helpers));await Promise.all(R)}else await x(w,this.helpers)}catch(R){throw this.handleError(R)}}}return this.processed=!0,this.stringify()}runOnRoot(w){this.result.lastPlugin=w;try{if(typeof w=="object"&&w.Once){if(this.result.root.type==="document"){let y=this.result.root.nodes.map(x=>w.Once(x,this.helpers));return r(y[0])?Promise.all(y):y}return w.Once(this.result.root,this.helpers)}else if(typeof w=="function")return w(this.result.root,this.result)}catch(y){throw this.handleError(y)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let w=this.result.opts,y=d;w.syntax&&(y=w.syntax.stringify),w.stringifier&&(y=w.stringifier),y.stringify&&(y=y.stringify);let R=new p(y,this.result.root,this.result.opts).generate();return this.result.css=R[0],this.result.map=R[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let w of this.plugins){let y=this.runOnRoot(w);if(r(y))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let w=this.result.root;for(;!w[e];)w[e]=!0,this.walkSync(w);if(this.listeners.OnceExit)if(w.type==="document")for(let y of w.nodes)this.visitSync(this.listeners.OnceExit,y);else this.visitSync(this.listeners.OnceExit,w)}return this.result}then(w,y){return this.async().then(w,y)}toString(){return this.css}visitSync(w,y){for(let[x,R]of w){this.result.lastPlugin=x;let P;try{P=R(y,this.helpers)}catch(A){throw this.handleError(A,y.proxyOf)}if(y.type!=="root"&&y.type!=="document"&&!y.parent)return!0;if(r(P))throw this.getAsyncError()}}visitTick(w){let y=w[w.length-1],{node:x,visitors:R}=y;if(x.type!=="root"&&x.type!=="document"&&!x.parent){w.pop();return}if(R.length>0&&y.visitorIndex<R.length){let[A,E]=R[y.visitorIndex];y.visitorIndex+=1,y.visitorIndex===R.length&&(y.visitors=[],y.visitorIndex=0),this.result.lastPlugin=A;try{return E(x.toProxy(),this.helpers)}catch(T){throw this.handleError(T,x)}}if(y.iterator!==0){let A=y.iterator,E;for(;E=x.nodes[x.indexes[A]];)if(x.indexes[A]+=1,!E[e]){E[e]=!0,w.push(u(E));return}y.iterator=0,delete x.indexes[A]}let P=y.events;for(;y.eventIndex<P.length;){let A=P[y.eventIndex];if(y.eventIndex+=1,A===i){x.nodes&&x.nodes.length&&(x[e]=!0,y.iterator=x.getIterator());return}else if(this.listeners[A]){y.visitors=this.listeners[A];return}}w.pop()}walkSync(w){w[e]=!0;let y=c(w);for(let x of y)if(x===i)w.nodes&&w.each(R=>{R[e]||this.walkSync(R)});else{let R=this.listeners[x];if(R&&this.visitSync(R,w.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return b.registerPostcss=v=>{S=v},Pt=b,b.default=b,n.registerLazyResult(b),f.registerLazyResult(b),Pt}var At,ii;function Ms(){if(ii)return At;ii=1;let e=Si(),o=Se(),p=Xt();const d=Kt();class s{constructor(a,m,n){m=m.toString(),this.stringified=!1,this._processor=a,this._css=m,this._opts=n,this._map=void 0;let h,t=o;this.result=new d(this._processor,h,this._opts),this.result.css=m;let l=this;Object.defineProperty(this.result,"root",{get(){return l.root}});let i=new e(t,h,this._opts,m);if(i.isMap()){let[r,c]=i.generate();r&&(this.result.css=r),c&&(this.result.map=c)}else i.clearAnnotation(),this.result.css=i.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(a){return this.async().catch(a)}finally(a){return this.async().then(a,a)}sync(){if(this.error)throw this.error;return this.result}then(a,m){return this.async().then(a,m)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let a,m=p;try{a=m(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=a,a}get[Symbol.toStringTag](){return"NoWorkResult"}}return At=s,s.default=s,At}var Nt,si;function _s(){if(si)return Nt;si=1;let e=Ms(),o=Ci(),p=Vt(),d=oe();class s{constructor(a=[]){this.version="8.4.38",this.plugins=this.normalize(a)}normalize(a){let m=[];for(let n of a)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))m=m.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)m.push(n);else if(typeof n=="function")m.push(n);else if(!(typeof n=="object"&&(n.parse||n.stringify)))throw new Error(n+" is not a PostCSS plugin");return m}process(a,m={}){return!this.plugins.length&&!m.parser&&!m.stringifier&&!m.syntax?new e(this,a,m):new o(this,a,m)}use(a){return this.plugins=this.plugins.concat(this.normalize([a])),this}}return Nt=s,s.default=s,d.registerProcessor(s),p.registerProcessor(s),Nt}var Mt,ni;function Is(){if(ni)return Mt;ni=1;let e=Oe(),o=xi(),p=Ee(),d=Qt(),s=Ce(),f=oe(),a=Yt();function m(n,h){if(Array.isArray(n))return n.map(i=>m(i));let{inputs:t,...l}=n;if(t){h=[];for(let i of t){let r={...i,__proto__:s.prototype};r.map&&(r.map={...r.map,__proto__:o.prototype}),h.push(r)}}if(l.nodes&&(l.nodes=n.nodes.map(i=>m(i,h))),l.source){let{inputId:i,...r}=l.source;l.source=r,i!=null&&(l.source.input=h[i])}if(l.type==="root")return new f(l);if(l.type==="decl")return new e(l);if(l.type==="rule")return new a(l);if(l.type==="comment")return new p(l);if(l.type==="atrule")return new d(l);throw new Error("Unknown node type: "+n.type)}return Mt=m,m.default=m,Mt}var _t,oi;function Ls(){if(oi)return _t;oi=1;let e=Gt(),o=Oe(),p=Ci(),d=Y(),s=_s(),f=Se(),a=Is(),m=Vt(),n=Ri(),h=Ee(),t=Qt(),l=Kt(),i=Ce(),r=Xt(),c=Oi(),u=Yt(),g=oe(),S=Re();function b(...v){return v.length===1&&Array.isArray(v[0])&&(v=v[0]),new s(v)}return b.plugin=function(w,y){let x=!1;function R(...A){console&&console.warn&&!x&&(x=!0,console.warn(w+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),me.LANG&&me.LANG.startsWith("cn")&&console.warn(w+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));let E=y(...A);return E.postcssPlugin=w,E.postcssVersion=new s().version,E}let P;return Object.defineProperty(R,"postcss",{get(){return P||(P=R()),P}}),R.process=function(A,E,T){return b([R(T)]).process(A,E)},R},b.stringify=f,b.parse=r,b.fromJSON=a,b.list=c,b.comment=v=>new h(v),b.atRule=v=>new t(v),b.decl=v=>new o(v),b.rule=v=>new u(v),b.root=v=>new g(v),b.document=v=>new m(v),b.CssSyntaxError=e,b.Declaration=o,b.Container=d,b.Processor=s,b.Document=m,b.Comment=h,b.Warning=n,b.AtRule=t,b.Result=l,b.Input=i,b.Rule=u,b.Root=g,b.Node=S,p.registerPostcss(b),_t=b,b.default=b,_t}var $s=Ls();const I=Ss($s);I.stringify;I.fromJSON;I.plugin;I.parse;I.list;I.document;I.comment;I.atRule;I.rule;I.decl;I.root;I.CssSyntaxError;I.Declaration;I.Container;I.Processor;I.Document;I.Comment;I.Warning;I.AtRule;I.Result;I.Input;I.Rule;I.Root;I.Node;class Zt{constructor(...o){k(this,"parentElement",null),k(this,"parentNode",null),k(this,"ownerDocument"),k(this,"firstChild",null),k(this,"lastChild",null),k(this,"previousSibling",null),k(this,"nextSibling",null),k(this,"ELEMENT_NODE",1),k(this,"TEXT_NODE",3),k(this,"nodeType"),k(this,"nodeName"),k(this,"RRNodeType")}get childNodes(){const o=[];let p=this.firstChild;for(;p;)o.push(p),p=p.nextSibling;return o}contains(o){if(o instanceof Zt){if(o.ownerDocument!==this.ownerDocument)return!1;if(o===this)return!0}else return!1;for(;o.parentNode;){if(o.parentNode===this)return!0;o=o.parentNode}return!1}appendChild(o){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(o,p){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(o){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const li={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ai={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pe={};function Ts(e){var o,p;const d=(p=(o=globalThis?.Zone)==null?void 0:o.__symbol__)==null?void 0:p.call(o,e);if(d&&globalThis[d])return globalThis[d]}function er(e){if(pe[e])return pe[e];const o=Ts(e)||globalThis[e],p=o.prototype,d=e in li?li[e]:void 0,s=!!(d&&d.every(m=>{var n,h;return!!((h=(n=Object.getOwnPropertyDescriptor(p,m))==null?void 0:n.get)!=null&&h.toString().includes("[native code]"))})),f=e in ai?ai[e]:void 0,a=!!(f&&f.every(m=>{var n;return typeof p[m]=="function"&&((n=p[m])==null?void 0:n.toString().includes("[native code]"))}));if(s&&a)return pe[e]=o.prototype,o.prototype;try{const m=document.createElement("iframe");document.body.appendChild(m);const n=m.contentWindow;if(!n)return o.prototype;const h=n[e].prototype;return document.body.removeChild(m),h?pe[e]=h:p}catch{return p}}const It={};function H(e,o,p){var d;const s=`${e}.${String(p)}`;if(It[s])return It[s].call(o);const f=er(e),a=(d=Object.getOwnPropertyDescriptor(f,p))==null?void 0:d.get;return a?(It[s]=a,a.call(o)):o[p]}const Lt={};function Ei(e,o,p){const d=`${e}.${String(p)}`;if(Lt[d])return Lt[d].bind(o);const f=er(e)[p];return typeof f!="function"?o[p]:(Lt[d]=f,f.bind(o))}function Us(e){return H("Node",e,"childNodes")}function Ds(e){return H("Node",e,"parentNode")}function ks(e){return H("Node",e,"parentElement")}function qs(e){return H("Node",e,"textContent")}function Fs(e,o){return Ei("Node",e,"contains")(o)}function Bs(e){return Ei("Node",e,"getRootNode")()}function zs(e){return!e||!("host"in e)?null:H("ShadowRoot",e,"host")}function js(e){return e.styleSheets}function Ws(e){return!e||!("shadowRoot"in e)?null:H("Element",e,"shadowRoot")}function Hs(e,o){return H("Element",e,"querySelector")(o)}function Gs(e,o){return H("Element",e,"querySelectorAll")(o)}function Js(){return er("MutationObserver").constructor}const q={childNodes:Us,parentNode:Ds,parentElement:ks,textContent:qs,contains:Fs,getRootNode:Bs,host:zs,styleSheets:js,shadowRoot:Ws,querySelector:Hs,querySelectorAll:Gs,mutationObserver:Js};function Vs(e,o,p=document){const d={capture:!0,passive:!0};return p.addEventListener(e,o,d),()=>p.removeEventListener(e,o,d)}const ee=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let Ut={map:{},getId(){return console.error(ee),-1},getNode(){return console.error(ee),null},removeNodeFromMap(){console.error(ee)},has(){return console.error(ee),!1},reset(){console.error(ee)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ut=new Proxy(Ut,{get(e,o,p){return o==="map"&&console.error(ee),Reflect.get(e,o,p)}}));function Ks(e,o,p={}){let d=null,s=0;return function(...f){const a=Date.now();!s&&p.leading===!1&&(s=a);const m=o-(a-s),n=this;m<=0||m>o?(d&&(clearTimeout(d),d=null),s=a,e.apply(n,f)):!d&&p.trailing!==!1&&(d=setTimeout(()=>{s=p.leading===!1?0:Date.now(),d=null,e.apply(n,f)},m))}}function Pi(e,o,p,d,s=window){const f=s.Object.getOwnPropertyDescriptor(e,o);return s.Object.defineProperty(e,o,d?p:{set(a){setTimeout(()=>{p.set.call(this,a)},0),f&&f.set&&f.set.call(this,a)}}),()=>Pi(e,o,f||{},!0)}function Qs(e,o,p){try{if(!(o in e))return()=>{};const d=e[o],s=p(d);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:d}})),e[o]=s,()=>{e[o]=d}}catch{return()=>{}}}let Ai=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ai=()=>new Date().getTime());function Ys(e){var o,p,d,s;const f=e.document;return{left:f.scrollingElement?f.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:f.documentElement.scrollLeft||f?.body&&((o=q.parentElement(f.body))==null?void 0:o.scrollLeft)||((p=f?.body)==null?void 0:p.scrollLeft)||0,top:f.scrollingElement?f.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:f?.documentElement.scrollTop||f?.body&&((d=q.parentElement(f.body))==null?void 0:d.scrollTop)||((s=f?.body)==null?void 0:s.scrollTop)||0}}function Xs(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Zs(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ni(e){return e?e.nodeType===e.ELEMENT_NODE?e:q.parentElement(e):null}function en(e,o,p,d){if(!e)return!1;const s=Ni(e);if(!s)return!1;try{if(typeof o=="string"){if(s.classList.contains(o)||d&&s.closest("."+o)!==null)return!0}else if(Tt(s,o,d))return!0}catch{}return!!(p&&(s.matches(p)||d&&s.closest(p)!==null))}function tn(e,o){return o.getId(e)!==-1}function rn(e,o,p){return e.tagName==="TITLE"&&p.headTitleMutations?!0:o.getId(e)===os}function Mi(e,o){if(is(e))return!1;const p=o.getId(e);if(!o.has(p))return!0;const d=q.parentNode(e);return d&&d.nodeType===e.DOCUMENT_NODE?!1:d?Mi(d,o):!0}function sn(e){return!!e.changedTouches}function nn(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function on(e){const o={},p=(s,f)=>{const a={value:s,parent:f,children:[]};return o[s.node.id]=a,a},d=[];for(const s of e){const{nextId:f,parentId:a}=s;if(f&&f in o){const m=o[f];if(m.parent){const n=m.parent.children.indexOf(m);m.parent.children.splice(n,0,p(s,m.parent))}else{const n=d.indexOf(m);d.splice(n,0,p(s,null))}continue}if(a in o){const m=o[a];m.children.push(p(s,m));continue}d.push(p(s,null))}return d}function _i(e,o){o(e.value);for(let p=e.children.length-1;p>=0;p--)_i(e.children[p],o)}function ln(e,o){return!!(e.nodeName==="IFRAME"&&o.getMeta(e))}function an(e,o){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&o.getMeta(e))}function Ii(e,o){var p,d;const s=(d=(p=e.ownerDocument)==null?void 0:p.defaultView)==null?void 0:d.frameElement;if(!s||s===o)return{x:0,y:0,relativeScale:1,absoluteScale:1};const f=s.getBoundingClientRect(),a=Ii(s,o),m=f.height/s.clientHeight;return{x:f.x*a.relativeScale+a.x,y:f.y*a.relativeScale+a.y,relativeScale:m,absoluteScale:a.absoluteScale*m}}function un(e){return e?e instanceof Zt&&"shadowRoot"in e?!!e.shadowRoot:!!q.shadowRoot(e):!1}function Li(e,o){const p=e[o[0]];return o.length===1?p:Li(p.cssRules[o[1]].cssRules,o.slice(2))}function fn(e){const o=[...e],p=o.pop();return{positions:o,index:p}}function hn(e){const o=new Set,p=[];for(let d=e.length;d--;){const s=e[d];o.has(s.id)||(p.push(s),o.add(s.id))}return p}class cn{constructor(){_e(this,"id",1),_e(this,"styleIDMap",new WeakMap),_e(this,"idStyleMap",new Map)}getId(o){return this.styleIDMap.get(o)??-1}has(o){return this.styleIDMap.has(o)}add(o,p){if(this.has(o))return this.getId(o);let d;return p===void 0?d=this.id++:d=p,this.styleIDMap.set(o,d),this.idStyleMap.set(d,o),d}getStyle(o){return this.idStyleMap.get(o)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function $i(e){var o;let p=null;return"getRootNode"in e&&((o=q.getRootNode(e))==null?void 0:o.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&q.host(q.getRootNode(e))&&(p=q.host(q.getRootNode(e))),p}function Ti(e){let o=e,p;for(;p=$i(o);)o=p;return o}function Ui(e){const o=e.ownerDocument;if(!o)return!1;const p=Ti(e);return q.contains(o,p)}function pn(e){const o=e.ownerDocument;return o?q.contains(o,e)||Ui(e):!1}const dn=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:cn,get _mirror(){return Ut},closestElementOfNode:Ni,getBaseDimension:Ii,getNestedRule:Li,getPositionsAndIndex:fn,getRootShadowHost:Ti,getShadowHost:$i,getWindowHeight:Xs,getWindowScroll:Ys,getWindowWidth:Zs,hasShadowRoot:un,hookSetter:Pi,inDom:pn,isAncestorRemoved:Mi,isBlocked:en,isIgnored:rn,isSerialized:tn,isSerializedIframe:ln,isSerializedStylesheet:an,iterateResolveTree:_i,legacy_isTouchEvent:sn,get nowTimestamp(){return Ai},on:Vs,patch:Qs,polyfill:nn,queueToResolveTrees:on,shadowHostInDom:Ui,throttle:Ks,uniqueTextMutations:hn},Symbol.toStringTag,{value:"Module"}));var ui="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var de=0;de<ui.length;de++)mn[ui.charCodeAt(de)]=de;const gn=`(function() {
  "use strict";
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
  for (var i = 0; i < chars.length; i++) {
    lookup[chars.charCodeAt(i)] = i;
  }
  var encode = function(arraybuffer) {
    var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
    for (i2 = 0; i2 < len; i2 += 3) {
      base64 += chars[bytes[i2] >> 2];
      base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
      base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
      base64 += chars[bytes[i2 + 2] & 63];
    }
    if (len % 3 === 2) {
      base64 = base64.substring(0, base64.length - 1) + "=";
    } else if (len % 3 === 1) {
      base64 = base64.substring(0, base64.length - 2) + "==";
    }
    return base64;
  };
  const lastBlobMap = /* @__PURE__ */ new Map();
  const transparentBlobMap = /* @__PURE__ */ new Map();
  async function getTransparentBlobFor(width, height, dataURLOptions) {
    const id = \`\${width}-\${height}\`;
    if ("OffscreenCanvas" in globalThis) {
      if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
      const offscreen = new OffscreenCanvas(width, height);
      offscreen.getContext("2d");
      const blob = await offscreen.convertToBlob(dataURLOptions);
      const arrayBuffer = await blob.arrayBuffer();
      const base64 = encode(arrayBuffer);
      transparentBlobMap.set(id, base64);
      return base64;
    } else {
      return "";
    }
  }
  const worker = self;
  worker.onmessage = async function(e) {
    if ("OffscreenCanvas" in globalThis) {
      const { id, bitmap, width, height, dataURLOptions } = e.data;
      const transparentBase64 = getTransparentBlobFor(
        width,
        height,
        dataURLOptions
      );
      const offscreen = new OffscreenCanvas(width, height);
      const ctx = offscreen.getContext("2d");
      ctx.drawImage(bitmap, 0, 0);
      bitmap.close();
      const blob = await offscreen.convertToBlob(dataURLOptions);
      const type = blob.type;
      const arrayBuffer = await blob.arrayBuffer();
      const base64 = encode(arrayBuffer);
      if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
        lastBlobMap.set(id, base64);
        return worker.postMessage({ id });
      }
      if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
      worker.postMessage({
        id,
        type,
        base64,
        width,
        height
      });
      lastBlobMap.set(id, base64);
    } else {
      return worker.postMessage({ id: e.data.id });
    }
  };
})();
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
`;typeof self<"u"&&self.Blob&&new Blob([gn],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((tr=e.contentWindow)==null?void 0:tr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}ns();var fi;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(fi||(fi={}));class X{constructor(o){le(this,"fileName"),le(this,"functionName"),le(this,"lineNumber"),le(this,"columnNumber"),this.fileName=o.fileName||"",this.functionName=o.functionName||"",this.lineNumber=o.lineNumber,this.columnNumber=o.columnNumber}toString(){const o=this.lineNumber||"",p=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${o}:${p})`:`${this.fileName}:${o}:${p}`}}const yn=/(^|@)\S+:\d+/,hi=/^\s*at .*(\S+:\d+|\(native\))/m,wn=/^(eval@)?(\[native code])?$/,$t={parse:function(e){return e?typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u"?this.parseOpera(e):e.stack&&e.stack.match(hi)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];const p=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!p)throw new Error(`Cannot parse given url: ${e}`);return[p[1],p[2]||void 0,p[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
`).filter(function(p){return!!p.match(hi)},this).map(function(p){p.indexOf("(eval ")>-1&&(p=p.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let d=p.replace(/^\s+/,"").replace(/\(eval code/g,"(");const s=d.match(/ (\((.+):(\d+):(\d+)\)$)/);d=s?d.replace(s[0],""):d;const f=d.split(/\s+/).slice(1),a=this.extractLocation(s?s[1]:f.pop()),m=f.join(" ")||void 0,n=["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0];return new X({functionName:m,fileName:n,lineNumber:a[1],columnNumber:a[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
`).filter(function(p){return!p.match(wn)},this).map(function(p){if(p.indexOf(" > eval")>-1&&(p=p.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),p.indexOf("@")===-1&&p.indexOf(":")===-1)return new X({functionName:p});{const d=/((.*".+"[^@]*)?[^@]*)(?:@)/,s=p.match(d),f=s&&s[1]?s[1]:void 0,a=this.extractLocation(p.replace(d,""));return new X({functionName:f,fileName:a[0],lineNumber:a[1],columnNumber:a[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
`)>-1&&e.message.split(`
`).length>e.stacktrace.split(`
`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const o=/Line (\d+).*script (?:in )?(\S+)/i,p=e.message.split(`
`),d=[];for(let s=2,f=p.length;s<f;s+=2){const a=o.exec(p[s]);a&&d.push(new X({fileName:a[2],lineNumber:parseFloat(a[1])}))}return d},parseOpera10:function(e){const o=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,p=e.stacktrace.split(`
`),d=[];for(let s=0,f=p.length;s<f;s+=2){const a=o.exec(p[s]);a&&d.push(new X({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return d},parseOpera11:function(e){return e.stack.split(`
`).filter(function(p){return!!p.match(yn)&&!p.match(/^Error created at/)},this).map(function(p){const d=p.split("@"),s=this.extractLocation(d.pop()),a=(d.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new X({functionName:a,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})},this)}};function bn(e){if(!e||!e.outerHTML)return"";let o="";for(;e.parentElement;){let p=e.localName;if(!p)break;p=p.toLowerCase();const d=e.parentElement,s=[];if(d.children&&d.children.length>0)for(let f=0;f<d.children.length;f++){const a=d.children[f];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===p&&s.push(a)}s.length>1&&(p+=`:eq(${s.indexOf(e)})`),o=p+(o?">"+o:""),e=d}return o}function Dt(e){return Object.prototype.toString.call(e)==="[object Object]"}function Di(e,o){if(o===0)return!0;const p=Object.keys(e);for(const d of p)if(Dt(e[d])&&Di(e[d],o-1))return!0;return!1}function Z(e,o){const p={numOfKeysLimit:50,depthOfLimit:4};Object.assign(p,o);const d=[],s=[];return JSON.stringify(e,function(m,n){if(d.length>0){const h=d.indexOf(this);~h?d.splice(h+1):d.push(this),~h?s.splice(h,1/0,m):s.push(m),~d.indexOf(n)&&(d[0]===n?n="[Circular ~]":n="[Circular ~."+s.slice(0,d.indexOf(n)).join(".")+"]")}else d.push(n);if(n===null)return n;if(n===void 0)return"undefined";if(f(n))return a(n);if(typeof n=="bigint")return n.toString()+"n";if(n instanceof Event){const h={};for(const t in n){const l=n[t];Array.isArray(l)?h[t]=bn(l.length?l[0]:null):h[t]=l}return h}else{if(n instanceof Node)return n instanceof HTMLElement?n?n.outerHTML:"":n.nodeName;if(n instanceof Error)return n.stack?n.stack+`
End of stack for Error object`:n.name+": "+n.message}return n});function f(m){return!!(Dt(m)&&Object.keys(m).length>p.numOfKeysLimit||typeof m=="function"||Dt(m)&&Di(m,p.depthOfLimit))}function a(m){let n=m.toString();return p.stringLengthLimit&&n.length>p.stringLengthLimit&&(n=`${n.slice(0,p.stringLengthLimit)}...`),n}}const ci={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function vn(e,o,p){const d=p?Object.assign({},ci,p):ci,s=d.logger;if(!s)return()=>{};let f;typeof s=="string"?f=o[s]:f=s;let a=0,m=!1;const n=[];if(d.level.includes("error")){const t=i=>{const r=i.message,c=i.error,u=$t.parse(c).map(S=>S.toString()),g=[Z(r,d.stringifyOptions)];e({level:"error",trace:u,payload:g})};o.addEventListener("error",t),n.push(()=>{o.removeEventListener("error",t)});const l=i=>{let r,c;i.reason instanceof Error?(r=i.reason,c=[Z(`Uncaught (in promise) ${r.name}: ${r.message}`,d.stringifyOptions)]):(r=new Error,c=[Z("Uncaught (in promise)",d.stringifyOptions),Z(i.reason,d.stringifyOptions)]);const u=$t.parse(r).map(g=>g.toString());e({level:"error",trace:u,payload:c})};o.addEventListener("unhandledrejection",l),n.push(()=>{o.removeEventListener("unhandledrejection",l)})}for(const t of d.level)n.push(h(f,t));return()=>{n.forEach(t=>t())};function h(t,l){return t[l]?dn.patch(t,l,i=>(...r)=>{if(i.apply(this,r),!(l==="assert"&&r[0])&&!m){m=!0;try{const c=$t.parse(new Error).map(S=>S.toString()).splice(1),g=(l==="assert"?r.slice(1):r).map(S=>Z(S,d.stringifyOptions));a++,a<d.lengthThreshold?e({level:l,trace:c,payload:g}):a===d.lengthThreshold&&e({level:"warn",trace:[],payload:[Z("The number of log records reached the threshold.")]})}catch(c){i("rrweb logger error:",c,...r)}finally{m=!1}}}):()=>{}}}const xn="rrweb/console@1",Sn=e=>({name:xn,observer:vn,options:e});export{xn as PLUGIN_NAME,Sn as getRecordConsolePlugin};

```

---

## .svelte-kit/output/client/_app/immutable/entry/app.BLmegFPX.js

```js
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_app/immutable/nodes/0.Bx7q24Sj.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/K4hkKKa0.js","_app/immutable/assets/0.CVzJfwEK.css","_app/immutable/nodes/1.BGCl9XKM.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/CahBYLSE.js","_app/immutable/nodes/2.Co1ksXco.js","_app/immutable/nodes/3.CfAbGAA2.js","_app/immutable/nodes/4.BNJRNjNL.js"])))=>i.map(i=>d[i]);
import{B as Q,d as X,i as x,e as R}from"../chunks/HWAjEwF5.js";import{m as Y,Z as W,z as p,E as $,aA as ee,ad as te,G as re,F as j,as as ae,J as se,e as ne,T as ie,y as oe,i as V,X as F,aB as ue,aC as G,aD as ce,aE as fe,aF as de,g as l,aG as _e,d as O,aH as le,aI as ve,aJ as he,h as me,aK as ge,aL as Ee,R as be,aM as ye,aN as Pe,aO as k,aP as Re,ah as Oe,aQ as Ie,p as Te,M as Ae,u as Se,x as xe,f as T,s as De,a as Le,b as D,c as we,r as Me,t as Be,aR as L}from"../chunks/3TW-MQft.js";import{h as Ne,m as Ce,u as Ye,a as P,c as w,f as z,t as je,s as Ue}from"../chunks/CcgZgiL9.js";import{o as Ve}from"../chunks/CahBYLSE.js";let A=!1;function Fe(t){var e=A;try{return A=!1,[t(),A]}finally{A=e}}function M(t,e,s){var u;Y&&(u=se,W());var o=new Q(t);p(()=>{var r=e()??null;if(Y){var a=ee(u),n=a===ae,c=r!==null;if(n!==c){var m=te();re(m),o.anchor=m,j(!1),o.ensure(r,r&&(f=>s(f,r))),j(!0);return}}o.ensure(r,r&&(f=>s(f,r)))},$)}function U(t,e){return t===e||t?.[G]===e}function B(t={},e,s,u){var o=ne.r,r=F;return ie(()=>{var a,n;return oe(()=>{a=n,n=[],V(()=>{t!==s(...n)&&(e(t,...n),a&&U(s(...a),t)&&e(null,...a))})}),()=>{let c=r;for(;c!==o&&c.parent!==null&&c.parent.f&ue;)c=c.parent;const m=()=>{n&&U(s(...n),t)&&e(null,...n)},f=c.teardown;c.teardown=()=>{m(),f?.()}}}),t}function N(t,e,s,u){var o=!me||(s&ge)!==0,r=(s&he)!==0,a=(s&Pe)!==0,n=u,c=!0,m=()=>(c&&(c=!1,n=a?V(u):u),n);let f;if(r){var S=G in t||k in t;f=ce(t,e)?.set??(S&&e in t?i=>t[e]=i:void 0)}var b,I=!1;r?[b,I]=Fe(()=>t[e]):b=t[e],b===void 0&&u!==void 0&&(b=m(),f&&(o&&fe(),f(b)));var g;if(o?g=()=>{var i=t[e];return i===void 0?m():(c=!0,i)}:g=()=>{var i=t[e];return i!==void 0&&(n=void 0),i===void 0?n:i},o&&(s&de)===0)return g;if(f){var d=t.$$legacy;return(function(i,h){return arguments.length>0?((!o||!h||d||I)&&f(h?g():i),i):g()})}var v=!1,_=((s&Ee)!==0?be:ye)(()=>(v=!1,g()));r&&l(_);var y=F;return(function(i,h){if(arguments.length>0){const E=h?l(_):o&&r?_e(i):i;return O(_,E),v=!0,n!==void 0&&(n=E),i}return le&&v||(y.f&ve)!==0?_.v:l(_)})}function Ge(t){return class extends ke{constructor(e){super({component:t,...e})}}}class ke{#t;#e;constructor(e){var s=new Map,u=(r,a)=>{var n=Ie(a,!1,!1);return s.set(r,n),n};const o=new Proxy({...e.props||{},$$events:{}},{get(r,a){return l(s.get(a)??u(a,Reflect.get(r,a)))},has(r,a){return a===k?!0:(l(s.get(a)??u(a,Reflect.get(r,a))),Reflect.has(r,a))},set(r,a,n){return O(s.get(a)??u(a,n),n),Reflect.set(r,a,n)}});this.#e=(e.hydrate?Ne:Ce)(e.component,{target:e.target,anchor:e.anchor,props:o,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),(!e?.props?.$$host||e.sync===!1)&&Re(),this.#t=o.$$events;for(const r of Object.keys(this.#e))r==="$set"||r==="$destroy"||r==="$on"||Oe(this,r,{get(){return this.#e[r]},set(a){this.#e[r]=a},enumerable:!0});this.#e.$set=r=>{Object.assign(o,r)},this.#e.$destroy=()=>{Ye(this.#e)}}$set(e){this.#e.$set(e)}$on(e,s){this.#t[e]=this.#t[e]||[];const u=(...o)=>s.call(this,...o);return this.#t[e].push(u),()=>{this.#t[e]=this.#t[e].filter(o=>o!==u)}}$destroy(){this.#e.$destroy()}}const ze=globalThis.__sveltekit_1bdh8ft.env;async function He(){X(ze.PUBLIC_AMPLITUDE_API_KEY??"")}const et={};var Je=z('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),Ke=z("<!> <!>",1);function Ze(t,e){Te(e,!0);let s=N(e,"components",23,()=>[]),u=N(e,"data_0",3,null),o=N(e,"data_1",3,null);Ae(()=>e.stores.page.set(e.page)),Se(()=>{e.stores,e.page,e.constructors,s(),e.form,u(),o(),e.stores.page.notify()});let r=D(!1),a=D(!1),n=D(null);Ve(()=>{const d=e.stores.page.subscribe(()=>{l(r)&&(O(a,!0),xe().then(()=>{O(n,document.title||"untitled page",!0)}))});return O(r,!0),d});const c=L(()=>e.constructors[1]);var m=Ke(),f=T(m);{var S=d=>{const v=L(()=>e.constructors[0]);var _=w(),y=T(_);M(y,()=>l(v),(i,h)=>{B(h(i,{get data(){return u()},get form(){return e.form},get params(){return e.page.params},children:(E,Qe)=>{var C=w(),J=T(C);M(J,()=>l(c),(K,Z)=>{B(Z(K,{get data(){return o()},get form(){return e.form},get params(){return e.page.params}}),q=>s()[1]=q,()=>s()?.[1])}),P(E,C)},$$slots:{default:!0}}),E=>s()[0]=E,()=>s()?.[0])}),P(d,_)},b=d=>{const v=L(()=>e.constructors[0]);var _=w(),y=T(_);M(y,()=>l(v),(i,h)=>{B(h(i,{get data(){return u()},get form(){return e.form},get params(){return e.page.params}}),E=>s()[0]=E,()=>s()?.[0])}),P(d,_)};x(f,d=>{e.constructors[1]?d(S):d(b,-1)})}var I=De(f,2);{var g=d=>{var v=Je(),_=we(v);{var y=i=>{var h=je();Be(()=>Ue(h,l(n))),P(i,h)};x(_,i=>{l(a)&&i(y)})}Me(v),P(d,v)};x(I,d=>{l(r)&&d(g)})}P(t,m),Le()}const tt=Ge(Ze),rt=[()=>R(()=>import("../nodes/0.Bx7q24Sj.js"),__vite__mapDeps([0,1,2,3,4,5])),()=>R(()=>import("../nodes/1.BGCl9XKM.js"),__vite__mapDeps([6,1,2,7,8])),()=>R(()=>import("../nodes/2.Co1ksXco.js"),__vite__mapDeps([9,1,2,3,4])),()=>R(()=>import("../nodes/3.CfAbGAA2.js"),__vite__mapDeps([10,1,2,3,7,8,4])),()=>R(()=>import("../nodes/4.BNJRNjNL.js"),__vite__mapDeps([11,1,2,3,7,8,4]))],at=[],st={"/":[2],"/burrito":[3],"/profile":[4]},H={handleError:(({error:t})=>{console.error(t)}),init:He,reroute:(()=>{}),transport:{}},qe=Object.fromEntries(Object.entries(H.transport).map(([t,e])=>[t,e.decode])),nt=Object.fromEntries(Object.entries(H.transport).map(([t,e])=>[t,e.encode])),it=!1,ot=(t,e)=>qe[t](e);export{ot as decode,qe as decoders,st as dictionary,nt as encoders,it as hash,H as hooks,et as matchers,rt as nodes,tt as root,at as server_loads};

```

---

## .svelte-kit/output/client/_app/immutable/entry/start.C-_kLNuo.js

```js
import{l as o,a as r}from"../chunks/CpUSghGZ.js";export{o as load_css,r as start};

```

---

## .svelte-kit/output/client/_app/immutable/nodes/0.Bx7q24Sj.js

```js
import{d as N,a as v,f as p,s as P,b as S}from"../chunks/CcgZgiL9.js";import{z as k,E as O,A as $,H as q,B as z,m as h,C as G,D as b,F as y,G as E,J,K,e as L,M as Q,u as x,i as V,O as A,P as W,g as F,Q as j,R as I,S as U,p as w,a as B,c as u,s as _,r as d,n as X,f as R,t as Y,T as Z,$ as ee}from"../chunks/3TW-MQft.js";import{B as ae,i as C}from"../chunks/HWAjEwF5.js";import{g as te,A as se,s as re}from"../chunks/K4hkKKa0.js";function ne(n,s,...a){var r=new ae(n);k(()=>{const t=s()??null;r.ensure(t,t&&(e=>t(e,...a)))},O)}function oe(n,s){let a=null,r=h;var t;if(h){a=J;for(var e=K(document.head);e!==null&&(e.nodeType!==G||e.data!==n);)e=b(e);if(e===null)y(!1);else{var i=b(e);e.remove(),E(i)}}h||(t=document.head.appendChild($()));try{k(()=>s(t),q|z)}finally{r&&(y(!0),E(a))}}function ie(n=!1){const s=L,a=s.l.u;if(!a)return;let r=()=>j(s.s);if(n){let t=0,e={};const i=I(()=>{let f=!1;const o=s.s;for(const c in o)o[c]!==e[c]&&(e[c]=o[c],f=!0);return f&&t++,t});r=()=>F(i)}a.b.length&&Q(()=>{T(s,r),A(a.b)}),x(()=>{const t=V(()=>a.m.map(W));return()=>{for(const e of t)typeof e=="function"&&e()}}),a.a.length&&x(()=>{T(s,r),A(a.a)})}function T(n,s){if(n.l.s)for(const a of n.l.s)F(a);s()}U();var le=p('<a href="/burrito">Burrito</a> <a href="/profile">Profile</a>',1),fe=p('<span> </span> <button class="btn-logout">Logout</button>',1),ce=p('<header class="header"><div class="header-container"><nav><a href="/">Home</a> <!></nav> <div class="user-section"><!></div></div></header>');function ue(n,s){w(s,!1);const a=te();ie();var r=ce(),t=u(r),e=u(t),i=_(u(e),2);{var f=l=>{var m=le();X(2),v(l,m)};C(i,l=>{a.user&&l(f)})}d(e);var o=_(e,2),c=u(o);{var D=l=>{var m=fe(),g=R(m),H=u(g);d(g);var M=_(g,2);Y(()=>P(H,`Welcome, ${a.user.username??""}`)),S("click",M,()=>a.logout()),v(l,m)};C(c,l=>{a.user&&l(D)})}d(o),d(t),d(r),v(n,r),B()}N(["click"]);var de=p('<meta name="description" content="Consider the potential of burritos with Amplitude analytics"/>'),ve=p("<!> <main><!></main>",1);function he(n,s){w(s,!0);const a=new se;re(a);var r=ve();oe("12qhfyh",f=>{var o=de();Z(()=>{ee.title="Burrito consideration app"}),v(f,o)});var t=R(r);ue(t,{});var e=_(t,2),i=u(e);ne(i,()=>s.children),d(e),v(n,r),B()}export{he as component};

```

---

## .svelte-kit/output/client/_app/immutable/nodes/1.BGCl9XKM.js

```js
import{a as h,f as i,s}from"../chunks/CcgZgiL9.js";import{p as g,f as v,t as d,a as l,c as a,r as o,s as _}from"../chunks/3TW-MQft.js";import{s as x,p}from"../chunks/CpUSghGZ.js";const $={get error(){return p.error},get status(){return p.status}};x.updated.check;const c=$;var k=i("<h1> </h1> <p> </p>",1);function q(m,f){g(f,!0);var t=k(),r=v(t),n=a(r,!0);o(r);var e=_(r,2),u=a(e,!0);o(e),d(()=>{s(n,c.status),s(u,c.error?.message)}),h(m,t),l()}export{q as component};

```

---

## .svelte-kit/output/client/_app/immutable/nodes/2.Co1ksXco.js

```js
import{a as S,f as k,s as C,e as K}from"../chunks/CcgZgiL9.js";import{m as T,q as R,o as Y,L as X,N as j,I as z,v as F,w as b,x as J,i as Q,y as Z,p as $,a as ee,c as d,r as m,f as q,n as E,t as H,s as p,g as _,b as L,d as c}from"../chunks/3TW-MQft.js";import{i as O}from"../chunks/HWAjEwF5.js";import{g as ae}from"../chunks/K4hkKKa0.js";const re=Symbol("is custom element"),se=Symbol("is html"),oe=z?"link":"LINK";function P(e){if(T){var a=!1,o=()=>{if(!a){if(a=!0,e.hasAttribute("value")){var t=e.value;U(e,"value",null),e.value=t}if(e.hasAttribute("checked")){var r=e.checked;U(e,"checked",null),e.checked=r}}};e.__on_r=o,R(o),Y()}}function U(e,a,o,t){var r=te(e);T&&(r[a]=e.getAttribute(a),a==="src"||a==="srcset"||a==="href"&&e.nodeName===oe)||r[a]!==(r[a]=o)&&(a==="loading"&&(e[X]=o),e.removeAttribute(a))}function te(e){return e.__attributes??={[re]:e.nodeName.includes("-"),[se]:e.namespaceURI===j}}function V(e,a,o=a){var t=new WeakSet;F(e,"input",async r=>{var s=r?e.defaultValue:e.value;if(s=x(e)?I(s):s,o(s),b!==null&&t.add(b),await J(),s!==(s=a())){var g=e.selectionStart,l=e.selectionEnd,y=e.value.length;if(e.value=s??"",l!==null){var u=e.value.length;g===l&&l===y&&u>y?(e.selectionStart=u,e.selectionEnd=u):(e.selectionStart=g,e.selectionEnd=Math.min(l,u))}}}),(T&&e.defaultValue!==e.value||Q(a)==null&&e.value)&&(o(x(e)?I(e.value):e.value),b!==null&&t.add(b)),Z(()=>{var r=a();if(e===document.activeElement){var s=b;if(t.has(s))return}x(e)&&r===I(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function x(e){var a=e.type;return a==="number"||a==="range"}function I(e){return e===""?null:+e}var le=k('<h1> </h1> <p>You are now logged in. Check out the navigation to explore features.</p> <ul><li><a href="/burrito">Consider a burrito</a></li> <li><a href="/profile">View your profile</a></li></ul>',1),ie=k('<p class="error"> </p>'),ne=k('<h1>Welcome to Burrito consideration app</h1> <p>Sign in to start considering burritos.</p> <form class="form"><div class="form-group"><label for="username">Username:</label> <input type="text" id="username" required=""/></div> <div class="form-group"><label for="password">Password:</label> <input type="password" id="password" required=""/></div> <!> <button type="submit" class="btn-primary">Sign In</button></form> <p class="note">Enter any username and password to sign in. This is a demo app.</p>',1),ve=k('<div class="container"><!></div>');function me(e,a){$(a,!0);const o=ae();let t=L(""),r=L(""),s=L("");async function g(i){i.preventDefault(),c(s,"");try{await o.login(_(t),_(r))?(c(t,""),c(r,"")):c(s,"Please provide both username and password")}catch(n){console.error("Login failed:",n),c(s,"An error occurred during login")}}var l=ve(),y=d(l);{var u=i=>{var n=le(),f=q(n),h=d(f);m(f),E(4),H(()=>C(h,`Welcome back, ${o.user.username??""}!`)),S(i,n)},W=i=>{var n=ne(),f=p(q(n),4),h=d(f),M=p(d(h),2);P(M),m(h);var w=p(h,2),N=p(d(w),2);P(N),m(w);var B=p(w,2);{var D=v=>{var A=ie(),G=d(A,!0);m(A),H(()=>C(G,_(s))),S(v,A)};O(B,v=>{_(s)&&v(D)})}E(2),m(f),E(2),K("submit",f,g),V(M,()=>_(t),v=>c(t,v)),V(N,()=>_(r),v=>c(r,v)),S(i,n)};O(y,i=>{o.user?i(u):i(W,-1)})}m(l),S(e,l),ee()}export{me as component};

```

---

## .svelte-kit/output/client/_app/immutable/nodes/3.CfAbGAA2.js

```js
import{d as E,a as s,f as n,s as m,b as I}from"../chunks/CcgZgiL9.js";import{p as P,u as j,a as q,c as o,r as a,s as i,f as D,g as F,n as G,t as h,b as H,d as b}from"../chunks/3TW-MQft.js";import{i as _,t as J}from"../chunks/HWAjEwF5.js";import{g as K}from"../chunks/CpUSghGZ.js";import{g as L}from"../chunks/K4hkKKa0.js";var M=n('<p class="success"> </p>'),N=n('<h1>Burrito consideration zone</h1> <p>This is where you consider the infinite potential of burritos.</p> <p>Current considerations: <strong> </strong></p> <button class="btn-burrito">I have considered the burrito potential</button> <!> <div class="note"><p>Each consideration is tracked as an Amplitude event with custom properties.</p></div>',1),O=n("<p>Please log in to consider burritos.</p>"),Q=n('<div class="container"><!></div>');function X(g,C){P(C,!0);const t=L();let u=H(!1);j(()=>{t.user||K("/")});function k(){t.user&&(t.incrementBurritoConsiderations(),b(u,!0),setTimeout(()=>b(u,!1),2e3),J("burrito_considered",{total_considerations:t.user.burritoConsiderations,username:t.user.username}))}var c=Q(),x=o(c);{var y=r=>{var e=N(),d=i(D(e),4),l=i(o(d)),w=o(l,!0);a(l),a(d);var v=i(d,2),A=i(v,2);{var B=p=>{var f=M(),z=o(f);a(f),h(()=>m(z,`Thank you for your consideration! Count: ${t.user.burritoConsiderations??""}`)),s(p,f)};_(A,p=>{F(u)&&p(B)})}G(2),h(()=>m(w,t.user.burritoConsiderations)),I("click",v,k),s(r,e)},T=r=>{var e=O();s(r,e)};_(x,r=>{t.user?r(y):r(T,-1)})}a(c),s(g,c),q()}E(["click"]);export{X as component};

```

---

## .svelte-kit/output/client/_app/immutable/nodes/4.BNJRNjNL.js

```js
import{a as n,f,s as u}from"../chunks/CcgZgiL9.js";import{p as b,u as C,a as U,c as a,r as e,s as t,f as k,t as w}from"../chunks/3TW-MQft.js";import{i as y}from"../chunks/HWAjEwF5.js";import{g as A}from"../chunks/CpUSghGZ.js";import{g as B}from"../chunks/K4hkKKa0.js";var P=f('<h1>User profile</h1> <div class="stats"><h2>Your information</h2> <p><strong>Username:</strong> </p> <p><strong>Burrito considerations:</strong> </p></div>',1),Y=f("<p>Please log in to view your profile.</p>"),j=f('<div class="container"><!></div>');function G(c,l){b(l,!0);const o=B();C(()=>{o.user||A("/")});var i=j(),_=a(i);{var g=r=>{var s=P(),v=t(k(s),2),p=t(a(v),2),h=t(a(p));e(p);var m=t(p,2),x=t(a(m));e(m),e(v),w(()=>{u(h,` ${o.user.username??""}`),u(x,` ${o.user.burritoConsiderations??""}`)}),n(r,s)},d=r=>{var s=Y();n(r,s)};y(_,r=>{o.user?r(g):r(d,-1)})}e(i),n(c,i),U()}export{G as component};

```

---

## .svelte-kit/output/client/robots.txt

```txt
# allow crawling everything by default
User-agent: *
Disallow:

```

---

## .svelte-kit/output/server/chunks/attributes.js

```js
import { l as lifecycle_outside_component } from "./errors.js";
var ssr_context = null;
function set_ssr_context(v) {
  ssr_context = v;
}
function getContext(key) {
  const context_map = get_or_init_context_map();
  const result = (
    /** @type {T} */
    context_map.get(key)
  );
  return result;
}
function setContext(key, context) {
  get_or_init_context_map().set(key, context);
  return context;
}
function get_or_init_context_map(name) {
  if (ssr_context === null) {
    lifecycle_outside_component();
  }
  return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0);
}
function push(fn) {
  ssr_context = { p: ssr_context, c: null, r: null };
}
function pop() {
  ssr_context = /** @type {SSRContext} */
  ssr_context.p;
}
function get_parent_context(ssr_context2) {
  let parent = ssr_context2.p;
  while (parent !== null) {
    const context_map = parent.c;
    if (context_map !== null) {
      return context_map;
    }
    parent = parent.p;
  }
  return null;
}
var is_array = Array.isArray;
var index_of = Array.prototype.indexOf;
var includes = Array.prototype.includes;
var array_from = Array.from;
var define_property = Object.defineProperty;
var get_descriptor = Object.getOwnPropertyDescriptor;
var object_prototype = Object.prototype;
var array_prototype = Array.prototype;
var get_prototype_of = Object.getPrototypeOf;
var is_extensible = Object.isExtensible;
var has_own_property = Object.prototype.hasOwnProperty;
const noop = () => {
};
function run_all(arr) {
  for (var i = 0; i < arr.length; i++) {
    arr[i]();
  }
}
function deferred() {
  var resolve;
  var reject;
  var promise = new Promise((res, rej) => {
    resolve = res;
    reject = rej;
  });
  return { promise, resolve, reject };
}
const ATTR_REGEX = /[&"<]/g;
const CONTENT_REGEX = /[&<]/g;
function escape_html(value, is_attr) {
  const str = String(value ?? "");
  const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
  pattern.lastIndex = 0;
  let escaped = "";
  let last = 0;
  while (pattern.test(str)) {
    const i = pattern.lastIndex - 1;
    const ch = str[i];
    escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === '"' ? "&quot;" : "&lt;");
    last = i + 1;
  }
  return escaped + str.substring(last);
}
function r(e) {
  var t, f, n = "";
  if ("string" == typeof e || "number" == typeof e) n += e;
  else if ("object" == typeof e) if (Array.isArray(e)) {
    var o = e.length;
    for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
  } else for (f in e) e[f] && (n && (n += " "), n += f);
  return n;
}
function clsx$1() {
  for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
  return n;
}
const replacements = {
  translate: /* @__PURE__ */ new Map([
    [true, "yes"],
    [false, "no"]
  ])
};
function attr(name, value, is_boolean = false) {
  if (name === "hidden" && value !== "until-found") {
    is_boolean = true;
  }
  if (value == null || !value && is_boolean) return "";
  const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
  const assignment = is_boolean ? `=""` : `="${escape_html(normalized, true)}"`;
  return ` ${name}${assignment}`;
}
function clsx(value) {
  if (typeof value === "object") {
    return clsx$1(value);
  } else {
    return value ?? "";
  }
}
const whitespace = [..." 	\n\r\f \v\uFEFF"];
function to_class(value, hash, directives) {
  var classname = value == null ? "" : "" + value;
  if (hash) {
    classname = classname ? classname + " " + hash : hash;
  }
  if (directives) {
    for (var key of Object.keys(directives)) {
      if (directives[key]) {
        classname = classname ? classname + " " + key : key;
      } else if (classname.length) {
        var len = key.length;
        var a = 0;
        while ((a = classname.indexOf(key, a)) >= 0) {
          var b = a + len;
          if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
            classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
          } else {
            a = b;
          }
        }
      }
    }
  }
  return classname === "" ? null : classname;
}
function append_styles(styles, important = false) {
  var separator = important ? " !important;" : ";";
  var css = "";
  for (var key of Object.keys(styles)) {
    var value = styles[key];
    if (value != null && value !== "") {
      css += " " + key + ": " + value + separator;
    }
  }
  return css;
}
function to_css_name(name) {
  if (name[0] !== "-" || name[1] !== "-") {
    return name.toLowerCase();
  }
  return name;
}
function to_style(value, styles) {
  if (styles) {
    var new_style = "";
    var normal_styles;
    var important_styles;
    if (Array.isArray(styles)) {
      normal_styles = styles[0];
      important_styles = styles[1];
    } else {
      normal_styles = styles;
    }
    if (value) {
      value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
      var in_str = false;
      var in_apo = 0;
      var in_comment = false;
      var reserved_names = [];
      if (normal_styles) {
        reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
      }
      if (important_styles) {
        reserved_names.push(...Object.keys(important_styles).map(to_css_name));
      }
      var start_index = 0;
      var name_index = -1;
      const len = value.length;
      for (var i = 0; i < len; i++) {
        var c = value[i];
        if (in_comment) {
          if (c === "/" && value[i - 1] === "*") {
            in_comment = false;
          }
        } else if (in_str) {
          if (in_str === c) {
            in_str = false;
          }
        } else if (c === "/" && value[i + 1] === "*") {
          in_comment = true;
        } else if (c === '"' || c === "'") {
          in_str = c;
        } else if (c === "(") {
          in_apo++;
        } else if (c === ")") {
          in_apo--;
        }
        if (!in_comment && in_str === false && in_apo === 0) {
          if (c === ":" && name_index === -1) {
            name_index = i;
          } else if (c === ";" || i === len - 1) {
            if (name_index !== -1) {
              var name = to_css_name(value.substring(start_index, name_index).trim());
              if (!reserved_names.includes(name)) {
                if (c !== ";") {
                  i++;
                }
                var property = value.substring(start_index, i).trim();
                new_style += " " + property + ";";
              }
            }
            start_index = i + 1;
            name_index = -1;
          }
        }
      }
    }
    if (normal_styles) {
      new_style += append_styles(normal_styles);
    }
    if (important_styles) {
      new_style += append_styles(important_styles, true);
    }
    new_style = new_style.trim();
    return new_style === "" ? null : new_style;
  }
  return value == null ? null : String(value);
}
export {
  attr as a,
  array_prototype as b,
  get_descriptor as c,
  deferred as d,
  escape_html as e,
  get_prototype_of as f,
  getContext as g,
  is_array as h,
  includes as i,
  is_extensible as j,
  index_of as k,
  define_property as l,
  array_from as m,
  noop as n,
  object_prototype as o,
  clsx as p,
  to_class as q,
  run_all as r,
  setContext as s,
  to_style as t,
  ssr_context as u,
  set_ssr_context as v,
  push as w,
  pop as x,
  has_own_property as y
};

```

---

## .svelte-kit/output/server/chunks/auth.svelte.js

```js
import { B as BROWSER } from "./errors.js";
import { s as setContext, g as getContext } from "./attributes.js";
import * as amplitude from "@amplitude/unified";
import { Identify } from "@amplitude/unified";
const AUTH_KEY = /* @__PURE__ */ Symbol("auth");
class AuthState {
  user = null;
  constructor() {
  }
  login = async (username, password) => {
    try {
      const response = await fetch("/api/auth/login", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ username, password })
      });
      if (response.ok) {
        const { user: userData } = await response.json();
        this.user = userData;
        if (BROWSER) ;
        return true;
      }
      return false;
    } catch (error) {
      console.error("Login error:", error);
      return false;
    }
  };
  logout = () => {
    this.user = null;
  };
  incrementBurritoConsiderations = () => {
    if (this.user) {
      this.user = {
        ...this.user,
        burritoConsiderations: this.user.burritoConsiderations + 1
      };
    }
  };
}
function setAuthContext(auth) {
  setContext(AUTH_KEY, auth);
}
function getAuthContext() {
  return getContext(AUTH_KEY);
}
export {
  AuthState as A,
  getAuthContext as g,
  setAuthContext as s
};

```

---

## .svelte-kit/output/server/chunks/environment.js

```js
let base = "";
let assets = base;
const app_dir = "_app";
const relative = false;
const initial = { base, assets };
function override(paths) {
  base = paths.base;
  assets = paths.assets;
}
function reset() {
  base = initial.base;
  assets = initial.assets;
}
function set_assets(path) {
  assets = initial.assets = path;
}
let prerendering = false;
function set_building() {
}
function set_prerendering() {
  prerendering = true;
}
export {
  assets as a,
  base as b,
  app_dir as c,
  reset as d,
  set_building as e,
  set_prerendering as f,
  override as o,
  prerendering as p,
  relative as r,
  set_assets as s
};

```

---

## .svelte-kit/output/server/chunks/errors.js

```js
const BROWSER = false;
function experimental_async_required(name) {
  {
    throw new Error(`https://svelte.dev/e/experimental_async_required`);
  }
}
function lifecycle_outside_component(name) {
  {
    throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
  }
}
export {
  BROWSER as B,
  experimental_async_required as e,
  lifecycle_outside_component as l
};

```

---

## .svelte-kit/output/server/chunks/exports.js

```js
const SCHEME = /^[a-z][a-z\d+\-.]+:/i;
const internal = new URL("sveltekit-internal://");
function resolve(base, path) {
  if (path[0] === "/" && path[1] === "/") return path;
  let url = new URL(base, internal);
  url = new URL(path, url);
  return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
}
function normalize_path(path, trailing_slash) {
  if (path === "/" || trailing_slash === "ignore") return path;
  if (trailing_slash === "never") {
    return path.endsWith("/") ? path.slice(0, -1) : path;
  } else if (trailing_slash === "always" && !path.endsWith("/")) {
    return path + "/";
  }
  return path;
}
function decode_pathname(pathname) {
  return pathname.split("%25").map(decodeURI).join("%25");
}
function decode_params(params) {
  for (const key in params) {
    params[key] = decodeURIComponent(params[key]);
  }
  return params;
}
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
  const tracked = new URL(url);
  Object.defineProperty(tracked, "searchParams", {
    value: new Proxy(tracked.searchParams, {
      get(obj, key) {
        if (key === "get" || key === "getAll" || key === "has") {
          return (param, ...rest) => {
            search_params_callback(param);
            return obj[key](param, ...rest);
          };
        }
        callback();
        const value = Reflect.get(obj, key);
        return typeof value === "function" ? value.bind(obj) : value;
      }
    }),
    enumerable: true,
    configurable: true
  });
  const tracked_url_properties = ["href", "pathname", "search", "toString", "toJSON"];
  if (allow_hash) tracked_url_properties.push("hash");
  for (const property of tracked_url_properties) {
    Object.defineProperty(tracked, property, {
      get() {
        callback();
        return url[property];
      },
      enumerable: true,
      configurable: true
    });
  }
  {
    tracked[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
      return inspect(url, opts);
    };
    tracked.searchParams[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
      return inspect(url.searchParams, opts);
    };
  }
  if (!allow_hash) {
    disable_hash(tracked);
  }
  return tracked;
}
function disable_hash(url) {
  allow_nodejs_console_log(url);
  Object.defineProperty(url, "hash", {
    get() {
      throw new Error(
        "Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead"
      );
    }
  });
}
function disable_search(url) {
  allow_nodejs_console_log(url);
  for (const property of ["search", "searchParams"]) {
    Object.defineProperty(url, property, {
      get() {
        throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
      }
    });
  }
}
function allow_nodejs_console_log(url) {
  {
    url[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
      return inspect(new URL(url), opts);
    };
  }
}
function validator(expected) {
  function validate(module, file) {
    if (!module) return;
    for (const key in module) {
      if (key[0] === "_" || expected.has(key)) continue;
      const values = [...expected.values()];
      const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
      throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
    }
  }
  return validate;
}
function hint_for_supported_files(key, ext = ".js") {
  const supported_files = [];
  if (valid_layout_exports.has(key)) {
    supported_files.push(`+layout${ext}`);
  }
  if (valid_page_exports.has(key)) {
    supported_files.push(`+page${ext}`);
  }
  if (valid_layout_server_exports.has(key)) {
    supported_files.push(`+layout.server${ext}`);
  }
  if (valid_page_server_exports.has(key)) {
    supported_files.push(`+page.server${ext}`);
  }
  if (valid_server_exports.has(key)) {
    supported_files.push(`+server${ext}`);
  }
  if (supported_files.length > 0) {
    return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
  }
}
const valid_layout_exports = /* @__PURE__ */ new Set([
  "load",
  "prerender",
  "csr",
  "ssr",
  "trailingSlash",
  "config"
]);
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
const valid_server_exports = /* @__PURE__ */ new Set([
  "GET",
  "POST",
  "PATCH",
  "PUT",
  "DELETE",
  "OPTIONS",
  "HEAD",
  "fallback",
  "prerender",
  "trailingSlash",
  "config",
  "entries"
]);
const validate_layout_exports = validator(valid_layout_exports);
const validate_page_exports = validator(valid_page_exports);
const validate_layout_server_exports = validator(valid_layout_server_exports);
const validate_page_server_exports = validator(valid_page_server_exports);
const validate_server_exports = validator(valid_server_exports);
export {
  SCHEME as S,
  decode_params as a,
  validate_layout_exports as b,
  validate_page_server_exports as c,
  disable_search as d,
  validate_page_exports as e,
  decode_pathname as f,
  validate_server_exports as g,
  make_trackable as m,
  normalize_path as n,
  resolve as r,
  validate_layout_server_exports as v
};

```

---

## .svelte-kit/output/server/chunks/index.js

```js
import { n as noop } from "./attributes.js";
import { s as safe_not_equal } from "./root.js";
const subscriber_queue = [];
function readable(value, start) {
  return {
    subscribe: writable(value, start).subscribe
  };
}
function writable(value, start = noop) {
  let stop = null;
  const subscribers = /* @__PURE__ */ new Set();
  function set(new_value) {
    if (safe_not_equal(value, new_value)) {
      value = new_value;
      if (stop) {
        const run_queue = !subscriber_queue.length;
        for (const subscriber of subscribers) {
          subscriber[1]();
          subscriber_queue.push(subscriber, value);
        }
        if (run_queue) {
          for (let i = 0; i < subscriber_queue.length; i += 2) {
            subscriber_queue[i][0](subscriber_queue[i + 1]);
          }
          subscriber_queue.length = 0;
        }
      }
    }
  }
  function update(fn) {
    set(fn(
      /** @type {T} */
      value
    ));
  }
  function subscribe(run, invalidate = noop) {
    const subscriber = [run, invalidate];
    subscribers.add(subscriber);
    if (subscribers.size === 1) {
      stop = start(set, update) || noop;
    }
    run(
      /** @type {T} */
      value
    );
    return () => {
      subscribers.delete(subscriber);
      if (subscribers.size === 0 && stop) {
        stop();
        stop = null;
      }
    };
  }
  return { set, update, subscribe };
}
export {
  readable as r,
  writable as w
};

```

---

## .svelte-kit/output/server/chunks/internal.js

```js
import { r as root } from "./root.js";
import "./environment.js";
import "./shared-server.js";
let read_implementation = null;
function set_read_implementation(fn) {
  read_implementation = fn;
}
function set_manifest(_) {
}
const options = {
  app_template_contains_nonce: false,
  async: false,
  csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
  csrf_check_origin: true,
  csrf_trusted_origins: [],
  embedded: false,
  env_public_prefix: "PUBLIC_",
  env_private_prefix: "",
  hash_routing: false,
  hooks: null,
  // added lazily, via `get_hooks`
  preload_strategy: "modulepreload",
  root,
  service_worker: false,
  service_worker_options: void 0,
  server_error_boundaries: false,
  templates: {
    app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n	<head>\n		<meta charset="utf-8" />\n		<meta name="viewport" content="width=device-width, initial-scale=1" />\n		' + head + '\n	</head>\n	<body data-sveltekit-preload-data="hover">\n		<div style="display: contents">' + body + "</div>\n	</body>\n</html>\n",
    error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n	<head>\n		<meta charset="utf-8" />\n		<title>' + message + `</title>

		<style>
			body {
				--bg: white;
				--fg: #222;
				--divider: #ccc;
				background: var(--bg);
				color: var(--fg);
				font-family:
					system-ui,
					-apple-system,
					BlinkMacSystemFont,
					'Segoe UI',
					Roboto,
					Oxygen,
					Ubuntu,
					Cantarell,
					'Open Sans',
					'Helvetica Neue',
					sans-serif;
				display: flex;
				align-items: center;
				justify-content: center;
				height: 100vh;
				margin: 0;
			}

			.error {
				display: flex;
				align-items: center;
				max-width: 32rem;
				margin: 0 1rem;
			}

			.status {
				font-weight: 200;
				font-size: 3rem;
				line-height: 1;
				position: relative;
				top: -0.05rem;
			}

			.message {
				border-left: 1px solid var(--divider);
				padding: 0 0 0 1rem;
				margin: 0 0 0 1rem;
				min-height: 2.5rem;
				display: flex;
				align-items: center;
			}

			.message h1 {
				font-weight: 400;
				font-size: 1em;
				margin: 0;
			}

			@media (prefers-color-scheme: dark) {
				body {
					--bg: #222;
					--fg: #ddd;
					--divider: #666;
				}
			}
		</style>
	</head>
	<body>
		<div class="error">
			<span class="status">` + status + '</span>\n			<div class="message">\n				<h1>' + message + "</h1>\n			</div>\n		</div>\n	</body>\n</html>\n"
  },
  version_hash: "1bdh8ft"
};
async function get_hooks() {
  let handle;
  let handleFetch;
  let handleError;
  let handleValidationError;
  let init;
  ({ handle, handleFetch, handleError, handleValidationError, init } = await import("../entries/hooks.server.js"));
  let reroute;
  let transport;
  return {
    handle,
    handleFetch,
    handleError,
    handleValidationError,
    init,
    reroute,
    transport
  };
}
export {
  set_manifest as a,
  get_hooks as g,
  options as o,
  read_implementation as r,
  set_read_implementation as s
};

```

---

## .svelte-kit/output/server/chunks/render-context.js

```js
const escaped = {
  "<": "\\u003C",
  "\\": "\\\\",
  "\b": "\\b",
  "\f": "\\f",
  "\n": "\\n",
  "\r": "\\r",
  "	": "\\t",
  "\u2028": "\\u2028",
  "\u2029": "\\u2029"
};
class DevalueError extends Error {
  /**
   * @param {string} message
   * @param {string[]} keys
   * @param {any} [value] - The value that failed to be serialized
   * @param {any} [root] - The root value being serialized
   */
  constructor(message, keys, value, root) {
    super(message);
    this.name = "DevalueError";
    this.path = keys.join("");
    this.value = value;
    this.root = root;
  }
}
function is_primitive(thing) {
  return thing === null || typeof thing !== "object" && typeof thing !== "function";
}
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
function is_plain_object(thing) {
  const proto = Object.getPrototypeOf(thing);
  return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
}
function get_type(thing) {
  return Object.prototype.toString.call(thing).slice(8, -1);
}
function get_escaped_char(char) {
  switch (char) {
    case '"':
      return '\\"';
    case "<":
      return "\\u003C";
    case "\\":
      return "\\\\";
    case "\n":
      return "\\n";
    case "\r":
      return "\\r";
    case "	":
      return "\\t";
    case "\b":
      return "\\b";
    case "\f":
      return "\\f";
    case "\u2028":
      return "\\u2028";
    case "\u2029":
      return "\\u2029";
    default:
      return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
  }
}
function stringify_string(str) {
  let result = "";
  let last_pos = 0;
  const len = str.length;
  for (let i = 0; i < len; i += 1) {
    const char = str[i];
    const replacement = get_escaped_char(char);
    if (replacement) {
      result += str.slice(last_pos, i) + replacement;
      last_pos = i + 1;
    }
  }
  return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
}
function enumerable_symbols(object) {
  return Object.getOwnPropertySymbols(object).filter(
    (symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
  );
}
const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
function stringify_key(key) {
  return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
}
function is_valid_array_index(s) {
  if (s.length === 0) return false;
  if (s.length > 1 && s.charCodeAt(0) === 48) return false;
  for (let i = 0; i < s.length; i++) {
    const c = s.charCodeAt(i);
    if (c < 48 || c > 57) return false;
  }
  const n = +s;
  if (n >= 2 ** 32 - 1) return false;
  if (n < 0) return false;
  return true;
}
function valid_array_indices(array) {
  const keys = Object.keys(array);
  for (var i = keys.length - 1; i >= 0; i--) {
    if (is_valid_array_index(keys[i])) {
      break;
    }
  }
  keys.length = i + 1;
  return keys;
}
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
const reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
function uneval(value, replacer) {
  const counts = /* @__PURE__ */ new Map();
  const keys = [];
  const custom = /* @__PURE__ */ new Map();
  function walk(thing) {
    if (!is_primitive(thing)) {
      if (counts.has(thing)) {
        counts.set(thing, counts.get(thing) + 1);
        return;
      }
      counts.set(thing, 1);
      if (replacer) {
        const str2 = replacer(thing, (value2) => uneval(value2, replacer));
        if (typeof str2 === "string") {
          custom.set(thing, str2);
          return;
        }
      }
      if (typeof thing === "function") {
        throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
      }
      const type = get_type(thing);
      switch (type) {
        case "Number":
        case "BigInt":
        case "String":
        case "Boolean":
        case "Date":
        case "RegExp":
        case "URL":
        case "URLSearchParams":
          return;
        case "Array":
          thing.forEach((value2, i) => {
            keys.push(`[${i}]`);
            walk(value2);
            keys.pop();
          });
          break;
        case "Set":
          Array.from(thing).forEach(walk);
          break;
        case "Map":
          for (const [key, value2] of thing) {
            keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`);
            walk(value2);
            keys.pop();
          }
          break;
        case "Int8Array":
        case "Uint8Array":
        case "Uint8ClampedArray":
        case "Int16Array":
        case "Uint16Array":
        case "Float16Array":
        case "Int32Array":
        case "Uint32Array":
        case "Float32Array":
        case "Float64Array":
        case "BigInt64Array":
        case "BigUint64Array":
        case "DataView":
          walk(thing.buffer);
          return;
        case "ArrayBuffer":
          return;
        case "Temporal.Duration":
        case "Temporal.Instant":
        case "Temporal.PlainDate":
        case "Temporal.PlainTime":
        case "Temporal.PlainDateTime":
        case "Temporal.PlainMonthDay":
        case "Temporal.PlainYearMonth":
        case "Temporal.ZonedDateTime":
          return;
        default:
          if (!is_plain_object(thing)) {
            throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
          }
          if (enumerable_symbols(thing).length > 0) {
            throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
          }
          for (const key of Object.keys(thing)) {
            if (key === "__proto__") {
              throw new DevalueError(
                `Cannot stringify objects with __proto__ keys`,
                keys,
                thing,
                value
              );
            }
            keys.push(stringify_key(key));
            walk(thing[key]);
            keys.pop();
          }
      }
    } else if (typeof thing === "symbol") {
      throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
    }
  }
  walk(value);
  const names = /* @__PURE__ */ new Map();
  Array.from(counts).filter((entry) => entry[1] > 1).sort((a, b) => b[1] - a[1]).forEach((entry, i) => {
    names.set(entry[0], get_name(i));
  });
  function stringify(thing) {
    if (names.has(thing)) {
      return names.get(thing);
    }
    if (is_primitive(thing)) {
      return stringify_primitive(thing);
    }
    if (custom.has(thing)) {
      return custom.get(thing);
    }
    const type = get_type(thing);
    switch (type) {
      case "Number":
      case "String":
      case "Boolean":
      case "BigInt":
        return `Object(${stringify(thing.valueOf())})`;
      case "RegExp":
        return `new RegExp(${stringify_string(thing.source)}, "${thing.flags}")`;
      case "Date":
        return `new Date(${thing.getTime()})`;
      case "URL":
        return `new URL(${stringify_string(thing.toString())})`;
      case "URLSearchParams":
        return `new URLSearchParams(${stringify_string(thing.toString())})`;
      case "Array": {
        let has_holes = false;
        let result = "[";
        for (let i = 0; i < thing.length; i += 1) {
          if (i > 0) result += ",";
          if (Object.hasOwn(thing, i)) {
            result += stringify(thing[i]);
          } else if (!has_holes) {
            const populated_keys = valid_array_indices(
              /** @type {any[]} */
              thing
            );
            const population = populated_keys.length;
            const d = String(thing.length).length;
            const hole_cost = thing.length + 2;
            const sparse_cost = 25 + d + population * (d + 2);
            if (hole_cost > sparse_cost) {
              const entries = populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(",");
              return `Object.assign(Array(${thing.length}),{${entries}})`;
            }
            has_holes = true;
            i -= 1;
          }
        }
        const tail = thing.length === 0 || thing.length - 1 in thing ? "" : ",";
        return result + tail + "]";
      }
      case "Set":
      case "Map":
        return `new ${type}([${Array.from(thing).map(stringify).join(",")}])`;
      case "Int8Array":
      case "Uint8Array":
      case "Uint8ClampedArray":
      case "Int16Array":
      case "Uint16Array":
      case "Float16Array":
      case "Int32Array":
      case "Uint32Array":
      case "Float32Array":
      case "Float64Array":
      case "BigInt64Array":
      case "BigUint64Array": {
        let str2 = `new ${type}`;
        if (!names.has(thing.buffer)) {
          const array = new thing.constructor(thing.buffer);
          str2 += `([${array}])`;
        } else {
          str2 += `(${stringify(thing.buffer)})`;
        }
        if (thing.byteLength !== thing.buffer.byteLength) {
          const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
          const end = start + thing.length;
          str2 += `.subarray(${start},${end})`;
        }
        return str2;
      }
      case "DataView": {
        let str2 = `new DataView`;
        if (!names.has(thing.buffer)) {
          str2 += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
        } else {
          str2 += `(${stringify(thing.buffer)}`;
        }
        if (thing.byteLength !== thing.buffer.byteLength) {
          str2 += `,${thing.startOffset},${thing.byteLength}`;
        }
        return str2 + ")";
      }
      case "ArrayBuffer": {
        const ui8 = new Uint8Array(thing);
        return `new Uint8Array([${ui8.toString()}]).buffer`;
      }
      case "Temporal.Duration":
      case "Temporal.Instant":
      case "Temporal.PlainDate":
      case "Temporal.PlainTime":
      case "Temporal.PlainDateTime":
      case "Temporal.PlainMonthDay":
      case "Temporal.PlainYearMonth":
      case "Temporal.ZonedDateTime":
        return `${type}.from(${stringify_string(thing.toString())})`;
      default:
        const keys2 = Object.keys(thing);
        const obj = keys2.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(",");
        const proto = Object.getPrototypeOf(thing);
        if (proto === null) {
          return keys2.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
        }
        return `{${obj}}`;
    }
  }
  const str = stringify(value);
  if (names.size) {
    const params = [];
    const statements = [];
    const values = [];
    names.forEach((name, thing) => {
      params.push(name);
      if (custom.has(thing)) {
        values.push(
          /** @type {string} */
          custom.get(thing)
        );
        return;
      }
      if (is_primitive(thing)) {
        values.push(stringify_primitive(thing));
        return;
      }
      const type = get_type(thing);
      switch (type) {
        case "Number":
        case "String":
        case "Boolean":
        case "BigInt":
          values.push(`Object(${stringify(thing.valueOf())})`);
          break;
        case "RegExp":
          values.push(thing.toString());
          break;
        case "Date":
          values.push(`new Date(${thing.getTime()})`);
          break;
        case "URL":
          values.push(`new URL(${stringify_string(thing.toString())})`);
          break;
        case "URLSearchParams":
          values.push(`new URLSearchParams(${stringify_string(thing.toString())})`);
          break;
        case "Array":
          values.push(`Array(${thing.length})`);
          thing.forEach((v, i) => {
            statements.push(`${name}[${i}]=${stringify(v)}`);
          });
          break;
        case "Set":
          values.push(`new Set`);
          statements.push(
            `${name}.${Array.from(thing).map((v) => `add(${stringify(v)})`).join(".")}`
          );
          break;
        case "Map":
          values.push(`new Map`);
          statements.push(
            `${name}.${Array.from(thing).map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`).join(".")}`
          );
          break;
        case "Int8Array":
        case "Uint8Array":
        case "Uint8ClampedArray":
        case "Int16Array":
        case "Uint16Array":
        case "Float16Array":
        case "Int32Array":
        case "Uint32Array":
        case "Float32Array":
        case "Float64Array":
        case "BigInt64Array":
        case "BigUint64Array": {
          let str2 = `new ${type}`;
          if (!names.has(thing.buffer)) {
            const array = new thing.constructor(thing.buffer);
            str2 += `([${array}])`;
          } else {
            str2 += `(${stringify(thing.buffer)})`;
          }
          if (thing.byteLength !== thing.buffer.byteLength) {
            const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
            const end = start + thing.length;
            str2 += `.subarray(${start},${end})`;
          }
          values.push(`{}`);
          statements.push(`${name}=${str2}`);
          break;
        }
        case "DataView": {
          let str2 = `new DataView`;
          if (!names.has(thing.buffer)) {
            str2 += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
          } else {
            str2 += `(${stringify(thing.buffer)}`;
          }
          if (thing.byteLength !== thing.buffer.byteLength) {
            str2 += `,${thing.byteOffset},${thing.byteLength}`;
          }
          str2 += ")";
          values.push(`{}`);
          statements.push(`${name}=${str2}`);
          break;
        }
        case "ArrayBuffer":
          values.push(`new Uint8Array([${new Uint8Array(thing)}]).buffer`);
          break;
        default:
          values.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}");
          Object.keys(thing).forEach((key) => {
            statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`);
          });
      }
    });
    statements.push(`return ${str}`);
    return `(function(${params.join(",")}){${statements.join(";")}}(${values.join(",")}))`;
  } else {
    return str;
  }
}
function get_name(num) {
  let name = "";
  do {
    name = chars[num % chars.length] + name;
    num = ~~(num / chars.length) - 1;
  } while (num >= 0);
  return reserved.test(name) ? `${name}0` : name;
}
function escape_unsafe_char(c) {
  return escaped[c] || c;
}
function escape_unsafe_chars(str) {
  return str.replace(unsafe_chars, escape_unsafe_char);
}
function safe_key(key) {
  return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
}
function safe_prop(key) {
  return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`;
}
function stringify_primitive(thing) {
  const type = typeof thing;
  if (type === "string") return stringify_string(thing);
  if (thing === void 0) return "void 0";
  if (thing === 0 && 1 / thing < 0) return "-0";
  const str = String(thing);
  if (type === "number") return str.replace(/^(-)?0\./, "$1.");
  if (type === "bigint") return thing + "n";
  return str;
}
function await_invalid() {
  const error = new Error(`await_invalid
Encountered asynchronous work while rendering synchronously.
https://svelte.dev/e/await_invalid`);
  error.name = "Svelte error";
  throw error;
}
function hydratable_serialization_failed(key, stack) {
  const error = new Error(`hydratable_serialization_failed
Failed to serialize \`hydratable\` data for key \`${key}\`.

\`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises.

Cause:
${stack}
https://svelte.dev/e/hydratable_serialization_failed`);
  error.name = "Svelte error";
  throw error;
}
function invalid_csp() {
  const error = new Error(`invalid_csp
\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
https://svelte.dev/e/invalid_csp`);
  error.name = "Svelte error";
  throw error;
}
function invalid_id_prefix() {
  const error = new Error(`invalid_id_prefix
The \`idPrefix\` option cannot include \`--\`.
https://svelte.dev/e/invalid_id_prefix`);
  error.name = "Svelte error";
  throw error;
}
function server_context_required() {
  const error = new Error(`server_context_required
Could not resolve \`render\` context.
https://svelte.dev/e/server_context_required`);
  error.name = "Svelte error";
  throw error;
}
function get_render_context() {
  const store = als?.getStore();
  {
    server_context_required();
  }
  return store;
}
let als = null;
export {
  DevalueError as D,
  is_plain_object as a,
  stringify_string as b,
  get_render_context as c,
  invalid_csp as d,
  enumerable_symbols as e,
  await_invalid as f,
  get_type as g,
  hydratable_serialization_failed as h,
  is_primitive as i,
  invalid_id_prefix as j,
  stringify_key as s,
  uneval as u,
  valid_array_indices as v
};

```

---

## .svelte-kit/output/server/chunks/renderer.js

```js
import { t as to_style, p as clsx, q as to_class, a as attr, u as ssr_context, v as set_ssr_context, n as noop, w as push, x as pop, e as escape_html, y as has_own_property } from "./attributes.js";
import { d as invalid_csp, f as await_invalid, c as get_render_context, j as invalid_id_prefix, u as uneval } from "./render-context.js";
const DERIVED = 1 << 1;
const EFFECT = 1 << 2;
const RENDER_EFFECT = 1 << 3;
const MANAGED_EFFECT = 1 << 24;
const BLOCK_EFFECT = 1 << 4;
const BRANCH_EFFECT = 1 << 5;
const ROOT_EFFECT = 1 << 6;
const BOUNDARY_EFFECT = 1 << 7;
const CONNECTED = 1 << 9;
const CLEAN = 1 << 10;
const DIRTY = 1 << 11;
const MAYBE_DIRTY = 1 << 12;
const INERT = 1 << 13;
const DESTROYED = 1 << 14;
const REACTION_RAN = 1 << 15;
const DESTROYING = 1 << 25;
const EFFECT_TRANSPARENT = 1 << 16;
const EAGER_EFFECT = 1 << 17;
const HEAD_EFFECT = 1 << 18;
const EFFECT_PRESERVED = 1 << 19;
const USER_EFFECT = 1 << 20;
const WAS_MARKED = 1 << 16;
const REACTION_IS_UPDATING = 1 << 21;
const ASYNC = 1 << 22;
const ERROR_VALUE = 1 << 23;
const STATE_SYMBOL = /* @__PURE__ */ Symbol("$state");
const LEGACY_PROPS = /* @__PURE__ */ Symbol("legacy props");
const STALE_REACTION = new class StaleReactionError extends Error {
  name = "StaleReactionError";
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}();
const COMMENT_NODE = 8;
let controller = null;
function abort() {
  controller?.abort(STALE_REACTION);
  controller = null;
}
const HYDRATION_START = "[";
const HYDRATION_START_ELSE = "[!";
const HYDRATION_START_FAILED = "[?";
const HYDRATION_END = "]";
const HYDRATION_ERROR = {};
const ELEMENT_IS_NAMESPACED = 1;
const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
const ELEMENT_IS_INPUT = 1 << 2;
const UNINITIALIZED = /* @__PURE__ */ Symbol();
function unresolved_hydratable(key, stack) {
  {
    console.warn(`https://svelte.dev/e/unresolved_hydratable`);
  }
}
const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
const EMPTY_COMMENT = `<!---->`;
const DOM_BOOLEAN_ATTRIBUTES = [
  "allowfullscreen",
  "async",
  "autofocus",
  "autoplay",
  "checked",
  "controls",
  "default",
  "disabled",
  "formnovalidate",
  "indeterminate",
  "inert",
  "ismap",
  "loop",
  "multiple",
  "muted",
  "nomodule",
  "novalidate",
  "open",
  "playsinline",
  "readonly",
  "required",
  "reversed",
  "seamless",
  "selected",
  "webkitdirectory",
  "defer",
  "disablepictureinpicture",
  "disableremoteplayback"
];
function is_boolean_attribute(name) {
  return DOM_BOOLEAN_ATTRIBUTES.includes(name);
}
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
function is_passive_event(name) {
  return PASSIVE_EVENTS.includes(name);
}
const INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
function render(component, options = {}) {
  if (options.csp?.hash && options.csp.nonce) {
    invalid_csp();
  }
  return Renderer.render(
    /** @type {Component<Props>} */
    component,
    options
  );
}
function head(hash, renderer, fn) {
  renderer.head((renderer2) => {
    renderer2.push(`<!--${hash}-->`);
    renderer2.child(fn);
    renderer2.push(EMPTY_COMMENT);
  });
}
function attributes(attrs, css_hash, classes, styles, flags = 0) {
  if (styles) {
    attrs.style = to_style(attrs.style, styles);
  }
  if (attrs.class) {
    attrs.class = clsx(attrs.class);
  }
  if (css_hash || classes) {
    attrs.class = to_class(attrs.class, css_hash, classes);
  }
  let attr_str = "";
  let name;
  const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
  const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
  const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
  for (name of Object.keys(attrs)) {
    if (typeof attrs[name] === "function") continue;
    if (name[0] === "$" && name[1] === "$") continue;
    if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
    var value = attrs[name];
    var lower = name.toLowerCase();
    if (lowercase) name = lower;
    if (lower.length > 2 && lower.startsWith("on")) continue;
    if (is_input) {
      if (name === "defaultvalue" || name === "defaultchecked") {
        name = name === "defaultvalue" ? "value" : "checked";
        if (attrs[name]) continue;
      }
    }
    attr_str += attr(name, value, is_html && is_boolean_attribute(name));
  }
  return attr_str;
}
function once(get_value) {
  let value = (
    /** @type {V} */
    UNINITIALIZED
  );
  return () => {
    if (value === UNINITIALIZED) {
      value = get_value();
    }
    return value;
  };
}
function derived(fn) {
  const get_value = ssr_context === null ? fn : once(fn);
  let updated_value;
  return function(new_value) {
    if (arguments.length === 0) {
      return updated_value ?? get_value();
    }
    updated_value = new_value;
    return updated_value;
  };
}
let text_encoder;
let crypto;
const obfuscated_import = (module_name) => import(
  /* @vite-ignore */
  module_name
);
async function sha256(data) {
  text_encoder ??= new TextEncoder();
  crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (
    // @ts-ignore - we don't install node types in the prod build
    // don't use import('node:crypto') directly because static analysers will think we rely on node when we don't
    (await obfuscated_import("node:crypto")).webcrypto
  );
  const hash_buffer = await crypto.subtle.digest("SHA-256", text_encoder.encode(data));
  return base64_encode(hash_buffer);
}
function base64_encode(bytes) {
  if (globalThis.Buffer) {
    return globalThis.Buffer.from(bytes).toString("base64");
  }
  let binary = "";
  for (let i = 0; i < bytes.length; i++) {
    binary += String.fromCharCode(bytes[i]);
  }
  return btoa(binary);
}
class Renderer {
  /**
   * The contents of the renderer.
   * @type {RendererItem[]}
   */
  #out = [];
  /**
   * Any `onDestroy` callbacks registered during execution of this renderer.
   * @type {(() => void)[] | undefined}
   */
  #on_destroy = void 0;
  /**
   * Whether this renderer is a component body.
   * @type {boolean}
   */
  #is_component_body = false;
  /**
   * If set, this renderer is an error boundary. When async collection
   * of the children fails, the failed snippet is rendered instead.
   * @type {{
   * 	failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
   * 	transformError: (error: unknown) => unknown;
   * 	context: SSRContext | null;
   * } | null}
   */
  #boundary = null;
  /**
   * The type of string content that this renderer is accumulating.
   * @type {RendererType}
   */
  type;
  /** @type {Renderer | undefined} */
  #parent;
  /**
   * Asynchronous work associated with this renderer
   * @type {Promise<void> | undefined}
   */
  promise = void 0;
  /**
   * State which is associated with the content tree as a whole.
   * It will be re-exposed, uncopied, on all children.
   * @type {SSRState}
   * @readonly
   */
  global;
  /**
   * State that is local to the branch it is declared in.
   * It will be shallow-copied to all children.
   *
   * @type {{ select_value: string | undefined }}
   */
  local;
  /**
   * @param {SSRState} global
   * @param {Renderer | undefined} [parent]
   */
  constructor(global, parent) {
    this.#parent = parent;
    this.global = global;
    this.local = parent ? { ...parent.local } : { select_value: void 0 };
    this.type = parent ? parent.type : "body";
  }
  /**
   * @param {(renderer: Renderer) => void} fn
   */
  head(fn) {
    const head2 = new Renderer(this.global, this);
    head2.type = "head";
    this.#out.push(head2);
    head2.child(fn);
  }
  /**
   * @param {Array<Promise<void>>} blockers
   * @param {(renderer: Renderer) => void} fn
   */
  async_block(blockers, fn) {
    this.#out.push(BLOCK_OPEN);
    this.async(blockers, fn);
    this.#out.push(BLOCK_CLOSE);
  }
  /**
   * @param {Array<Promise<void>>} blockers
   * @param {(renderer: Renderer) => void} fn
   */
  async(blockers, fn) {
    let callback = fn;
    if (blockers.length > 0) {
      const context = ssr_context;
      callback = (renderer) => {
        return Promise.all(blockers).then(() => {
          const previous_context = ssr_context;
          try {
            set_ssr_context(context);
            return fn(renderer);
          } finally {
            set_ssr_context(previous_context);
          }
        });
      };
    }
    this.child(callback);
  }
  /**
   * @param {Array<() => void>} thunks
   */
  run(thunks) {
    const context = ssr_context;
    let promise = Promise.resolve(thunks[0]());
    const promises = [promise];
    for (const fn of thunks.slice(1)) {
      promise = promise.then(() => {
        const previous_context = ssr_context;
        set_ssr_context(context);
        try {
          return fn();
        } finally {
          set_ssr_context(previous_context);
        }
      });
      promises.push(promise);
    }
    promise.catch(noop);
    this.promise = promise;
    return promises;
  }
  /**
   * @param {(renderer: Renderer) => MaybePromise<void>} fn
   */
  child_block(fn) {
    this.#out.push(BLOCK_OPEN);
    this.child(fn);
    this.#out.push(BLOCK_CLOSE);
  }
  /**
   * Create a child renderer. The child renderer inherits the state from the parent,
   * but has its own content.
   * @param {(renderer: Renderer) => MaybePromise<void>} fn
   */
  child(fn) {
    const child = new Renderer(this.global, this);
    this.#out.push(child);
    const parent = ssr_context;
    set_ssr_context({
      ...ssr_context,
      p: parent,
      c: null,
      r: child
    });
    const result = fn(child);
    set_ssr_context(parent);
    if (result instanceof Promise) {
      result.catch(noop);
      result.finally(() => set_ssr_context(null)).catch(noop);
      if (child.global.mode === "sync") {
        await_invalid();
      }
      child.promise = result;
    }
    return child;
  }
  /**
   * Render children inside an error boundary. If the children throw and the API-level
   * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
   * rendered instead. Otherwise the error propagates.
   *
   * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
   * @param {(renderer: Renderer) => MaybePromise<void>} children_fn
   */
  boundary(props, children_fn) {
    const child = new Renderer(this.global, this);
    this.#out.push(child);
    const parent_context = ssr_context;
    if (props.failed) {
      child.#boundary = {
        failed: props.failed,
        transformError: this.global.transformError,
        context: parent_context
      };
    }
    set_ssr_context({
      ...ssr_context,
      p: parent_context,
      c: null,
      r: child
    });
    try {
      const result = children_fn(child);
      set_ssr_context(parent_context);
      if (result instanceof Promise) {
        if (child.global.mode === "sync") {
          await_invalid();
        }
        result.catch(noop);
        child.promise = result;
      }
    } catch (error) {
      set_ssr_context(parent_context);
      const failed_snippet = props.failed;
      if (!failed_snippet) throw error;
      const result = this.global.transformError(error);
      child.#out.length = 0;
      child.#boundary = null;
      if (result instanceof Promise) {
        if (this.global.mode === "sync") {
          await_invalid();
        }
        child.promise = /** @type {Promise<unknown>} */
        result.then((transformed) => {
          set_ssr_context(parent_context);
          child.#out.push(Renderer.#serialize_failed_boundary(transformed));
          failed_snippet(child, transformed, noop);
          child.#out.push(BLOCK_CLOSE);
        });
        child.promise.catch(noop);
      } else {
        child.#out.push(Renderer.#serialize_failed_boundary(result));
        failed_snippet(child, result, noop);
        child.#out.push(BLOCK_CLOSE);
      }
    }
  }
  /**
   * Create a component renderer. The component renderer inherits the state from the parent,
   * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
   * @param {(renderer: Renderer) => MaybePromise<void>} fn
   * @param {Function} [component_fn]
   * @returns {void}
   */
  component(fn, component_fn) {
    push();
    const child = this.child(fn);
    child.#is_component_body = true;
    pop();
  }
  /**
   * @param {Record<string, any>} attrs
   * @param {(renderer: Renderer) => void} fn
   * @param {string | undefined} [css_hash]
   * @param {Record<string, boolean> | undefined} [classes]
   * @param {Record<string, string> | undefined} [styles]
   * @param {number | undefined} [flags]
   * @param {boolean | undefined} [is_rich]
   * @returns {void}
   */
  select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
    const { value, ...select_attrs } = attrs;
    this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
    this.child((renderer) => {
      renderer.local.select_value = value;
      fn(renderer);
    });
    this.push(`${is_rich ? "<!>" : ""}</select>`);
  }
  /**
   * @param {Record<string, any>} attrs
   * @param {string | number | boolean | ((renderer: Renderer) => void)} body
   * @param {string | undefined} [css_hash]
   * @param {Record<string, boolean> | undefined} [classes]
   * @param {Record<string, string> | undefined} [styles]
   * @param {number | undefined} [flags]
   * @param {boolean | undefined} [is_rich]
   */
  option(attrs, body, css_hash, classes, styles, flags, is_rich) {
    this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
    const close = (renderer, value, { head: head2, body: body2 }) => {
      if (has_own_property.call(attrs, "value")) {
        value = attrs.value;
      }
      if (value === this.local.select_value) {
        renderer.#out.push(' selected=""');
      }
      renderer.#out.push(`>${body2}${is_rich ? "<!>" : ""}</option>`);
      if (head2) {
        renderer.head((child) => child.push(head2));
      }
    };
    if (typeof body === "function") {
      this.child((renderer) => {
        const r = new Renderer(this.global, this);
        body(r);
        if (this.global.mode === "async") {
          return r.#collect_content_async().then((content) => {
            close(renderer, content.body.replaceAll("<!---->", ""), content);
          });
        } else {
          const content = r.#collect_content();
          close(renderer, content.body.replaceAll("<!---->", ""), content);
        }
      });
    } else {
      close(this, body, { body: escape_html(body) });
    }
  }
  /**
   * @param {(renderer: Renderer) => void} fn
   */
  title(fn) {
    const path = this.get_path();
    const close = (head2) => {
      this.global.set_title(head2, path);
    };
    this.child((renderer) => {
      const r = new Renderer(renderer.global, renderer);
      fn(r);
      if (renderer.global.mode === "async") {
        return r.#collect_content_async().then((content) => {
          close(content.head);
        });
      } else {
        const content = r.#collect_content();
        close(content.head);
      }
    });
  }
  /**
   * @param {string | (() => Promise<string>)} content
   */
  push(content) {
    if (typeof content === "function") {
      this.child(async (renderer) => renderer.push(await content()));
    } else {
      this.#out.push(content);
    }
  }
  /**
   * @param {() => void} fn
   */
  on_destroy(fn) {
    (this.#on_destroy ??= []).push(fn);
  }
  /**
   * @returns {number[]}
   */
  get_path() {
    return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
  }
  /**
   * @deprecated this is needed for legacy component bindings
   */
  copy() {
    const copy = new Renderer(this.global, this.#parent);
    copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
    copy.promise = this.promise;
    return copy;
  }
  /**
   * @param {Renderer} other
   * @deprecated this is needed for legacy component bindings
   */
  subsume(other) {
    if (this.global.mode !== other.global.mode) {
      throw new Error(
        "invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
      );
    }
    this.local = other.local;
    this.#out = other.#out.map((item, i) => {
      const current = this.#out[i];
      if (current instanceof Renderer && item instanceof Renderer) {
        current.subsume(item);
        return current;
      }
      return item;
    });
    this.promise = other.promise;
    this.type = other.type;
  }
  get length() {
    return this.#out.length;
  }
  /**
   * Creates the hydration comment that marks the start of a failed boundary.
   * The error is JSON-serialized and embedded inside an HTML comment for the client
   * to parse during hydration. The JSON is escaped to prevent `-->` or `<!--` sequences
   * from breaking out of the comment (XSS). Uses unicode escapes which `JSON.parse()`
   * handles transparently.
   * @param {unknown} error
   * @returns {string}
   */
  static #serialize_failed_boundary(error) {
    var json = JSON.stringify(error);
    var escaped = json.replace(/>/g, "\\u003e").replace(/</g, "\\u003c");
    return `<!--${HYDRATION_START_FAILED}${escaped}-->`;
  }
  /**
   * Only available on the server and when compiling with the `server` option.
   * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
   * @template {Record<string, any>} Props
   * @param {Component<Props>} component
   * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
   * @returns {RenderOutput}
   */
  static render(component, options = {}) {
    let sync;
    const result = (
      /** @type {RenderOutput} */
      {}
    );
    Object.defineProperties(result, {
      html: {
        get: () => {
          return (sync ??= Renderer.#render(component, options)).body;
        }
      },
      head: {
        get: () => {
          return (sync ??= Renderer.#render(component, options)).head;
        }
      },
      body: {
        get: () => {
          return (sync ??= Renderer.#render(component, options)).body;
        }
      },
      hashes: {
        value: {
          script: ""
        }
      },
      then: {
        value: (
          /**
           * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
           *
           * @template TResult1
           * @template [TResult2=never]
           * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
           * @param { (reason: unknown) => TResult2 } onrejected
           */
          (onfulfilled, onrejected) => {
            {
              const result2 = sync ??= Renderer.#render(component, options);
              const user_result = onfulfilled({
                head: result2.head,
                body: result2.body,
                html: result2.body,
                hashes: { script: [] }
              });
              return Promise.resolve(user_result);
            }
          }
        )
      }
    });
    return result;
  }
  /**
   * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
   * after awaiting `collect_async`.
   *
   * Child renderers are "porous" and don't affect execution order, but component body renderers
   * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
   * @returns {Iterable<() => void>}
   */
  *#collect_on_destroy() {
    for (const component of this.#traverse_components()) {
      yield* component.#collect_ondestroy();
    }
  }
  /**
   * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
   * @returns {Iterable<Renderer>}
   */
  *#traverse_components() {
    for (const child of this.#out) {
      if (typeof child !== "string") {
        yield* child.#traverse_components();
      }
    }
    if (this.#is_component_body) {
      yield this;
    }
  }
  /**
   * @returns {Iterable<() => void>}
   */
  *#collect_ondestroy() {
    if (this.#on_destroy) {
      for (const fn of this.#on_destroy) {
        yield fn;
      }
    }
    for (const child of this.#out) {
      if (child instanceof Renderer && !child.#is_component_body) {
        yield* child.#collect_ondestroy();
      }
    }
  }
  /**
   * Render a component. Throws if any of the children are performing asynchronous work.
   *
   * @template {Record<string, any>} Props
   * @param {Component<Props>} component
   * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
   * @returns {AccumulatedContent}
   */
  static #render(component, options) {
    var previous_context = ssr_context;
    try {
      const renderer = Renderer.#open_render("sync", component, options);
      const content = renderer.#collect_content();
      return Renderer.#close_render(content, renderer);
    } finally {
      abort();
      set_ssr_context(previous_context);
    }
  }
  /**
   * Render a component.
   *
   * @template {Record<string, any>} Props
   * @param {Component<Props>} component
   * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
   * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
   */
  static async #render_async(component, options) {
    const previous_context = ssr_context;
    try {
      const renderer = Renderer.#open_render("async", component, options);
      const content = await renderer.#collect_content_async();
      const hydratables = await renderer.#collect_hydratables();
      if (hydratables !== null) {
        content.head = hydratables + content.head;
      }
      return Renderer.#close_render(content, renderer);
    } finally {
      set_ssr_context(previous_context);
      abort();
    }
  }
  /**
   * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
   * @param {AccumulatedContent} content
   * @returns {AccumulatedContent}
   */
  #collect_content(content = { head: "", body: "" }) {
    for (const item of this.#out) {
      if (typeof item === "string") {
        content[this.type] += item;
      } else if (item instanceof Renderer) {
        item.#collect_content(content);
      }
    }
    return content;
  }
  /**
   * Collect all of the code from the `out` array and return it as a string.
   * @param {AccumulatedContent} content
   * @returns {Promise<AccumulatedContent>}
   */
  async #collect_content_async(content = { head: "", body: "" }) {
    await this.promise;
    for (const item of this.#out) {
      if (typeof item === "string") {
        content[this.type] += item;
      } else if (item instanceof Renderer) {
        if (item.#boundary) {
          const boundary_content = { head: "", body: "" };
          try {
            await item.#collect_content_async(boundary_content);
            content.head += boundary_content.head;
            content.body += boundary_content.body;
          } catch (error) {
            const { context, failed, transformError } = item.#boundary;
            set_ssr_context(context);
            let transformed = await transformError(error);
            const failed_renderer = new Renderer(item.global, item);
            failed_renderer.type = item.type;
            failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
            failed(failed_renderer, transformed, noop);
            failed_renderer.#out.push(BLOCK_CLOSE);
            await failed_renderer.#collect_content_async(content);
          }
        } else {
          await item.#collect_content_async(content);
        }
      }
    }
    return content;
  }
  async #collect_hydratables() {
    const ctx = get_render_context().hydratable;
    for (const [_, key] of ctx.unresolved_promises) {
      unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
    }
    for (const comparison of ctx.comparisons) {
      await comparison;
    }
    return await this.#hydratable_block(ctx);
  }
  /**
   * @template {Record<string, any>} Props
   * @param {'sync' | 'async'} mode
   * @param {import('svelte').Component<Props>} component
   * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
   * @returns {Renderer}
   */
  static #open_render(mode, component, options) {
    if (options.idPrefix?.includes("--")) {
      invalid_id_prefix();
    }
    var previous_context = ssr_context;
    try {
      const renderer = new Renderer(
        new SSRState(
          mode,
          options.idPrefix ? options.idPrefix + "-" : "",
          options.csp,
          options.transformError
        )
      );
      const context = { p: null, c: options.context ?? null, r: renderer };
      set_ssr_context(context);
      renderer.push(BLOCK_OPEN);
      component(renderer, options.props ?? {});
      renderer.push(BLOCK_CLOSE);
      return renderer;
    } finally {
      set_ssr_context(previous_context);
    }
  }
  /**
   * @param {AccumulatedContent} content
   * @param {Renderer} renderer
   * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
   */
  static #close_render(content, renderer) {
    for (const cleanup of renderer.#collect_on_destroy()) {
      cleanup();
    }
    let head2 = content.head + renderer.global.get_title();
    let body = content.body;
    for (const { hash, code } of renderer.global.css) {
      head2 += `<style id="${hash}">${code}</style>`;
    }
    return {
      head: head2,
      body,
      hashes: {
        script: renderer.global.csp.script_hashes
      }
    };
  }
  /**
   * @param {HydratableContext} ctx
   */
  async #hydratable_block(ctx) {
    if (ctx.lookup.size === 0) {
      return null;
    }
    let entries = [];
    let has_promises = false;
    for (const [k, v] of ctx.lookup) {
      if (v.promises) {
        has_promises = true;
        for (const p of v.promises) await p;
      }
      entries.push(`[${uneval(k)},${v.serialized}]`);
    }
    let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
    if (has_promises) {
      prelude = `const r = (v) => Promise.resolve(v);
				${prelude}`;
    }
    const body = `
			{
				${prelude}

				for (const [k, v] of [
					${entries.join(",\n					")}
				]) {
					h.set(k, v);
				}
			}
		`;
    let csp_attr = "";
    if (this.global.csp.nonce) {
      csp_attr = ` nonce="${this.global.csp.nonce}"`;
    } else if (this.global.csp.hash) {
      const hash = await sha256(body);
      this.global.csp.script_hashes.push(`sha256-${hash}`);
    }
    return `
		<script${csp_attr}>${body}<\/script>`;
  }
}
class SSRState {
  /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
  csp;
  /** @readonly @type {'sync' | 'async'} */
  mode;
  /** @readonly @type {() => string} */
  uid;
  /** @readonly @type {Set<{ hash: string; code: string }>} */
  css = /* @__PURE__ */ new Set();
  /**
   * `transformError` passed to `render`. Called when an error boundary catches an error.
   * Throws by default if unset in `render`.
   * @type {(error: unknown) => unknown}
   */
  transformError;
  /** @type {{ path: number[], value: string }} */
  #title = { path: [], value: "" };
  /**
   * @param {'sync' | 'async'} mode
   * @param {string} id_prefix
   * @param {Csp} csp
   * @param {((error: unknown) => unknown) | undefined} [transformError]
   */
  constructor(mode, id_prefix = "", csp = { hash: false }, transformError) {
    this.mode = mode;
    this.csp = { ...csp, script_hashes: [] };
    this.transformError = transformError ?? ((error) => {
      throw error;
    });
    let uid = 1;
    this.uid = () => `${id_prefix}s${uid++}`;
  }
  get_title() {
    return this.#title.value;
  }
  /**
   * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
   * from earlier than or equal to the current value.
   * @param {string} value
   * @param {number[]} path
   */
  set_title(value, path) {
    const current = this.#title.path;
    let i = 0;
    let l = Math.min(path.length, current.length);
    while (i < l && path[i] === current[i]) i += 1;
    if (path[i] === void 0) return;
    if (current[i] === void 0 || path[i] > current[i]) {
      this.#title.path = path;
      this.#title.value = value;
    }
  }
}
export {
  ASYNC as A,
  BOUNDARY_EFFECT as B,
  COMMENT_NODE as C,
  DIRTY as D,
  ERROR_VALUE as E,
  HYDRATION_ERROR as H,
  INERT as I,
  LEGACY_PROPS as L,
  MAYBE_DIRTY as M,
  REACTION_RAN as R,
  STALE_REACTION as S,
  UNINITIALIZED as U,
  WAS_MARKED as W,
  HYDRATION_END as a,
  HYDRATION_START as b,
  HYDRATION_START_ELSE as c,
  EFFECT as d,
  CONNECTED as e,
  CLEAN as f,
  DERIVED as g,
  head as h,
  BLOCK_EFFECT as i,
  DESTROYED as j,
  EAGER_EFFECT as k,
  RENDER_EFFECT as l,
  MANAGED_EFFECT as m,
  ROOT_EFFECT as n,
  BRANCH_EFFECT as o,
  HYDRATION_START_FAILED as p,
  EFFECT_TRANSPARENT as q,
  EFFECT_PRESERVED as r,
  STATE_SYMBOL as s,
  HEAD_EFFECT as t,
  DESTROYING as u,
  USER_EFFECT as v,
  REACTION_IS_UPDATING as w,
  is_passive_event as x,
  render as y,
  derived as z
};

```

---

## .svelte-kit/output/server/chunks/root.js

```js
import { H as HYDRATION_ERROR, C as COMMENT_NODE, a as HYDRATION_END, b as HYDRATION_START, c as HYDRATION_START_ELSE, B as BOUNDARY_EFFECT, R as REACTION_RAN, E as ERROR_VALUE, d as EFFECT, e as CONNECTED, f as CLEAN, M as MAYBE_DIRTY, D as DIRTY, g as DERIVED, W as WAS_MARKED, I as INERT, i as BLOCK_EFFECT, U as UNINITIALIZED, A as ASYNC, j as DESTROYED, k as EAGER_EFFECT, l as RENDER_EFFECT, m as MANAGED_EFFECT, n as ROOT_EFFECT, o as BRANCH_EFFECT, p as HYDRATION_START_FAILED, q as EFFECT_TRANSPARENT, r as EFFECT_PRESERVED, S as STALE_REACTION, s as STATE_SYMBOL, t as HEAD_EFFECT, u as DESTROYING, v as USER_EFFECT, w as REACTION_IS_UPDATING, x as is_passive_event, L as LEGACY_PROPS, y as render, z as derived } from "./renderer.js";
import { B as BROWSER } from "./errors.js";
import { r as run_all, d as deferred, i as includes, n as noop, o as object_prototype, b as array_prototype, c as get_descriptor, f as get_prototype_of, h as is_array, j as is_extensible, k as index_of, l as define_property, m as array_from, s as setContext } from "./attributes.js";
let tracing_mode_flag = false;
function effect_update_depth_exceeded() {
  {
    throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
  }
}
function hydration_failed() {
  {
    throw new Error(`https://svelte.dev/e/hydration_failed`);
  }
}
function state_descriptors_fixed() {
  {
    throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
  }
}
function state_prototype_fixed() {
  {
    throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
  }
}
function state_unsafe_mutation() {
  {
    throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
  }
}
function svelte_boundary_reset_onerror() {
  {
    throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
  }
}
function hydration_mismatch(location) {
  {
    console.warn(`https://svelte.dev/e/hydration_mismatch`);
  }
}
function svelte_boundary_reset_noop() {
  {
    console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
  }
}
let hydrating = false;
function set_hydrating(value) {
  hydrating = value;
}
let hydrate_node;
function set_hydrate_node(node) {
  if (node === null) {
    hydration_mismatch();
    throw HYDRATION_ERROR;
  }
  return hydrate_node = node;
}
function hydrate_next() {
  return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
}
function next(count = 1) {
  if (hydrating) {
    var i = count;
    var node = hydrate_node;
    while (i--) {
      node = /** @type {TemplateNode} */
      /* @__PURE__ */ get_next_sibling(node);
    }
    hydrate_node = node;
  }
}
function skip_nodes(remove = true) {
  var depth = 0;
  var node = hydrate_node;
  while (true) {
    if (node.nodeType === COMMENT_NODE) {
      var data = (
        /** @type {Comment} */
        node.data
      );
      if (data === HYDRATION_END) {
        if (depth === 0) return node;
        depth -= 1;
      } else if (data === HYDRATION_START || data === HYDRATION_START_ELSE || // "[1", "[2", etc. for if blocks
      data[0] === "[" && !isNaN(Number(data.slice(1)))) {
        depth += 1;
      }
    }
    var next2 = (
      /** @type {TemplateNode} */
      /* @__PURE__ */ get_next_sibling(node)
    );
    if (remove) node.remove();
    node = next2;
  }
}
function equals(value) {
  return value === this.v;
}
function safe_not_equal(a, b) {
  return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
}
function safe_equals(value) {
  return !safe_not_equal(value, this.v);
}
let component_context = null;
function set_component_context(context) {
  component_context = context;
}
function push(props, runes = false, fn) {
  component_context = {
    p: component_context,
    i: false,
    c: null,
    e: null,
    s: props,
    x: null,
    r: (
      /** @type {Effect} */
      active_effect
    ),
    l: null
  };
}
function pop(component) {
  var context = (
    /** @type {ComponentContext} */
    component_context
  );
  var effects = context.e;
  if (effects !== null) {
    context.e = null;
    for (var fn of effects) {
      create_user_effect(fn);
    }
  }
  context.i = true;
  component_context = context.p;
  return (
    /** @type {T} */
    {}
  );
}
function is_runes() {
  return true;
}
let micro_tasks = [];
function run_micro_tasks() {
  var tasks = micro_tasks;
  micro_tasks = [];
  run_all(tasks);
}
function queue_micro_task(fn) {
  if (micro_tasks.length === 0 && !is_flushing_sync) {
    var tasks = micro_tasks;
    queueMicrotask(() => {
      if (tasks === micro_tasks) run_micro_tasks();
    });
  }
  micro_tasks.push(fn);
}
function flush_tasks() {
  while (micro_tasks.length > 0) {
    run_micro_tasks();
  }
}
function handle_error(error) {
  var effect = active_effect;
  if (effect === null) {
    active_reaction.f |= ERROR_VALUE;
    return error;
  }
  if ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {
    throw error;
  }
  invoke_error_boundary(error, effect);
}
function invoke_error_boundary(error, effect) {
  while (effect !== null) {
    if ((effect.f & BOUNDARY_EFFECT) !== 0) {
      if ((effect.f & REACTION_RAN) === 0) {
        throw error;
      }
      try {
        effect.b.error(error);
        return;
      } catch (e) {
        error = e;
      }
    }
    effect = effect.parent;
  }
  throw error;
}
const STATUS_MASK = -7169;
function set_signal_status(signal, status) {
  signal.f = signal.f & STATUS_MASK | status;
}
function update_derived_status(derived2) {
  if ((derived2.f & CONNECTED) !== 0 || derived2.deps === null) {
    set_signal_status(derived2, CLEAN);
  } else {
    set_signal_status(derived2, MAYBE_DIRTY);
  }
}
function clear_marked(deps) {
  if (deps === null) return;
  for (const dep of deps) {
    if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
      continue;
    }
    dep.f ^= WAS_MARKED;
    clear_marked(
      /** @type {Derived} */
      dep.deps
    );
  }
}
function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
  if ((effect.f & DIRTY) !== 0) {
    dirty_effects.add(effect);
  } else if ((effect.f & MAYBE_DIRTY) !== 0) {
    maybe_dirty_effects.add(effect);
  }
  clear_marked(effect.deps);
  set_signal_status(effect, CLEAN);
}
const batches = /* @__PURE__ */ new Set();
let current_batch = null;
let batch_values = null;
let last_scheduled_effect = null;
let is_flushing_sync = false;
let is_processing = false;
let collected_effects = null;
let legacy_updates = null;
var flush_count = 0;
let uid = 1;
class Batch {
  id = uid++;
  /**
   * The current values of any signals that are updated in this batch.
   * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
   * They keys of this map are identical to `this.#previous`
   * @type {Map<Value, [any, boolean]>}
   */
  current = /* @__PURE__ */ new Map();
  /**
   * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
   * They keys of this map are identical to `this.#current`
   * @type {Map<Value, any>}
   */
  previous = /* @__PURE__ */ new Map();
  /**
   * When the batch is committed (and the DOM is updated), we need to remove old branches
   * and append new ones by calling the functions added inside (if/each/key/etc) blocks
   * @type {Set<(batch: Batch) => void>}
   */
  #commit_callbacks = /* @__PURE__ */ new Set();
  /**
   * If a fork is discarded, we need to destroy any effects that are no longer needed
   * @type {Set<(batch: Batch) => void>}
   */
  #discard_callbacks = /* @__PURE__ */ new Set();
  /**
   * Async effects that are currently in flight
   * @type {Map<Effect, number>}
   */
  #pending = /* @__PURE__ */ new Map();
  /**
   * Async effects that are currently in flight, _not_ inside a pending boundary
   * @type {Map<Effect, number>}
   */
  #blocking_pending = /* @__PURE__ */ new Map();
  /**
   * A deferred that resolves when the batch is committed, used with `settled()`
   * TODO replace with Promise.withResolvers once supported widely enough
   * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
   */
  #deferred = null;
  /**
   * The root effects that need to be flushed
   * @type {Effect[]}
   */
  #roots = [];
  /**
   * Effects created while this batch was active.
   * @type {Effect[]}
   */
  #new_effects = [];
  /**
   * Deferred effects (which run after async work has completed) that are DIRTY
   * @type {Set<Effect>}
   */
  #dirty_effects = /* @__PURE__ */ new Set();
  /**
   * Deferred effects that are MAYBE_DIRTY
   * @type {Set<Effect>}
   */
  #maybe_dirty_effects = /* @__PURE__ */ new Set();
  /**
   * A map of branches that still exist, but will be destroyed when this batch
   * is committed — we skip over these during `process`.
   * The value contains child effects that were dirty/maybe_dirty before being reset,
   * so they can be rescheduled if the branch survives.
   * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
   */
  #skipped_branches = /* @__PURE__ */ new Map();
  /**
   * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
   * @type {Set<Effect>}
   */
  #unskipped_branches = /* @__PURE__ */ new Set();
  is_fork = false;
  #decrement_queued = false;
  /** @type {Set<Batch>} */
  #blockers = /* @__PURE__ */ new Set();
  #is_deferred() {
    return this.is_fork || this.#blocking_pending.size > 0;
  }
  #is_blocked() {
    for (const batch of this.#blockers) {
      for (const effect of batch.#blocking_pending.keys()) {
        var skipped = false;
        var e = effect;
        while (e.parent !== null) {
          if (this.#skipped_branches.has(e)) {
            skipped = true;
            break;
          }
          e = e.parent;
        }
        if (!skipped) {
          return true;
        }
      }
    }
    return false;
  }
  /**
   * Add an effect to the #skipped_branches map and reset its children
   * @param {Effect} effect
   */
  skip_effect(effect) {
    if (!this.#skipped_branches.has(effect)) {
      this.#skipped_branches.set(effect, { d: [], m: [] });
    }
    this.#unskipped_branches.delete(effect);
  }
  /**
   * Remove an effect from the #skipped_branches map and reschedule
   * any tracked dirty/maybe_dirty child effects
   * @param {Effect} effect
   * @param {(e: Effect) => void} callback
   */
  unskip_effect(effect, callback = (e) => this.schedule(e)) {
    var tracked = this.#skipped_branches.get(effect);
    if (tracked) {
      this.#skipped_branches.delete(effect);
      for (var e of tracked.d) {
        set_signal_status(e, DIRTY);
        callback(e);
      }
      for (e of tracked.m) {
        set_signal_status(e, MAYBE_DIRTY);
        callback(e);
      }
    }
    this.#unskipped_branches.add(effect);
  }
  #process() {
    if (flush_count++ > 1e3) {
      batches.delete(this);
      infinite_loop_guard();
    }
    if (!this.#is_deferred()) {
      for (const e of this.#dirty_effects) {
        this.#maybe_dirty_effects.delete(e);
        set_signal_status(e, DIRTY);
        this.schedule(e);
      }
      for (const e of this.#maybe_dirty_effects) {
        set_signal_status(e, MAYBE_DIRTY);
        this.schedule(e);
      }
    }
    const roots = this.#roots;
    this.#roots = [];
    this.apply();
    var effects = collected_effects = [];
    var render_effects = [];
    var updates = legacy_updates = [];
    for (const root2 of roots) {
      try {
        this.#traverse(root2, effects, render_effects);
      } catch (e) {
        reset_all(root2);
        throw e;
      }
    }
    current_batch = null;
    if (updates.length > 0) {
      var batch = Batch.ensure();
      for (const e of updates) {
        batch.schedule(e);
      }
    }
    collected_effects = null;
    legacy_updates = null;
    if (this.#is_deferred() || this.#is_blocked()) {
      this.#defer_effects(render_effects);
      this.#defer_effects(effects);
      for (const [e, t] of this.#skipped_branches) {
        reset_branch(e, t);
      }
    } else {
      if (this.#pending.size === 0) {
        batches.delete(this);
      }
      this.#dirty_effects.clear();
      this.#maybe_dirty_effects.clear();
      for (const fn of this.#commit_callbacks) fn(this);
      this.#commit_callbacks.clear();
      flush_queued_effects(render_effects);
      flush_queued_effects(effects);
      this.#deferred?.resolve();
    }
    var next_batch = (
      /** @type {Batch | null} */
      /** @type {unknown} */
      current_batch
    );
    if (this.#roots.length > 0) {
      const batch2 = next_batch ??= this;
      batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
    }
    if (next_batch !== null) {
      batches.add(next_batch);
      next_batch.#process();
    }
  }
  /**
   * Traverse the effect tree, executing effects or stashing
   * them for later execution as appropriate
   * @param {Effect} root
   * @param {Effect[]} effects
   * @param {Effect[]} render_effects
   */
  #traverse(root2, effects, render_effects) {
    root2.f ^= CLEAN;
    var effect = root2.first;
    while (effect !== null) {
      var flags2 = effect.f;
      var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
      var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
      var skip = is_skippable_branch || (flags2 & INERT) !== 0 || this.#skipped_branches.has(effect);
      if (!skip && effect.fn !== null) {
        if (is_branch) {
          effect.f ^= CLEAN;
        } else if ((flags2 & EFFECT) !== 0) {
          effects.push(effect);
        } else if (is_dirty(effect)) {
          if ((flags2 & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);
          update_effect(effect);
        }
        var child = effect.first;
        if (child !== null) {
          effect = child;
          continue;
        }
      }
      while (effect !== null) {
        var next2 = effect.next;
        if (next2 !== null) {
          effect = next2;
          break;
        }
        effect = effect.parent;
      }
    }
  }
  /**
   * @param {Effect[]} effects
   */
  #defer_effects(effects) {
    for (var i = 0; i < effects.length; i += 1) {
      defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
    }
  }
  /**
   * Associate a change to a given source with the current
   * batch, noting its previous and current values
   * @param {Value} source
   * @param {any} value
   * @param {boolean} [is_derived]
   */
  capture(source2, value, is_derived = false) {
    if (source2.v !== UNINITIALIZED && !this.previous.has(source2)) {
      this.previous.set(source2, source2.v);
    }
    if ((source2.f & ERROR_VALUE) === 0) {
      this.current.set(source2, [value, is_derived]);
      batch_values?.set(source2, value);
    }
    if (!this.is_fork) {
      source2.v = value;
    }
  }
  activate() {
    current_batch = this;
  }
  deactivate() {
    current_batch = null;
    batch_values = null;
  }
  flush() {
    try {
      is_processing = true;
      current_batch = this;
      this.#process();
    } finally {
      flush_count = 0;
      last_scheduled_effect = null;
      collected_effects = null;
      legacy_updates = null;
      is_processing = false;
      current_batch = null;
      batch_values = null;
      old_values.clear();
    }
  }
  discard() {
    for (const fn of this.#discard_callbacks) fn(this);
    this.#discard_callbacks.clear();
    batches.delete(this);
  }
  /**
   * @param {Effect} effect
   */
  register_created_effect(effect) {
    this.#new_effects.push(effect);
  }
  #commit() {
    for (const batch of batches) {
      var is_earlier = batch.id < this.id;
      var sources = [];
      for (const [source3, [value, is_derived]] of this.current) {
        if (batch.current.has(source3)) {
          var batch_value = (
            /** @type {[any, boolean]} */
            batch.current.get(source3)[0]
          );
          if (is_earlier && value !== batch_value) {
            batch.current.set(source3, [value, is_derived]);
          } else {
            continue;
          }
        }
        sources.push(source3);
      }
      var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
      if (others.length === 0) {
        if (is_earlier) {
          batch.discard();
        }
      } else if (sources.length > 0) {
        if (is_earlier) {
          for (const unskipped of this.#unskipped_branches) {
            batch.unskip_effect(unskipped, (e) => {
              if ((e.f & (BLOCK_EFFECT | ASYNC)) !== 0) {
                batch.schedule(e);
              } else {
                batch.#defer_effects([e]);
              }
            });
          }
        }
        batch.activate();
        var marked = /* @__PURE__ */ new Set();
        var checked = /* @__PURE__ */ new Map();
        for (var source2 of sources) {
          mark_effects(source2, others, marked, checked);
        }
        checked = /* @__PURE__ */ new Map();
        var current_unequal = [...batch.current.keys()].filter(
          (c) => this.current.has(c) ? (
            /** @type {[any, boolean]} */
            this.current.get(c)[0] !== c
          ) : true
        );
        for (const effect of this.#new_effects) {
          if ((effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect, current_unequal, checked)) {
            if ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
              set_signal_status(effect, DIRTY);
              batch.schedule(effect);
            } else {
              batch.#dirty_effects.add(effect);
            }
          }
        }
        if (batch.#roots.length > 0) {
          batch.apply();
          for (var root2 of batch.#roots) {
            batch.#traverse(root2, [], []);
          }
          batch.#roots = [];
        }
        batch.deactivate();
      }
    }
    for (const batch of batches) {
      if (batch.#blockers.has(this)) {
        batch.#blockers.delete(this);
        if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
          batch.activate();
          batch.#process();
        }
      }
    }
  }
  /**
   * @param {boolean} blocking
   * @param {Effect} effect
   */
  increment(blocking, effect) {
    let pending_count = this.#pending.get(effect) ?? 0;
    this.#pending.set(effect, pending_count + 1);
    if (blocking) {
      let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
      this.#blocking_pending.set(effect, blocking_pending_count + 1);
    }
  }
  /**
   * @param {boolean} blocking
   * @param {Effect} effect
   * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
   */
  decrement(blocking, effect, skip) {
    let pending_count = this.#pending.get(effect) ?? 0;
    if (pending_count === 1) {
      this.#pending.delete(effect);
    } else {
      this.#pending.set(effect, pending_count - 1);
    }
    if (blocking) {
      let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
      if (blocking_pending_count === 1) {
        this.#blocking_pending.delete(effect);
      } else {
        this.#blocking_pending.set(effect, blocking_pending_count - 1);
      }
    }
    if (this.#decrement_queued || skip) return;
    this.#decrement_queued = true;
    queue_micro_task(() => {
      this.#decrement_queued = false;
      this.flush();
    });
  }
  /**
   * @param {Set<Effect>} dirty_effects
   * @param {Set<Effect>} maybe_dirty_effects
   */
  transfer_effects(dirty_effects, maybe_dirty_effects) {
    for (const e of dirty_effects) {
      this.#dirty_effects.add(e);
    }
    for (const e of maybe_dirty_effects) {
      this.#maybe_dirty_effects.add(e);
    }
    dirty_effects.clear();
    maybe_dirty_effects.clear();
  }
  /** @param {(batch: Batch) => void} fn */
  oncommit(fn) {
    this.#commit_callbacks.add(fn);
  }
  /** @param {(batch: Batch) => void} fn */
  ondiscard(fn) {
    this.#discard_callbacks.add(fn);
  }
  settled() {
    return (this.#deferred ??= deferred()).promise;
  }
  static ensure() {
    if (current_batch === null) {
      const batch = current_batch = new Batch();
      if (!is_processing) {
        batches.add(current_batch);
        if (!is_flushing_sync) {
          queue_micro_task(() => {
            if (current_batch !== batch) {
              return;
            }
            batch.flush();
          });
        }
      }
    }
    return current_batch;
  }
  apply() {
    {
      batch_values = null;
      return;
    }
  }
  /**
   *
   * @param {Effect} effect
   */
  schedule(effect) {
    last_scheduled_effect = effect;
    if (effect.b?.is_pending && (effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect.f & REACTION_RAN) === 0) {
      effect.b.defer_effect(effect);
      return;
    }
    var e = effect;
    while (e.parent !== null) {
      e = e.parent;
      var flags2 = e.f;
      if (collected_effects !== null && e === active_effect) {
        if ((active_reaction === null || (active_reaction.f & DERIVED) === 0) && true) {
          return;
        }
      }
      if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
        if ((flags2 & CLEAN) === 0) {
          return;
        }
        e.f ^= CLEAN;
      }
    }
    this.#roots.push(e);
  }
}
function flushSync(fn) {
  var was_flushing_sync = is_flushing_sync;
  is_flushing_sync = true;
  try {
    var result;
    if (fn) ;
    while (true) {
      flush_tasks();
      if (current_batch === null) {
        return (
          /** @type {T} */
          result
        );
      }
      current_batch.flush();
    }
  } finally {
    is_flushing_sync = was_flushing_sync;
  }
}
function infinite_loop_guard() {
  try {
    effect_update_depth_exceeded();
  } catch (error) {
    invoke_error_boundary(error, last_scheduled_effect);
  }
}
let eager_block_effects = null;
function flush_queued_effects(effects) {
  var length = effects.length;
  if (length === 0) return;
  var i = 0;
  while (i < length) {
    var effect = effects[i++];
    if ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {
      eager_block_effects = /* @__PURE__ */ new Set();
      update_effect(effect);
      if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) {
        unlink_effect(effect);
      }
      if (eager_block_effects?.size > 0) {
        old_values.clear();
        for (const e of eager_block_effects) {
          if ((e.f & (DESTROYED | INERT)) !== 0) continue;
          const ordered_effects = [e];
          let ancestor = e.parent;
          while (ancestor !== null) {
            if (eager_block_effects.has(ancestor)) {
              eager_block_effects.delete(ancestor);
              ordered_effects.push(ancestor);
            }
            ancestor = ancestor.parent;
          }
          for (let j = ordered_effects.length - 1; j >= 0; j--) {
            const e2 = ordered_effects[j];
            if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
            update_effect(e2);
          }
        }
        eager_block_effects.clear();
      }
    }
  }
  eager_block_effects = null;
}
function mark_effects(value, sources, marked, checked) {
  if (marked.has(value)) return;
  marked.add(value);
  if (value.reactions !== null) {
    for (const reaction of value.reactions) {
      const flags2 = reaction.f;
      if ((flags2 & DERIVED) !== 0) {
        mark_effects(
          /** @type {Derived} */
          reaction,
          sources,
          marked,
          checked
        );
      } else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags2 & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
        set_signal_status(reaction, DIRTY);
        schedule_effect(
          /** @type {Effect} */
          reaction
        );
      }
    }
  }
}
function depends_on(reaction, sources, checked) {
  const depends = checked.get(reaction);
  if (depends !== void 0) return depends;
  if (reaction.deps !== null) {
    for (const dep of reaction.deps) {
      if (includes.call(sources, dep)) {
        return true;
      }
      if ((dep.f & DERIVED) !== 0 && depends_on(
        /** @type {Derived} */
        dep,
        sources,
        checked
      )) {
        checked.set(
          /** @type {Derived} */
          dep,
          true
        );
        return true;
      }
    }
  }
  checked.set(reaction, false);
  return false;
}
function schedule_effect(effect) {
  current_batch.schedule(effect);
}
function reset_branch(effect, tracked) {
  if ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {
    return;
  }
  if ((effect.f & DIRTY) !== 0) {
    tracked.d.push(effect);
  } else if ((effect.f & MAYBE_DIRTY) !== 0) {
    tracked.m.push(effect);
  }
  set_signal_status(effect, CLEAN);
  var e = effect.first;
  while (e !== null) {
    reset_branch(e, tracked);
    e = e.next;
  }
}
function reset_all(effect) {
  set_signal_status(effect, CLEAN);
  var e = effect.first;
  while (e !== null) {
    reset_all(e);
    e = e.next;
  }
}
function createSubscriber(start) {
  let subscribers = 0;
  let version = source(0);
  let stop;
  return () => {
    if (effect_tracking()) {
      get(version);
      render_effect(() => {
        if (subscribers === 0) {
          stop = untrack(() => start(() => increment(version)));
        }
        subscribers += 1;
        return () => {
          queue_micro_task(() => {
            subscribers -= 1;
            if (subscribers === 0) {
              stop?.();
              stop = void 0;
              increment(version);
            }
          });
        };
      });
    }
  };
}
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
function boundary(node, props, children, transform_error) {
  new Boundary(node, props, children, transform_error);
}
class Boundary {
  /** @type {Boundary | null} */
  parent;
  is_pending = false;
  /**
   * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
   * Inherited from parent boundary, or defaults to identity.
   * @type {(error: unknown) => unknown}
   */
  transform_error;
  /** @type {TemplateNode} */
  #anchor;
  /** @type {TemplateNode | null} */
  #hydrate_open = hydrating ? hydrate_node : null;
  /** @type {BoundaryProps} */
  #props;
  /** @type {((anchor: Node) => void)} */
  #children;
  /** @type {Effect} */
  #effect;
  /** @type {Effect | null} */
  #main_effect = null;
  /** @type {Effect | null} */
  #pending_effect = null;
  /** @type {Effect | null} */
  #failed_effect = null;
  /** @type {DocumentFragment | null} */
  #offscreen_fragment = null;
  #local_pending_count = 0;
  #pending_count = 0;
  #pending_count_update_queued = false;
  /** @type {Set<Effect>} */
  #dirty_effects = /* @__PURE__ */ new Set();
  /** @type {Set<Effect>} */
  #maybe_dirty_effects = /* @__PURE__ */ new Set();
  /**
   * A source containing the number of pending async deriveds/expressions.
   * Only created if `$effect.pending()` is used inside the boundary,
   * otherwise updating the source results in needless `Batch.ensure()`
   * calls followed by no-op flushes
   * @type {Source<number> | null}
   */
  #effect_pending = null;
  #effect_pending_subscriber = createSubscriber(() => {
    this.#effect_pending = source(this.#local_pending_count);
    return () => {
      this.#effect_pending = null;
    };
  });
  /**
   * @param {TemplateNode} node
   * @param {BoundaryProps} props
   * @param {((anchor: Node) => void)} children
   * @param {((error: unknown) => unknown) | undefined} [transform_error]
   */
  constructor(node, props, children, transform_error) {
    this.#anchor = node;
    this.#props = props;
    this.#children = (anchor) => {
      var effect = (
        /** @type {Effect} */
        active_effect
      );
      effect.b = this;
      effect.f |= BOUNDARY_EFFECT;
      children(anchor);
    };
    this.parent = /** @type {Effect} */
    active_effect.b;
    this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
    this.#effect = block(() => {
      if (hydrating) {
        const comment = (
          /** @type {Comment} */
          this.#hydrate_open
        );
        hydrate_next();
        const server_rendered_pending = comment.data === HYDRATION_START_ELSE;
        const server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);
        if (server_rendered_failed) {
          const serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));
          this.#hydrate_failed_content(serialized_error);
        } else if (server_rendered_pending) {
          this.#hydrate_pending_content();
        } else {
          this.#hydrate_resolved_content();
        }
      } else {
        this.#render();
      }
    }, flags);
    if (hydrating) {
      this.#anchor = hydrate_node;
    }
  }
  #hydrate_resolved_content() {
    try {
      this.#main_effect = branch(() => this.#children(this.#anchor));
    } catch (error) {
      this.error(error);
    }
  }
  /**
   * @param {unknown} error The deserialized error from the server's hydration comment
   */
  #hydrate_failed_content(error) {
    const failed = this.#props.failed;
    if (!failed) return;
    this.#failed_effect = branch(() => {
      failed(
        this.#anchor,
        () => error,
        () => () => {
        }
      );
    });
  }
  #hydrate_pending_content() {
    const pending = this.#props.pending;
    if (!pending) return;
    this.is_pending = true;
    this.#pending_effect = branch(() => pending(this.#anchor));
    queue_micro_task(() => {
      var fragment = this.#offscreen_fragment = document.createDocumentFragment();
      var anchor = create_text();
      fragment.append(anchor);
      this.#main_effect = this.#run(() => {
        return branch(() => this.#children(anchor));
      });
      if (this.#pending_count === 0) {
        this.#anchor.before(fragment);
        this.#offscreen_fragment = null;
        pause_effect(
          /** @type {Effect} */
          this.#pending_effect,
          () => {
            this.#pending_effect = null;
          }
        );
        this.#resolve(
          /** @type {Batch} */
          current_batch
        );
      }
    });
  }
  #render() {
    try {
      this.is_pending = this.has_pending_snippet();
      this.#pending_count = 0;
      this.#local_pending_count = 0;
      this.#main_effect = branch(() => {
        this.#children(this.#anchor);
      });
      if (this.#pending_count > 0) {
        var fragment = this.#offscreen_fragment = document.createDocumentFragment();
        move_effect(this.#main_effect, fragment);
        const pending = (
          /** @type {(anchor: Node) => void} */
          this.#props.pending
        );
        this.#pending_effect = branch(() => pending(this.#anchor));
      } else {
        this.#resolve(
          /** @type {Batch} */
          current_batch
        );
      }
    } catch (error) {
      this.error(error);
    }
  }
  /**
   * @param {Batch} batch
   */
  #resolve(batch) {
    this.is_pending = false;
    batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
  }
  /**
   * Defer an effect inside a pending boundary until the boundary resolves
   * @param {Effect} effect
   */
  defer_effect(effect) {
    defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
  }
  /**
   * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
   * @returns {boolean}
   */
  is_rendered() {
    return !this.is_pending && (!this.parent || this.parent.is_rendered());
  }
  has_pending_snippet() {
    return !!this.#props.pending;
  }
  /**
   * @template T
   * @param {() => T} fn
   */
  #run(fn) {
    var previous_effect = active_effect;
    var previous_reaction = active_reaction;
    var previous_ctx = component_context;
    set_active_effect(this.#effect);
    set_active_reaction(this.#effect);
    set_component_context(this.#effect.ctx);
    try {
      Batch.ensure();
      return fn();
    } catch (e) {
      handle_error(e);
      return null;
    } finally {
      set_active_effect(previous_effect);
      set_active_reaction(previous_reaction);
      set_component_context(previous_ctx);
    }
  }
  /**
   * Updates the pending count associated with the currently visible pending snippet,
   * if any, such that we can replace the snippet with content once work is done
   * @param {1 | -1} d
   * @param {Batch} batch
   */
  #update_pending_count(d, batch) {
    if (!this.has_pending_snippet()) {
      if (this.parent) {
        this.parent.#update_pending_count(d, batch);
      }
      return;
    }
    this.#pending_count += d;
    if (this.#pending_count === 0) {
      this.#resolve(batch);
      if (this.#pending_effect) {
        pause_effect(this.#pending_effect, () => {
          this.#pending_effect = null;
        });
      }
      if (this.#offscreen_fragment) {
        this.#anchor.before(this.#offscreen_fragment);
        this.#offscreen_fragment = null;
      }
    }
  }
  /**
   * Update the source that powers `$effect.pending()` inside this boundary,
   * and controls when the current `pending` snippet (if any) is removed.
   * Do not call from inside the class
   * @param {1 | -1} d
   * @param {Batch} batch
   */
  update_pending_count(d, batch) {
    this.#update_pending_count(d, batch);
    this.#local_pending_count += d;
    if (!this.#effect_pending || this.#pending_count_update_queued) return;
    this.#pending_count_update_queued = true;
    queue_micro_task(() => {
      this.#pending_count_update_queued = false;
      if (this.#effect_pending) {
        internal_set(this.#effect_pending, this.#local_pending_count);
      }
    });
  }
  get_effect_pending() {
    this.#effect_pending_subscriber();
    return get(
      /** @type {Source<number>} */
      this.#effect_pending
    );
  }
  /** @param {unknown} error */
  error(error) {
    var onerror = this.#props.onerror;
    let failed = this.#props.failed;
    if (!onerror && !failed) {
      throw error;
    }
    if (this.#main_effect) {
      destroy_effect(this.#main_effect);
      this.#main_effect = null;
    }
    if (this.#pending_effect) {
      destroy_effect(this.#pending_effect);
      this.#pending_effect = null;
    }
    if (this.#failed_effect) {
      destroy_effect(this.#failed_effect);
      this.#failed_effect = null;
    }
    if (hydrating) {
      set_hydrate_node(
        /** @type {TemplateNode} */
        this.#hydrate_open
      );
      next();
      set_hydrate_node(skip_nodes());
    }
    var did_reset = false;
    var calling_on_error = false;
    const reset = () => {
      if (did_reset) {
        svelte_boundary_reset_noop();
        return;
      }
      did_reset = true;
      if (calling_on_error) {
        svelte_boundary_reset_onerror();
      }
      if (this.#failed_effect !== null) {
        pause_effect(this.#failed_effect, () => {
          this.#failed_effect = null;
        });
      }
      this.#run(() => {
        this.#render();
      });
    };
    const handle_error_result = (transformed_error) => {
      try {
        calling_on_error = true;
        onerror?.(transformed_error, reset);
        calling_on_error = false;
      } catch (error2) {
        invoke_error_boundary(error2, this.#effect && this.#effect.parent);
      }
      if (failed) {
        this.#failed_effect = this.#run(() => {
          try {
            return branch(() => {
              var effect = (
                /** @type {Effect} */
                active_effect
              );
              effect.b = this;
              effect.f |= BOUNDARY_EFFECT;
              failed(
                this.#anchor,
                () => transformed_error,
                () => reset
              );
            });
          } catch (error2) {
            invoke_error_boundary(
              error2,
              /** @type {Effect} */
              this.#effect.parent
            );
            return null;
          }
        });
      }
    };
    queue_micro_task(() => {
      var result;
      try {
        result = this.transform_error(error);
      } catch (e) {
        invoke_error_boundary(e, this.#effect && this.#effect.parent);
        return;
      }
      if (result !== null && typeof result === "object" && typeof /** @type {any} */
      result.then === "function") {
        result.then(
          handle_error_result,
          /** @param {unknown} e */
          (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
        );
      } else {
        handle_error_result(result);
      }
    });
  }
}
function destroy_derived_effects(derived2) {
  var effects = derived2.effects;
  if (effects !== null) {
    derived2.effects = null;
    for (var i = 0; i < effects.length; i += 1) {
      destroy_effect(
        /** @type {Effect} */
        effects[i]
      );
    }
  }
}
function get_derived_parent_effect(derived2) {
  var parent = derived2.parent;
  while (parent !== null) {
    if ((parent.f & DERIVED) === 0) {
      return (parent.f & DESTROYED) === 0 ? (
        /** @type {Effect} */
        parent
      ) : null;
    }
    parent = parent.parent;
  }
  return null;
}
function execute_derived(derived2) {
  var value;
  var prev_active_effect = active_effect;
  set_active_effect(get_derived_parent_effect(derived2));
  {
    try {
      derived2.f &= ~WAS_MARKED;
      destroy_derived_effects(derived2);
      value = update_reaction(derived2);
    } finally {
      set_active_effect(prev_active_effect);
    }
  }
  return value;
}
function update_derived(derived2) {
  var value = execute_derived(derived2);
  if (!derived2.equals(value)) {
    derived2.wv = increment_write_version();
    if (!current_batch?.is_fork || derived2.deps === null) {
      if (current_batch !== null) {
        current_batch.capture(derived2, value, true);
      } else {
        derived2.v = value;
      }
      if (derived2.deps === null) {
        set_signal_status(derived2, CLEAN);
        return;
      }
    }
  }
  if (is_destroying_effect) {
    return;
  }
  if (batch_values !== null) {
    if (effect_tracking() || current_batch?.is_fork) {
      batch_values.set(derived2, value);
    }
  } else {
    update_derived_status(derived2);
  }
}
function freeze_derived_effects(derived2) {
  if (derived2.effects === null) return;
  for (const e of derived2.effects) {
    if (e.teardown || e.ac) {
      e.teardown?.();
      e.ac?.abort(STALE_REACTION);
      e.teardown = noop;
      e.ac = null;
      remove_reactions(e, 0);
      destroy_effect_children(e);
    }
  }
}
function unfreeze_derived_effects(derived2) {
  if (derived2.effects === null) return;
  for (const e of derived2.effects) {
    if (e.teardown) {
      update_effect(e);
    }
  }
}
let eager_effects = /* @__PURE__ */ new Set();
const old_values = /* @__PURE__ */ new Map();
let eager_effects_deferred = false;
function source(v, stack) {
  var signal = {
    f: 0,
    // TODO ideally we could skip this altogether, but it causes type errors
    v,
    reactions: null,
    equals,
    rv: 0,
    wv: 0
  };
  return signal;
}
// @__NO_SIDE_EFFECTS__
function state(v, stack) {
  const s = source(v);
  push_reaction_value(s);
  return s;
}
// @__NO_SIDE_EFFECTS__
function mutable_source(initial_value, immutable = false, trackable = true) {
  const s = source(initial_value);
  if (!immutable) {
    s.equals = safe_equals;
  }
  return s;
}
function set(source2, value, should_proxy = false) {
  if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
  // to ensure we error if state is set inside an inspect effect
  (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
    state_unsafe_mutation();
  }
  let new_value = should_proxy ? proxy(value) : value;
  return internal_set(source2, new_value, legacy_updates);
}
function internal_set(source2, value, updated_during_traversal = null) {
  if (!source2.equals(value)) {
    old_values.set(source2, is_destroying_effect ? value : source2.v);
    var batch = Batch.ensure();
    batch.capture(source2, value);
    if ((source2.f & DERIVED) !== 0) {
      const derived2 = (
        /** @type {Derived} */
        source2
      );
      if ((source2.f & DIRTY) !== 0) {
        execute_derived(derived2);
      }
      if (batch_values === null) {
        update_derived_status(derived2);
      }
    }
    source2.wv = increment_write_version();
    mark_reactions(source2, DIRTY, updated_during_traversal);
    if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
      if (untracked_writes === null) {
        set_untracked_writes([source2]);
      } else {
        untracked_writes.push(source2);
      }
    }
    if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {
      flush_eager_effects();
    }
  }
  return value;
}
function flush_eager_effects() {
  eager_effects_deferred = false;
  for (const effect of eager_effects) {
    if ((effect.f & CLEAN) !== 0) {
      set_signal_status(effect, MAYBE_DIRTY);
    }
    if (is_dirty(effect)) {
      update_effect(effect);
    }
  }
  eager_effects.clear();
}
function increment(source2) {
  set(source2, source2.v + 1);
}
function mark_reactions(signal, status, updated_during_traversal) {
  var reactions = signal.reactions;
  if (reactions === null) return;
  var length = reactions.length;
  for (var i = 0; i < length; i++) {
    var reaction = reactions[i];
    var flags2 = reaction.f;
    var not_dirty = (flags2 & DIRTY) === 0;
    if (not_dirty) {
      set_signal_status(reaction, status);
    }
    if ((flags2 & DERIVED) !== 0) {
      var derived2 = (
        /** @type {Derived} */
        reaction
      );
      batch_values?.delete(derived2);
      if ((flags2 & WAS_MARKED) === 0) {
        if (flags2 & CONNECTED) {
          reaction.f |= WAS_MARKED;
        }
        mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
      }
    } else if (not_dirty) {
      var effect = (
        /** @type {Effect} */
        reaction
      );
      if ((flags2 & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
        eager_block_effects.add(effect);
      }
      if (updated_during_traversal !== null) {
        updated_during_traversal.push(effect);
      } else {
        schedule_effect(effect);
      }
    }
  }
}
function proxy(value) {
  if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
    return value;
  }
  const prototype = get_prototype_of(value);
  if (prototype !== object_prototype && prototype !== array_prototype) {
    return value;
  }
  var sources = /* @__PURE__ */ new Map();
  var is_proxied_array = is_array(value);
  var version = /* @__PURE__ */ state(0);
  var parent_version = update_version;
  var with_parent = (fn) => {
    if (update_version === parent_version) {
      return fn();
    }
    var reaction = active_reaction;
    var version2 = update_version;
    set_active_reaction(null);
    set_update_version(parent_version);
    var result = fn();
    set_active_reaction(reaction);
    set_update_version(version2);
    return result;
  };
  if (is_proxied_array) {
    sources.set("length", /* @__PURE__ */ state(
      /** @type {any[]} */
      value.length
    ));
  }
  return new Proxy(
    /** @type {any} */
    value,
    {
      defineProperty(_, prop, descriptor) {
        if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
          state_descriptors_fixed();
        }
        var s = sources.get(prop);
        if (s === void 0) {
          with_parent(() => {
            var s2 = /* @__PURE__ */ state(descriptor.value);
            sources.set(prop, s2);
            return s2;
          });
        } else {
          set(s, descriptor.value, true);
        }
        return true;
      },
      deleteProperty(target, prop) {
        var s = sources.get(prop);
        if (s === void 0) {
          if (prop in target) {
            const s2 = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
            sources.set(prop, s2);
            increment(version);
          }
        } else {
          set(s, UNINITIALIZED);
          increment(version);
        }
        return true;
      },
      get(target, prop, receiver) {
        if (prop === STATE_SYMBOL) {
          return value;
        }
        var s = sources.get(prop);
        var exists = prop in target;
        if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
          s = with_parent(() => {
            var p = proxy(exists ? target[prop] : UNINITIALIZED);
            var s2 = /* @__PURE__ */ state(p);
            return s2;
          });
          sources.set(prop, s);
        }
        if (s !== void 0) {
          var v = get(s);
          return v === UNINITIALIZED ? void 0 : v;
        }
        return Reflect.get(target, prop, receiver);
      },
      getOwnPropertyDescriptor(target, prop) {
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
        if (descriptor && "value" in descriptor) {
          var s = sources.get(prop);
          if (s) descriptor.value = get(s);
        } else if (descriptor === void 0) {
          var source2 = sources.get(prop);
          var value2 = source2?.v;
          if (source2 !== void 0 && value2 !== UNINITIALIZED) {
            return {
              enumerable: true,
              configurable: true,
              value: value2,
              writable: true
            };
          }
        }
        return descriptor;
      },
      has(target, prop) {
        if (prop === STATE_SYMBOL) {
          return true;
        }
        var s = sources.get(prop);
        var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
        if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
          if (s === void 0) {
            s = with_parent(() => {
              var p = has ? proxy(target[prop]) : UNINITIALIZED;
              var s2 = /* @__PURE__ */ state(p);
              return s2;
            });
            sources.set(prop, s);
          }
          var value2 = get(s);
          if (value2 === UNINITIALIZED) {
            return false;
          }
        }
        return has;
      },
      set(target, prop, value2, receiver) {
        var s = sources.get(prop);
        var has = prop in target;
        if (is_proxied_array && prop === "length") {
          for (var i = value2; i < /** @type {Source<number>} */
          s.v; i += 1) {
            var other_s = sources.get(i + "");
            if (other_s !== void 0) {
              set(other_s, UNINITIALIZED);
            } else if (i in target) {
              other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
              sources.set(i + "", other_s);
            }
          }
        }
        if (s === void 0) {
          if (!has || get_descriptor(target, prop)?.writable) {
            s = with_parent(() => /* @__PURE__ */ state(void 0));
            set(s, proxy(value2));
            sources.set(prop, s);
          }
        } else {
          has = s.v !== UNINITIALIZED;
          var p = with_parent(() => proxy(value2));
          set(s, p);
        }
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
        if (descriptor?.set) {
          descriptor.set.call(receiver, value2);
        }
        if (!has) {
          if (is_proxied_array && typeof prop === "string") {
            var ls = (
              /** @type {Source<number>} */
              sources.get("length")
            );
            var n = Number(prop);
            if (Number.isInteger(n) && n >= ls.v) {
              set(ls, n + 1);
            }
          }
          increment(version);
        }
        return true;
      },
      ownKeys(target) {
        get(version);
        var own_keys = Reflect.ownKeys(target).filter((key2) => {
          var source3 = sources.get(key2);
          return source3 === void 0 || source3.v !== UNINITIALIZED;
        });
        for (var [key, source2] of sources) {
          if (source2.v !== UNINITIALIZED && !(key in target)) {
            own_keys.push(key);
          }
        }
        return own_keys;
      },
      setPrototypeOf() {
        state_prototype_fixed();
      }
    }
  );
}
var $window;
var first_child_getter;
var next_sibling_getter;
function init_operations() {
  if ($window !== void 0) {
    return;
  }
  $window = window;
  var element_prototype = Element.prototype;
  var node_prototype = Node.prototype;
  var text_prototype = Text.prototype;
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
  if (is_extensible(element_prototype)) {
    element_prototype.__click = void 0;
    element_prototype.__className = void 0;
    element_prototype.__attributes = null;
    element_prototype.__style = void 0;
    element_prototype.__e = void 0;
  }
  if (is_extensible(text_prototype)) {
    text_prototype.__t = void 0;
  }
}
function create_text(value = "") {
  return document.createTextNode(value);
}
// @__NO_SIDE_EFFECTS__
function get_first_child(node) {
  return (
    /** @type {TemplateNode | null} */
    first_child_getter.call(node)
  );
}
// @__NO_SIDE_EFFECTS__
function get_next_sibling(node) {
  return (
    /** @type {TemplateNode | null} */
    next_sibling_getter.call(node)
  );
}
function clear_text_content(node) {
  node.textContent = "";
}
function without_reactive_context(fn) {
  var previous_reaction = active_reaction;
  var previous_effect = active_effect;
  set_active_reaction(null);
  set_active_effect(null);
  try {
    return fn();
  } finally {
    set_active_reaction(previous_reaction);
    set_active_effect(previous_effect);
  }
}
function push_effect(effect, parent_effect) {
  var parent_last = parent_effect.last;
  if (parent_last === null) {
    parent_effect.last = parent_effect.first = effect;
  } else {
    parent_last.next = effect;
    effect.prev = parent_last;
    parent_effect.last = effect;
  }
}
function create_effect(type, fn) {
  var parent = active_effect;
  if (parent !== null && (parent.f & INERT) !== 0) {
    type |= INERT;
  }
  var effect = {
    ctx: component_context,
    deps: null,
    nodes: null,
    f: type | DIRTY | CONNECTED,
    first: null,
    fn,
    last: null,
    next: null,
    parent,
    b: parent && parent.b,
    prev: null,
    teardown: null,
    wv: 0,
    ac: null
  };
  current_batch?.register_created_effect(effect);
  var e = effect;
  if ((type & EFFECT) !== 0) {
    if (collected_effects !== null) {
      collected_effects.push(effect);
    } else {
      Batch.ensure().schedule(effect);
    }
  } else if (fn !== null) {
    try {
      update_effect(effect);
    } catch (e2) {
      destroy_effect(effect);
      throw e2;
    }
    if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && // either `null`, or a singular child
    (e.f & EFFECT_PRESERVED) === 0) {
      e = e.first;
      if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
        e.f |= EFFECT_TRANSPARENT;
      }
    }
  }
  if (e !== null) {
    e.parent = parent;
    if (parent !== null) {
      push_effect(e, parent);
    }
    if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
      var derived2 = (
        /** @type {Derived} */
        active_reaction
      );
      (derived2.effects ??= []).push(e);
    }
  }
  return effect;
}
function effect_tracking() {
  return active_reaction !== null && !untracking;
}
function create_user_effect(fn) {
  return create_effect(EFFECT | USER_EFFECT, fn);
}
function component_root(fn) {
  Batch.ensure();
  const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);
  return (options = {}) => {
    return new Promise((fulfil) => {
      if (options.outro) {
        pause_effect(effect, () => {
          destroy_effect(effect);
          fulfil(void 0);
        });
      } else {
        destroy_effect(effect);
        fulfil(void 0);
      }
    });
  };
}
function render_effect(fn, flags2 = 0) {
  return create_effect(RENDER_EFFECT | flags2, fn);
}
function block(fn, flags2 = 0) {
  var effect = create_effect(BLOCK_EFFECT | flags2, fn);
  return effect;
}
function branch(fn) {
  return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);
}
function execute_effect_teardown(effect) {
  var teardown = effect.teardown;
  if (teardown !== null) {
    const previously_destroying_effect = is_destroying_effect;
    const previous_reaction = active_reaction;
    set_is_destroying_effect(true);
    set_active_reaction(null);
    try {
      teardown.call(null);
    } finally {
      set_is_destroying_effect(previously_destroying_effect);
      set_active_reaction(previous_reaction);
    }
  }
}
function destroy_effect_children(signal, remove_dom = false) {
  var effect = signal.first;
  signal.first = signal.last = null;
  while (effect !== null) {
    const controller = effect.ac;
    if (controller !== null) {
      without_reactive_context(() => {
        controller.abort(STALE_REACTION);
      });
    }
    var next2 = effect.next;
    if ((effect.f & ROOT_EFFECT) !== 0) {
      effect.parent = null;
    } else {
      destroy_effect(effect, remove_dom);
    }
    effect = next2;
  }
}
function destroy_block_effect_children(signal) {
  var effect = signal.first;
  while (effect !== null) {
    var next2 = effect.next;
    if ((effect.f & BRANCH_EFFECT) === 0) {
      destroy_effect(effect);
    }
    effect = next2;
  }
}
function destroy_effect(effect, remove_dom = true) {
  var removed = false;
  if ((remove_dom || (effect.f & HEAD_EFFECT) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
    remove_effect_dom(
      effect.nodes.start,
      /** @type {TemplateNode} */
      effect.nodes.end
    );
    removed = true;
  }
  set_signal_status(effect, DESTROYING);
  destroy_effect_children(effect, remove_dom && !removed);
  remove_reactions(effect, 0);
  var transitions = effect.nodes && effect.nodes.t;
  if (transitions !== null) {
    for (const transition of transitions) {
      transition.stop();
    }
  }
  execute_effect_teardown(effect);
  effect.f ^= DESTROYING;
  effect.f |= DESTROYED;
  var parent = effect.parent;
  if (parent !== null && parent.first !== null) {
    unlink_effect(effect);
  }
  effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
}
function remove_effect_dom(node, end) {
  while (node !== null) {
    var next2 = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
    node.remove();
    node = next2;
  }
}
function unlink_effect(effect) {
  var parent = effect.parent;
  var prev = effect.prev;
  var next2 = effect.next;
  if (prev !== null) prev.next = next2;
  if (next2 !== null) next2.prev = prev;
  if (parent !== null) {
    if (parent.first === effect) parent.first = next2;
    if (parent.last === effect) parent.last = prev;
  }
}
function pause_effect(effect, callback, destroy = true) {
  var transitions = [];
  pause_children(effect, transitions, true);
  var fn = () => {
    if (destroy) destroy_effect(effect);
    if (callback) callback();
  };
  var remaining = transitions.length;
  if (remaining > 0) {
    var check = () => --remaining || fn();
    for (var transition of transitions) {
      transition.out(check);
    }
  } else {
    fn();
  }
}
function pause_children(effect, transitions, local) {
  if ((effect.f & INERT) !== 0) return;
  effect.f ^= INERT;
  var t = effect.nodes && effect.nodes.t;
  if (t !== null) {
    for (const transition of t) {
      if (transition.is_global || local) {
        transitions.push(transition);
      }
    }
  }
  var child = effect.first;
  while (child !== null) {
    var sibling = child.next;
    var transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
    // it means the parent block effect was pruned. In that case,
    // transparency information was transferred to the branch effect.
    (child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0;
    pause_children(child, transitions, transparent ? local : false);
    child = sibling;
  }
}
function move_effect(effect, fragment) {
  if (!effect.nodes) return;
  var node = effect.nodes.start;
  var end = effect.nodes.end;
  while (node !== null) {
    var next2 = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
    fragment.append(node);
    node = next2;
  }
}
let is_updating_effect = false;
let is_destroying_effect = false;
function set_is_destroying_effect(value) {
  is_destroying_effect = value;
}
let active_reaction = null;
let untracking = false;
function set_active_reaction(reaction) {
  active_reaction = reaction;
}
let active_effect = null;
function set_active_effect(effect) {
  active_effect = effect;
}
let current_sources = null;
function push_reaction_value(value) {
  if (active_reaction !== null && true) {
    if (current_sources === null) {
      current_sources = [value];
    } else {
      current_sources.push(value);
    }
  }
}
let new_deps = null;
let skipped_deps = 0;
let untracked_writes = null;
function set_untracked_writes(value) {
  untracked_writes = value;
}
let write_version = 1;
let read_version = 0;
let update_version = read_version;
function set_update_version(value) {
  update_version = value;
}
function increment_write_version() {
  return ++write_version;
}
function is_dirty(reaction) {
  var flags2 = reaction.f;
  if ((flags2 & DIRTY) !== 0) {
    return true;
  }
  if (flags2 & DERIVED) {
    reaction.f &= ~WAS_MARKED;
  }
  if ((flags2 & MAYBE_DIRTY) !== 0) {
    var dependencies = (
      /** @type {Value[]} */
      reaction.deps
    );
    var length = dependencies.length;
    for (var i = 0; i < length; i++) {
      var dependency = dependencies[i];
      if (is_dirty(
        /** @type {Derived} */
        dependency
      )) {
        update_derived(
          /** @type {Derived} */
          dependency
        );
      }
      if (dependency.wv > reaction.wv) {
        return true;
      }
    }
    if ((flags2 & CONNECTED) !== 0 && // During time traveling we don't want to reset the status so that
    // traversal of the graph in the other batches still happens
    batch_values === null) {
      set_signal_status(reaction, CLEAN);
    }
  }
  return false;
}
function schedule_possible_effect_self_invalidation(signal, effect, root2 = true) {
  var reactions = signal.reactions;
  if (reactions === null) return;
  if (current_sources !== null && includes.call(current_sources, signal)) {
    return;
  }
  for (var i = 0; i < reactions.length; i++) {
    var reaction = reactions[i];
    if ((reaction.f & DERIVED) !== 0) {
      schedule_possible_effect_self_invalidation(
        /** @type {Derived} */
        reaction,
        effect,
        false
      );
    } else if (effect === reaction) {
      if (root2) {
        set_signal_status(reaction, DIRTY);
      } else if ((reaction.f & CLEAN) !== 0) {
        set_signal_status(reaction, MAYBE_DIRTY);
      }
      schedule_effect(
        /** @type {Effect} */
        reaction
      );
    }
  }
}
function update_reaction(reaction) {
  var previous_deps = new_deps;
  var previous_skipped_deps = skipped_deps;
  var previous_untracked_writes = untracked_writes;
  var previous_reaction = active_reaction;
  var previous_sources = current_sources;
  var previous_component_context = component_context;
  var previous_untracking = untracking;
  var previous_update_version = update_version;
  var flags2 = reaction.f;
  new_deps = /** @type {null | Value[]} */
  null;
  skipped_deps = 0;
  untracked_writes = null;
  active_reaction = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
  current_sources = null;
  set_component_context(reaction.ctx);
  untracking = false;
  update_version = ++read_version;
  if (reaction.ac !== null) {
    without_reactive_context(() => {
      reaction.ac.abort(STALE_REACTION);
    });
    reaction.ac = null;
  }
  try {
    reaction.f |= REACTION_IS_UPDATING;
    var fn = (
      /** @type {Function} */
      reaction.fn
    );
    var result = fn();
    reaction.f |= REACTION_RAN;
    var deps = reaction.deps;
    var is_fork = current_batch?.is_fork;
    if (new_deps !== null) {
      var i;
      if (!is_fork) {
        remove_reactions(reaction, skipped_deps);
      }
      if (deps !== null && skipped_deps > 0) {
        deps.length = skipped_deps + new_deps.length;
        for (i = 0; i < new_deps.length; i++) {
          deps[skipped_deps + i] = new_deps[i];
        }
      } else {
        reaction.deps = deps = new_deps;
      }
      if (effect_tracking() && (reaction.f & CONNECTED) !== 0) {
        for (i = skipped_deps; i < deps.length; i++) {
          (deps[i].reactions ??= []).push(reaction);
        }
      }
    } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
      remove_reactions(reaction, skipped_deps);
      deps.length = skipped_deps;
    }
    if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
      for (i = 0; i < /** @type {Source[]} */
      untracked_writes.length; i++) {
        schedule_possible_effect_self_invalidation(
          untracked_writes[i],
          /** @type {Effect} */
          reaction
        );
      }
    }
    if (previous_reaction !== null && previous_reaction !== reaction) {
      read_version++;
      if (previous_reaction.deps !== null) {
        for (let i2 = 0; i2 < previous_skipped_deps; i2 += 1) {
          previous_reaction.deps[i2].rv = read_version;
        }
      }
      if (previous_deps !== null) {
        for (const dep of previous_deps) {
          dep.rv = read_version;
        }
      }
      if (untracked_writes !== null) {
        if (previous_untracked_writes === null) {
          previous_untracked_writes = untracked_writes;
        } else {
          previous_untracked_writes.push(.../** @type {Source[]} */
          untracked_writes);
        }
      }
    }
    if ((reaction.f & ERROR_VALUE) !== 0) {
      reaction.f ^= ERROR_VALUE;
    }
    return result;
  } catch (error) {
    return handle_error(error);
  } finally {
    reaction.f ^= REACTION_IS_UPDATING;
    new_deps = previous_deps;
    skipped_deps = previous_skipped_deps;
    untracked_writes = previous_untracked_writes;
    active_reaction = previous_reaction;
    current_sources = previous_sources;
    set_component_context(previous_component_context);
    untracking = previous_untracking;
    update_version = previous_update_version;
  }
}
function remove_reaction(signal, dependency) {
  let reactions = dependency.reactions;
  if (reactions !== null) {
    var index = index_of.call(reactions, signal);
    if (index !== -1) {
      var new_length = reactions.length - 1;
      if (new_length === 0) {
        reactions = dependency.reactions = null;
      } else {
        reactions[index] = reactions[new_length];
        reactions.pop();
      }
    }
  }
  if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
  (new_deps === null || !includes.call(new_deps, dependency))) {
    var derived2 = (
      /** @type {Derived} */
      dependency
    );
    if ((derived2.f & CONNECTED) !== 0) {
      derived2.f ^= CONNECTED;
      derived2.f &= ~WAS_MARKED;
    }
    if (derived2.v !== UNINITIALIZED) {
      update_derived_status(derived2);
    }
    freeze_derived_effects(derived2);
    remove_reactions(derived2, 0);
  }
}
function remove_reactions(signal, start_index) {
  var dependencies = signal.deps;
  if (dependencies === null) return;
  for (var i = start_index; i < dependencies.length; i++) {
    remove_reaction(signal, dependencies[i]);
  }
}
function update_effect(effect) {
  var flags2 = effect.f;
  if ((flags2 & DESTROYED) !== 0) {
    return;
  }
  set_signal_status(effect, CLEAN);
  var previous_effect = active_effect;
  var was_updating_effect = is_updating_effect;
  active_effect = effect;
  is_updating_effect = true;
  try {
    if ((flags2 & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
      destroy_block_effect_children(effect);
    } else {
      destroy_effect_children(effect);
    }
    execute_effect_teardown(effect);
    var teardown = update_reaction(effect);
    effect.teardown = typeof teardown === "function" ? teardown : null;
    effect.wv = write_version;
    var dep;
    if (BROWSER && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) ;
  } finally {
    is_updating_effect = was_updating_effect;
    active_effect = previous_effect;
  }
}
function get(signal) {
  var flags2 = signal.f;
  var is_derived = (flags2 & DERIVED) !== 0;
  if (active_reaction !== null && !untracking) {
    var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
    if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
      var deps = active_reaction.deps;
      if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
        if (signal.rv < read_version) {
          signal.rv = read_version;
          if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
            skipped_deps++;
          } else if (new_deps === null) {
            new_deps = [signal];
          } else {
            new_deps.push(signal);
          }
        }
      } else {
        (active_reaction.deps ??= []).push(signal);
        var reactions = signal.reactions;
        if (reactions === null) {
          signal.reactions = [active_reaction];
        } else if (!includes.call(reactions, active_reaction)) {
          reactions.push(active_reaction);
        }
      }
    }
  }
  if (is_destroying_effect && old_values.has(signal)) {
    return old_values.get(signal);
  }
  if (is_derived) {
    var derived2 = (
      /** @type {Derived} */
      signal
    );
    if (is_destroying_effect) {
      var value = derived2.v;
      if ((derived2.f & CLEAN) === 0 && derived2.reactions !== null || depends_on_old_values(derived2)) {
        value = execute_derived(derived2);
      }
      old_values.set(derived2, value);
      return value;
    }
    var should_connect = (derived2.f & CONNECTED) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & CONNECTED) !== 0);
    var is_new = (derived2.f & REACTION_RAN) === 0;
    if (is_dirty(derived2)) {
      if (should_connect) {
        derived2.f |= CONNECTED;
      }
      update_derived(derived2);
    }
    if (should_connect && !is_new) {
      unfreeze_derived_effects(derived2);
      reconnect(derived2);
    }
  }
  if (batch_values?.has(signal)) {
    return batch_values.get(signal);
  }
  if ((signal.f & ERROR_VALUE) !== 0) {
    throw signal.v;
  }
  return signal.v;
}
function reconnect(derived2) {
  derived2.f |= CONNECTED;
  if (derived2.deps === null) return;
  for (const dep of derived2.deps) {
    (dep.reactions ??= []).push(derived2);
    if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
      unfreeze_derived_effects(
        /** @type {Derived} */
        dep
      );
      reconnect(
        /** @type {Derived} */
        dep
      );
    }
  }
}
function depends_on_old_values(derived2) {
  if (derived2.v === UNINITIALIZED) return true;
  if (derived2.deps === null) return false;
  for (const dep of derived2.deps) {
    if (old_values.has(dep)) {
      return true;
    }
    if ((dep.f & DERIVED) !== 0 && depends_on_old_values(
      /** @type {Derived} */
      dep
    )) {
      return true;
    }
  }
  return false;
}
function untrack(fn) {
  var previous_untracking = untracking;
  try {
    untracking = true;
    return fn();
  } finally {
    untracking = previous_untracking;
  }
}
const event_symbol = /* @__PURE__ */ Symbol("events");
const all_registered_events = /* @__PURE__ */ new Set();
const root_event_handles = /* @__PURE__ */ new Set();
let last_propagated_event = null;
function handle_event_propagation(event) {
  var handler_element = this;
  var owner_document = (
    /** @type {Node} */
    handler_element.ownerDocument
  );
  var event_name = event.type;
  var path = event.composedPath?.() || [];
  var current_target = (
    /** @type {null | Element} */
    path[0] || event.target
  );
  last_propagated_event = event;
  var path_idx = 0;
  var handled_at = last_propagated_event === event && event[event_symbol];
  if (handled_at) {
    var at_idx = path.indexOf(handled_at);
    if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
    window)) {
      event[event_symbol] = handler_element;
      return;
    }
    var handler_idx = path.indexOf(handler_element);
    if (handler_idx === -1) {
      return;
    }
    if (at_idx <= handler_idx) {
      path_idx = at_idx;
    }
  }
  current_target = /** @type {Element} */
  path[path_idx] || event.target;
  if (current_target === handler_element) return;
  define_property(event, "currentTarget", {
    configurable: true,
    get() {
      return current_target || owner_document;
    }
  });
  var previous_reaction = active_reaction;
  var previous_effect = active_effect;
  set_active_reaction(null);
  set_active_effect(null);
  try {
    var throw_error;
    var other_errors = [];
    while (current_target !== null) {
      var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
      current_target.host || null;
      try {
        var delegated = current_target[event_symbol]?.[event_name];
        if (delegated != null && (!/** @type {any} */
        current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
        // -> the target could not have been disabled because it emits the event in the first place
        event.target === current_target)) {
          delegated.call(current_target, event);
        }
      } catch (error) {
        if (throw_error) {
          other_errors.push(error);
        } else {
          throw_error = error;
        }
      }
      if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
        break;
      }
      current_target = parent_element;
    }
    if (throw_error) {
      for (let error of other_errors) {
        queueMicrotask(() => {
          throw error;
        });
      }
      throw throw_error;
    }
  } finally {
    event[event_symbol] = handler_element;
    delete event.currentTarget;
    set_active_reaction(previous_reaction);
    set_active_effect(previous_effect);
  }
}
function assign_nodes(start, end) {
  var effect = (
    /** @type {Effect} */
    active_effect
  );
  if (effect.nodes === null) {
    effect.nodes = { start, end, a: null, t: null };
  }
}
function mount(component, options) {
  return _mount(component, options);
}
function hydrate(component, options) {
  init_operations();
  options.intro = options.intro ?? false;
  const target = options.target;
  const was_hydrating = hydrating;
  const previous_hydrate_node = hydrate_node;
  try {
    var anchor = /* @__PURE__ */ get_first_child(target);
    while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
    anchor.data !== HYDRATION_START)) {
      anchor = /* @__PURE__ */ get_next_sibling(anchor);
    }
    if (!anchor) {
      throw HYDRATION_ERROR;
    }
    set_hydrating(true);
    set_hydrate_node(
      /** @type {Comment} */
      anchor
    );
    const instance = _mount(component, { ...options, anchor });
    set_hydrating(false);
    return (
      /**  @type {Exports} */
      instance
    );
  } catch (error) {
    if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
      throw error;
    }
    if (error !== HYDRATION_ERROR) {
      console.warn("Failed to hydrate: ", error);
    }
    if (options.recover === false) {
      hydration_failed();
    }
    init_operations();
    clear_text_content(target);
    set_hydrating(false);
    return mount(component, options);
  } finally {
    set_hydrating(was_hydrating);
    set_hydrate_node(previous_hydrate_node);
  }
}
const listeners = /* @__PURE__ */ new Map();
function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
  init_operations();
  var component = void 0;
  var unmount2 = component_root(() => {
    var anchor_node = anchor ?? target.appendChild(create_text());
    boundary(
      /** @type {TemplateNode} */
      anchor_node,
      {
        pending: () => {
        }
      },
      (anchor_node2) => {
        push({});
        var ctx = (
          /** @type {ComponentContext} */
          component_context
        );
        if (context) ctx.c = context;
        if (events) {
          props.$$events = events;
        }
        if (hydrating) {
          assign_nodes(
            /** @type {TemplateNode} */
            anchor_node2,
            null
          );
        }
        component = Component(anchor_node2, props) || {};
        if (hydrating) {
          active_effect.nodes.end = hydrate_node;
          if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
          hydrate_node.data !== HYDRATION_END) {
            hydration_mismatch();
            throw HYDRATION_ERROR;
          }
        }
        pop();
      },
      transformError
    );
    var registered_events = /* @__PURE__ */ new Set();
    var event_handle = (events2) => {
      for (var i = 0; i < events2.length; i++) {
        var event_name = events2[i];
        if (registered_events.has(event_name)) continue;
        registered_events.add(event_name);
        var passive = is_passive_event(event_name);
        for (const node of [target, document]) {
          var counts = listeners.get(node);
          if (counts === void 0) {
            counts = /* @__PURE__ */ new Map();
            listeners.set(node, counts);
          }
          var count = counts.get(event_name);
          if (count === void 0) {
            node.addEventListener(event_name, handle_event_propagation, { passive });
            counts.set(event_name, 1);
          } else {
            counts.set(event_name, count + 1);
          }
        }
      }
    };
    event_handle(array_from(all_registered_events));
    root_event_handles.add(event_handle);
    return () => {
      for (var event_name of registered_events) {
        for (const node of [target, document]) {
          var counts = (
            /** @type {Map<string, number>} */
            listeners.get(node)
          );
          var count = (
            /** @type {number} */
            counts.get(event_name)
          );
          if (--count == 0) {
            node.removeEventListener(event_name, handle_event_propagation);
            counts.delete(event_name);
            if (counts.size === 0) {
              listeners.delete(node);
            }
          } else {
            counts.set(event_name, count);
          }
        }
      }
      root_event_handles.delete(event_handle);
      if (anchor_node !== anchor) {
        anchor_node.parentNode?.removeChild(anchor_node);
      }
    };
  });
  mounted_components.set(component, unmount2);
  return component;
}
let mounted_components = /* @__PURE__ */ new WeakMap();
function unmount(component, options) {
  const fn = mounted_components.get(component);
  if (fn) {
    mounted_components.delete(component);
    return fn(options);
  }
  return Promise.resolve();
}
function asClassComponent$1(component) {
  return class extends Svelte4Component {
    /** @param {any} options */
    constructor(options) {
      super({
        component,
        ...options
      });
    }
  };
}
class Svelte4Component {
  /** @type {any} */
  #events;
  /** @type {Record<string, any>} */
  #instance;
  /**
   * @param {ComponentConstructorOptions & {
   *  component: any;
   * }} options
   */
  constructor(options) {
    var sources = /* @__PURE__ */ new Map();
    var add_source = (key, value) => {
      var s = /* @__PURE__ */ mutable_source(value, false, false);
      sources.set(key, s);
      return s;
    };
    const props = new Proxy(
      { ...options.props || {}, $$events: {} },
      {
        get(target, prop) {
          return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
        },
        has(target, prop) {
          if (prop === LEGACY_PROPS) return true;
          get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
          return Reflect.has(target, prop);
        },
        set(target, prop, value) {
          set(sources.get(prop) ?? add_source(prop, value), value);
          return Reflect.set(target, prop, value);
        }
      }
    );
    this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
      target: options.target,
      anchor: options.anchor,
      props,
      context: options.context,
      intro: options.intro ?? false,
      recover: options.recover,
      transformError: options.transformError
    });
    if (!options?.props?.$$host || options.sync === false) {
      flushSync();
    }
    this.#events = props.$$events;
    for (const key of Object.keys(this.#instance)) {
      if (key === "$set" || key === "$destroy" || key === "$on") continue;
      define_property(this, key, {
        get() {
          return this.#instance[key];
        },
        /** @param {any} value */
        set(value) {
          this.#instance[key] = value;
        },
        enumerable: true
      });
    }
    this.#instance.$set = /** @param {Record<string, any>} next */
    (next2) => {
      Object.assign(props, next2);
    };
    this.#instance.$destroy = () => {
      unmount(this.#instance);
    };
  }
  /** @param {Record<string, any>} props */
  $set(props) {
    this.#instance.$set(props);
  }
  /**
   * @param {string} event
   * @param {(...args: any[]) => any} callback
   * @returns {any}
   */
  $on(event, callback) {
    this.#events[event] = this.#events[event] || [];
    const cb = (...args) => callback.call(this, ...args);
    this.#events[event].push(cb);
    return () => {
      this.#events[event] = this.#events[event].filter(
        /** @param {any} fn */
        (fn) => fn !== cb
      );
    };
  }
  $destroy() {
    this.#instance.$destroy();
  }
}
function asClassComponent(component) {
  const component_constructor = asClassComponent$1(component);
  const _render = (props, { context, csp, transformError } = {}) => {
    const result = render(component, { props, context, csp, transformError });
    const munged = Object.defineProperties(
      /** @type {LegacyRenderResult & PromiseLike<LegacyRenderResult>} */
      {},
      {
        css: {
          value: { code: "", map: null }
        },
        head: {
          get: () => result.head
        },
        html: {
          get: () => result.body
        },
        then: {
          /**
           * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
           *
           * @template TResult1
           * @template [TResult2=never]
           * @param { (value: LegacyRenderResult) => TResult1 } onfulfilled
           * @param { (reason: unknown) => TResult2 } onrejected
           */
          value: (onfulfilled, onrejected) => {
            {
              const user_result = onfulfilled({
                css: munged.css,
                head: munged.head,
                html: munged.html
              });
              return Promise.resolve(user_result);
            }
          }
        }
      }
    );
    return munged;
  };
  component_constructor.render = _render;
  return component_constructor;
}
function Root($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let {
      stores,
      page,
      constructors,
      components = [],
      form,
      data_0 = null,
      data_1 = null
    } = $$props;
    {
      setContext("__svelte__", stores);
    }
    {
      stores.page.set(page);
    }
    const Pyramid_1 = derived(() => constructors[1]);
    if (constructors[1]) {
      $$renderer2.push("<!--[0-->");
      const Pyramid_0 = constructors[0];
      if (Pyramid_0) {
        $$renderer2.push("<!--[-->");
        Pyramid_0($$renderer2, {
          data: data_0,
          form,
          params: page.params,
          children: ($$renderer3) => {
            if (Pyramid_1()) {
              $$renderer3.push("<!--[-->");
              Pyramid_1()($$renderer3, { data: data_1, form, params: page.params });
              $$renderer3.push("<!--]-->");
            } else {
              $$renderer3.push("<!--[!-->");
              $$renderer3.push("<!--]-->");
            }
          },
          $$slots: { default: true }
        });
        $$renderer2.push("<!--]-->");
      } else {
        $$renderer2.push("<!--[!-->");
        $$renderer2.push("<!--]-->");
      }
    } else {
      $$renderer2.push("<!--[-1-->");
      const Pyramid_0 = constructors[0];
      if (Pyramid_0) {
        $$renderer2.push("<!--[-->");
        Pyramid_0($$renderer2, { data: data_0, form, params: page.params });
        $$renderer2.push("<!--]-->");
      } else {
        $$renderer2.push("<!--[!-->");
        $$renderer2.push("<!--]-->");
      }
    }
    $$renderer2.push(`<!--]--> `);
    {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]-->`);
  });
}
const root = asClassComponent(Root);
export {
  root as r,
  safe_not_equal as s
};

```

---

## .svelte-kit/output/server/chunks/shared-server.js

```js
let public_env = {};
function set_private_env(environment) {
}
function set_public_env(environment) {
  public_env = environment;
}
export {
  set_public_env as a,
  public_env as p,
  set_private_env as s
};

```

---

## .svelte-kit/output/server/chunks/shared.js

```js
import { json, text } from "@sveltejs/kit";
import { SvelteKitError, HttpError } from "@sveltejs/kit/internal";
import { with_request_store } from "@sveltejs/kit/internal/server";
import { t as text_decoder, c as base64_decode, b as base64_encode } from "./utils.js";
import { D as DevalueError, i as is_primitive, g as get_type, a as is_plain_object$1, e as enumerable_symbols, s as stringify_key, b as stringify_string, v as valid_array_indices, c as get_render_context, u as uneval, h as hydratable_serialization_failed } from "./render-context.js";
import { e as experimental_async_required } from "./errors.js";
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
const MUTATIVE_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
const PAGE_METHODS = ["GET", "POST", "HEAD"];
function encode_native(array_buffer) {
  return new Uint8Array(array_buffer).toBase64();
}
function decode_native(base64) {
  return Uint8Array.fromBase64(base64).buffer;
}
function encode_buffer(array_buffer) {
  return Buffer.from(array_buffer).toString("base64");
}
function decode_buffer(base64) {
  return Uint8Array.from(Buffer.from(base64, "base64")).buffer;
}
function encode_legacy(array_buffer) {
  const array = new Uint8Array(array_buffer);
  let binary = "";
  const chunk_size = 32768;
  for (let i = 0; i < array.length; i += chunk_size) {
    const chunk = array.subarray(i, i + chunk_size);
    binary += String.fromCharCode.apply(null, chunk);
  }
  return btoa(binary);
}
function decode_legacy(base64) {
  const binary_string = atob(base64);
  const len = binary_string.length;
  const array = new Uint8Array(len);
  for (let i = 0; i < len; i++) {
    array[i] = binary_string.charCodeAt(i);
  }
  return array.buffer;
}
const native = typeof Uint8Array.fromBase64 === "function";
const buffer = typeof process === "object" && process.versions?.node !== void 0;
const encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
const decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
const UNDEFINED = -1;
const HOLE = -2;
const NAN = -3;
const POSITIVE_INFINITY = -4;
const NEGATIVE_INFINITY = -5;
const NEGATIVE_ZERO = -6;
const SPARSE = -7;
function parse(serialized, revivers) {
  return unflatten(JSON.parse(serialized), revivers);
}
function unflatten(parsed, revivers) {
  if (typeof parsed === "number") return hydrate(parsed, true);
  if (!Array.isArray(parsed) || parsed.length === 0) {
    throw new Error("Invalid input");
  }
  const values = (
    /** @type {any[]} */
    parsed
  );
  const hydrated = Array(values.length);
  let hydrating = null;
  function hydrate(index, standalone = false) {
    if (index === UNDEFINED) return void 0;
    if (index === NAN) return NaN;
    if (index === POSITIVE_INFINITY) return Infinity;
    if (index === NEGATIVE_INFINITY) return -Infinity;
    if (index === NEGATIVE_ZERO) return -0;
    if (standalone || typeof index !== "number") {
      throw new Error(`Invalid input`);
    }
    if (index in hydrated) return hydrated[index];
    const value = values[index];
    if (!value || typeof value !== "object") {
      hydrated[index] = value;
    } else if (Array.isArray(value)) {
      if (typeof value[0] === "string") {
        const type = value[0];
        const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
        if (reviver) {
          let i = value[1];
          if (typeof i !== "number") {
            i = values.push(value[1]) - 1;
          }
          hydrating ??= /* @__PURE__ */ new Set();
          if (hydrating.has(i)) {
            throw new Error("Invalid circular reference");
          }
          hydrating.add(i);
          hydrated[index] = reviver(hydrate(i));
          hydrating.delete(i);
          return hydrated[index];
        }
        switch (type) {
          case "Date":
            hydrated[index] = new Date(value[1]);
            break;
          case "Set":
            const set = /* @__PURE__ */ new Set();
            hydrated[index] = set;
            for (let i = 1; i < value.length; i += 1) {
              set.add(hydrate(value[i]));
            }
            break;
          case "Map":
            const map = /* @__PURE__ */ new Map();
            hydrated[index] = map;
            for (let i = 1; i < value.length; i += 2) {
              map.set(hydrate(value[i]), hydrate(value[i + 1]));
            }
            break;
          case "RegExp":
            hydrated[index] = new RegExp(value[1], value[2]);
            break;
          case "Object": {
            const wrapped_index = value[1];
            if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
              throw new Error("Invalid input");
            }
            hydrated[index] = Object(hydrate(wrapped_index));
            break;
          }
          case "BigInt":
            hydrated[index] = BigInt(value[1]);
            break;
          case "null":
            const obj = /* @__PURE__ */ Object.create(null);
            hydrated[index] = obj;
            for (let i = 1; i < value.length; i += 2) {
              if (value[i] === "__proto__") {
                throw new Error("Cannot parse an object with a `__proto__` property");
              }
              obj[value[i]] = hydrate(value[i + 1]);
            }
            break;
          case "Int8Array":
          case "Uint8Array":
          case "Uint8ClampedArray":
          case "Int16Array":
          case "Uint16Array":
          case "Float16Array":
          case "Int32Array":
          case "Uint32Array":
          case "Float32Array":
          case "Float64Array":
          case "BigInt64Array":
          case "BigUint64Array":
          case "DataView": {
            if (values[value[1]][0] !== "ArrayBuffer") {
              throw new Error("Invalid data");
            }
            const TypedArrayConstructor = globalThis[type];
            const buffer2 = hydrate(value[1]);
            hydrated[index] = value[2] !== void 0 ? new TypedArrayConstructor(buffer2, value[2], value[3]) : new TypedArrayConstructor(buffer2);
            break;
          }
          case "ArrayBuffer": {
            const base64 = value[1];
            if (typeof base64 !== "string") {
              throw new Error("Invalid ArrayBuffer encoding");
            }
            const arraybuffer = decode64(base64);
            hydrated[index] = arraybuffer;
            break;
          }
          case "Temporal.Duration":
          case "Temporal.Instant":
          case "Temporal.PlainDate":
          case "Temporal.PlainTime":
          case "Temporal.PlainDateTime":
          case "Temporal.PlainMonthDay":
          case "Temporal.PlainYearMonth":
          case "Temporal.ZonedDateTime": {
            const temporalName = type.slice(9);
            hydrated[index] = Temporal[temporalName].from(value[1]);
            break;
          }
          case "URL": {
            const url = new URL(value[1]);
            hydrated[index] = url;
            break;
          }
          case "URLSearchParams": {
            const url = new URLSearchParams(value[1]);
            hydrated[index] = url;
            break;
          }
          default:
            throw new Error(`Unknown type ${type}`);
        }
      } else if (value[0] === SPARSE) {
        const len = value[1];
        if (!Number.isInteger(len) || len < 0) {
          throw new Error("Invalid input");
        }
        const array = new Array(len);
        hydrated[index] = array;
        for (let i = 2; i < value.length; i += 2) {
          const idx = value[i];
          if (!Number.isInteger(idx) || idx < 0 || idx >= len) {
            throw new Error("Invalid input");
          }
          array[idx] = hydrate(value[i + 1]);
        }
      } else {
        const array = new Array(value.length);
        hydrated[index] = array;
        for (let i = 0; i < value.length; i += 1) {
          const n = value[i];
          if (n === HOLE) continue;
          array[i] = hydrate(n);
        }
      }
    } else {
      const object = {};
      hydrated[index] = object;
      for (const key of Object.keys(value)) {
        if (key === "__proto__") {
          throw new Error("Cannot parse an object with a `__proto__` property");
        }
        const n = value[key];
        object[key] = hydrate(n);
      }
    }
    return hydrated[index];
  }
  return hydrate(0);
}
function stringify$1(value, reducers) {
  const stringified = [];
  const indexes = /* @__PURE__ */ new Map();
  const custom = [];
  if (reducers) {
    for (const key of Object.getOwnPropertyNames(reducers)) {
      custom.push({ key, fn: reducers[key] });
    }
  }
  const keys = [];
  let p = 0;
  function flatten(thing) {
    if (thing === void 0) return UNDEFINED;
    if (Number.isNaN(thing)) return NAN;
    if (thing === Infinity) return POSITIVE_INFINITY;
    if (thing === -Infinity) return NEGATIVE_INFINITY;
    if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;
    if (indexes.has(thing)) return (
      /** @type {number} */
      indexes.get(thing)
    );
    const index2 = p++;
    indexes.set(thing, index2);
    for (const { key, fn } of custom) {
      const value2 = fn(thing);
      if (value2) {
        stringified[index2] = `["${key}",${flatten(value2)}]`;
        return index2;
      }
    }
    if (typeof thing === "function") {
      throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
    } else if (typeof thing === "symbol") {
      throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
    }
    let str = "";
    if (is_primitive(thing)) {
      str = stringify_primitive(thing);
    } else {
      const type = get_type(thing);
      switch (type) {
        case "Number":
        case "String":
        case "Boolean":
        case "BigInt":
          str = `["Object",${flatten(thing.valueOf())}]`;
          break;
        case "Date":
          const valid = !isNaN(thing.getDate());
          str = `["Date","${valid ? thing.toISOString() : ""}"]`;
          break;
        case "URL":
          str = `["URL",${stringify_string(thing.toString())}]`;
          break;
        case "URLSearchParams":
          str = `["URLSearchParams",${stringify_string(thing.toString())}]`;
          break;
        case "RegExp":
          const { source, flags } = thing;
          str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
          break;
        case "Array": {
          let mostly_dense = false;
          str = "[";
          for (let i = 0; i < thing.length; i += 1) {
            if (i > 0) str += ",";
            if (Object.hasOwn(thing, i)) {
              keys.push(`[${i}]`);
              str += flatten(thing[i]);
              keys.pop();
            } else if (mostly_dense) {
              str += HOLE;
            } else {
              const populated_keys = valid_array_indices(
                /** @type {any[]} */
                thing
              );
              const population = populated_keys.length;
              const d = String(thing.length).length;
              const hole_cost = (thing.length - population) * 3;
              const sparse_cost = 4 + d + population * (d + 1);
              if (hole_cost > sparse_cost) {
                str = "[" + SPARSE + "," + thing.length;
                for (let j = 0; j < populated_keys.length; j++) {
                  const key = populated_keys[j];
                  keys.push(`[${key}]`);
                  str += "," + key + "," + flatten(thing[key]);
                  keys.pop();
                }
                break;
              } else {
                mostly_dense = true;
                str += HOLE;
              }
            }
          }
          str += "]";
          break;
        }
        case "Set":
          str = '["Set"';
          for (const value2 of thing) {
            str += `,${flatten(value2)}`;
          }
          str += "]";
          break;
        case "Map":
          str = '["Map"';
          for (const [key, value2] of thing) {
            keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`);
            str += `,${flatten(key)},${flatten(value2)}`;
            keys.pop();
          }
          str += "]";
          break;
        case "Int8Array":
        case "Uint8Array":
        case "Uint8ClampedArray":
        case "Int16Array":
        case "Uint16Array":
        case "Float16Array":
        case "Int32Array":
        case "Uint32Array":
        case "Float32Array":
        case "Float64Array":
        case "BigInt64Array":
        case "BigUint64Array":
        case "DataView": {
          const typedArray = thing;
          str = '["' + type + '",' + flatten(typedArray.buffer);
          if (typedArray.byteLength !== typedArray.buffer.byteLength) {
            str += `,${typedArray.byteOffset},${typedArray.length}`;
          }
          str += "]";
          break;
        }
        case "ArrayBuffer": {
          const arraybuffer = thing;
          const base64 = encode64(arraybuffer);
          str = `["ArrayBuffer","${base64}"]`;
          break;
        }
        case "Temporal.Duration":
        case "Temporal.Instant":
        case "Temporal.PlainDate":
        case "Temporal.PlainTime":
        case "Temporal.PlainDateTime":
        case "Temporal.PlainMonthDay":
        case "Temporal.PlainYearMonth":
        case "Temporal.ZonedDateTime":
          str = `["${type}",${stringify_string(thing.toString())}]`;
          break;
        default:
          if (!is_plain_object$1(thing)) {
            throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
          }
          if (enumerable_symbols(thing).length > 0) {
            throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
          }
          if (Object.getPrototypeOf(thing) === null) {
            str = '["null"';
            for (const key of Object.keys(thing)) {
              if (key === "__proto__") {
                throw new DevalueError(
                  `Cannot stringify objects with __proto__ keys`,
                  keys,
                  thing,
                  value
                );
              }
              keys.push(stringify_key(key));
              str += `,${stringify_string(key)},${flatten(thing[key])}`;
              keys.pop();
            }
            str += "]";
          } else {
            str = "{";
            let started = false;
            for (const key of Object.keys(thing)) {
              if (key === "__proto__") {
                throw new DevalueError(
                  `Cannot stringify objects with __proto__ keys`,
                  keys,
                  thing,
                  value
                );
              }
              if (started) str += ",";
              started = true;
              keys.push(stringify_key(key));
              str += `${stringify_string(key)}:${flatten(thing[key])}`;
              keys.pop();
            }
            str += "}";
          }
      }
    }
    stringified[index2] = str;
    return index2;
  }
  const index = flatten(value);
  if (index < 0) return `${index}`;
  return `[${stringified.join(",")}]`;
}
function stringify_primitive(thing) {
  const type = typeof thing;
  if (type === "string") return stringify_string(thing);
  if (thing === void 0) return UNDEFINED.toString();
  if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
  if (type === "bigint") return `["BigInt","${thing}"]`;
  return String(thing);
}
function set_nested_value(object, path_string, value) {
  if (path_string.startsWith("n:")) {
    path_string = path_string.slice(2);
    value = value === "" ? void 0 : parseFloat(value);
  } else if (path_string.startsWith("b:")) {
    path_string = path_string.slice(2);
    value = value === "on";
  }
  deep_set(object, split_path(path_string), value);
}
function convert_formdata(data) {
  const result = {};
  for (let key of data.keys()) {
    const is_array = key.endsWith("[]");
    let values = data.getAll(key);
    if (is_array) key = key.slice(0, -2);
    if (values.length > 1 && !is_array) {
      throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
    }
    values = values.filter(
      (entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0
    );
    if (key.startsWith("n:")) {
      key = key.slice(2);
      values = values.map((v) => v === "" ? void 0 : parseFloat(
        /** @type {string} */
        v
      ));
    } else if (key.startsWith("b:")) {
      key = key.slice(2);
      values = values.map((v) => v === "on");
    }
    set_nested_value(result, key, is_array ? values : values[0]);
  }
  return result;
}
const BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
const BINARY_FORM_VERSION = 0;
const HEADER_BYTES = 1 + 4 + 2;
async function deserialize_binary_form(request) {
  if (request.headers.get("content-type") !== BINARY_FORM_CONTENT_TYPE) {
    const form_data = await request.formData();
    return { data: convert_formdata(form_data), meta: {}, form_data };
  }
  if (!request.body) {
    throw deserialize_error("no body");
  }
  const content_length = parseInt(request.headers.get("content-length") ?? "");
  if (Number.isNaN(content_length)) {
    throw deserialize_error("invalid Content-Length header");
  }
  const reader = request.body.getReader();
  const chunks = [];
  function get_chunk(index) {
    if (index in chunks) return chunks[index];
    let i = chunks.length;
    while (i <= index) {
      chunks[i] = reader.read().then((chunk) => chunk.value);
      i++;
    }
    return chunks[index];
  }
  async function get_buffer(offset, length) {
    let start_chunk;
    let chunk_start = 0;
    let chunk_index;
    for (chunk_index = 0; ; chunk_index++) {
      const chunk = await get_chunk(chunk_index);
      if (!chunk) return null;
      const chunk_end = chunk_start + chunk.byteLength;
      if (offset >= chunk_start && offset < chunk_end) {
        start_chunk = chunk;
        break;
      }
      chunk_start = chunk_end;
    }
    if (offset + length <= chunk_start + start_chunk.byteLength) {
      return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
    }
    const chunks2 = [start_chunk.subarray(offset - chunk_start)];
    let cursor = start_chunk.byteLength - offset + chunk_start;
    while (cursor < length) {
      chunk_index++;
      let chunk = await get_chunk(chunk_index);
      if (!chunk) return null;
      if (chunk.byteLength > length - cursor) {
        chunk = chunk.subarray(0, length - cursor);
      }
      chunks2.push(chunk);
      cursor += chunk.byteLength;
    }
    const buffer2 = new Uint8Array(length);
    cursor = 0;
    for (const chunk of chunks2) {
      buffer2.set(chunk, cursor);
      cursor += chunk.byteLength;
    }
    return buffer2;
  }
  const header = await get_buffer(0, HEADER_BYTES);
  if (!header) throw deserialize_error("too short");
  if (header[0] !== BINARY_FORM_VERSION) {
    throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
  }
  const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
  const data_length = header_view.getUint32(1, true);
  if (HEADER_BYTES + data_length > content_length) {
    throw deserialize_error("data overflow");
  }
  const file_offsets_length = header_view.getUint16(5, true);
  if (HEADER_BYTES + data_length + file_offsets_length > content_length) {
    throw deserialize_error("file offset table overflow");
  }
  const data_buffer = await get_buffer(HEADER_BYTES, data_length);
  if (!data_buffer) throw deserialize_error("data too short");
  let file_offsets;
  let files_start_offset;
  if (file_offsets_length > 0) {
    const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
    if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
    const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
    if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) {
      throw deserialize_error("invalid file offset table");
    }
    file_offsets = /** @type {Array<number>} */
    parsed_offsets;
    files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
  }
  const file_spans = [];
  const [data, meta] = parse(text_decoder.decode(data_buffer), {
    File: ([name, type, size, last_modified, index]) => {
      if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") {
        throw deserialize_error("invalid file metadata");
      }
      let offset = file_offsets[index];
      if (offset === void 0) {
        throw deserialize_error("duplicate file offset table index");
      }
      file_offsets[index] = void 0;
      offset += files_start_offset;
      if (offset + size > content_length) {
        throw deserialize_error("file data overflow");
      }
      file_spans.push({ offset, size });
      return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), {
        getPrototypeOf() {
          return File.prototype;
        }
      });
    }
  });
  file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
  for (let i = 1; i < file_spans.length; i++) {
    const previous = file_spans[i - 1];
    const current = file_spans[i];
    const previous_end = previous.offset + previous.size;
    if (previous_end < current.offset) {
      throw deserialize_error("gaps in file data");
    }
    if (previous_end > current.offset) {
      throw deserialize_error("overlapping file data");
    }
  }
  void (async () => {
    let has_more = true;
    while (has_more) {
      const chunk = await get_chunk(chunks.length);
      has_more = !!chunk;
    }
  })();
  return { data, meta, form_data: null };
}
function deserialize_error(message) {
  return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
}
class LazyFile {
  /** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
  #get_chunk;
  /** @type {number} */
  #offset;
  /**
   * @param {string} name
   * @param {string} type
   * @param {number} size
   * @param {number} last_modified
   * @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
   * @param {number} offset
   */
  constructor(name, type, size, last_modified, get_chunk, offset) {
    this.name = name;
    this.type = type;
    this.size = size;
    this.lastModified = last_modified;
    this.webkitRelativePath = "";
    this.#get_chunk = get_chunk;
    this.#offset = offset;
    this.arrayBuffer = this.arrayBuffer.bind(this);
    this.bytes = this.bytes.bind(this);
    this.slice = this.slice.bind(this);
    this.stream = this.stream.bind(this);
    this.text = this.text.bind(this);
  }
  /** @type {ArrayBuffer | undefined} */
  #buffer;
  async arrayBuffer() {
    this.#buffer ??= await new Response(this.stream()).arrayBuffer();
    return this.#buffer;
  }
  async bytes() {
    return new Uint8Array(await this.arrayBuffer());
  }
  /**
   * @param {number=} start
   * @param {number=} end
   * @param {string=} contentType
   */
  slice(start = 0, end = this.size, contentType = this.type) {
    if (start < 0) {
      start = Math.max(this.size + start, 0);
    } else {
      start = Math.min(start, this.size);
    }
    if (end < 0) {
      end = Math.max(this.size + end, 0);
    } else {
      end = Math.min(end, this.size);
    }
    const size = Math.max(end - start, 0);
    const file = new LazyFile(
      this.name,
      contentType,
      size,
      this.lastModified,
      this.#get_chunk,
      this.#offset + start
    );
    return file;
  }
  stream() {
    let cursor = 0;
    let chunk_index = 0;
    return new ReadableStream({
      start: async (controller) => {
        let chunk_start = 0;
        let start_chunk;
        for (chunk_index = 0; ; chunk_index++) {
          const chunk = await this.#get_chunk(chunk_index);
          if (!chunk) return null;
          const chunk_end = chunk_start + chunk.byteLength;
          if (this.#offset >= chunk_start && this.#offset < chunk_end) {
            start_chunk = chunk;
            break;
          }
          chunk_start = chunk_end;
        }
        if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
          controller.enqueue(
            start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start)
          );
          controller.close();
        } else {
          controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
          cursor = start_chunk.byteLength - this.#offset + chunk_start;
        }
      },
      pull: async (controller) => {
        chunk_index++;
        let chunk = await this.#get_chunk(chunk_index);
        if (!chunk) {
          controller.error("incomplete file data");
          controller.close();
          return;
        }
        if (chunk.byteLength > this.size - cursor) {
          chunk = chunk.subarray(0, this.size - cursor);
        }
        controller.enqueue(chunk);
        cursor += chunk.byteLength;
        if (cursor >= this.size) {
          controller.close();
        }
      }
    });
  }
  async text() {
    return text_decoder.decode(await this.arrayBuffer());
  }
}
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
function split_path(path) {
  if (!path_regex.test(path)) {
    throw new Error(`Invalid path ${path}`);
  }
  return path.split(/\.|\[|\]/).filter(Boolean);
}
function check_prototype_pollution(key) {
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
    throw new Error(
      `Invalid key "${key}"`
    );
  }
}
function deep_set(object, keys, value) {
  let current = object;
  for (let i = 0; i < keys.length - 1; i += 1) {
    const key = keys[i];
    check_prototype_pollution(key);
    const is_array = /^\d+$/.test(keys[i + 1]);
    const exists = Object.hasOwn(current, key);
    const inner = current[key];
    if (exists && is_array !== Array.isArray(inner)) {
      throw new Error(`Invalid array key ${keys[i + 1]}`);
    }
    if (!exists) {
      current[key] = is_array ? [] : {};
    }
    current = current[key];
  }
  const final_key = keys[keys.length - 1];
  check_prototype_pollution(final_key);
  current[final_key] = value;
}
function normalize_issue(issue, server = false) {
  const normalized = { name: "", path: [], message: issue.message, server };
  if (issue.path !== void 0) {
    let name = "";
    for (const segment of issue.path) {
      const key = (
        /** @type {string | number} */
        typeof segment === "object" ? segment.key : segment
      );
      normalized.path.push(key);
      if (typeof key === "number") {
        name += `[${key}]`;
      } else if (typeof key === "string") {
        name += name === "" ? key : "." + key;
      }
    }
    normalized.name = name;
  }
  return normalized;
}
function flatten_issues(issues) {
  const result = {};
  for (const issue of issues) {
    (result.$ ??= []).push(issue);
    let name = "";
    if (issue.path !== void 0) {
      for (const key of issue.path) {
        if (typeof key === "number") {
          name += `[${key}]`;
        } else if (typeof key === "string") {
          name += name === "" ? key : "." + key;
        }
        (result[name] ??= []).push(issue);
      }
    }
  }
  return result;
}
function deep_get(object, path) {
  let current = object;
  for (const key of path) {
    if (current == null || typeof current !== "object") {
      return current;
    }
    current = current[key];
  }
  return current;
}
function create_field_proxy(target, get_input, set_input, get_issues, path = []) {
  const get_value = () => {
    return deep_get(get_input(), path);
  };
  return new Proxy(target, {
    get(target2, prop) {
      if (typeof prop === "symbol") return target2[prop];
      if (/^\d+$/.test(prop)) {
        return create_field_proxy({}, get_input, set_input, get_issues, [
          ...path,
          parseInt(prop, 10)
        ]);
      }
      const key = build_path_string(path);
      if (prop === "set") {
        const set_func = function(newValue) {
          set_input(path, newValue);
          return newValue;
        };
        return create_field_proxy(set_func, get_input, set_input, get_issues, [...path, prop]);
      }
      if (prop === "value") {
        return create_field_proxy(get_value, get_input, set_input, get_issues, [...path, prop]);
      }
      if (prop === "issues" || prop === "allIssues") {
        const issues_func = () => {
          const all_issues = get_issues()[key === "" ? "$" : key];
          if (prop === "allIssues") {
            return all_issues?.map((issue) => ({
              path: issue.path,
              message: issue.message
            }));
          }
          return all_issues?.filter((issue) => issue.name === key)?.map((issue) => ({
            path: issue.path,
            message: issue.message
          }));
        };
        return create_field_proxy(issues_func, get_input, set_input, get_issues, [...path, prop]);
      }
      if (prop === "as") {
        const as_func = (type, input_value) => {
          const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string";
          const prefix = type === "number" || type === "range" ? "n:" : type === "checkbox" && !is_array ? "b:" : "";
          const base_props = {
            name: prefix + key + (is_array ? "[]" : ""),
            get "aria-invalid"() {
              const issues = get_issues();
              return key in issues ? "true" : void 0;
            }
          };
          if (type !== "text" && type !== "select" && type !== "select multiple") {
            base_props.type = type === "file multiple" ? "file" : type;
          }
          if (type === "submit" || type === "hidden") {
            return Object.defineProperties(base_props, {
              value: { value: input_value, enumerable: true }
            });
          }
          if (type === "select" || type === "select multiple") {
            return Object.defineProperties(base_props, {
              multiple: { value: is_array, enumerable: true },
              value: {
                enumerable: true,
                get() {
                  return input_value !== void 0 ? input_value : get_value();
                }
              }
            });
          }
          if (type === "checkbox" || type === "radio") {
            return Object.defineProperties(base_props, {
              value: { value: input_value ?? "on", enumerable: true },
              checked: {
                enumerable: true,
                get() {
                  const value = get_value();
                  if (type === "radio") {
                    return value === input_value;
                  }
                  if (is_array) {
                    return (value ?? []).includes(input_value);
                  }
                  return value;
                }
              }
            });
          }
          if (type === "file" || type === "file multiple") {
            return Object.defineProperties(base_props, {
              multiple: { value: is_array, enumerable: true },
              files: {
                enumerable: true,
                get() {
                  const value = get_value();
                  if (value instanceof File) {
                    if (typeof DataTransfer !== "undefined") {
                      const fileList = new DataTransfer();
                      fileList.items.add(value);
                      return fileList.files;
                    }
                    return { 0: value, length: 1 };
                  }
                  if (Array.isArray(value) && value.every((f) => f instanceof File)) {
                    if (typeof DataTransfer !== "undefined") {
                      const fileList = new DataTransfer();
                      value.forEach((file) => fileList.items.add(file));
                      return fileList.files;
                    }
                    const fileListLike = { length: value.length };
                    value.forEach((file, index) => {
                      fileListLike[index] = file;
                    });
                    return fileListLike;
                  }
                  return null;
                }
              }
            });
          }
          return Object.defineProperties(base_props, {
            value: {
              enumerable: true,
              get() {
                const value = input_value !== void 0 ? input_value : get_value();
                return value != null ? String(value) : "";
              }
            }
          });
        };
        return create_field_proxy(as_func, get_input, set_input, get_issues, [...path, "as"]);
      }
      return create_field_proxy({}, get_input, set_input, get_issues, [...path, prop]);
    }
  });
}
function build_path_string(path) {
  let result = "";
  for (const segment of path) {
    if (typeof segment === "number") {
      result += `[${segment}]`;
    } else {
      result += result === "" ? segment : "." + segment;
    }
  }
  return result;
}
function negotiate(accept, types) {
  const parts = [];
  accept.split(",").forEach((str, i) => {
    const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
    if (match) {
      const [, type, subtype, q = "1"] = match;
      parts.push({ type, subtype, q: +q, i });
    }
  });
  parts.sort((a, b) => {
    if (a.q !== b.q) {
      return b.q - a.q;
    }
    if (a.subtype === "*" !== (b.subtype === "*")) {
      return a.subtype === "*" ? 1 : -1;
    }
    if (a.type === "*" !== (b.type === "*")) {
      return a.type === "*" ? 1 : -1;
    }
    return a.i - b.i;
  });
  let accepted;
  let min_priority = Infinity;
  for (const mimetype of types) {
    const [type, subtype] = mimetype.split("/");
    const priority = parts.findIndex(
      (part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
    );
    if (priority !== -1 && priority < min_priority) {
      accepted = mimetype;
      min_priority = priority;
    }
  }
  return accepted;
}
function is_content_type(request, ...types) {
  const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
  return types.includes(type.toLowerCase());
}
function is_form_content_type(request) {
  return is_content_type(
    request,
    "application/x-www-form-urlencoded",
    "multipart/form-data",
    "text/plain",
    BINARY_FORM_CONTENT_TYPE
  );
}
function coalesce_to_error(err) {
  return err instanceof Error || err && /** @type {any} */
  err.name && /** @type {any} */
  err.message ? (
    /** @type {Error} */
    err
  ) : new Error(JSON.stringify(err));
}
function normalize_error(error) {
  return (
    /** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
    error
  );
}
function get_status(error) {
  return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
}
function get_message(error) {
  return error instanceof SvelteKitError ? error.text : "Internal Error";
}
const escape_html_attr_dict = {
  "&": "&amp;",
  '"': "&quot;"
  // Svelte also escapes < because the escape function could be called inside a `noscript` there
  // https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
  // However, that doesn't apply in SvelteKit
};
const escape_html_dict = {
  "&": "&amp;",
  "<": "&lt;"
};
const surrogates = (
  // high surrogate without paired low surrogate
  "[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
);
const escape_html_attr_regex = new RegExp(
  `[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
  "g"
);
const escape_html_regex = new RegExp(
  `[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
  "g"
);
function escape_html(str, is_attr) {
  const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
  const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
    if (match.length === 2) {
      return match;
    }
    return dict[match] ?? `&#${match.charCodeAt(0)};`;
  });
  return escaped_str;
}
function method_not_allowed(mod, method) {
  return text(`${method} method not allowed`, {
    status: 405,
    headers: {
      // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
      // "The server must generate an Allow header field in a 405 status code response"
      allow: allowed_methods(mod).join(", ")
    }
  });
}
function allowed_methods(mod) {
  const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
  if ("GET" in mod && !("HEAD" in mod)) {
    allowed.push("HEAD");
  }
  return allowed;
}
function get_global_name(options) {
  return `__sveltekit_${options.version_hash}`;
}
function static_error_page(options, status, message) {
  let page = options.templates.error({ status, message: escape_html(message) });
  return text(page, {
    headers: { "content-type": "text/html; charset=utf-8" },
    status
  });
}
async function handle_fatal_error(event, state, options, error) {
  error = error instanceof HttpError ? error : coalesce_to_error(error);
  const status = get_status(error);
  const body = await handle_error_and_jsonify(event, state, options, error);
  const type = negotiate(event.request.headers.get("accept") || "text/html", [
    "application/json",
    "text/html"
  ]);
  if (event.isDataRequest || type === "application/json") {
    return json(body, {
      status
    });
  }
  return static_error_page(options, status, body.message);
}
async function handle_error_and_jsonify(event, state, options, error) {
  if (error instanceof HttpError) {
    return { message: "Unknown Error", ...error.body };
  }
  const status = get_status(error);
  const message = get_message(error);
  return await with_request_store(
    { event, state },
    () => options.hooks.handleError({ error, event, status, message })
  ) ?? { message };
}
function redirect_response(status, location) {
  const response = new Response(void 0, {
    status,
    headers: { location }
  });
  return response;
}
function clarify_devalue_error(event, error) {
  if (error.path) {
    return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
  }
  if (error.path === "") {
    return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
  }
  return error.message;
}
function serialize_uses(node) {
  const uses = {};
  if (node.uses && node.uses.dependencies.size > 0) {
    uses.dependencies = Array.from(node.uses.dependencies);
  }
  if (node.uses && node.uses.search_params.size > 0) {
    uses.search_params = Array.from(node.uses.search_params);
  }
  if (node.uses && node.uses.params.size > 0) {
    uses.params = Array.from(node.uses.params);
  }
  if (node.uses?.parent) uses.parent = 1;
  if (node.uses?.route) uses.route = 1;
  if (node.uses?.url) uses.url = 1;
  return uses;
}
function has_prerendered_path(manifest, pathname) {
  return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
}
function format_server_error(status, error, event) {
  const formatted_text = `
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
  if (status === 404) {
    return formatted_text;
  }
  return `${formatted_text}
${error.stack}`;
}
function get_node_type(node_id) {
  const parts = node_id?.split("/");
  const filename = parts?.at(-1);
  if (!filename) return "unknown";
  const dot_parts = filename.split(".");
  return dot_parts.slice(0, -1).join(".");
}
function hydratable(key, fn) {
  {
    experimental_async_required();
  }
  const { hydratable: hydratable2 } = get_render_context();
  let entry = hydratable2.lookup.get(key);
  if (entry !== void 0) {
    return (
      /** @type {T} */
      entry.value
    );
  }
  const value = fn();
  entry = encode(key, value, hydratable2.unresolved_promises);
  hydratable2.lookup.set(key, entry);
  return value;
}
function encode(key, value, unresolved) {
  const entry = { value, serialized: "" };
  let uid = 1;
  entry.serialized = uneval(entry.value, (value2, uneval2) => {
    if (is_promise(value2)) {
      const placeholder = `"${uid++}"`;
      const p = value2.then((v) => {
        entry.serialized = entry.serialized.replace(placeholder, `r(${uneval2(v)})`);
      }).catch(
        (devalue_error) => hydratable_serialization_failed(
          key,
          serialization_stack(entry.stack, devalue_error?.stack)
        )
      );
      p.catch(() => {
      }).finally(() => unresolved?.delete(p));
      (entry.promises ??= []).push(p);
      return placeholder;
    }
  });
  return entry;
}
function is_promise(value) {
  return Object.prototype.toString.call(value) === "[object Promise]";
}
function serialization_stack(root_stack, uneval_stack) {
  let out = "";
  if (root_stack) {
    out += root_stack + "\n";
  }
  if (uneval_stack) {
    out += "Caused by:\n" + uneval_stack + "\n";
  }
  return out || "<missing stack trace>";
}
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
function stringify(data, transport) {
  const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
  return stringify$1(data, encoders);
}
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
function is_plain_object(thing) {
  if (typeof thing !== "object" || thing === null) return false;
  const proto = Object.getPrototypeOf(thing);
  return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
}
function to_sorted(value, clones) {
  const clone = Object.getPrototypeOf(value) === null ? /* @__PURE__ */ Object.create(null) : {};
  clones.set(value, clone);
  Object.defineProperty(clone, remote_arg_marker, { value: true });
  for (const key of Object.keys(value).sort()) {
    const property = value[key];
    Object.defineProperty(clone, key, {
      value: clones.get(property) ?? property,
      enumerable: true,
      configurable: true,
      writable: true
    });
  }
  return clone;
}
const remote_object = "__skrao";
const remote_map = "__skram";
const remote_set = "__skras";
const remote_regex_guard = "__skrag";
const remote_arg_marker = Symbol(remote_object);
function create_remote_arg_reducers(transport, sort, remote_arg_clones) {
  const remote_fns_reducers = {
    [remote_regex_guard]: (
      /** @type {(value: unknown) => void} */
      (value) => {
        if (value instanceof RegExp) {
          throw new Error("Regular expressions are not valid remote function arguments");
        }
      }
    )
  };
  if (sort) {
    remote_fns_reducers[remote_map] = (value) => {
      if (!(value instanceof Map)) {
        return;
      }
      const entries = [];
      for (const [key, val] of value) {
        entries.push([stringify2(key), stringify2(val)]);
      }
      return entries.sort(([a1, a2], [b1, b2]) => {
        if (a1 < b1) return -1;
        if (a1 > b1) return 1;
        if (a2 < b2) return -1;
        if (a2 > b2) return 1;
        return 0;
      });
    };
    remote_fns_reducers[remote_set] = (value) => {
      if (!(value instanceof Set)) {
        return;
      }
      const items = [];
      for (const item of value) {
        items.push(stringify2(item));
      }
      items.sort();
      return items;
    };
    remote_fns_reducers[remote_object] = (value) => {
      if (!is_plain_object(value)) {
        return;
      }
      if (Object.hasOwn(value, remote_arg_marker)) {
        return;
      }
      if (remote_arg_clones.has(value)) {
        return remote_arg_clones.get(value);
      }
      return to_sorted(value, remote_arg_clones);
    };
  }
  const user_reducers = Object.fromEntries(
    Object.entries(transport).map(([k, v]) => [k, v.encode])
  );
  const all_reducers = { ...user_reducers, ...remote_fns_reducers };
  const stringify2 = (value) => stringify$1(value, all_reducers);
  return all_reducers;
}
function create_remote_arg_revivers(transport) {
  const remote_fns_revivers = {
    /** @type {(value: unknown) => unknown} */
    [remote_object]: (value) => value,
    /** @type {(value: unknown) => Map<unknown, unknown>} */
    [remote_map]: (value) => {
      if (!Array.isArray(value)) {
        throw new Error("Invalid data for Map reviver");
      }
      const map = /* @__PURE__ */ new Map();
      for (const item of value) {
        if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") {
          throw new Error("Invalid data for Map reviver");
        }
        const [key, val] = item;
        map.set(parse$1(key), parse$1(val));
      }
      return map;
    },
    /** @type {(value: unknown) => Set<unknown>} */
    [remote_set]: (value) => {
      if (!Array.isArray(value)) {
        throw new Error("Invalid data for Set reviver");
      }
      const set = /* @__PURE__ */ new Set();
      for (const item of value) {
        if (typeof item !== "string") {
          throw new Error("Invalid data for Set reviver");
        }
        set.add(parse$1(item));
      }
      return set;
    }
  };
  const user_revivers = Object.fromEntries(
    Object.entries(transport).map(([k, v]) => [k, v.decode])
  );
  const all_revivers = { ...user_revivers, ...remote_fns_revivers };
  const parse$1 = (data) => parse(data, all_revivers);
  return all_revivers;
}
function stringify_remote_arg(value, transport, sort = true) {
  if (value === void 0) return "";
  const json_string = stringify$1(
    value,
    create_remote_arg_reducers(transport, sort, /* @__PURE__ */ new Map())
  );
  const bytes = new TextEncoder().encode(json_string);
  return base64_encode(bytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
}
function parse_remote_arg(string, transport) {
  if (!string) return void 0;
  const json_string = text_decoder.decode(
    // no need to add back `=` characters, atob can handle it
    base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
  );
  return parse(json_string, create_remote_arg_revivers(transport));
}
function create_remote_key(id, payload) {
  return id + "/" + payload;
}
function split_remote_key(key) {
  const i = key.lastIndexOf("/");
  if (i === -1) {
    throw new Error(`Invalid remote key: ${key}`);
  }
  return {
    id: key.slice(0, i),
    payload: key.slice(i + 1)
  };
}
function unfriendly_hydratable(key, fn) {
  if (!hydratable) {
    throw new Error("Remote functions require Svelte 5.44.0 or later");
  }
  return hydratable(key, fn);
}
export {
  normalize_issue as A,
  set_nested_value as B,
  flatten_issues as C,
  deep_set as D,
  ENDPOINT_METHODS as E,
  INVALIDATED_PARAM as I,
  MUTATIVE_METHODS as M,
  PAGE_METHODS as P,
  TRAILING_SLASH_PARAM as T,
  normalize_error as a,
  get_global_name as b,
  serialize_uses as c,
  clarify_devalue_error as d,
  get_node_type as e,
  escape_html as f,
  get_status as g,
  handle_error_and_jsonify as h,
  is_form_content_type as i,
  create_remote_key as j,
  static_error_page as k,
  stringify as l,
  method_not_allowed as m,
  negotiate as n,
  deserialize_binary_form as o,
  parse_remote_arg as p,
  split_remote_key as q,
  redirect_response as r,
  stringify$1 as s,
  has_prerendered_path as t,
  handle_fatal_error as u,
  format_server_error as v,
  stringify_remote_arg as w,
  unfriendly_hydratable as x,
  parse as y,
  create_field_proxy as z
};

```

---

## .svelte-kit/output/server/chunks/state.svelte.js

```js
import { n as noop } from "./attributes.js";
import "./exports.js";
import "@sveltejs/kit/internal/server";
import "./root.js";
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
const placeholder_url = "a:";
if (is_legacy) {
  ({
    data: {},
    form: null,
    error: null,
    params: {},
    route: { id: null },
    state: {},
    status: -1,
    url: new URL(placeholder_url)
  });
}

```

---

## .svelte-kit/output/server/chunks/utils.js

```js
const text_encoder = new TextEncoder();
const text_decoder = new TextDecoder();
function base64_encode(bytes) {
  if (globalThis.Buffer) {
    return globalThis.Buffer.from(bytes).toString("base64");
  }
  let binary = "";
  for (let i = 0; i < bytes.length; i++) {
    binary += String.fromCharCode(bytes[i]);
  }
  return btoa(binary);
}
function base64_decode(encoded) {
  if (globalThis.Buffer) {
    const buffer = globalThis.Buffer.from(encoded, "base64");
    return new Uint8Array(buffer);
  }
  const binary = atob(encoded);
  const bytes = new Uint8Array(binary.length);
  for (let i = 0; i < binary.length; i++) {
    bytes[i] = binary.charCodeAt(i);
  }
  return bytes;
}
export {
  text_encoder as a,
  base64_encode as b,
  base64_decode as c,
  text_decoder as t
};

```

---

## .svelte-kit/output/server/entries/endpoints/api/auth/login/_server.ts.js

```js
import { json } from "@sveltejs/kit";
import { createInstance } from "@amplitude/analytics-node";
import { p as public_env } from "../../../../../chunks/shared-server.js";
let amplitudeClient = null;
function getAmplitudeClient() {
  if (!amplitudeClient) {
    amplitudeClient = createInstance();
    amplitudeClient.init(public_env.PUBLIC_AMPLITUDE_API_KEY ?? "");
  }
  return amplitudeClient;
}
const users = /* @__PURE__ */ new Map();
const POST = async ({ request }) => {
  const { username, password } = await request.json();
  if (!username || !password) {
    return json({ error: "Username and password required" }, { status: 400 });
  }
  let user = users.get(username);
  const isNewUser = !user;
  if (!user) {
    user = { username, burritoConsiderations: 0 };
    users.set(username, user);
  }
  const amplitude = getAmplitudeClient();
  amplitude.track("server_login", { isNewUser, source: "api" }, { user_id: username });
  await amplitude.flush();
  return json({ success: true, user });
};
export {
  POST
};

```

---

## .svelte-kit/output/server/entries/fallbacks/error.svelte.js

```js
import { g as getContext, e as escape_html } from "../../chunks/attributes.js";
import "../../chunks/state.svelte.js";
import "@sveltejs/kit/internal";
import "../../chunks/exports.js";
import "../../chunks/utils.js";
import { w as writable } from "../../chunks/index.js";
import "@sveltejs/kit/internal/server";
import "../../chunks/root.js";
function create_updated_store() {
  const { set, subscribe } = writable(false);
  {
    return {
      subscribe,
      // eslint-disable-next-line @typescript-eslint/require-await
      check: async () => false
    };
  }
}
const stores = {
  updated: /* @__PURE__ */ create_updated_store()
};
({
  check: stores.updated.check
});
function context() {
  return getContext("__request__");
}
const page$1 = {
  get error() {
    return context().page.error;
  },
  get status() {
    return context().page.status;
  }
};
const page = page$1;
function Error$1($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    $$renderer2.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);
  });
}
export {
  Error$1 as default
};

```

---

## .svelte-kit/output/server/entries/hooks.server.js

```js
const handle = async ({ event, resolve }) => {
  return resolve(event);
};
export {
  handle
};

```

---

## .svelte-kit/output/server/entries/pages/_layout.svelte.js

```js
import { h as head } from "../../chunks/renderer.js";
import { g as getAuthContext, s as setAuthContext, A as AuthState } from "../../chunks/auth.svelte.js";
import { e as escape_html } from "../../chunks/attributes.js";
function Header($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    const auth = getAuthContext();
    $$renderer2.push(`<header class="header"><div class="header-container"><nav><a href="/">Home</a> `);
    if (auth.user) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<a href="/burrito">Burrito</a> <a href="/profile">Profile</a>`);
    } else {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]--></nav> <div class="user-section">`);
    if (auth.user) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<span>Welcome, ${escape_html(auth.user.username)}</span> <button class="btn-logout">Logout</button>`);
    } else {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]--></div></div></header>`);
  });
}
function _layout($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let { children } = $$props;
    const auth = new AuthState();
    setAuthContext(auth);
    head("12qhfyh", $$renderer2, ($$renderer3) => {
      $$renderer3.title(($$renderer4) => {
        $$renderer4.push(`<title>Burrito consideration app</title>`);
      });
      $$renderer3.push(`<meta name="description" content="Consider the potential of burritos with Amplitude analytics"/>`);
    });
    Header($$renderer2);
    $$renderer2.push(`<!----> <main>`);
    children($$renderer2);
    $$renderer2.push(`<!----></main>`);
  });
}
export {
  _layout as default
};

```

---

## .svelte-kit/output/server/entries/pages/_page.svelte.js

```js
import { e as escape_html, a as attr } from "../../chunks/attributes.js";
import { g as getAuthContext } from "../../chunks/auth.svelte.js";
function _page($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    const auth = getAuthContext();
    let username = "";
    let password = "";
    $$renderer2.push(`<div class="container">`);
    if (auth.user) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<h1>Welcome back, ${escape_html(auth.user.username)}!</h1> <p>You are now logged in. Check out the navigation to explore features.</p> <ul><li><a href="/burrito">Consider a burrito</a></li> <li><a href="/profile">View your profile</a></li></ul>`);
    } else {
      $$renderer2.push("<!--[-1-->");
      $$renderer2.push(`<h1>Welcome to Burrito consideration app</h1> <p>Sign in to start considering burritos.</p> <form class="form"><div class="form-group"><label for="username">Username:</label> <input type="text" id="username"${attr("value", username)} required=""/></div> <div class="form-group"><label for="password">Password:</label> <input type="password" id="password"${attr("value", password)} required=""/></div> `);
      {
        $$renderer2.push("<!--[-1-->");
      }
      $$renderer2.push(`<!--]--> <button type="submit" class="btn-primary">Sign In</button></form> <p class="note">Enter any username and password to sign in. This is a demo app.</p>`);
    }
    $$renderer2.push(`<!--]--></div>`);
  });
}
export {
  _page as default
};

```

---

## .svelte-kit/output/server/entries/pages/burrito/_page.svelte.js

```js
import { e as escape_html } from "../../../chunks/attributes.js";
import "@sveltejs/kit/internal";
import "../../../chunks/exports.js";
import "../../../chunks/utils.js";
import "@sveltejs/kit/internal/server";
import "../../../chunks/root.js";
import "../../../chunks/state.svelte.js";
import { g as getAuthContext } from "../../../chunks/auth.svelte.js";
function _page($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    const auth = getAuthContext();
    $$renderer2.push(`<div class="container">`);
    if (auth.user) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<h1>Burrito consideration zone</h1> <p>This is where you consider the infinite potential of burritos.</p> <p>Current considerations: <strong>${escape_html(auth.user.burritoConsiderations)}</strong></p> <button class="btn-burrito">I have considered the burrito potential</button> `);
      {
        $$renderer2.push("<!--[-1-->");
      }
      $$renderer2.push(`<!--]--> <div class="note"><p>Each consideration is tracked as an Amplitude event with custom properties.</p></div>`);
    } else {
      $$renderer2.push("<!--[-1-->");
      $$renderer2.push(`<p>Please log in to consider burritos.</p>`);
    }
    $$renderer2.push(`<!--]--></div>`);
  });
}
export {
  _page as default
};

```

---

## .svelte-kit/output/server/entries/pages/profile/_page.svelte.js

```js
import { e as escape_html } from "../../../chunks/attributes.js";
import "@sveltejs/kit/internal";
import "../../../chunks/exports.js";
import "../../../chunks/utils.js";
import "@sveltejs/kit/internal/server";
import "../../../chunks/root.js";
import "../../../chunks/state.svelte.js";
import { g as getAuthContext } from "../../../chunks/auth.svelte.js";
function _page($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    const auth = getAuthContext();
    $$renderer2.push(`<div class="container">`);
    if (
      // Redirect to home if not logged in
      auth.user
    ) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<h1>User profile</h1> <div class="stats"><h2>Your information</h2> <p><strong>Username:</strong> ${escape_html(auth.user.username)}</p> <p><strong>Burrito considerations:</strong> ${escape_html(auth.user.burritoConsiderations)}</p></div>`);
    } else {
      $$renderer2.push("<!--[-1-->");
      $$renderer2.push(`<p>Please log in to view your profile.</p>`);
    }
    $$renderer2.push(`<!--]--></div>`);
  });
}
export {
  _page as default
};

```

---

## .svelte-kit/output/server/index.js

```js
import { B as BROWSER } from "./chunks/errors.js";
import { json, text, isRedirect, error } from "@sveltejs/kit";
import { Redirect, SvelteKitError, ActionFailure, HttpError } from "@sveltejs/kit/internal";
import { with_request_store, merge_tracing, try_get_request_store } from "@sveltejs/kit/internal/server";
import { a as assets, b as base, c as app_dir, r as relative, o as override, d as reset } from "./chunks/environment.js";
import { E as ENDPOINT_METHODS, P as PAGE_METHODS, n as negotiate, m as method_not_allowed, h as handle_error_and_jsonify, g as get_status, i as is_form_content_type, a as normalize_error, s as stringify, b as get_global_name, c as serialize_uses, d as clarify_devalue_error, e as get_node_type, f as escape_html, j as create_remote_key, k as static_error_page, r as redirect_response, p as parse_remote_arg, l as stringify$1, o as deserialize_binary_form, q as split_remote_key, t as has_prerendered_path, T as TRAILING_SLASH_PARAM, I as INVALIDATED_PARAM, u as handle_fatal_error, v as format_server_error } from "./chunks/shared.js";
import { u as uneval } from "./chunks/render-context.js";
import { m as make_trackable, d as disable_search, a as decode_params, S as SCHEME, v as validate_layout_server_exports, b as validate_layout_exports, c as validate_page_server_exports, e as validate_page_exports, n as normalize_path, r as resolve, f as decode_pathname, g as validate_server_exports } from "./chunks/exports.js";
import { b as base64_encode, t as text_decoder, a as text_encoder } from "./chunks/utils.js";
import { w as writable, r as readable } from "./chunks/index.js";
import { p as public_env, s as set_private_env, a as set_public_env } from "./chunks/shared-server.js";
import { r as read_implementation, o as options, g as get_hooks, s as set_read_implementation } from "./chunks/internal.js";
function with_resolvers() {
  let resolve2;
  let reject;
  const promise = new Promise((res, rej) => {
    resolve2 = res;
    reject = rej;
  });
  return { promise, resolve: resolve2, reject };
}
const NULL_BODY_STATUS = [101, 103, 204, 205, 304];
const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
const s = JSON.stringify;
async function render_endpoint(event, event_state, mod, state) {
  const method = (
    /** @type {import('types').HttpMethod} */
    event.request.method
  );
  let handler = mod[method] || mod.fallback;
  if (method === "HEAD" && !mod.HEAD && mod.GET) {
    handler = mod.GET;
  }
  if (!handler) {
    return method_not_allowed(mod, method);
  }
  const prerender = mod.prerender ?? state.prerender_default;
  if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) {
    throw new Error("Cannot prerender endpoints that have mutative methods");
  }
  if (state.prerendering && !state.prerendering.inside_reroute && !prerender) {
    if (state.depth > 0) {
      throw new Error(`${event.route.id} is not prerenderable`);
    } else {
      return new Response(void 0, { status: 204 });
    }
  }
  try {
    const response = await with_request_store(
      { event, state: event_state },
      () => handler(
        /** @type {import('@sveltejs/kit').RequestEvent<Record<string, any>>} */
        event
      )
    );
    if (!(response instanceof Response)) {
      throw new Error(
        `Invalid response from route ${event.url.pathname}: handler should return a Response object`
      );
    }
    if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
      const cloned = new Response(response.clone().body, {
        status: response.status,
        statusText: response.statusText,
        headers: new Headers(response.headers)
      });
      cloned.headers.set("x-sveltekit-prerender", String(prerender));
      if (state.prerendering.inside_reroute && prerender) {
        cloned.headers.set(
          "x-sveltekit-routeid",
          encodeURI(
            /** @type {string} */
            event.route.id
          )
        );
        state.prerendering.dependencies.set(event.url.pathname, { response: cloned, body: null });
      } else {
        return cloned;
      }
    }
    return response;
  } catch (e) {
    if (e instanceof Redirect) {
      return new Response(void 0, {
        status: e.status,
        headers: { location: e.location }
      });
    }
    throw e;
  }
}
function is_endpoint_request(event) {
  const { method, headers: headers2 } = event.request;
  if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) {
    return true;
  }
  if (method === "POST" && headers2.get("x-sveltekit-action") === "true") return false;
  const accept = event.request.headers.get("accept") ?? "*/*";
  return negotiate(accept, ["*", "text/html"]) !== "text/html";
}
function compact(arr) {
  return arr.filter(
    /** @returns {val is NonNullable<T>} */
    (val) => val != null
  );
}
const DATA_SUFFIX = "/__data.json";
const HTML_DATA_SUFFIX = ".html__data.json";
function has_data_suffix(pathname) {
  return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
}
function add_data_suffix(pathname) {
  if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
  return pathname.replace(/\/$/, "") + DATA_SUFFIX;
}
function strip_data_suffix(pathname) {
  if (pathname.endsWith(HTML_DATA_SUFFIX)) {
    return pathname.slice(0, -HTML_DATA_SUFFIX.length) + ".html";
  }
  return pathname.slice(0, -DATA_SUFFIX.length);
}
const ROUTE_SUFFIX = "/__route.js";
function has_resolution_suffix(pathname) {
  return pathname.endsWith(ROUTE_SUFFIX);
}
function add_resolution_suffix(pathname) {
  return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
}
function strip_resolution_suffix(pathname) {
  return pathname.slice(0, -ROUTE_SUFFIX.length);
}
const noop_span = {
  spanContext() {
    return noop_span_context;
  },
  setAttribute() {
    return this;
  },
  setAttributes() {
    return this;
  },
  addEvent() {
    return this;
  },
  setStatus() {
    return this;
  },
  updateName() {
    return this;
  },
  end() {
    return this;
  },
  isRecording() {
    return false;
  },
  recordException() {
    return this;
  },
  addLink() {
    return this;
  },
  addLinks() {
    return this;
  }
};
const noop_span_context = {
  traceId: "",
  spanId: "",
  traceFlags: 0
};
async function record_span({ name, attributes, fn }) {
  {
    return fn(noop_span);
  }
}
function is_action_json_request(event) {
  const accept = negotiate(event.request.headers.get("accept") ?? "*/*", [
    "application/json",
    "text/html"
  ]);
  return accept === "application/json" && event.request.method === "POST";
}
async function handle_action_json_request(event, event_state, options2, server) {
  const actions = server?.actions;
  if (!actions) {
    const no_actions_error = new SvelteKitError(
      405,
      "Method Not Allowed",
      `POST method not allowed. No form actions exist for ${"this page"}`
    );
    return action_json(
      {
        type: "error",
        error: await handle_error_and_jsonify(event, event_state, options2, no_actions_error)
      },
      {
        status: no_actions_error.status,
        headers: {
          // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
          // "The server must generate an Allow header field in a 405 status code response"
          allow: "GET"
        }
      }
    );
  }
  check_named_default_separate(actions);
  try {
    const data = await call_action(event, event_state, actions);
    if (BROWSER) ;
    if (data instanceof ActionFailure) {
      return action_json({
        type: "failure",
        status: data.status,
        // @ts-expect-error we assign a string to what is supposed to be an object. That's ok
        // because we don't use the object outside, and this way we have better code navigation
        // through knowing where the related interface is used.
        data: stringify_action_response(
          data.data,
          /** @type {string} */
          event.route.id,
          options2.hooks.transport
        )
      });
    } else {
      return action_json({
        type: "success",
        status: data ? 200 : 204,
        // @ts-expect-error see comment above
        data: stringify_action_response(
          data,
          /** @type {string} */
          event.route.id,
          options2.hooks.transport
        )
      });
    }
  } catch (e) {
    const err = normalize_error(e);
    if (err instanceof Redirect) {
      return action_json_redirect(err);
    }
    return action_json(
      {
        type: "error",
        error: await handle_error_and_jsonify(
          event,
          event_state,
          options2,
          check_incorrect_fail_use(err)
        )
      },
      {
        status: get_status(err)
      }
    );
  }
}
function check_incorrect_fail_use(error2) {
  return error2 instanceof ActionFailure ? new Error('Cannot "throw fail()". Use "return fail()"') : error2;
}
function action_json_redirect(redirect) {
  return action_json({
    type: "redirect",
    status: redirect.status,
    location: redirect.location
  });
}
function action_json(data, init2) {
  return json(data, init2);
}
function is_action_request(event) {
  return event.request.method === "POST";
}
async function handle_action_request(event, event_state, server) {
  const actions = server?.actions;
  if (!actions) {
    event.setHeaders({
      // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
      // "The server must generate an Allow header field in a 405 status code response"
      allow: "GET"
    });
    return {
      type: "error",
      error: new SvelteKitError(
        405,
        "Method Not Allowed",
        `POST method not allowed. No form actions exist for ${"this page"}`
      )
    };
  }
  check_named_default_separate(actions);
  try {
    const data = await call_action(event, event_state, actions);
    if (BROWSER) ;
    if (data instanceof ActionFailure) {
      return {
        type: "failure",
        status: data.status,
        data: data.data
      };
    } else {
      return {
        type: "success",
        status: 200,
        // @ts-expect-error this will be removed upon serialization, so `undefined` is the same as omission
        data
      };
    }
  } catch (e) {
    const err = normalize_error(e);
    if (err instanceof Redirect) {
      return {
        type: "redirect",
        status: err.status,
        location: err.location
      };
    }
    return {
      type: "error",
      error: check_incorrect_fail_use(err)
    };
  }
}
function check_named_default_separate(actions) {
  if (actions.default && Object.keys(actions).length > 1) {
    throw new Error(
      "When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions"
    );
  }
}
async function call_action(event, event_state, actions) {
  const url = new URL(event.request.url);
  let name = "default";
  for (const param of url.searchParams) {
    if (param[0].startsWith("/")) {
      name = param[0].slice(1);
      if (name === "default") {
        throw new Error('Cannot use reserved action name "default"');
      }
      break;
    }
  }
  const action = actions[name];
  if (!action) {
    throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
  }
  if (!is_form_content_type(event.request)) {
    throw new SvelteKitError(
      415,
      "Unsupported Media Type",
      `Form actions expect form-encoded data — received ${event.request.headers.get(
        "content-type"
      )}`
    );
  }
  return record_span({
    name: "sveltekit.form_action",
    attributes: {
      "http.route": event.route.id || "unknown"
    },
    fn: async (current2) => {
      const traced_event = merge_tracing(event, current2);
      const result = await with_request_store(
        { event: traced_event, state: event_state },
        () => action(traced_event)
      );
      if (result instanceof ActionFailure) {
        current2.setAttributes({
          "sveltekit.form_action.result.type": "failure",
          "sveltekit.form_action.result.status": result.status
        });
      }
      return result;
    }
  });
}
function validate_action_return(data) {
  if (data instanceof Redirect) {
    throw new Error("Cannot `return redirect(...)` — use `redirect(...)` instead");
  }
  if (data instanceof HttpError) {
    throw new Error("Cannot `return error(...)` — use `error(...)` or `return fail(...)` instead");
  }
}
function uneval_action_response(data, route_id, transport) {
  const replacer = (thing) => {
    for (const key2 in transport) {
      const encoded = transport[key2].encode(thing);
      if (encoded) {
        return `app.decode('${key2}', ${uneval(encoded, replacer)})`;
      }
    }
  };
  return try_serialize(data, (value) => uneval(value, replacer), route_id);
}
function stringify_action_response(data, route_id, transport) {
  const encoders = Object.fromEntries(
    Object.entries(transport).map(([key2, value]) => [key2, value.encode])
  );
  return try_serialize(data, (value) => stringify(value, encoders), route_id);
}
function try_serialize(data, fn, route_id) {
  try {
    return fn(data);
  } catch (e) {
    const error2 = (
      /** @type {any} */
      e
    );
    if (data instanceof Response) {
      throw new Error(
        `Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`,
        { cause: e }
      );
    }
    if ("path" in error2) {
      let message = `Data returned from action inside ${route_id} is not serializable: ${error2.message}`;
      if (error2.path !== "") message += ` (data.${error2.path})`;
      throw new Error(message, { cause: e });
    }
    throw error2;
  }
}
function create_async_iterator() {
  let resolved = -1;
  let returned = -1;
  const deferred = [];
  return {
    iterate: (transform = (x) => x) => {
      return {
        [Symbol.asyncIterator]() {
          return {
            next: async () => {
              const next = deferred[++returned];
              if (!next) return { value: null, done: true };
              const value = await next.promise;
              return { value: transform(value), done: false };
            }
          };
        }
      };
    },
    add: (promise) => {
      deferred.push(with_resolvers());
      void promise.then((value) => {
        deferred[++resolved].resolve(value);
      });
    }
  };
}
function server_data_serializer(event, event_state, options2) {
  let promise_id = 1;
  let max_nodes = -1;
  const iterator = create_async_iterator();
  const global = get_global_name(options2);
  function get_replacer(index) {
    return function replacer(thing) {
      if (typeof thing?.then === "function") {
        const id = promise_id++;
        const promise = thing.then(
          /** @param {any} data */
          (data) => ({ data })
        ).catch(
          /** @param {any} error */
          async (error2) => ({
            error: await handle_error_and_jsonify(event, event_state, options2, error2)
          })
        ).then(
          /**
           * @param {{data: any; error: any}} result
           */
          async ({ data, error: error2 }) => {
            let str;
            try {
              str = uneval(error2 ? [, error2] : [data], replacer);
            } catch {
              error2 = await handle_error_and_jsonify(
                event,
                event_state,
                options2,
                new Error(`Failed to serialize promise while rendering ${event.route.id}`)
              );
              str = uneval([, error2], replacer);
            }
            return {
              index,
              str: `${global}.resolve(${id}, ${str.includes("app.decode") ? `(app) => ${str}` : `() => ${str}`})`
            };
          }
        );
        iterator.add(promise);
        return `${global}.defer(${id})`;
      } else {
        for (const key2 in options2.hooks.transport) {
          const encoded = options2.hooks.transport[key2].encode(thing);
          if (encoded) {
            return `app.decode('${key2}', ${uneval(encoded, replacer)})`;
          }
        }
      }
    };
  }
  const strings = (
    /** @type {string[]} */
    []
  );
  return {
    set_max_nodes(i) {
      max_nodes = i;
    },
    add_node(i, node) {
      try {
        if (!node) {
          strings[i] = "null";
          return;
        }
        const payload = { type: "data", data: node.data, uses: serialize_uses(node) };
        if (node.slash) payload.slash = node.slash;
        strings[i] = uneval(payload, get_replacer(i));
      } catch (e) {
        e.path = e.path.slice(1);
        throw new Error(clarify_devalue_error(
          event,
          /** @type {any} */
          e
        ), { cause: e });
      }
    },
    get_data(csp) {
      const open = `<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>`;
      const close = `<\/script>
`;
      return {
        data: `[${compact(max_nodes > -1 ? strings.slice(0, max_nodes) : strings).join(",")}]`,
        chunks: promise_id > 1 ? iterator.iterate(({ index, str }) => {
          if (max_nodes > -1 && index >= max_nodes) {
            return "";
          }
          return open + str + close;
        }) : null
      };
    }
  };
}
function server_data_serializer_json(event, event_state, options2) {
  let promise_id = 1;
  const iterator = create_async_iterator();
  const reducers = {
    ...Object.fromEntries(
      Object.entries(options2.hooks.transport).map(([key2, value]) => [key2, value.encode])
    ),
    /** @param {any} thing */
    Promise: (thing) => {
      if (typeof thing?.then !== "function") {
        return;
      }
      const id = promise_id++;
      let key2 = "data";
      const promise = thing.catch(
        /** @param {any} e */
        async (e) => {
          key2 = "error";
          return handle_error_and_jsonify(
            event,
            event_state,
            options2,
            /** @type {any} */
            e
          );
        }
      ).then(
        /** @param {any} value */
        async (value) => {
          let str;
          try {
            str = stringify(value, reducers);
          } catch {
            const error2 = await handle_error_and_jsonify(
              event,
              event_state,
              options2,
              new Error(`Failed to serialize promise while rendering ${event.route.id}`)
            );
            key2 = "error";
            str = stringify(error2, reducers);
          }
          return `{"type":"chunk","id":${id},"${key2}":${str}}
`;
        }
      );
      iterator.add(promise);
      return id;
    }
  };
  const strings = (
    /** @type {string[]} */
    []
  );
  return {
    add_node(i, node) {
      try {
        if (!node) {
          strings[i] = "null";
          return;
        }
        if (node.type === "error" || node.type === "skip") {
          strings[i] = JSON.stringify(node);
          return;
        }
        strings[i] = `{"type":"data","data":${stringify(node.data, reducers)},"uses":${JSON.stringify(
          serialize_uses(node)
        )}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
      } catch (e) {
        e.path = "data" + e.path;
        throw new Error(clarify_devalue_error(
          event,
          /** @type {any} */
          e
        ), { cause: e });
      }
    },
    get_data() {
      return {
        data: `{"type":"data","nodes":[${strings.join(",")}]}
`,
        chunks: promise_id > 1 ? iterator.iterate() : null
      };
    }
  };
}
async function load_server_data({ event, event_state, state, node, parent }) {
  if (!node?.server) return null;
  let is_tracking = true;
  const uses = {
    dependencies: /* @__PURE__ */ new Set(),
    params: /* @__PURE__ */ new Set(),
    parent: false,
    route: false,
    url: false,
    search_params: /* @__PURE__ */ new Set()
  };
  const load = node.server.load;
  const slash = node.server.trailingSlash;
  if (!load) {
    return { type: "data", data: null, uses, slash };
  }
  const url = make_trackable(
    event.url,
    () => {
      if (is_tracking) {
        uses.url = true;
      }
    },
    (param) => {
      if (is_tracking) {
        uses.search_params.add(param);
      }
    }
  );
  if (state.prerendering) {
    disable_search(url);
  }
  const result = await record_span({
    name: "sveltekit.load",
    attributes: {
      "sveltekit.load.node_id": node.server_id || "unknown",
      "sveltekit.load.node_type": get_node_type(node.server_id),
      "http.route": event.route.id || "unknown"
    },
    fn: async (current2) => {
      const traced_event = merge_tracing(event, current2);
      const result2 = await with_request_store(
        { event: traced_event, state: event_state },
        () => load.call(null, {
          ...traced_event,
          fetch: (info, init2) => {
            new URL(info instanceof Request ? info.url : info, event.url);
            return event.fetch(info, init2);
          },
          /** @param {string[]} deps */
          depends: (...deps) => {
            for (const dep of deps) {
              const { href } = new URL(dep, event.url);
              uses.dependencies.add(href);
            }
          },
          params: new Proxy(event.params, {
            get: (target, key2) => {
              if (is_tracking) {
                uses.params.add(key2);
              }
              return target[
                /** @type {string} */
                key2
              ];
            }
          }),
          parent: async () => {
            if (is_tracking) {
              uses.parent = true;
            }
            return parent();
          },
          route: new Proxy(event.route, {
            get: (target, key2) => {
              if (is_tracking) {
                uses.route = true;
              }
              return target[
                /** @type {'id'} */
                key2
              ];
            }
          }),
          url,
          untrack(fn) {
            is_tracking = false;
            try {
              return fn();
            } finally {
              is_tracking = true;
            }
          }
        })
      );
      return result2;
    }
  });
  return {
    type: "data",
    data: result ?? null,
    uses,
    slash
  };
}
async function load_data({
  event,
  event_state,
  fetched,
  node,
  parent,
  server_data_promise,
  state,
  resolve_opts,
  csr
}) {
  const server_data_node = await server_data_promise;
  const load = node?.universal?.load;
  if (!load) {
    return server_data_node?.data ?? null;
  }
  const result = await record_span({
    name: "sveltekit.load",
    attributes: {
      "sveltekit.load.node_id": node.universal_id || "unknown",
      "sveltekit.load.node_type": get_node_type(node.universal_id),
      "http.route": event.route.id || "unknown"
    },
    fn: async (current2) => {
      const traced_event = merge_tracing(event, current2);
      const child_state = { ...event_state, is_in_universal_load: true };
      return await with_request_store(
        { event: traced_event, state: child_state },
        () => load.call(null, {
          url: event.url,
          params: event.params,
          data: server_data_node?.data ?? null,
          route: event.route,
          fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
          setHeaders: event.setHeaders,
          depends: () => {
          },
          parent,
          untrack: (fn) => fn(),
          tracing: traced_event.tracing
        })
      );
    }
  });
  return result ?? null;
}
function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
  const universal_fetch = async (input, init2) => {
    const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
    const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init2?.headers;
    let response = await event.fetch(input, init2);
    const url = new URL(input instanceof Request ? input.url : input, event.url);
    const same_origin = url.origin === event.url.origin;
    let dependency;
    if (same_origin) {
      if (state.prerendering) {
        dependency = { response, body: null };
        state.prerendering.dependencies.set(url.pathname, dependency);
      }
    } else if (url.protocol === "https:" || url.protocol === "http:") {
      const mode = input instanceof Request ? input.mode : init2?.mode ?? "cors";
      if (mode === "no-cors") {
        response = new Response("", {
          status: response.status,
          statusText: response.statusText,
          headers: response.headers
        });
      } else {
        const acao = response.headers.get("access-control-allow-origin");
        if (!acao || acao !== event.url.origin && acao !== "*") {
          throw new Error(
            `CORS error: ${acao ? "Incorrect" : "No"} 'Access-Control-Allow-Origin' header is present on the requested resource`
          );
        }
      }
    }
    let teed_body;
    const proxy = new Proxy(response, {
      get(response2, key2, receiver) {
        async function push_fetched(body2, is_b64) {
          const status_number = Number(response2.status);
          if (isNaN(status_number)) {
            throw new Error(
              `response.status is not a number. value: "${response2.status}" type: ${typeof response2.status}`
            );
          }
          fetched.push({
            url: same_origin ? url.href.slice(event.url.origin.length) : url.href,
            method: event.request.method,
            request_body: (
              /** @type {string | ArrayBufferView | undefined} */
              input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init2?.body
            ),
            request_headers: cloned_headers,
            response_body: body2,
            response: response2,
            is_b64
          });
        }
        if (key2 === "body") {
          if (response2.body === null) {
            return null;
          }
          if (teed_body) {
            return teed_body;
          }
          const [a, b] = response2.body.tee();
          void (async () => {
            let result = new Uint8Array();
            for await (const chunk of a) {
              const combined = new Uint8Array(result.length + chunk.length);
              combined.set(result, 0);
              combined.set(chunk, result.length);
              result = combined;
            }
            if (dependency) {
              dependency.body = new Uint8Array(result);
            }
            void push_fetched(base64_encode(result), true);
          })();
          return teed_body = b;
        }
        if (key2 === "arrayBuffer") {
          return async () => {
            const buffer = await response2.arrayBuffer();
            const bytes = new Uint8Array(buffer);
            if (dependency) {
              dependency.body = bytes;
            }
            if (buffer instanceof ArrayBuffer) {
              await push_fetched(base64_encode(bytes), true);
            }
            return buffer;
          };
        }
        async function text2() {
          const body2 = await response2.text();
          if (body2 === "" && NULL_BODY_STATUS.includes(response2.status)) {
            await push_fetched(void 0, false);
            return void 0;
          }
          if (!body2 || typeof body2 === "string") {
            await push_fetched(body2, false);
          }
          if (dependency) {
            dependency.body = body2;
          }
          return body2;
        }
        if (key2 === "text") {
          return text2;
        }
        if (key2 === "json") {
          return async () => {
            const body2 = await text2();
            return body2 ? JSON.parse(body2) : void 0;
          };
        }
        const value = Reflect.get(response2, key2, response2);
        if (value instanceof Function) {
          return Object.defineProperties(
            /**
             * @this {any}
             */
            function() {
              return Reflect.apply(value, this === receiver ? response2 : this, arguments);
            },
            {
              name: { value: value.name },
              length: { value: value.length }
            }
          );
        }
        return value;
      }
    });
    if (csr) {
      const get = response.headers.get;
      response.headers.get = (key2) => {
        const lower = key2.toLowerCase();
        const value = get.call(response.headers, lower);
        if (value && !lower.startsWith("x-sveltekit-")) {
          const included = resolve_opts.filterSerializedResponseHeaders(lower, value);
          if (!included) {
            throw new Error(
              `Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${event.route.id})`
            );
          }
        }
        return value;
      };
    }
    return proxy;
  };
  return (input, init2) => {
    const response = universal_fetch(input, init2);
    response.catch(() => {
    });
    return response;
  };
}
async function stream_to_string(stream) {
  let result = "";
  const reader = stream.getReader();
  while (true) {
    const { done, value } = await reader.read();
    if (done) {
      break;
    }
    result += text_decoder.decode(value);
  }
  return result;
}
function hash(...values) {
  let hash2 = 5381;
  for (const value of values) {
    if (typeof value === "string") {
      let i = value.length;
      while (i) hash2 = hash2 * 33 ^ value.charCodeAt(--i);
    } else if (ArrayBuffer.isView(value)) {
      const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
      let i = buffer.length;
      while (i) hash2 = hash2 * 33 ^ buffer[--i];
    } else {
      throw new TypeError("value must be a string or TypedArray");
    }
  }
  return (hash2 >>> 0).toString(36);
}
const replacements = {
  "<": "\\u003C",
  "\u2028": "\\u2028",
  "\u2029": "\\u2029"
};
const pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
function serialize_data(fetched, filter, prerendering = false) {
  const headers2 = {};
  let cache_control = null;
  let age = null;
  let varyAny = false;
  for (const [key2, value] of fetched.response.headers) {
    if (filter(key2, value)) {
      headers2[key2] = value;
    }
    if (key2 === "cache-control") cache_control = value;
    else if (key2 === "age") age = value;
    else if (key2 === "vary" && value.trim() === "*") varyAny = true;
  }
  const payload = {
    status: fetched.response.status,
    statusText: fetched.response.statusText,
    headers: headers2,
    body: fetched.response_body
  };
  const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
  const attrs = [
    'type="application/json"',
    "data-sveltekit-fetched",
    `data-url="${escape_html(fetched.url, true)}"`
  ];
  if (fetched.is_b64) {
    attrs.push("data-b64");
  }
  if (fetched.request_headers || fetched.request_body) {
    const values = [];
    if (fetched.request_headers) {
      values.push([...new Headers(fetched.request_headers)].join(","));
    }
    if (fetched.request_body) {
      values.push(fetched.request_body);
    }
    attrs.push(`data-hash="${hash(...values)}"`);
  }
  if (!prerendering && fetched.method === "GET" && cache_control && !varyAny) {
    const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
    if (match) {
      const ttl = +match[1] - +(age ?? "0");
      attrs.push(`data-ttl="${ttl}"`);
    }
  }
  return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
}
function sha256(data) {
  if (!key[0]) precompute();
  const out = init.slice(0);
  const array2 = encode(data);
  for (let i = 0; i < array2.length; i += 16) {
    const w = array2.subarray(i, i + 16);
    let tmp;
    let a;
    let b;
    let out0 = out[0];
    let out1 = out[1];
    let out2 = out[2];
    let out3 = out[3];
    let out4 = out[4];
    let out5 = out[5];
    let out6 = out[6];
    let out7 = out[7];
    for (let i2 = 0; i2 < 64; i2++) {
      if (i2 < 16) {
        tmp = w[i2];
      } else {
        a = w[i2 + 1 & 15];
        b = w[i2 + 14 & 15];
        tmp = w[i2 & 15] = (a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i2 & 15] + w[i2 + 9 & 15] | 0;
      }
      tmp = tmp + out7 + (out4 >>> 6 ^ out4 >>> 11 ^ out4 >>> 25 ^ out4 << 26 ^ out4 << 21 ^ out4 << 7) + (out6 ^ out4 & (out5 ^ out6)) + key[i2];
      out7 = out6;
      out6 = out5;
      out5 = out4;
      out4 = out3 + tmp | 0;
      out3 = out2;
      out2 = out1;
      out1 = out0;
      out0 = tmp + (out1 & out2 ^ out3 & (out1 ^ out2)) + (out1 >>> 2 ^ out1 >>> 13 ^ out1 >>> 22 ^ out1 << 30 ^ out1 << 19 ^ out1 << 10) | 0;
    }
    out[0] = out[0] + out0 | 0;
    out[1] = out[1] + out1 | 0;
    out[2] = out[2] + out2 | 0;
    out[3] = out[3] + out3 | 0;
    out[4] = out[4] + out4 | 0;
    out[5] = out[5] + out5 | 0;
    out[6] = out[6] + out6 | 0;
    out[7] = out[7] + out7 | 0;
  }
  const bytes = new Uint8Array(out.buffer);
  reverse_endianness(bytes);
  return btoa(String.fromCharCode(...bytes));
}
const init = new Uint32Array(8);
const key = new Uint32Array(64);
function precompute() {
  function frac(x) {
    return (x - Math.floor(x)) * 4294967296;
  }
  let prime = 2;
  for (let i = 0; i < 64; prime++) {
    let is_prime = true;
    for (let factor = 2; factor * factor <= prime; factor++) {
      if (prime % factor === 0) {
        is_prime = false;
        break;
      }
    }
    if (is_prime) {
      if (i < 8) {
        init[i] = frac(prime ** (1 / 2));
      }
      key[i] = frac(prime ** (1 / 3));
      i++;
    }
  }
}
function reverse_endianness(bytes) {
  for (let i = 0; i < bytes.length; i += 4) {
    const a = bytes[i + 0];
    const b = bytes[i + 1];
    const c = bytes[i + 2];
    const d = bytes[i + 3];
    bytes[i + 0] = d;
    bytes[i + 1] = c;
    bytes[i + 2] = b;
    bytes[i + 3] = a;
  }
}
function encode(str) {
  const encoded = text_encoder.encode(str);
  const length = encoded.length * 8;
  const size = 512 * Math.ceil((length + 65) / 512);
  const bytes = new Uint8Array(size / 8);
  bytes.set(encoded);
  bytes[encoded.length] = 128;
  reverse_endianness(bytes);
  const words = new Uint32Array(bytes.buffer);
  words[words.length - 2] = Math.floor(length / 4294967296);
  words[words.length - 1] = length;
  return words;
}
const array = new Uint8Array(16);
function generate_nonce() {
  crypto.getRandomValues(array);
  return btoa(String.fromCharCode(...array));
}
const quoted = /* @__PURE__ */ new Set([
  "self",
  "unsafe-eval",
  "unsafe-hashes",
  "unsafe-inline",
  "none",
  "strict-dynamic",
  "report-sample",
  "wasm-unsafe-eval",
  "script"
]);
const crypto_pattern = /^(nonce|sha\d\d\d)-/;
class BaseProvider {
  /** @type {boolean} */
  #use_hashes;
  /** @type {boolean} */
  #script_needs_csp;
  /** @type {boolean} */
  #script_src_needs_csp;
  /** @type {boolean} */
  #script_src_elem_needs_csp;
  /** @type {boolean} */
  #style_needs_csp;
  /** @type {boolean} */
  #style_src_needs_csp;
  /** @type {boolean} */
  #style_src_attr_needs_csp;
  /** @type {boolean} */
  #style_src_elem_needs_csp;
  /** @type {import('types').CspDirectives} */
  #directives;
  /** @type {Set<import('types').Csp.Source>} */
  #script_src;
  /** @type {Set<import('types').Csp.Source>} */
  #script_src_elem;
  /** @type {Set<import('types').Csp.Source>} */
  #style_src;
  /** @type {Set<import('types').Csp.Source>} */
  #style_src_attr;
  /** @type {Set<import('types').Csp.Source>} */
  #style_src_elem;
  /** @type {boolean} */
  script_needs_nonce;
  /** @type {boolean} */
  style_needs_nonce;
  /** @type {boolean} */
  script_needs_hash;
  /** @type {string} */
  #nonce;
  /**
   * @param {boolean} use_hashes
   * @param {import('types').CspDirectives} directives
   * @param {string} nonce
   */
  constructor(use_hashes, directives, nonce) {
    this.#use_hashes = use_hashes;
    this.#directives = directives;
    const d = this.#directives;
    this.#script_src = /* @__PURE__ */ new Set();
    this.#script_src_elem = /* @__PURE__ */ new Set();
    this.#style_src = /* @__PURE__ */ new Set();
    this.#style_src_attr = /* @__PURE__ */ new Set();
    this.#style_src_elem = /* @__PURE__ */ new Set();
    const effective_script_src = d["script-src"] || d["default-src"];
    const script_src_elem = d["script-src-elem"];
    const effective_style_src = d["style-src"] || d["default-src"];
    const style_src_attr = d["style-src-attr"];
    const style_src_elem = d["style-src-elem"];
    const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
    const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
    this.#script_src_needs_csp = script_needs_csp(effective_script_src);
    this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
    this.#style_src_needs_csp = style_needs_csp(effective_style_src);
    this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
    this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
    this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
    this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
    this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
    this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
    this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
    this.#nonce = nonce;
  }
  /** @param {string} content */
  add_script(content) {
    if (!this.#script_needs_csp) return;
    const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
    if (this.#script_src_needs_csp) {
      this.#script_src.add(source);
    }
    if (this.#script_src_elem_needs_csp) {
      this.#script_src_elem.add(source);
    }
  }
  /** @param {`sha256-${string}`[]} hashes */
  add_script_hashes(hashes) {
    for (const hash2 of hashes) {
      if (this.#script_src_needs_csp) {
        this.#script_src.add(hash2);
      }
      if (this.#script_src_elem_needs_csp) {
        this.#script_src_elem.add(hash2);
      }
    }
  }
  /** @param {string} content */
  add_style(content) {
    if (!this.#style_needs_csp) return;
    const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
    if (this.#style_src_needs_csp) {
      this.#style_src.add(source);
    }
    if (this.#style_src_attr_needs_csp) {
      this.#style_src_attr.add(source);
    }
    if (this.#style_src_elem_needs_csp) {
      const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
      const d = this.#directives;
      if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) {
        this.#style_src_elem.add(sha256_empty_comment_hash);
      }
      if (source !== sha256_empty_comment_hash) {
        this.#style_src_elem.add(source);
      }
    }
  }
  /**
   * @param {boolean} [is_meta]
   */
  get_header(is_meta = false) {
    const header = [];
    const directives = { ...this.#directives };
    if (this.#style_src.size > 0) {
      directives["style-src"] = [
        ...directives["style-src"] || directives["default-src"] || [],
        ...this.#style_src
      ];
    }
    if (this.#style_src_attr.size > 0) {
      directives["style-src-attr"] = [
        ...directives["style-src-attr"] || [],
        ...this.#style_src_attr
      ];
    }
    if (this.#style_src_elem.size > 0) {
      directives["style-src-elem"] = [
        ...directives["style-src-elem"] || [],
        ...this.#style_src_elem
      ];
    }
    if (this.#script_src.size > 0) {
      directives["script-src"] = [
        ...directives["script-src"] || directives["default-src"] || [],
        ...this.#script_src
      ];
    }
    if (this.#script_src_elem.size > 0) {
      directives["script-src-elem"] = [
        ...directives["script-src-elem"] || [],
        ...this.#script_src_elem
      ];
    }
    for (const key2 in directives) {
      if (is_meta && (key2 === "frame-ancestors" || key2 === "report-uri" || key2 === "sandbox")) {
        continue;
      }
      const value = (
        /** @type {string[] | true} */
        directives[key2]
      );
      if (!value) continue;
      const directive = [key2];
      if (Array.isArray(value)) {
        value.forEach((value2) => {
          if (quoted.has(value2) || crypto_pattern.test(value2)) {
            directive.push(`'${value2}'`);
          } else {
            directive.push(value2);
          }
        });
      }
      header.push(directive.join(" "));
    }
    return header.join("; ");
  }
}
class CspProvider extends BaseProvider {
  get_meta() {
    const content = this.get_header(true);
    if (!content) {
      return;
    }
    return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
  }
}
class CspReportOnlyProvider extends BaseProvider {
  /**
   * @param {boolean} use_hashes
   * @param {import('types').CspDirectives} directives
   * @param {string} nonce
   */
  constructor(use_hashes, directives, nonce) {
    super(use_hashes, directives, nonce);
    if (Object.values(directives).filter((v) => !!v).length > 0) {
      const has_report_to = directives["report-to"]?.length ?? 0 > 0;
      const has_report_uri = directives["report-uri"]?.length ?? 0 > 0;
      if (!has_report_to && !has_report_uri) {
        throw Error(
          "`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both"
        );
      }
    }
  }
}
class Csp {
  /** @readonly */
  nonce = generate_nonce();
  /** @type {CspProvider} */
  csp_provider;
  /** @type {CspReportOnlyProvider} */
  report_only_provider;
  /**
   * @param {import('./types.js').CspConfig} config
   * @param {import('./types.js').CspOpts} opts
   */
  constructor({ mode, directives, reportOnly }, { prerender }) {
    const use_hashes = mode === "hash" || mode === "auto" && prerender;
    this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
    this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
  }
  get script_needs_hash() {
    return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
  }
  get script_needs_nonce() {
    return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
  }
  get style_needs_nonce() {
    return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
  }
  /** @param {string} content */
  add_script(content) {
    this.csp_provider.add_script(content);
    this.report_only_provider.add_script(content);
  }
  /** @param {`sha256-${string}`[]} hashes */
  add_script_hashes(hashes) {
    this.csp_provider.add_script_hashes(hashes);
    this.report_only_provider.add_script_hashes(hashes);
  }
  /** @param {string} content */
  add_style(content) {
    this.csp_provider.add_style(content);
    this.report_only_provider.add_style(content);
  }
}
function exec(match, params, matchers) {
  const result = {};
  const values = match.slice(1);
  const values_needing_match = values.filter((value) => value !== void 0);
  let buffered = 0;
  for (let i = 0; i < params.length; i += 1) {
    const param = params[i];
    let value = values[i - buffered];
    if (param.chained && param.rest && buffered) {
      value = values.slice(i - buffered, i + 1).filter((s2) => s2).join("/");
      buffered = 0;
    }
    if (value === void 0) {
      if (param.rest) {
        value = "";
      } else {
        continue;
      }
    }
    if (!param.matcher || matchers[param.matcher](value)) {
      result[param.name] = value;
      const next_param = params[i + 1];
      const next_value = values[i + 1];
      if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {
        buffered = 0;
      }
      if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) {
        buffered = 0;
      }
      continue;
    }
    if (param.optional && param.chained) {
      buffered++;
      continue;
    }
    return;
  }
  if (buffered) return;
  return result;
}
function find_route(path, routes, matchers) {
  for (const route of routes) {
    const match = route.pattern.exec(path);
    if (!match) continue;
    const matched = exec(match, route.params, matchers);
    if (matched) {
      return {
        route,
        params: decode_params(matched)
      };
    }
  }
  return null;
}
function generate_route_object(route, url, manifest) {
  const { errors, layouts, leaf } = route;
  const nodes = [...errors, ...layouts.map((l) => l?.[1]), leaf[1]].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(manifest._.client.nodes?.[n])}`).join(",\n		");
  return [
    `{
	id: ${s(route.id)}`,
    `errors: ${s(route.errors)}`,
    `layouts: ${s(route.layouts)}`,
    `leaf: ${s(route.leaf)}`,
    `nodes: {
		${nodes}
	}
}`
  ].join(",\n	");
}
function create_client_import(import_path, url) {
  if (!import_path) return "Promise.resolve({})";
  if (import_path[0] === "/") {
    return `import('${import_path}')`;
  }
  if (assets !== "") {
    return `import('${assets}/${import_path}')`;
  }
  {
    return `import('${base}/${import_path}')`;
  }
}
async function resolve_route(resolved_path, url, manifest) {
  if (!manifest._.client.routes) {
    return text("Server-side route resolution disabled", { status: 400 });
  }
  const matchers = await manifest._.matchers();
  const result = find_route(resolved_path, manifest._.client.routes, matchers);
  return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest).response;
}
function create_server_routing_response(route, params, url, manifest) {
  const headers2 = new Headers({
    "content-type": "application/javascript; charset=utf-8"
  });
  if (route) {
    const csr_route = generate_route_object(route, url, manifest);
    const body2 = `${create_css_import(route, url, manifest)}
export const route = ${csr_route}; export const params = ${JSON.stringify(params)};`;
    return { response: text(body2, { headers: headers2 }), body: body2 };
  } else {
    return { response: text("", { headers: headers2 }), body: "" };
  }
}
function create_css_import(route, url, manifest) {
  const { errors, layouts, leaf } = route;
  let css = "";
  for (const node of [...errors, ...layouts.map((l) => l?.[1]), leaf[1]]) {
    if (typeof node !== "number") continue;
    const node_css = manifest._.client.css?.[node];
    for (const css_path of node_css ?? []) {
      css += `'${assets || base}/${css_path}',`;
    }
  }
  if (!css) return "";
  return `${create_client_import(
    /** @type {string} */
    manifest._.client.start
  )}.then(x => x.load_css([${css}]));`;
}
const updated = {
  ...readable(false),
  check: () => false
};
async function render_response({
  branch,
  fetched,
  options: options2,
  manifest,
  state,
  page_config,
  status,
  error: error2 = null,
  event,
  event_state,
  resolve_opts,
  action_result,
  data_serializer,
  error_components
}) {
  if (state.prerendering) {
    if (options2.csp.mode === "nonce") {
      throw new Error('Cannot use prerendering if config.kit.csp.mode === "nonce"');
    }
    if (options2.app_template_contains_nonce) {
      throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%");
    }
  }
  const { client } = manifest._;
  const modulepreloads = new Set(client.imports);
  const stylesheets = new Set(client.stylesheets);
  const fonts = new Set(client.fonts);
  const link_headers = /* @__PURE__ */ new Set();
  const inline_styles = /* @__PURE__ */ new Map();
  let rendered;
  const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
  let base$1 = base;
  let assets$1 = assets;
  let base_expression = s(base);
  const csp = new Csp(options2.csp, {
    prerender: !!state.prerendering
  });
  if (page_config.ssr) {
    const props = {
      stores: {
        page: writable(null),
        navigating: writable(null),
        updated
      },
      constructors: await Promise.all(
        branch.map(({ node }) => {
          if (!node.component) {
            throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
          }
          return node.component();
        })
      ),
      form: form_value
    };
    if (error_components) {
      if (error2) {
        props.error = error2;
      }
      props.errors = error_components;
    }
    let data2 = {};
    for (let i = 0; i < branch.length; i += 1) {
      data2 = { ...data2, ...branch[i].data };
      props[`data_${i}`] = data2;
    }
    props.page = {
      error: error2,
      params: (
        /** @type {Record<string, any>} */
        event.params
      ),
      route: event.route,
      status,
      url: event.url,
      data: data2,
      form: form_value,
      state: {}
    };
    const render_opts = {
      context: /* @__PURE__ */ new Map([
        [
          "__request__",
          {
            page: props.page
          }
        ]
      ]),
      csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash },
      transformError: error_components ? (
        /** @param {unknown} e */
        async (e) => {
          if (isRedirect(e)) {
            throw e;
          }
          const transformed2 = await handle_error_and_jsonify(event, event_state, options2, e);
          props.page.error = props.error = error2 = transformed2;
          props.page.status = status = get_status(e);
          return transformed2;
        }
      ) : void 0
    };
    const fetch2 = globalThis.fetch;
    try {
      if (BROWSER) ;
      const state2 = { ...event_state, is_in_render: true };
      rendered = await with_request_store({ event, state: state2 }, async () => {
        if (relative) ;
        const maybe_promise = options2.root.render(props, render_opts);
        const rendered2 = options2.async && "then" in maybe_promise ? (
          /** @type {ReturnType<typeof options.root.render> & Promise<any>} */
          maybe_promise.then((r) => r)
        ) : maybe_promise;
        if (options2.async) {
          reset();
        }
        const { head: head2, html: html2, css, hashes } = (
          /** @type {ReturnType<typeof options.root.render>} */
          options2.async ? await rendered2 : rendered2
        );
        if (hashes) {
          csp.add_script_hashes(hashes.script);
        }
        return { head: head2, html: html2, css, hashes };
      });
    } finally {
      reset();
    }
    for (const { node } of branch) {
      for (const url of node.imports) modulepreloads.add(url);
      for (const url of node.stylesheets) stylesheets.add(url);
      for (const url of node.fonts) fonts.add(url);
      if (node.inline_styles && !client.inline) {
        Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
          if (typeof css === "string") {
            inline_styles.set(filename, css);
            return;
          }
          inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
        });
      }
    }
  } else {
    rendered = { head: "", html: "", css: { code: "", map: null }, hashes: { script: [] } };
  }
  const head = new Head(rendered.head, !!state.prerendering);
  let body2 = rendered.html;
  const prefixed = (path) => {
    if (path.startsWith("/")) {
      return base + path;
    }
    return `${assets$1}/${path}`;
  };
  const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
  if (style) {
    const attributes = [];
    if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
    csp.add_style(style);
    head.add_style(style, attributes);
  }
  for (const dep of stylesheets) {
    const path = prefixed(dep);
    const attributes = ['rel="stylesheet"'];
    if (inline_styles.has(dep)) {
      attributes.push("disabled", 'media="(max-width: 0)"');
    } else {
      if (resolve_opts.preload({ type: "css", path })) {
        link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
      }
    }
    head.add_stylesheet(path, attributes);
  }
  for (const dep of fonts) {
    const path = prefixed(dep);
    if (resolve_opts.preload({ type: "font", path })) {
      const ext = dep.slice(dep.lastIndexOf(".") + 1);
      head.add_link_tag(path, ['rel="preload"', 'as="font"', `type="font/${ext}"`, "crossorigin"]);
      link_headers.add(
        `<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`
      );
    }
  }
  const global = get_global_name(options2);
  const { data, chunks } = data_serializer.get_data(csp);
  if (page_config.ssr && page_config.csr) {
    body2 += `
			${fetched.map(
      (item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!state.prerendering)
    ).join("\n			")}`;
  }
  if (page_config.csr) {
    const route = manifest._.client.routes?.find((r) => r.id === event.route.id) ?? null;
    if (client.uses_env_dynamic_public && state.prerendering) {
      modulepreloads.add(`${app_dir}/env.js`);
    }
    if (!client.inline) {
      const included_modulepreloads = Array.from(modulepreloads, (dep) => prefixed(dep)).filter(
        (path) => resolve_opts.preload({ type: "js", path })
      );
      for (const path of included_modulepreloads) {
        link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
        if (options2.preload_strategy !== "modulepreload") {
          head.add_script_preload(path);
        } else {
          head.add_link_tag(path, ['rel="modulepreload"']);
        }
      }
    }
    if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
      const pathname = add_resolution_suffix(event.url.pathname);
      state.prerendering.dependencies.set(
        pathname,
        create_server_routing_response(route, event.params, new URL(pathname, event.url), manifest)
      );
    }
    const blocks = [];
    const load_env_eagerly = client.uses_env_dynamic_public && state.prerendering;
    const properties = [`base: ${base_expression}`];
    if (assets) {
      properties.push(`assets: ${s(assets)}`);
    }
    if (client.uses_env_dynamic_public) {
      properties.push(`env: ${load_env_eagerly ? "null" : s(public_env)}`);
    }
    if (chunks) {
      blocks.push("const deferred = new Map();");
      properties.push(`defer: (id) => new Promise((fulfil, reject) => {
							deferred.set(id, { fulfil, reject });
						})`);
      let app_declaration = "";
      if (Object.keys(options2.hooks.transport).length > 0) {
        if (client.inline) {
          app_declaration = `const app = __sveltekit_${options2.version_hash}.app.app;`;
        } else if (client.app) {
          app_declaration = `const app = await import(${s(prefixed(client.app))});`;
        } else {
          app_declaration = `const { app } = await import(${s(prefixed(client.start))});`;
        }
      }
      const prelude = app_declaration ? `${app_declaration}
							const [data, error] = fn(app);` : `const [data, error] = fn();`;
      properties.push(`resolve: async (id, fn) => {
							${prelude}

							const try_to_resolve = () => {
								if (!deferred.has(id)) {
									setTimeout(try_to_resolve, 0);
									return;
								}
								const { fulfil, reject } = deferred.get(id);
								deferred.delete(id);
								if (error) reject(error);
								else fulfil(data);
							}
							try_to_resolve();
						}`);
    }
    blocks.push(`${global} = {
						${properties.join(",\n						")}
					};`);
    const args = ["element"];
    blocks.push("const element = document.currentScript.parentElement;");
    if (page_config.ssr) {
      const serialized = { form: "null", error: "null" };
      if (form_value) {
        serialized.form = uneval_action_response(
          form_value,
          /** @type {string} */
          event.route.id,
          options2.hooks.transport
        );
      }
      if (error2) {
        serialized.error = uneval(error2);
      }
      const hydrate = [
        `node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
        `data: ${data}`,
        `form: ${serialized.form}`,
        `error: ${serialized.error}`
      ];
      if (status !== 200) {
        hydrate.push(`status: ${status}`);
      }
      if (manifest._.client.routes) {
        if (route) {
          const stringified = generate_route_object(route, event.url, manifest).replaceAll(
            "\n",
            "\n							"
          );
          hydrate.push(`params: ${uneval(event.params)}`, `server_route: ${stringified}`);
        }
      } else if (options2.embedded) {
        hydrate.push(`params: ${uneval(event.params)}`, `route: ${s(event.route)}`);
      }
      const indent = "	".repeat(load_env_eagerly ? 7 : 6);
      args.push(`{
${indent}	${hydrate.join(`,
${indent}	`)}
${indent}}`);
    }
    const { remote } = event_state;
    let serialized_query_data = "";
    let serialized_prerender_data = "";
    if (remote.data) {
      const query = {};
      const prerender = {};
      for (const [internals, cache] of remote.data) {
        if (!internals.id) continue;
        for (const key2 in cache) {
          const entry = cache[key2];
          if (!entry.serialize) continue;
          const remote_key = create_remote_key(internals.id, key2);
          const store = internals.type === "prerender" ? prerender : query;
          if (event_state.remote.refreshes?.[remote_key] !== void 0) {
            store[remote_key] = await entry.data;
          } else {
            const result = await Promise.race([
              Promise.resolve(entry.data).then(
                (v) => (
                  /** @type {const} */
                  { settled: true, value: v }
                ),
                (e) => (
                  /** @type {const} */
                  { settled: true, error: e }
                )
              ),
              new Promise((resolve2) => {
                queueMicrotask(() => resolve2(
                  /** @type {const} */
                  { settled: false }
                ));
              })
            ]);
            if (result.settled) {
              if ("error" in result) throw result.error;
              store[remote_key] = result.value;
            }
          }
        }
      }
      const replacer = (thing) => {
        for (const key2 in options2.hooks.transport) {
          const encoded = options2.hooks.transport[key2].encode(thing);
          if (encoded) {
            return `app.decode('${key2}', ${uneval(encoded, replacer)})`;
          }
        }
      };
      if (Object.keys(query).length > 0) {
        serialized_query_data = `${global}.query = ${uneval(query, replacer)};

						`;
      }
      if (Object.keys(prerender).length > 0) {
        serialized_prerender_data = `${global}.prerender = ${uneval(prerender, replacer)};

						`;
      }
    }
    const serialized_remote_data = `${serialized_query_data}${serialized_prerender_data}`;
    const boot = client.inline ? `${client.inline.script}

					${serialized_remote_data}${global}.app.start(${args.join(", ")});` : client.app ? `Promise.all([
						import(${s(prefixed(client.start))}),
						import(${s(prefixed(client.app))})
					]).then(([kit, app]) => {
						${serialized_remote_data}kit.start(app, ${args.join(", ")});
					});` : `import(${s(prefixed(client.start))}).then((app) => {
						${serialized_remote_data}app.start(${args.join(", ")})
					});`;
    if (load_env_eagerly) {
      blocks.push(`import(${s(`${base$1}/${app_dir}/env.js`)}).then(({ env }) => {
						${global}.env = env;

						${boot.replace(/\n/g, "\n	")}
					});`);
    } else {
      blocks.push(boot);
    }
    if (options2.service_worker) {
      let opts = "";
      if (options2.service_worker_options != null) {
        const service_worker_options = { ...options2.service_worker_options };
        opts = `, ${s(service_worker_options)}`;
      }
      blocks.push(`if ('serviceWorker' in navigator) {
						addEventListener('load', function () {
							navigator.serviceWorker.register('${prefixed("service-worker.js")}'${opts});
						});
					}`);
    }
    const init_app = `
				{
					${blocks.join("\n\n					")}
				}
			`;
    csp.add_script(init_app);
    body2 += `
			<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>
		`;
  }
  const headers2 = new Headers({
    "x-sveltekit-page": "true",
    "content-type": "text/html"
  });
  if (state.prerendering) {
    const csp_headers = csp.csp_provider.get_meta();
    if (csp_headers) {
      head.add_http_equiv(csp_headers);
    }
    if (state.prerendering.cache) {
      head.add_http_equiv(
        `<meta http-equiv="cache-control" content="${state.prerendering.cache}">`
      );
    }
  } else {
    const csp_header = csp.csp_provider.get_header();
    if (csp_header) {
      headers2.set("content-security-policy", csp_header);
    }
    const report_only_header = csp.report_only_provider.get_header();
    if (report_only_header) {
      headers2.set("content-security-policy-report-only", report_only_header);
    }
    if (link_headers.size) {
      headers2.set("link", Array.from(link_headers).join(", "));
    }
  }
  const html = options2.templates.app({
    head: head.build(),
    body: body2,
    assets: assets$1,
    nonce: (
      /** @type {string} */
      csp.nonce
    ),
    env: public_env
  });
  const transformed = await resolve_opts.transformPageChunk({
    html,
    done: true
  }) || "";
  if (!chunks) {
    headers2.set("etag", `"${hash(transformed)}"`);
  }
  return !chunks ? text(transformed, {
    status,
    headers: headers2
  }) : new Response(
    new ReadableStream({
      async start(controller) {
        controller.enqueue(text_encoder.encode(transformed + "\n"));
        for await (const chunk of chunks) {
          if (chunk.length) controller.enqueue(text_encoder.encode(chunk));
        }
        controller.close();
      },
      type: "bytes"
    }),
    {
      headers: headers2
    }
  );
}
class Head {
  #rendered;
  #prerendering;
  /** @type {string[]} */
  #http_equiv = [];
  /** @type {string[]} */
  #link_tags = [];
  /** @type {string[]} */
  #script_preloads = [];
  /** @type {string[]} */
  #style_tags = [];
  /** @type {string[]} */
  #stylesheet_links = [];
  /**
   * @param {string} rendered
   * @param {boolean} prerendering
   */
  constructor(rendered, prerendering) {
    this.#rendered = rendered;
    this.#prerendering = prerendering;
  }
  build() {
    return [
      ...this.#http_equiv,
      ...this.#link_tags,
      ...this.#script_preloads,
      this.#rendered,
      ...this.#style_tags,
      ...this.#stylesheet_links
    ].join("\n		");
  }
  /**
   * @param {string} style
   * @param {string[]} attributes
   */
  add_style(style, attributes) {
    this.#style_tags.push(
      `<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`
    );
  }
  /**
   * @param {string} href
   * @param {string[]} attributes
   */
  add_stylesheet(href, attributes) {
    this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
  }
  /** @param {string} href */
  add_script_preload(href) {
    this.#script_preloads.push(
      `<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`
    );
  }
  /**
   * @param {string} href
   * @param {string[]} attributes
   */
  add_link_tag(href, attributes) {
    if (!this.#prerendering) return;
    this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
  }
  /** @param {string} tag */
  add_http_equiv(tag) {
    if (!this.#prerendering) return;
    this.#http_equiv.push(tag);
  }
}
class PageNodes {
  data;
  /**
   * @param {Array<import('types').SSRNode | undefined>} nodes
   */
  constructor(nodes) {
    this.data = nodes;
  }
  layouts() {
    return this.data.slice(0, -1);
  }
  page() {
    return this.data.at(-1);
  }
  validate() {
    for (const layout of this.layouts()) {
      if (layout) {
        validate_layout_server_exports(
          layout.server,
          /** @type {string} */
          layout.server_id
        );
        validate_layout_exports(
          layout.universal,
          /** @type {string} */
          layout.universal_id
        );
      }
    }
    const page = this.page();
    if (page) {
      validate_page_server_exports(
        page.server,
        /** @type {string} */
        page.server_id
      );
      validate_page_exports(
        page.universal,
        /** @type {string} */
        page.universal_id
      );
    }
  }
  /**
   * @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash'} Option
   * @param {Option} option
   * @returns {Value | undefined}
   */
  #get_option(option) {
    return this.data.reduce(
      (value, node) => {
        return node?.universal?.[option] ?? node?.server?.[option] ?? value;
      },
      /** @type {Value | undefined} */
      void 0
    );
  }
  csr() {
    return this.#get_option("csr") ?? true;
  }
  ssr() {
    return this.#get_option("ssr") ?? true;
  }
  prerender() {
    return this.#get_option("prerender") ?? false;
  }
  trailing_slash() {
    return this.#get_option("trailingSlash") ?? "never";
  }
  get_config() {
    let current2 = {};
    for (const node of this.data) {
      if (!node?.universal?.config && !node?.server?.config) continue;
      current2 = {
        ...current2,
        // TODO: should we override the server config value with the universal value similar to other page options?
        ...node?.universal?.config,
        ...node?.server?.config
      };
    }
    return Object.keys(current2).length ? current2 : void 0;
  }
  should_prerender_data() {
    return this.data.some(
      // prerender in case of trailingSlash because the client retrieves that value from the server
      (node) => node?.server?.load || node?.server?.trailingSlash !== void 0
    );
  }
}
async function respond_with_error({
  event,
  event_state,
  options: options2,
  manifest,
  state,
  status,
  error: error2,
  resolve_opts
}) {
  if (event.request.headers.get("x-sveltekit-error")) {
    return static_error_page(
      options2,
      status,
      /** @type {Error} */
      error2.message
    );
  }
  const fetched = [];
  try {
    const branch = [];
    const default_layout = await manifest._.nodes[0]();
    const nodes = new PageNodes([default_layout]);
    const ssr = nodes.ssr();
    const csr = nodes.csr();
    const data_serializer = server_data_serializer(event, event_state, options2);
    if (ssr) {
      state.error = true;
      const server_data_promise = load_server_data({
        event,
        event_state,
        state,
        node: default_layout,
        // eslint-disable-next-line @typescript-eslint/require-await
        parent: async () => ({})
      });
      const server_data = await server_data_promise;
      data_serializer.add_node(0, server_data);
      const data = await load_data({
        event,
        event_state,
        fetched,
        node: default_layout,
        // eslint-disable-next-line @typescript-eslint/require-await
        parent: async () => ({}),
        resolve_opts,
        server_data_promise,
        state,
        csr
      });
      branch.push(
        {
          node: default_layout,
          server_data,
          data
        },
        {
          node: await manifest._.nodes[1](),
          // 1 is always the root error
          data: null,
          server_data: null
        }
      );
    }
    return await render_response({
      options: options2,
      manifest,
      state,
      page_config: {
        ssr,
        csr
      },
      status,
      error: await handle_error_and_jsonify(event, event_state, options2, error2),
      branch,
      error_components: [],
      fetched,
      event,
      event_state,
      resolve_opts,
      data_serializer
    });
  } catch (e) {
    if (e instanceof Redirect) {
      return redirect_response(e.status, e.location);
    }
    return static_error_page(
      options2,
      get_status(e),
      (await handle_error_and_jsonify(event, event_state, options2, e)).message
    );
  }
}
async function handle_remote_call(event, state, options2, manifest, id) {
  return record_span({
    name: "sveltekit.remote.call",
    attributes: {},
    fn: (current2) => {
      const traced_event = merge_tracing(event, current2);
      return with_request_store(
        { event: traced_event, state },
        () => handle_remote_call_internal(traced_event, state, options2, manifest, id)
      );
    }
  });
}
async function handle_remote_call_internal(event, state, options2, manifest, id) {
  const [hash2, name, additional_args] = id.split("/");
  const remotes = manifest._.remotes;
  if (!remotes[hash2]) error(404);
  const module = await remotes[hash2]();
  const fn = module.default[name];
  if (!fn) error(404);
  const internals = fn.__;
  const transport = options2.hooks.transport;
  event.tracing.current.setAttributes({
    "sveltekit.remote.call.type": internals.type,
    "sveltekit.remote.call.name": internals.name
  });
  try {
    if (internals.type === "query_batch") {
      if (event.request.method !== "POST") {
        throw new SvelteKitError(
          405,
          "Method Not Allowed",
          `\`query.batch\` functions must be invoked via POST request, not ${event.request.method}`
        );
      }
      const { payloads } = await event.request.json();
      const args = await Promise.all(
        payloads.map((payload2) => parse_remote_arg(payload2, transport))
      );
      const results = await with_request_store(
        { event, state },
        () => internals.run(args, options2)
      );
      return json(
        /** @type {RemoteFunctionResponse} */
        {
          type: "result",
          result: stringify$1(results, transport)
        }
      );
    }
    if (internals.type === "form") {
      if (event.request.method !== "POST") {
        throw new SvelteKitError(
          405,
          "Method Not Allowed",
          `\`form\` functions must be invoked via POST request, not ${event.request.method}`
        );
      }
      if (!is_form_content_type(event.request)) {
        throw new SvelteKitError(
          415,
          "Unsupported Media Type",
          `\`form\` functions expect form-encoded data — received ${event.request.headers.get(
            "content-type"
          )}`
        );
      }
      const { data: data2, meta, form_data } = await deserialize_binary_form(event.request);
      state.remote.requested = create_requested_map(meta.remote_refreshes);
      if (additional_args && !("id" in data2)) {
        data2.id = JSON.parse(decodeURIComponent(additional_args));
      }
      const fn2 = internals.fn;
      const result = await with_request_store({ event, state }, () => fn2(data2, meta, form_data));
      return json(
        /** @type {RemoteFunctionResponse} */
        {
          type: "result",
          result: stringify$1(result, transport),
          refreshes: result.issues ? void 0 : await serialize_refreshes()
        }
      );
    }
    if (internals.type === "command") {
      const { payload: payload2, refreshes } = await event.request.json();
      state.remote.requested = create_requested_map(refreshes);
      const arg = parse_remote_arg(payload2, transport);
      const data2 = await with_request_store({ event, state }, () => fn(arg));
      return json(
        /** @type {RemoteFunctionResponse} */
        {
          type: "result",
          result: stringify$1(data2, transport),
          refreshes: await serialize_refreshes()
        }
      );
    }
    const payload = internals.type === "prerender" ? additional_args : (
      /** @type {string} */
      // new URL(...) necessary because we're hiding the URL from the user in the event object
      new URL(event.request.url).searchParams.get("payload")
    );
    const data = await with_request_store(
      { event, state },
      () => fn(parse_remote_arg(payload, transport))
    );
    return json(
      /** @type {RemoteFunctionResponse} */
      {
        type: "result",
        result: stringify$1(data, transport)
      }
    );
  } catch (error2) {
    if (error2 instanceof Redirect) {
      return json(
        /** @type {RemoteFunctionResponse} */
        {
          type: "redirect",
          location: error2.location,
          refreshes: await serialize_refreshes()
        }
      );
    }
    const status = error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500;
    return json(
      /** @type {RemoteFunctionResponse} */
      {
        type: "error",
        error: await handle_error_and_jsonify(event, state, options2, error2),
        status
      },
      {
        // By setting a non-200 during prerendering we fail the prerender process (unless handleHttpError handles it).
        // Errors at runtime will be passed to the client and are handled there
        status: state.prerendering ? status : void 0,
        headers: {
          "cache-control": "private, no-store"
        }
      }
    );
  }
  async function serialize_refreshes() {
    const refreshes = state.remote.refreshes ?? {};
    const entries = Object.entries(refreshes);
    if (entries.length === 0) {
      return void 0;
    }
    const results = await Promise.all(
      entries.map(async ([key2, promise]) => {
        try {
          return [key2, { type: "result", data: await promise }];
        } catch (error2) {
          const status = error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500;
          return [
            key2,
            {
              type: "error",
              status,
              error: await handle_error_and_jsonify(event, state, options2, error2)
            }
          ];
        }
      })
    );
    return stringify$1(Object.fromEntries(results), transport);
  }
}
function create_requested_map(refreshes) {
  const requested = /* @__PURE__ */ new Map();
  for (const key2 of refreshes ?? []) {
    const parts = split_remote_key(key2);
    const existing = requested.get(parts.id);
    if (existing) {
      existing.push(parts.payload);
    } else {
      requested.set(parts.id, [parts.payload]);
    }
  }
  return requested;
}
async function handle_remote_form_post(event, state, manifest, id) {
  return record_span({
    name: "sveltekit.remote.form.post",
    attributes: {},
    fn: (current2) => {
      const traced_event = merge_tracing(event, current2);
      return with_request_store(
        { event: traced_event, state },
        () => handle_remote_form_post_internal(traced_event, state, manifest, id)
      );
    }
  });
}
async function handle_remote_form_post_internal(event, state, manifest, id) {
  const [hash2, name, action_id] = id.split("/");
  const remotes = manifest._.remotes;
  const module = await remotes[hash2]?.();
  let form = (
    /** @type {RemoteForm<any, any>} */
    module?.default[name]
  );
  if (!form) {
    event.setHeaders({
      // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
      // "The server must generate an Allow header field in a 405 status code response"
      allow: "GET"
    });
    return {
      type: "error",
      error: new SvelteKitError(
        405,
        "Method Not Allowed",
        `POST method not allowed. No form actions exist for ${"this page"}`
      )
    };
  }
  if (action_id) {
    form = with_request_store({ event, state }, () => form.for(JSON.parse(action_id)));
  }
  try {
    const fn = (
      /** @type {RemoteFormInternals} */
      /** @type {any} */
      form.__.fn
    );
    const { data, meta, form_data } = await deserialize_binary_form(event.request);
    if (action_id && !("id" in data)) {
      data.id = JSON.parse(decodeURIComponent(action_id));
    }
    await with_request_store({ event, state }, () => fn(data, meta, form_data));
    return {
      type: "success",
      status: 200
    };
  } catch (e) {
    const err = normalize_error(e);
    if (err instanceof Redirect) {
      return {
        type: "redirect",
        status: err.status,
        location: err.location
      };
    }
    return {
      type: "error",
      error: check_incorrect_fail_use(err)
    };
  }
}
function get_remote_id(url) {
  return url.pathname.startsWith(`${base}/${app_dir}/remote/`) && url.pathname.replace(`${base}/${app_dir}/remote/`, "");
}
function get_remote_action(url) {
  return url.searchParams.get("/remote");
}
const MAX_DEPTH = 10;
async function render_page(event, event_state, page, options2, manifest, state, nodes, resolve_opts) {
  if (state.depth > MAX_DEPTH) {
    return text(`Not found: ${event.url.pathname}`, {
      status: 404
      // TODO in some cases this should be 500. not sure how to differentiate
    });
  }
  if (is_action_json_request(event)) {
    const node = await manifest._.nodes[page.leaf]();
    return handle_action_json_request(event, event_state, options2, node?.server);
  }
  try {
    const leaf_node = (
      /** @type {import('types').SSRNode} */
      nodes.page()
    );
    let status = 200;
    let action_result = void 0;
    if (is_action_request(event)) {
      const remote_id = get_remote_action(event.url);
      if (remote_id) {
        action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
      } else {
        action_result = await handle_action_request(event, event_state, leaf_node.server);
      }
      if (action_result?.type === "redirect") {
        return redirect_response(action_result.status, action_result.location);
      }
      if (action_result?.type === "error") {
        status = get_status(action_result.error);
      }
      if (action_result?.type === "failure") {
        status = action_result.status;
      }
    }
    const should_prerender = nodes.prerender();
    if (should_prerender) {
      const mod = leaf_node.server;
      if (mod?.actions) {
        throw new Error("Cannot prerender pages with actions");
      }
    } else if (state.prerendering) {
      return new Response(void 0, {
        status: 204
      });
    }
    state.prerender_default = should_prerender;
    const should_prerender_data = nodes.should_prerender_data();
    const data_pathname = add_data_suffix(event.url.pathname);
    const fetched = [];
    const ssr = nodes.ssr();
    const csr = nodes.csr();
    if (ssr === false && !(state.prerendering && should_prerender_data)) {
      if (BROWSER && action_result && !event.request.headers.has("x-sveltekit-action")) ;
      return await render_response({
        branch: [],
        fetched,
        page_config: {
          ssr: false,
          csr
        },
        status,
        error: null,
        event,
        event_state,
        options: options2,
        manifest,
        state,
        resolve_opts,
        data_serializer: server_data_serializer(event, event_state, options2)
      });
    }
    const branch = [];
    let load_error = null;
    const data_serializer = server_data_serializer(event, event_state, options2);
    const data_serializer_json = state.prerendering && should_prerender_data ? server_data_serializer_json(event, event_state, options2) : null;
    const server_promises = nodes.data.map((node, i) => {
      if (load_error) {
        throw load_error;
      }
      return Promise.resolve().then(async () => {
        try {
          if (node === leaf_node && action_result?.type === "error") {
            throw action_result.error;
          }
          const server_data = await load_server_data({
            event,
            event_state,
            state,
            node,
            parent: async () => {
              const data = {};
              for (let j = 0; j < i; j += 1) {
                const parent = await server_promises[j];
                if (parent) Object.assign(data, parent.data);
              }
              return data;
            }
          });
          if (node) {
            data_serializer.add_node(i, server_data);
          }
          data_serializer_json?.add_node(i, server_data);
          return server_data;
        } catch (e) {
          load_error = /** @type {Error} */
          e;
          throw load_error;
        }
      });
    });
    const load_promises = nodes.data.map((node, i) => {
      if (load_error) throw load_error;
      return Promise.resolve().then(async () => {
        try {
          return await load_data({
            event,
            event_state,
            fetched,
            node,
            parent: async () => {
              const data = {};
              for (let j = 0; j < i; j += 1) {
                Object.assign(data, await load_promises[j]);
              }
              return data;
            },
            resolve_opts,
            server_data_promise: server_promises[i],
            state,
            csr
          });
        } catch (e) {
          load_error = /** @type {Error} */
          e;
          throw load_error;
        }
      });
    });
    for (const p of server_promises) p.catch(() => {
    });
    for (const p of load_promises) p.catch(() => {
    });
    for (let i = 0; i < nodes.data.length; i += 1) {
      const node = nodes.data[i];
      if (node) {
        try {
          const server_data = await server_promises[i];
          const data = await load_promises[i];
          branch.push({ node, server_data, data });
        } catch (e) {
          const err = normalize_error(e);
          if (err instanceof Redirect) {
            if (state.prerendering && should_prerender_data) {
              const body2 = JSON.stringify({
                type: "redirect",
                location: err.location
              });
              state.prerendering.dependencies.set(data_pathname, {
                response: text(body2),
                body: body2
              });
            }
            return redirect_response(err.status, err.location);
          }
          const status2 = get_status(err);
          const error2 = await handle_error_and_jsonify(event, event_state, options2, err);
          while (i--) {
            if (page.errors[i]) {
              const index = (
                /** @type {number} */
                page.errors[i]
              );
              const node2 = await manifest._.nodes[index]();
              let j = i;
              while (!branch[j]) j -= 1;
              data_serializer.set_max_nodes(j + 1);
              const layouts = compact(branch.slice(0, j + 1));
              const nodes2 = new PageNodes(layouts.map((layout) => layout.node));
              const error_branch = layouts.concat({
                node: node2,
                data: null,
                server_data: null
              });
              return await render_response({
                event,
                event_state,
                options: options2,
                manifest,
                state,
                resolve_opts,
                page_config: {
                  ssr: nodes2.ssr(),
                  csr: nodes2.csr()
                },
                status: status2,
                error: error2,
                error_components: await load_error_components(
                  options2,
                  ssr,
                  error_branch,
                  page,
                  manifest
                ),
                branch: error_branch,
                fetched,
                data_serializer
              });
            }
          }
          return static_error_page(options2, status2, error2.message);
        }
      } else {
        branch.push(null);
      }
    }
    if (state.prerendering && data_serializer_json) {
      let { data, chunks } = data_serializer_json.get_data();
      if (chunks) {
        for await (const chunk of chunks) {
          data += chunk;
        }
      }
      state.prerendering.dependencies.set(data_pathname, {
        response: text(data),
        body: data
      });
    }
    return await render_response({
      event,
      event_state,
      options: options2,
      manifest,
      state,
      resolve_opts,
      page_config: {
        csr,
        ssr
      },
      status,
      error: null,
      branch: !ssr ? [] : compact(branch),
      action_result,
      fetched,
      data_serializer: !ssr ? server_data_serializer(event, event_state, options2) : data_serializer,
      error_components: await load_error_components(options2, ssr, branch, page, manifest)
    });
  } catch (e) {
    if (e instanceof Redirect) {
      return redirect_response(e.status, e.location);
    }
    return await respond_with_error({
      event,
      event_state,
      options: options2,
      manifest,
      state,
      status: e instanceof HttpError ? e.status : 500,
      error: e,
      resolve_opts
    });
  }
}
async function load_error_components(options2, ssr, branch, page, manifest) {
  let error_components;
  if (options2.server_error_boundaries && ssr) {
    let last_idx = -1;
    error_components = await Promise.all(
      // eslint-disable-next-line @typescript-eslint/await-thenable
      branch.map((b, i) => {
        if (i === 0) return void 0;
        if (!b) return null;
        i--;
        while (i > last_idx + 1 && page.errors[i] === void 0) i -= 1;
        last_idx = i;
        const idx = page.errors[i];
        if (idx == null) return void 0;
        return manifest._.nodes[idx]?.().then((e) => e.component?.()).catch(() => void 0);
      }).filter((e) => e !== null)
    );
  }
  return error_components;
}
function once(fn) {
  let done = false;
  let result;
  return () => {
    if (done) return result;
    done = true;
    return result = fn();
  };
}
async function render_data(event, event_state, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
  if (!route.page) {
    return new Response(void 0, {
      status: 404
    });
  }
  try {
    const node_ids = [...route.page.layouts, route.page.leaf];
    const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
    let aborted = false;
    const url = new URL(event.url);
    url.pathname = normalize_path(url.pathname, trailing_slash);
    const new_event = { ...event, url };
    const functions = node_ids.map((n, i) => {
      return once(async () => {
        try {
          if (aborted) {
            return (
              /** @type {import('types').ServerDataSkippedNode} */
              {
                type: "skip"
              }
            );
          }
          const node = n == void 0 ? n : await manifest._.nodes[n]();
          return load_server_data({
            event: new_event,
            event_state,
            state,
            node,
            parent: async () => {
              const data2 = {};
              for (let j = 0; j < i; j += 1) {
                const parent = (
                  /** @type {import('types').ServerDataNode | null} */
                  await functions[j]()
                );
                if (parent) {
                  Object.assign(data2, parent.data);
                }
              }
              return data2;
            }
          });
        } catch (e) {
          aborted = true;
          throw e;
        }
      });
    });
    const promises = functions.map(async (fn, i) => {
      if (!invalidated[i]) {
        return (
          /** @type {import('types').ServerDataSkippedNode} */
          {
            type: "skip"
          }
        );
      }
      return fn();
    });
    let length = promises.length;
    const nodes = await Promise.all(
      promises.map(
        (p, i) => p.catch(async (error2) => {
          if (error2 instanceof Redirect) {
            throw error2;
          }
          length = Math.min(length, i + 1);
          return (
            /** @type {import('types').ServerErrorNode} */
            {
              type: "error",
              error: await handle_error_and_jsonify(event, event_state, options2, error2),
              status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : void 0
            }
          );
        })
      )
    );
    const data_serializer = server_data_serializer_json(event, event_state, options2);
    for (let i = 0; i < nodes.length; i++) data_serializer.add_node(i, nodes[i]);
    const { data, chunks } = data_serializer.get_data();
    if (!chunks) {
      return json_response(data);
    }
    return new Response(
      new ReadableStream({
        async start(controller) {
          controller.enqueue(text_encoder.encode(data));
          for await (const chunk of chunks) {
            controller.enqueue(text_encoder.encode(chunk));
          }
          controller.close();
        },
        type: "bytes"
      }),
      {
        headers: {
          // we use a proprietary content type to prevent buffering.
          // the `text` prefix makes it inspectable
          "content-type": "text/sveltekit-data",
          "cache-control": "private, no-store"
        }
      }
    );
  } catch (e) {
    const error2 = normalize_error(e);
    if (error2 instanceof Redirect) {
      return redirect_json_response(error2);
    } else {
      return json_response(await handle_error_and_jsonify(event, event_state, options2, error2), 500);
    }
  }
}
function json_response(json2, status = 200) {
  return text(typeof json2 === "string" ? json2 : JSON.stringify(json2), {
    status,
    headers: {
      "content-type": "application/json",
      "cache-control": "private, no-store"
    }
  });
}
function redirect_json_response(redirect) {
  return json_response(
    /** @type {import('types').ServerRedirectNode} */
    {
      type: "redirect",
      location: redirect.location
    }
  );
}
var cookie = {};
var hasRequiredCookie;
function requireCookie() {
  if (hasRequiredCookie) return cookie;
  hasRequiredCookie = 1;
  cookie.parse = parse;
  cookie.serialize = serialize;
  var __toString = Object.prototype.toString;
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
  function parse(str, options2) {
    if (typeof str !== "string") {
      throw new TypeError("argument str must be a string");
    }
    var obj = {};
    var opt = options2 || {};
    var dec = opt.decode || decode;
    var index = 0;
    while (index < str.length) {
      var eqIdx = str.indexOf("=", index);
      if (eqIdx === -1) {
        break;
      }
      var endIdx = str.indexOf(";", index);
      if (endIdx === -1) {
        endIdx = str.length;
      } else if (endIdx < eqIdx) {
        index = str.lastIndexOf(";", eqIdx - 1) + 1;
        continue;
      }
      var key2 = str.slice(index, eqIdx).trim();
      if (void 0 === obj[key2]) {
        var val = str.slice(eqIdx + 1, endIdx).trim();
        if (val.charCodeAt(0) === 34) {
          val = val.slice(1, -1);
        }
        obj[key2] = tryDecode(val, dec);
      }
      index = endIdx + 1;
    }
    return obj;
  }
  function serialize(name, val, options2) {
    var opt = options2 || {};
    var enc = opt.encode || encode2;
    if (typeof enc !== "function") {
      throw new TypeError("option encode is invalid");
    }
    if (!fieldContentRegExp.test(name)) {
      throw new TypeError("argument name is invalid");
    }
    var value = enc(val);
    if (value && !fieldContentRegExp.test(value)) {
      throw new TypeError("argument val is invalid");
    }
    var str = name + "=" + value;
    if (null != opt.maxAge) {
      var maxAge = opt.maxAge - 0;
      if (isNaN(maxAge) || !isFinite(maxAge)) {
        throw new TypeError("option maxAge is invalid");
      }
      str += "; Max-Age=" + Math.floor(maxAge);
    }
    if (opt.domain) {
      if (!fieldContentRegExp.test(opt.domain)) {
        throw new TypeError("option domain is invalid");
      }
      str += "; Domain=" + opt.domain;
    }
    if (opt.path) {
      if (!fieldContentRegExp.test(opt.path)) {
        throw new TypeError("option path is invalid");
      }
      str += "; Path=" + opt.path;
    }
    if (opt.expires) {
      var expires = opt.expires;
      if (!isDate(expires) || isNaN(expires.valueOf())) {
        throw new TypeError("option expires is invalid");
      }
      str += "; Expires=" + expires.toUTCString();
    }
    if (opt.httpOnly) {
      str += "; HttpOnly";
    }
    if (opt.secure) {
      str += "; Secure";
    }
    if (opt.partitioned) {
      str += "; Partitioned";
    }
    if (opt.priority) {
      var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
      switch (priority) {
        case "low":
          str += "; Priority=Low";
          break;
        case "medium":
          str += "; Priority=Medium";
          break;
        case "high":
          str += "; Priority=High";
          break;
        default:
          throw new TypeError("option priority is invalid");
      }
    }
    if (opt.sameSite) {
      var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
      switch (sameSite) {
        case true:
          str += "; SameSite=Strict";
          break;
        case "lax":
          str += "; SameSite=Lax";
          break;
        case "strict":
          str += "; SameSite=Strict";
          break;
        case "none":
          str += "; SameSite=None";
          break;
        default:
          throw new TypeError("option sameSite is invalid");
      }
    }
    return str;
  }
  function decode(str) {
    return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
  }
  function encode2(val) {
    return encodeURIComponent(val);
  }
  function isDate(val) {
    return __toString.call(val) === "[object Date]" || val instanceof Date;
  }
  function tryDecode(str, decode2) {
    try {
      return decode2(str);
    } catch (e) {
      return str;
    }
  }
  return cookie;
}
var cookieExports = requireCookie();
const INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
function validate_options(options2) {
  if (options2?.path === void 0) {
    throw new Error("You must specify a `path` when setting, deleting or serializing cookies");
  }
}
function generate_cookie_key(domain, path, name) {
  return `${domain || ""}${path}?${encodeURIComponent(name)}`;
}
function get_cookies(request, url) {
  const header = request.headers.get("cookie") ?? "";
  const initial_cookies = cookieExports.parse(header, { decode: (value) => value });
  let normalized_url;
  const new_cookies = /* @__PURE__ */ new Map();
  const defaults = {
    httpOnly: true,
    sameSite: "lax",
    secure: url.hostname === "localhost" && url.protocol === "http:" ? false : true
  };
  const cookies = {
    // The JSDoc param annotations appearing below for get, set and delete
    // are necessary to expose the `cookie` library types to
    // typescript users. `@type {import('@sveltejs/kit').Cookies}` above is not
    // sufficient to do so.
    /**
     * @param {string} name
     * @param {import('cookie').CookieParseOptions} [opts]
     */
    get(name, opts) {
      const best_match = Array.from(new_cookies.values()).filter((c) => {
        return c.name === name && domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path);
      }).sort((a, b) => b.options.path.length - a.options.path.length)[0];
      if (best_match) {
        return best_match.options.maxAge === 0 ? void 0 : best_match.value;
      }
      const req_cookies = cookieExports.parse(header, { decode: opts?.decode });
      const cookie2 = req_cookies[name];
      return cookie2;
    },
    /**
     * @param {import('cookie').CookieParseOptions} [opts]
     */
    getAll(opts) {
      const cookies2 = cookieExports.parse(header, { decode: opts?.decode });
      const lookup = /* @__PURE__ */ new Map();
      for (const c of new_cookies.values()) {
        if (domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
          const existing = lookup.get(c.name);
          if (!existing || c.options.path.length > existing.options.path.length) {
            lookup.set(c.name, c);
          }
        }
      }
      for (const c of lookup.values()) {
        cookies2[c.name] = c.value;
      }
      return Object.entries(cookies2).map(([name, value]) => ({ name, value }));
    },
    /**
     * @param {string} name
     * @param {string} value
     * @param {import('./page/types.js').Cookie['options']} options
     */
    set(name, value, options2) {
      const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
      if (illegal_characters) {
        console.warn(
          `The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(
            " and "
          )}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`
        );
      }
      validate_options(options2);
      set_internal(name, value, { ...defaults, ...options2 });
    },
    /**
     * @param {string} name
     *  @param {import('./page/types.js').Cookie['options']} options
     */
    delete(name, options2) {
      validate_options(options2);
      cookies.set(name, "", { ...options2, maxAge: 0 });
    },
    /**
     * @param {string} name
     * @param {string} value
     *  @param {import('./page/types.js').Cookie['options']} options
     */
    serialize(name, value, options2) {
      validate_options(options2);
      let path = options2.path;
      if (!options2.domain || options2.domain === url.hostname) {
        if (!normalized_url) {
          throw new Error("Cannot serialize cookies until after the route is determined");
        }
        path = resolve(normalized_url, path);
      }
      return cookieExports.serialize(name, value, { ...defaults, ...options2, path });
    }
  };
  function get_cookie_header(destination, header2) {
    const combined_cookies = {
      // cookies sent by the user agent have lowest precedence
      ...initial_cookies
    };
    for (const cookie2 of new_cookies.values()) {
      if (!domain_matches(destination.hostname, cookie2.options.domain)) continue;
      if (!path_matches(destination.pathname, cookie2.options.path)) continue;
      const encoder = cookie2.options.encode || encodeURIComponent;
      combined_cookies[cookie2.name] = encoder(cookie2.value);
    }
    if (header2) {
      const parsed = cookieExports.parse(header2, { decode: (value) => value });
      for (const name in parsed) {
        combined_cookies[name] = parsed[name];
      }
    }
    return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
  }
  const internal_queue = [];
  function set_internal(name, value, options2) {
    if (!normalized_url) {
      internal_queue.push(() => set_internal(name, value, options2));
      return;
    }
    let path = options2.path;
    if (!options2.domain || options2.domain === url.hostname) {
      path = resolve(normalized_url, path);
    }
    const cookie_key = generate_cookie_key(options2.domain, path, name);
    const cookie2 = { name, value, options: { ...options2, path } };
    new_cookies.set(cookie_key, cookie2);
  }
  function set_trailing_slash(trailing_slash) {
    normalized_url = normalize_path(url.pathname, trailing_slash);
    internal_queue.forEach((fn) => fn());
  }
  return { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash };
}
function domain_matches(hostname, constraint) {
  if (!constraint) return true;
  const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
  if (hostname === normalized) return true;
  return hostname.endsWith("." + normalized);
}
function path_matches(path, constraint) {
  if (!constraint) return true;
  const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
  if (path === normalized) return true;
  return path.startsWith(normalized + "/");
}
function add_cookies_to_headers(headers2, cookies) {
  for (const new_cookie of cookies) {
    const { name, value, options: options2 } = new_cookie;
    headers2.append("set-cookie", cookieExports.serialize(name, value, options2));
    if (options2.path.endsWith(".html")) {
      const path = add_data_suffix(options2.path);
      headers2.append("set-cookie", cookieExports.serialize(name, value, { ...options2, path }));
    }
  }
}
var defaultParseOptions = {
  decodeValues: true,
  map: false,
  silent: false,
  split: "auto"
  // auto = split strings but not arrays
};
function isForbiddenKey(key2) {
  return typeof key2 !== "string" || key2 in {};
}
function createNullObj() {
  return /* @__PURE__ */ Object.create(null);
}
function isNonEmptyString(str) {
  return typeof str === "string" && !!str.trim();
}
function parseString(setCookieValue, options2) {
  var parts = setCookieValue.split(";").filter(isNonEmptyString);
  var nameValuePairStr = parts.shift();
  var parsed = parseNameValuePair(nameValuePairStr);
  var name = parsed.name;
  var value = parsed.value;
  options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
  if (isForbiddenKey(name)) {
    return null;
  }
  try {
    value = options2.decodeValues ? decodeURIComponent(value) : value;
  } catch (e) {
    console.error(
      "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
      e
    );
  }
  var cookie2 = createNullObj();
  cookie2.name = name;
  cookie2.value = value;
  parts.forEach(function(part) {
    var sides = part.split("=");
    var key2 = sides.shift().trimLeft().toLowerCase();
    if (isForbiddenKey(key2)) {
      return;
    }
    var value2 = sides.join("=");
    if (key2 === "expires") {
      cookie2.expires = new Date(value2);
    } else if (key2 === "max-age") {
      var n = parseInt(value2, 10);
      if (!Number.isNaN(n)) cookie2.maxAge = n;
    } else if (key2 === "secure") {
      cookie2.secure = true;
    } else if (key2 === "httponly") {
      cookie2.httpOnly = true;
    } else if (key2 === "samesite") {
      cookie2.sameSite = value2;
    } else if (key2 === "partitioned") {
      cookie2.partitioned = true;
    } else if (key2) {
      cookie2[key2] = value2;
    }
  });
  return cookie2;
}
function parseNameValuePair(nameValuePairStr) {
  var name = "";
  var value = "";
  var nameValueArr = nameValuePairStr.split("=");
  if (nameValueArr.length > 1) {
    name = nameValueArr.shift();
    value = nameValueArr.join("=");
  } else {
    value = nameValuePairStr;
  }
  return { name, value };
}
function parseSetCookie(input, options2) {
  options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
  if (!input) {
    if (!options2.map) {
      return [];
    } else {
      return createNullObj();
    }
  }
  if (input.headers) {
    if (typeof input.headers.getSetCookie === "function") {
      input = input.headers.getSetCookie();
    } else if (input.headers["set-cookie"]) {
      input = input.headers["set-cookie"];
    } else {
      var sch = input.headers[Object.keys(input.headers).find(function(key2) {
        return key2.toLowerCase() === "set-cookie";
      })];
      if (!sch && input.headers.cookie && !options2.silent) {
        console.warn(
          "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
        );
      }
      input = sch;
    }
  }
  var split = options2.split;
  var isArray = Array.isArray(input);
  if (split === "auto") {
    split = !isArray;
  }
  if (!isArray) {
    input = [input];
  }
  input = input.filter(isNonEmptyString);
  if (split) {
    input = input.map(splitCookiesString).flat();
  }
  if (!options2.map) {
    return input.map(function(str) {
      return parseString(str, options2);
    }).filter(Boolean);
  } else {
    var cookies = createNullObj();
    return input.reduce(function(cookies2, str) {
      var cookie2 = parseString(str, options2);
      if (cookie2 && !isForbiddenKey(cookie2.name)) {
        cookies2[cookie2.name] = cookie2;
      }
      return cookies2;
    }, cookies);
  }
}
function splitCookiesString(cookiesString) {
  if (Array.isArray(cookiesString)) {
    return cookiesString;
  }
  if (typeof cookiesString !== "string") {
    return [];
  }
  var cookiesStrings = [];
  var pos = 0;
  var start;
  var ch;
  var lastComma;
  var nextStart;
  var cookiesSeparatorFound;
  function skipWhitespace() {
    while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
      pos += 1;
    }
    return pos < cookiesString.length;
  }
  function notSpecialChar() {
    ch = cookiesString.charAt(pos);
    return ch !== "=" && ch !== ";" && ch !== ",";
  }
  while (pos < cookiesString.length) {
    start = pos;
    cookiesSeparatorFound = false;
    while (skipWhitespace()) {
      ch = cookiesString.charAt(pos);
      if (ch === ",") {
        lastComma = pos;
        pos += 1;
        skipWhitespace();
        nextStart = pos;
        while (pos < cookiesString.length && notSpecialChar()) {
          pos += 1;
        }
        if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
          cookiesSeparatorFound = true;
          pos = nextStart;
          cookiesStrings.push(cookiesString.substring(start, lastComma));
          start = pos;
        } else {
          pos = lastComma + 1;
        }
      } else {
        pos += 1;
      }
    }
    if (!cookiesSeparatorFound || pos >= cookiesString.length) {
      cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
    }
  }
  return cookiesStrings;
}
parseSetCookie.parseSetCookie = parseSetCookie;
parseSetCookie.parse = parseSetCookie;
parseSetCookie.parseString = parseString;
parseSetCookie.splitCookiesString = splitCookiesString;
function create_fetch({ event, options: options2, manifest, state, get_cookie_header, set_internal }) {
  const server_fetch = async (info, init2) => {
    const original_request = normalize_fetch_input(info, init2, event.url);
    let mode = (info instanceof Request ? info.mode : init2?.mode) ?? "cors";
    let credentials = (info instanceof Request ? info.credentials : init2?.credentials) ?? "same-origin";
    return options2.hooks.handleFetch({
      event,
      request: original_request,
      fetch: async (info2, init3) => {
        const request = normalize_fetch_input(info2, init3, event.url);
        const url = new URL(request.url);
        if (!request.headers.has("origin")) {
          request.headers.set("origin", event.url.origin);
        }
        if (info2 !== original_request) {
          mode = (info2 instanceof Request ? info2.mode : init3?.mode) ?? "cors";
          credentials = (info2 instanceof Request ? info2.credentials : init3?.credentials) ?? "same-origin";
        }
        if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) {
          request.headers.delete("origin");
        }
        const decoded = decodeURIComponent(url.pathname);
        if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
          if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
            const cookie2 = get_cookie_header(url, request.headers.get("cookie"));
            if (cookie2) request.headers.set("cookie", cookie2);
          }
          return fetch(request);
        }
        const prefix = assets || base;
        const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
        const filename_html = `${filename}/index.html`;
        const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
        const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest._.server_assets;
        if (is_asset || is_asset_html) {
          const file = is_asset ? filename : filename_html;
          if (state.read) {
            const type = is_asset ? manifest.mimeTypes[filename.slice(filename.lastIndexOf("."))] : "text/html";
            return new Response(state.read(file), {
              headers: type ? { "content-type": type } : {}
            });
          } else if (read_implementation && file in manifest._.server_assets) {
            const length = manifest._.server_assets[file];
            const type = manifest.mimeTypes[file.slice(file.lastIndexOf("."))];
            return new Response(read_implementation(file), {
              headers: {
                "Content-Length": "" + length,
                "Content-Type": type
              }
            });
          }
          return await fetch(request);
        }
        if (has_prerendered_path(manifest, base + decoded)) {
          return await fetch(request);
        }
        if (credentials !== "omit") {
          const cookie2 = get_cookie_header(url, request.headers.get("cookie"));
          if (cookie2) {
            request.headers.set("cookie", cookie2);
          }
          const authorization = event.request.headers.get("authorization");
          if (authorization && !request.headers.has("authorization")) {
            request.headers.set("authorization", authorization);
          }
        }
        if (!request.headers.has("accept")) {
          request.headers.set("accept", "*/*");
        }
        if (!request.headers.has("accept-language")) {
          request.headers.set(
            "accept-language",
            /** @type {string} */
            event.request.headers.get("accept-language")
          );
        }
        const response = await internal_fetch(request, options2, manifest, state);
        const set_cookie = response.headers.get("set-cookie");
        if (set_cookie) {
          for (const str of splitCookiesString(set_cookie)) {
            const { name, value, ...options3 } = parseString(str, {
              decodeValues: false
            });
            const path = options3.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/");
            set_internal(name, value, {
              path,
              encode: (value2) => value2,
              .../** @type {import('cookie').CookieSerializeOptions} */
              options3
            });
          }
        }
        return response;
      }
    });
  };
  return (input, init2) => {
    const response = server_fetch(input, init2);
    response.catch(() => {
    });
    return response;
  };
}
function normalize_fetch_input(info, init2, url) {
  if (info instanceof Request) {
    return info;
  }
  return new Request(typeof info === "string" ? new URL(info, url) : info, init2);
}
async function internal_fetch(request, options2, manifest, state) {
  if (request.signal) {
    if (request.signal.aborted) {
      throw new DOMException("The operation was aborted.", "AbortError");
    }
    let remove_abort_listener = () => {
    };
    const abort_promise = new Promise((_, reject) => {
      const on_abort = () => {
        reject(new DOMException("The operation was aborted.", "AbortError"));
      };
      request.signal.addEventListener("abort", on_abort, { once: true });
      remove_abort_listener = () => request.signal.removeEventListener("abort", on_abort);
    });
    const result = await Promise.race([
      respond(request, options2, manifest, {
        ...state,
        depth: state.depth + 1
      }),
      abort_promise
    ]);
    remove_abort_listener();
    return result;
  } else {
    return await respond(request, options2, manifest, {
      ...state,
      depth: state.depth + 1
    });
  }
}
let body;
let etag;
let headers;
function get_public_env(request) {
  body ??= `export const env=${JSON.stringify(public_env)}`;
  etag ??= `W/${Date.now()}`;
  headers ??= new Headers({
    "content-type": "application/javascript; charset=utf-8",
    etag
  });
  if (request.headers.get("if-none-match") === etag) {
    return new Response(void 0, { status: 304, headers });
  }
  return new Response(body, { headers });
}
const default_transform = ({ html }) => html;
const default_filter = () => false;
const default_preload = ({ type }) => type === "js" || type === "css";
const page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "POST"]);
const allowed_page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
let warned_on_devtools_json_request = false;
const respond = propagate_context(internal_respond);
async function internal_respond(request, options2, manifest, state) {
  const url = new URL(request.url);
  const is_route_resolution_request = has_resolution_suffix(url.pathname);
  const is_data_request = has_data_suffix(url.pathname);
  const remote_id = get_remote_id(url);
  {
    const request_origin = request.headers.get("origin");
    if (remote_id) {
      if (request.method !== "GET" && request_origin !== url.origin) {
        const message = "Cross-site remote requests are forbidden";
        return json({ message }, { status: 403 });
      }
    } else if (options2.csrf_check_origin) {
      const forbidden = is_form_content_type(request) && (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request_origin !== url.origin && (!request_origin || !options2.csrf_trusted_origins.includes(request_origin));
      if (forbidden) {
        const message = `Cross-site ${request.method} form submissions are forbidden`;
        const opts = { status: 403 };
        if (request.headers.get("accept") === "application/json") {
          return json({ message }, opts);
        }
        return text(message, opts);
      }
    }
  }
  if (options2.hash_routing && url.pathname !== base + "/" && url.pathname !== "/[fallback]") {
    return text("Not found", { status: 404 });
  }
  let invalidated_data_nodes;
  if (is_route_resolution_request) {
    url.pathname = strip_resolution_suffix(url.pathname);
  } else if (is_data_request) {
    url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get(TRAILING_SLASH_PARAM) === "1" ? "/" : "") || "/";
    url.searchParams.delete(TRAILING_SLASH_PARAM);
    invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
    url.searchParams.delete(INVALIDATED_PARAM);
  } else if (remote_id) {
    url.pathname = request.headers.get("x-sveltekit-pathname") ?? base;
    url.search = request.headers.get("x-sveltekit-search") ?? "";
  }
  const headers2 = {};
  const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(
    request,
    url
  );
  const event_state = {
    prerendering: state.prerendering,
    transport: options2.hooks.transport,
    handleValidationError: options2.hooks.handleValidationError,
    tracing: {
      record_span
    },
    remote: {
      data: null,
      forms: null,
      /** A map of remote function key to corresponding single-flight-mutation promise */
      refreshes: null,
      /** A map of remote function ID to payloads requested for refreshing by the client */
      requested: null,
      /**
       * A map of remote function ID to objects that have passed validation;
       * used to prevent revalidating parameters returned from `requested`
       */
      validated: null
    },
    is_in_remote_function: false,
    is_in_render: false,
    is_in_universal_load: false
  };
  const event = {
    cookies,
    // @ts-expect-error `fetch` needs to be created after the `event` itself
    fetch: null,
    getClientAddress: state.getClientAddress || (() => {
      throw new Error(
        `${"@sveltejs/adapter-auto"} does not specify getClientAddress. Please raise an issue`
      );
    }),
    locals: {},
    params: {},
    platform: state.platform,
    request,
    route: { id: null },
    setHeaders: (new_headers) => {
      for (const key2 in new_headers) {
        const lower = key2.toLowerCase();
        const value = new_headers[key2];
        if (lower === "set-cookie") {
          throw new Error(
            "Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies"
          );
        } else if (lower in headers2) {
          if (lower === "server-timing") {
            headers2[lower] += ", " + value;
          } else {
            throw new Error(`"${key2}" header is already set`);
          }
        } else {
          headers2[lower] = value;
          if (state.prerendering && lower === "cache-control") {
            state.prerendering.cache = /** @type {string} */
            value;
          }
        }
      }
    },
    url,
    isDataRequest: is_data_request,
    isSubRequest: state.depth > 0,
    isRemoteRequest: !!remote_id
  };
  event.fetch = create_fetch({
    event,
    options: options2,
    manifest,
    state,
    get_cookie_header,
    set_internal
  });
  if (state.emulator?.platform) {
    event.platform = await state.emulator.platform({
      config: {},
      prerender: !!state.prerendering?.fallback
    });
  }
  let resolved_path = url.pathname;
  if (!remote_id) {
    const prerendering_reroute_state = state.prerendering?.inside_reroute;
    try {
      if (state.prerendering) state.prerendering.inside_reroute = true;
      resolved_path = await options2.hooks.reroute({ url: new URL(url), fetch: event.fetch }) ?? url.pathname;
    } catch {
      return text("Internal Server Error", {
        status: 500
      });
    } finally {
      if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
    }
  }
  try {
    resolved_path = decode_pathname(resolved_path);
  } catch {
    return text("Malformed URI", { status: 400 });
  }
  if (
    // the resolved path has been decoded so it should be compared to the decoded url pathname
    resolved_path !== decode_pathname(url.pathname) && !state.prerendering?.fallback && has_prerendered_path(manifest, resolved_path)
  ) {
    const url2 = new URL(request.url);
    url2.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
    try {
      const response = await fetch(url2, request);
      const headers22 = new Headers(response.headers);
      if (headers22.has("content-encoding")) {
        headers22.delete("content-encoding");
        headers22.delete("content-length");
      }
      return new Response(response.body, {
        headers: headers22,
        status: response.status,
        statusText: response.statusText
      });
    } catch (error2) {
      return await handle_fatal_error(event, event_state, options2, error2);
    }
  }
  let route = null;
  if (base && !state.prerendering?.fallback) {
    if (!resolved_path.startsWith(base)) {
      return text("Not found", { status: 404 });
    }
    resolved_path = resolved_path.slice(base.length) || "/";
  }
  if (is_route_resolution_request) {
    return resolve_route(resolved_path, new URL(request.url), manifest);
  }
  if (resolved_path === `/${app_dir}/env.js`) {
    return get_public_env(request);
  }
  if (!remote_id && resolved_path.startsWith(`/${app_dir}`)) {
    const headers22 = new Headers();
    headers22.set("cache-control", "public, max-age=0, must-revalidate");
    return text("Not found", { status: 404, headers: headers22 });
  }
  if (!state.prerendering?.fallback) {
    const matchers = await manifest._.matchers();
    const result = find_route(resolved_path, manifest._.routes, matchers);
    if (result) {
      route = result.route;
      event.route = { id: route.id };
      event.params = result.params;
    }
  }
  let resolve_opts = {
    transformPageChunk: default_transform,
    filterSerializedResponseHeaders: default_filter,
    preload: default_preload
  };
  let trailing_slash = "never";
  try {
    const page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page, manifest)) : void 0;
    if (route && !remote_id) {
      if (url.pathname === base || url.pathname === base + "/") {
        trailing_slash = "always";
      } else if (page_nodes) {
        if (BROWSER) ;
        trailing_slash = page_nodes.trailing_slash();
      } else if (route.endpoint) {
        const node = await route.endpoint();
        trailing_slash = node.trailingSlash ?? "never";
        if (BROWSER) ;
      }
      if (!is_data_request) {
        const normalized = normalize_path(url.pathname, trailing_slash);
        if (normalized !== url.pathname && !state.prerendering?.fallback) {
          return new Response(void 0, {
            status: 308,
            headers: {
              "x-sveltekit-normalize": "1",
              location: (
                // ensure paths starting with '//' are not treated as protocol-relative
                (normalized.startsWith("//") ? url.origin + normalized : normalized) + (url.search === "?" ? "" : url.search)
              )
            }
          });
        }
      }
      if (state.before_handle || state.emulator?.platform) {
        let config = {};
        let prerender = false;
        if (route.endpoint) {
          const node = await route.endpoint();
          config = node.config ?? config;
          prerender = node.prerender ?? prerender;
        } else if (page_nodes) {
          config = page_nodes.get_config() ?? config;
          prerender = page_nodes.prerender();
        }
        if (state.before_handle) {
          state.before_handle(event, config, prerender);
        }
        if (state.emulator?.platform) {
          event.platform = await state.emulator.platform({ config, prerender });
        }
      }
    }
    set_trailing_slash(trailing_slash);
    if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) {
      disable_search(url);
    }
    const response = await record_span({
      name: "sveltekit.handle.root",
      attributes: {
        "http.route": event.route.id || "unknown",
        "http.method": event.request.method,
        "http.url": event.url.href,
        "sveltekit.is_data_request": is_data_request,
        "sveltekit.is_sub_request": event.isSubRequest
      },
      fn: async (root_span) => {
        const traced_event = {
          ...event,
          tracing: {
            enabled: false,
            root: root_span,
            current: root_span
          }
        };
        return await with_request_store(
          { event: traced_event, state: event_state },
          () => options2.hooks.handle({
            event: traced_event,
            resolve: (event2, opts) => {
              return record_span({
                name: "sveltekit.resolve",
                attributes: {
                  "http.route": event2.route.id || "unknown"
                },
                fn: (resolve_span) => {
                  return with_request_store(
                    null,
                    () => resolve2(merge_tracing(event2, resolve_span), page_nodes, opts).then(
                      (response2) => {
                        for (const key2 in headers2) {
                          const value = headers2[key2];
                          response2.headers.set(
                            key2,
                            /** @type {string} */
                            value
                          );
                        }
                        add_cookies_to_headers(response2.headers, new_cookies.values());
                        if (state.prerendering && event2.route.id !== null) {
                          response2.headers.set("x-sveltekit-routeid", encodeURI(event2.route.id));
                        }
                        resolve_span.setAttributes({
                          "http.response.status_code": response2.status,
                          "http.response.body.size": response2.headers.get("content-length") || "unknown"
                        });
                        return response2;
                      }
                    )
                  );
                }
              });
            }
          })
        );
      }
    });
    if (response.status === 200 && response.headers.has("etag")) {
      let if_none_match_value = request.headers.get("if-none-match");
      if (if_none_match_value?.startsWith('W/"')) {
        if_none_match_value = if_none_match_value.substring(2);
      }
      const etag2 = (
        /** @type {string} */
        response.headers.get("etag")
      );
      if (if_none_match_value === etag2) {
        const headers22 = new Headers({ etag: etag2 });
        for (const key2 of [
          "cache-control",
          "content-location",
          "date",
          "expires",
          "vary",
          "set-cookie"
        ]) {
          const value = response.headers.get(key2);
          if (value) headers22.set(key2, value);
        }
        return new Response(void 0, {
          status: 304,
          headers: headers22
        });
      }
    }
    if (is_data_request && response.status >= 300 && response.status <= 308) {
      const location = response.headers.get("location");
      if (location) {
        return redirect_json_response(new Redirect(
          /** @type {any} */
          response.status,
          location
        ));
      }
    }
    return response;
  } catch (e) {
    if (e instanceof Redirect) {
      const response = is_data_request || remote_id ? redirect_json_response(e) : route?.page && is_action_json_request(event) ? action_json_redirect(e) : redirect_response(e.status, e.location);
      add_cookies_to_headers(response.headers, new_cookies.values());
      return response;
    }
    return await handle_fatal_error(event, event_state, options2, e);
  }
  async function resolve2(event2, page_nodes, opts) {
    try {
      if (opts) {
        resolve_opts = {
          transformPageChunk: opts.transformPageChunk || default_transform,
          filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
          preload: opts.preload || default_preload
        };
      }
      if (options2.hash_routing || state.prerendering?.fallback) {
        return await render_response({
          event: event2,
          event_state,
          options: options2,
          manifest,
          state,
          page_config: { ssr: false, csr: true },
          status: 200,
          error: null,
          branch: [],
          fetched: [],
          resolve_opts,
          data_serializer: server_data_serializer(event2, event_state, options2)
        });
      }
      if (remote_id) {
        return await handle_remote_call(event2, event_state, options2, manifest, remote_id);
      }
      if (route) {
        const method = (
          /** @type {import('types').HttpMethod} */
          event2.request.method
        );
        let response2;
        if (is_data_request) {
          response2 = await render_data(
            event2,
            event_state,
            route,
            options2,
            manifest,
            state,
            invalidated_data_nodes,
            trailing_slash
          );
        } else if (route.endpoint && (!route.page || is_endpoint_request(event2))) {
          response2 = await render_endpoint(event2, event_state, await route.endpoint(), state);
        } else if (route.page) {
          if (!page_nodes) {
            throw new Error("page_nodes not found. This should never happen");
          } else if (page_methods.has(method)) {
            response2 = await render_page(
              event2,
              event_state,
              route.page,
              options2,
              manifest,
              state,
              page_nodes,
              resolve_opts
            );
          } else {
            const allowed_methods = new Set(allowed_page_methods);
            const node = await manifest._.nodes[route.page.leaf]();
            if (node?.server?.actions) {
              allowed_methods.add("POST");
            }
            if (method === "OPTIONS") {
              response2 = new Response(null, {
                status: 204,
                headers: {
                  allow: Array.from(allowed_methods.values()).join(", ")
                }
              });
            } else {
              const mod = [...allowed_methods].reduce(
                (acc, curr) => {
                  acc[curr] = true;
                  return acc;
                },
                /** @type {Record<string, any>} */
                {}
              );
              response2 = method_not_allowed(mod, method);
            }
          }
        } else {
          throw new Error("Route is neither page nor endpoint. This should never happen");
        }
        if (request.method === "GET" && route.page && route.endpoint) {
          const vary = response2.headers.get("vary")?.split(",")?.map((v) => v.trim().toLowerCase());
          if (!(vary?.includes("accept") || vary?.includes("*"))) {
            response2 = new Response(response2.body, {
              status: response2.status,
              statusText: response2.statusText,
              headers: new Headers(response2.headers)
            });
            response2.headers.append("Vary", "Accept");
          }
        }
        return response2;
      }
      if (state.error && event2.isSubRequest) {
        const headers22 = new Headers(request.headers);
        headers22.set("x-sveltekit-error", "true");
        return await fetch(request, { headers: headers22 });
      }
      if (state.error) {
        return text("Internal Server Error", {
          status: 500
        });
      }
      if (state.depth === 0) {
        if (BROWSER && event2.url.pathname === "/.well-known/appspecific/com.chrome.devtools.json") ;
        return await respond_with_error({
          event: event2,
          event_state,
          options: options2,
          manifest,
          state,
          status: 404,
          error: new SvelteKitError(404, "Not Found", `Not found: ${event2.url.pathname}`),
          resolve_opts
        });
      }
      if (state.prerendering) {
        return text("not found", { status: 404 });
      }
      const response = await fetch(request);
      return new Response(response.body, response);
    } catch (e) {
      return await handle_fatal_error(event2, event_state, options2, e);
    } finally {
      event2.cookies.set = () => {
        throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
      };
      event2.setHeaders = () => {
        throw new Error("Cannot use `setHeaders(...)` after the response has been generated");
      };
    }
  }
}
function load_page_nodes(page, manifest) {
  return Promise.all([
    // we use == here rather than === because [undefined] serializes as "[null]"
    ...page.layouts.map((n) => n == void 0 ? n : manifest._.nodes[n]()),
    manifest._.nodes[page.leaf]()
  ]);
}
function propagate_context(fn) {
  return async (req, ...rest) => {
    {
      return fn(req, ...rest);
    }
  };
}
function filter_env(env, allowed, disallowed) {
  return Object.fromEntries(
    Object.entries(env).filter(
      ([k]) => k.startsWith(allowed) && (disallowed === "" || !k.startsWith(disallowed))
    )
  );
}
function set_app(value) {
}
let init_promise;
let current = null;
class Server {
  /** @type {import('types').SSROptions} */
  #options;
  /** @type {import('@sveltejs/kit').SSRManifest} */
  #manifest;
  /** @param {import('@sveltejs/kit').SSRManifest} manifest */
  constructor(manifest) {
    this.#options = options;
    this.#manifest = manifest;
    if (IN_WEBCONTAINER) {
      const respond2 = this.respond.bind(this);
      this.respond = async (...args) => {
        const { promise, resolve: resolve2 } = (
          /** @type {PromiseWithResolvers<void>} */
          with_resolvers()
        );
        const previous = current;
        current = promise;
        await previous;
        return respond2(...args).finally(resolve2);
      };
    }
  }
  /**
   * @param {import('@sveltejs/kit').ServerInitOptions} opts
   */
  async init({ env, read }) {
    const { env_public_prefix, env_private_prefix } = this.#options;
    set_private_env(filter_env(env, env_private_prefix, env_public_prefix));
    set_public_env(filter_env(env, env_public_prefix, env_private_prefix));
    if (read) {
      const wrapped_read = (file) => {
        const result = read(file);
        if (result instanceof ReadableStream) {
          return result;
        } else {
          return new ReadableStream({
            async start(controller) {
              try {
                const stream = await Promise.resolve(result);
                if (!stream) {
                  controller.close();
                  return;
                }
                const reader = stream.getReader();
                while (true) {
                  const { done, value } = await reader.read();
                  if (done) break;
                  controller.enqueue(value);
                }
                controller.close();
              } catch (error2) {
                controller.error(error2);
              }
            }
          });
        }
      };
      set_read_implementation(wrapped_read);
    }
    await (init_promise ??= (async () => {
      try {
        const module = await get_hooks();
        this.#options.hooks = {
          handle: module.handle || (({ event, resolve: resolve2 }) => resolve2(event)),
          handleError: module.handleError || (({ status, error: error2, event }) => {
            const error_message = format_server_error(
              status,
              /** @type {Error} */
              error2,
              event
            );
            console.error(error_message);
          }),
          handleFetch: module.handleFetch || (({ request, fetch: fetch2 }) => fetch2(request)),
          handleValidationError: module.handleValidationError || (({ issues }) => {
            console.error("Remote function schema validation failed:", issues);
            return { message: "Bad Request" };
          }),
          reroute: module.reroute || (() => {
          }),
          transport: module.transport || {}
        };
        set_app({
          decoders: module.transport ? Object.fromEntries(Object.entries(module.transport).map(([k, v]) => [k, v.decode])) : {}
        });
        if (module.init) {
          await module.init();
        }
      } catch (e) {
        {
          throw e;
        }
      }
    })());
  }
  /**
   * @param {Request} request
   * @param {import('types').RequestOptions} options
   */
  async respond(request, options2) {
    return respond(request, this.#options, this.#manifest, {
      ...options2,
      error: false,
      depth: 0
    });
  }
}
export {
  Server
};

```

---

## .svelte-kit/output/server/internal.js

```js
import "./chunks/root.js";
import { s, e, f } from "./chunks/environment.js";
import { g, o, a, s as s2 } from "./chunks/internal.js";
import { s as s3, a as a2 } from "./chunks/shared-server.js";
export {
  g as get_hooks,
  o as options,
  s as set_assets,
  e as set_building,
  a as set_manifest,
  f as set_prerendering,
  s3 as set_private_env,
  a2 as set_public_env,
  s2 as set_read_implementation
};

```

---

## .svelte-kit/output/server/manifest-full.js

```js
export const manifest = (() => {
function __memo(fn) {
	let value;
	return () => value ??= (value = fn());
}

return {
	appDir: "_app",
	appPath: "_app",
	assets: new Set(["robots.txt"]),
	mimeTypes: {".txt":"text/plain"},
	_: {
		client: {start:"_app/immutable/entry/start.C-_kLNuo.js",app:"_app/immutable/entry/app.BLmegFPX.js",imports:["_app/immutable/entry/start.C-_kLNuo.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/CahBYLSE.js","_app/immutable/entry/app.BLmegFPX.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/CahBYLSE.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:true},
		nodes: [
			__memo(() => import('./nodes/0.js')),
			__memo(() => import('./nodes/1.js')),
			__memo(() => import('./nodes/2.js')),
			__memo(() => import('./nodes/3.js')),
			__memo(() => import('./nodes/4.js'))
		],
		remotes: {
			
		},
		routes: [
			{
				id: "/",
				pattern: /^\/$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 2 },
				endpoint: null
			},
			{
				id: "/api/auth/login",
				pattern: /^\/api\/auth\/login\/?$/,
				params: [],
				page: null,
				endpoint: __memo(() => import('./entries/endpoints/api/auth/login/_server.ts.js'))
			},
			{
				id: "/burrito",
				pattern: /^\/burrito\/?$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 3 },
				endpoint: null
			},
			{
				id: "/profile",
				pattern: /^\/profile\/?$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 4 },
				endpoint: null
			}
		],
		prerendered_routes: new Set([]),
		matchers: async () => {
			
			return {  };
		},
		server_assets: {}
	}
}
})();

```

---

## .svelte-kit/output/server/manifest.js

```js
export const manifest = (() => {
function __memo(fn) {
	let value;
	return () => value ??= (value = fn());
}

return {
	appDir: "_app",
	appPath: "_app",
	assets: new Set(["robots.txt"]),
	mimeTypes: {".txt":"text/plain"},
	_: {
		client: {start:"_app/immutable/entry/start.C-_kLNuo.js",app:"_app/immutable/entry/app.BLmegFPX.js",imports:["_app/immutable/entry/start.C-_kLNuo.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/CahBYLSE.js","_app/immutable/entry/app.BLmegFPX.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/CahBYLSE.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:true},
		nodes: [
			__memo(() => import('./nodes/0.js')),
			__memo(() => import('./nodes/1.js')),
			__memo(() => import('./nodes/2.js')),
			__memo(() => import('./nodes/3.js')),
			__memo(() => import('./nodes/4.js'))
		],
		remotes: {
			
		},
		routes: [
			{
				id: "/",
				pattern: /^\/$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 2 },
				endpoint: null
			},
			{
				id: "/api/auth/login",
				pattern: /^\/api\/auth\/login\/?$/,
				params: [],
				page: null,
				endpoint: __memo(() => import('./entries/endpoints/api/auth/login/_server.ts.js'))
			},
			{
				id: "/burrito",
				pattern: /^\/burrito\/?$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 3 },
				endpoint: null
			},
			{
				id: "/profile",
				pattern: /^\/profile\/?$/,
				params: [],
				page: { layouts: [0,], errors: [1,], leaf: 4 },
				endpoint: null
			}
		],
		prerendered_routes: new Set([]),
		matchers: async () => {
			
			return {  };
		},
		server_assets: {}
	}
}
})();

```

---

## .svelte-kit/output/server/nodes/0.js

```js


export const index = 0;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
export const imports = ["_app/immutable/nodes/0.Bx7q24Sj.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/K4hkKKa0.js"];
export const stylesheets = ["_app/immutable/assets/0.CVzJfwEK.css"];
export const fonts = [];

```

---

## .svelte-kit/output/server/nodes/1.js

```js


export const index = 1;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
export const imports = ["_app/immutable/nodes/1.BGCl9XKM.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/CahBYLSE.js"];
export const stylesheets = [];
export const fonts = [];

```

---

## .svelte-kit/output/server/nodes/2.js

```js


export const index = 2;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/2.Co1ksXco.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/K4hkKKa0.js"];
export const stylesheets = [];
export const fonts = [];

```

---

## .svelte-kit/output/server/nodes/3.js

```js


export const index = 3;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/burrito/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/3.CfAbGAA2.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/CahBYLSE.js","_app/immutable/chunks/K4hkKKa0.js"];
export const stylesheets = [];
export const fonts = [];

```

---

## .svelte-kit/output/server/nodes/4.js

```js


export const index = 4;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/profile/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/4.BNJRNjNL.js","_app/immutable/chunks/CcgZgiL9.js","_app/immutable/chunks/3TW-MQft.js","_app/immutable/chunks/HWAjEwF5.js","_app/immutable/chunks/CpUSghGZ.js","_app/immutable/chunks/CahBYLSE.js","_app/immutable/chunks/K4hkKKa0.js"];
export const stylesheets = [];
export const fonts = [];

```

---

## .svelte-kit/output/server/remote-entry.js

```js
import { get_request_store, with_request_store } from "@sveltejs/kit/internal/server";
import { error, json } from "@sveltejs/kit";
import { w as stringify_remote_arg, j as create_remote_key, x as unfriendly_hydratable, y as parse, l as stringify, M as MUTATIVE_METHODS, z as create_field_proxy, A as normalize_issue, B as set_nested_value, C as flatten_issues, D as deep_set, h as handle_error_and_jsonify, p as parse_remote_arg } from "./chunks/shared.js";
import { ValidationError, HttpError, SvelteKitError } from "@sveltejs/kit/internal";
import { B as BROWSER } from "./chunks/errors.js";
import { b as base, c as app_dir, p as prerendering } from "./chunks/environment.js";
function create_validator(validate_or_fn, maybe_fn) {
  if (!maybe_fn) {
    return (arg) => {
      if (arg !== void 0) {
        error(400, "Bad Request");
      }
    };
  }
  if (validate_or_fn === "unchecked") {
    return (arg) => arg;
  }
  if ("~standard" in validate_or_fn) {
    return async (arg) => {
      const { event, state } = get_request_store();
      const result = await validate_or_fn["~standard"].validate(arg);
      if (result.issues) {
        error(
          400,
          await state.handleValidationError({
            issues: result.issues,
            event
          })
        );
      }
      return result.value;
    };
  }
  throw new Error(
    'Invalid validator passed to remote function. Expected "unchecked" or a Standard Schema (https://standardschema.dev)'
  );
}
async function get_response(internals, arg, state, get_result) {
  await 0;
  const cache = get_cache(internals, state);
  const key = stringify_remote_arg(arg, state.transport);
  const entry = cache[key] ??= {
    serialize: false,
    data: get_result()
  };
  entry.serialize ||= !!state.is_in_universal_load;
  if (state.is_in_render && internals.id) {
    const remote_key = create_remote_key(internals.id, key);
    Promise.resolve(entry.data).then((value) => {
      void unfriendly_hydratable(remote_key, () => stringify(value, state.transport));
    }).catch(() => {
    });
  }
  return entry.data;
}
function parse_remote_response(data, transport) {
  const revivers = {};
  for (const key in transport) {
    revivers[key] = transport[key].decode;
  }
  return parse(data, revivers);
}
async function run_remote_function(event, state, allow_cookies, get_input, fn) {
  const store = {
    event: {
      ...event,
      setHeaders: () => {
        throw new Error("setHeaders is not allowed in remote functions");
      },
      cookies: {
        ...event.cookies,
        set: (name, value, opts) => {
          if (!allow_cookies) {
            throw new Error("Cannot set cookies in `query` or `prerender` functions");
          }
          if (opts.path && !opts.path.startsWith("/")) {
            throw new Error("Cookies set in remote functions must have an absolute path");
          }
          return event.cookies.set(name, value, opts);
        },
        delete: (name, opts) => {
          if (!allow_cookies) {
            throw new Error("Cannot delete cookies in `query` or `prerender` functions");
          }
          if (opts.path && !opts.path.startsWith("/")) {
            throw new Error("Cookies deleted in remote functions must have an absolute path");
          }
          return event.cookies.delete(name, opts);
        }
      }
    },
    state: {
      ...state,
      is_in_remote_function: true
    }
  };
  const input = await with_request_store(store, get_input);
  return with_request_store(store, () => fn(input));
}
function get_cache(internals, state = get_request_store().state) {
  let cache = state.remote.data?.get(internals);
  if (cache === void 0) {
    cache = {};
    (state.remote.data ??= /* @__PURE__ */ new Map()).set(internals, cache);
  }
  return cache;
}
// @__NO_SIDE_EFFECTS__
function command(validate_or_fn, maybe_fn) {
  const fn = maybe_fn ?? validate_or_fn;
  const validate = create_validator(validate_or_fn, maybe_fn);
  const __ = { type: "command", id: "", name: "" };
  const wrapper = (arg) => {
    const { event, state } = get_request_store();
    if (!MUTATIVE_METHODS.includes(event.request.method)) {
      throw new Error(
        `Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) from a ${event.request.method} handler`
      );
    }
    if (state.is_in_render) {
      throw new Error(
        `Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) during server-side rendering`
      );
    }
    state.remote.refreshes ??= {};
    const promise = Promise.resolve(
      run_remote_function(event, state, true, () => validate(arg), fn)
    );
    promise.updates = () => {
      throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
    };
    return (
      /** @type {ReturnType<RemoteCommand<Input, Output>>} */
      promise
    );
  };
  Object.defineProperty(wrapper, "__", { value: __ });
  Object.defineProperty(wrapper, "pending", {
    get: () => 0
  });
  return wrapper;
}
// @__NO_SIDE_EFFECTS__
function form(validate_or_fn, maybe_fn) {
  const fn = maybe_fn ?? validate_or_fn;
  const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : (
    /** @type {any} */
    validate_or_fn
  );
  function create_instance(key) {
    const instance = {};
    instance.method = "POST";
    Object.defineProperty(instance, "enhance", {
      value: () => {
        return { action: instance.action, method: instance.method };
      }
    });
    const __ = {
      type: "form",
      name: "",
      id: "",
      fn: async (data, meta, form_data) => {
        const output = {};
        output.submission = true;
        const { event, state } = get_request_store();
        const validated = await schema?.["~standard"].validate(data);
        if (meta.validate_only) {
          return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
        }
        if (validated?.issues !== void 0) {
          handle_issues(output, validated.issues, form_data);
        } else {
          if (validated !== void 0) {
            data = validated.value;
          }
          state.remote.refreshes ??= {};
          const issue = create_issues();
          try {
            output.result = await run_remote_function(
              event,
              state,
              true,
              () => data,
              (data2) => !maybe_fn ? fn() : fn(data2, issue)
            );
          } catch (e) {
            if (e instanceof ValidationError) {
              handle_issues(output, e.issues, form_data);
            } else {
              throw e;
            }
          }
        }
        if (!event.isRemoteRequest) {
          get_cache(__, state)[""] ??= { serialize: true, data: output };
        }
        return output;
      }
    };
    Object.defineProperty(instance, "__", { value: __ });
    Object.defineProperty(instance, "action", {
      get: () => `?/remote=${__.id}`,
      enumerable: true
    });
    Object.defineProperty(instance, "fields", {
      get() {
        return create_field_proxy(
          {},
          () => get_cache(__)?.[""]?.data?.input ?? {},
          (path, value) => {
            const cache = get_cache(__);
            const entry = cache[""];
            if (entry?.data?.submission) {
              return;
            }
            if (path.length === 0) {
              (cache[""] ??= { serialize: true, data: {} }).data.input = value;
              return;
            }
            const input = entry?.data?.input ?? {};
            deep_set(input, path.map(String), value);
            (cache[""] ??= { serialize: true, data: {} }).data.input = input;
          },
          () => flatten_issues(get_cache(__)?.[""]?.data?.issues ?? [])
        );
      }
    });
    Object.defineProperty(instance, "result", {
      get() {
        try {
          return get_cache(__)?.[""]?.data?.result;
        } catch {
          return void 0;
        }
      }
    });
    Object.defineProperty(instance, "pending", {
      get: () => 0
    });
    Object.defineProperty(instance, "preflight", {
      // preflight is a noop on the server
      value: () => instance
    });
    Object.defineProperty(instance, "validate", {
      value: () => {
        throw new Error("Cannot call validate() on the server");
      }
    });
    if (key == void 0) {
      Object.defineProperty(instance, "for", {
        /** @type {RemoteForm<any, any>['for']} */
        value: (key2) => {
          const { state } = get_request_store();
          const cache_key = __.id + "|" + JSON.stringify(key2);
          let instance2 = (state.remote.forms ??= /* @__PURE__ */ new Map()).get(cache_key);
          if (!instance2) {
            instance2 = create_instance(key2);
            instance2.__.id = `${__.id}/${encodeURIComponent(JSON.stringify(key2))}`;
            instance2.__.name = __.name;
            state.remote.forms.set(cache_key, instance2);
          }
          return instance2;
        }
      });
    }
    return instance;
  }
  return create_instance();
}
function handle_issues(output, issues, form_data) {
  output.issues = issues.map((issue) => normalize_issue(issue, true));
  if (form_data) {
    output.input = {};
    for (let key of form_data.keys()) {
      if (/^[.\]]?_/.test(key)) continue;
      const is_array = key.endsWith("[]");
      const values = form_data.getAll(key).filter((value) => typeof value === "string");
      if (is_array) key = key.slice(0, -2);
      set_nested_value(
        /** @type {Record<string, any>} */
        output.input,
        key,
        is_array ? values : values[0]
      );
    }
  }
}
function create_issues() {
  return (
    /** @type {InvalidField<any>} */
    new Proxy(
      /** @param {string} message */
      (message) => {
        if (typeof message !== "string") {
          throw new Error(
            "`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. For more info see https://github.com/sveltejs/kit/pulls/14768"
          );
        }
        return create_issue(message);
      },
      {
        get(target, prop) {
          if (typeof prop === "symbol") return (
            /** @type {any} */
            target[prop]
          );
          return create_issue_proxy(prop, []);
        }
      }
    )
  );
  function create_issue(message, path = []) {
    return {
      message,
      path
    };
  }
  function create_issue_proxy(key, path) {
    const new_path = [...path, key];
    const issue_func = (message) => create_issue(message, new_path);
    return new Proxy(issue_func, {
      get(target, prop) {
        if (typeof prop === "symbol") return (
          /** @type {any} */
          target[prop]
        );
        if (/^\d+$/.test(prop)) {
          return create_issue_proxy(parseInt(prop, 10), new_path);
        }
        return create_issue_proxy(prop, new_path);
      }
    });
  }
}
// @__NO_SIDE_EFFECTS__
function prerender(validate_or_fn, fn_or_options, maybe_options) {
  const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
  const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
  const fn = maybe_fn ?? validate_or_fn;
  const validate = create_validator(validate_or_fn, maybe_fn);
  const __ = {
    type: "prerender",
    id: "",
    name: "",
    has_arg: !!maybe_fn,
    inputs: options?.inputs,
    dynamic: options?.dynamic
  };
  const wrapper = (arg) => {
    const promise = (async () => {
      const { event, state } = get_request_store();
      const payload = stringify_remote_arg(arg, state.transport);
      const id = __.id;
      const url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
      if (!state.prerendering && !BROWSER && !event.isRemoteRequest) {
        try {
          return await get_response(__, arg, state, async () => {
            const key = stringify_remote_arg(arg, state.transport);
            const cache = get_cache(__, state);
            const promise3 = (cache[key] ??= {
              serialize: true,
              data: fetch(new URL(url, event.url.origin).href).then(async (response) => {
                if (!response.ok) {
                  throw new Error("Prerendered response not found");
                }
                const prerendered = await response.json();
                if (prerendered.type === "error") {
                  error(prerendered.status, prerendered.error);
                }
                return prerendered.result;
              })
            }).data;
            return parse_remote_response(await promise3, state.transport);
          });
        } catch {
        }
      }
      if (state.prerendering?.remote_responses.has(url)) {
        return (
          /** @type {Promise<any>} */
          state.prerendering.remote_responses.get(url)
        );
      }
      const promise2 = get_response(
        __,
        arg,
        state,
        () => run_remote_function(event, state, false, () => validate(arg), fn)
      );
      if (state.prerendering) {
        state.prerendering.remote_responses.set(url, promise2);
      }
      const result = await promise2;
      if (state.prerendering) {
        const body = { type: "result", result: stringify(result, state.transport) };
        state.prerendering.dependencies.set(url, {
          body: JSON.stringify(body),
          response: json(body)
        });
      }
      return result;
    })();
    promise.catch(() => {
    });
    return (
      /** @type {RemoteResource<Output>} */
      promise
    );
  };
  Object.defineProperty(wrapper, "__", { value: __ });
  return wrapper;
}
// @__NO_SIDE_EFFECTS__
function query(validate_or_fn, maybe_fn) {
  const fn = maybe_fn ?? validate_or_fn;
  const validate = create_validator(validate_or_fn, maybe_fn);
  const __ = { type: "query", id: "", name: "", validate };
  const wrapper = (arg) => {
    if (prerendering) {
      throw new Error(
        `Cannot call query '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
      );
    }
    const { event, state } = get_request_store();
    const is_validated = is_validated_argument(__, state, arg);
    return create_query_resource(
      __,
      arg,
      state,
      () => run_remote_function(event, state, false, () => is_validated ? arg : validate(arg), fn)
    );
  };
  Object.defineProperty(wrapper, "__", { value: __ });
  return wrapper;
}
function is_validated_argument(__, state, arg) {
  return state.remote.validated?.get(__.id)?.has(arg) ?? false;
}
function mark_argument_validated(__, state, arg) {
  const validated = state.remote.validated ??= /* @__PURE__ */ new Map();
  let validated_args = validated.get(__.id);
  if (!validated_args) {
    validated_args = /* @__PURE__ */ new Set();
    validated.set(__.id, validated_args);
  }
  validated_args.add(arg);
  return arg;
}
// @__NO_SIDE_EFFECTS__
function batch(validate_or_fn, maybe_fn) {
  const fn = maybe_fn ?? validate_or_fn;
  const validate = create_validator(validate_or_fn, maybe_fn);
  const __ = {
    type: "query_batch",
    id: "",
    name: "",
    run: async (args, options) => {
      const { event, state } = get_request_store();
      return run_remote_function(
        event,
        state,
        false,
        async () => Promise.all(args.map(validate)),
        async (input) => {
          const get_result = await fn(input);
          return Promise.all(
            input.map(async (arg, i) => {
              try {
                const data = get_result(arg, i);
                return { type: "result", data: stringify(data, state.transport) };
              } catch (error2) {
                return {
                  type: "error",
                  error: await handle_error_and_jsonify(event, state, options, error2),
                  status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
                };
              }
            })
          );
        }
      );
    }
  };
  let batching = /* @__PURE__ */ new Map();
  const wrapper = (arg) => {
    if (prerendering) {
      throw new Error(
        `Cannot call query.batch '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
      );
    }
    const { event, state } = get_request_store();
    return create_query_resource(__, arg, state, () => {
      return new Promise((resolve, reject) => {
        const key = stringify_remote_arg(arg, state.transport);
        const entry = batching.get(key);
        if (entry) {
          entry.resolvers.push({ resolve, reject });
          return;
        }
        batching.set(key, {
          arg,
          resolvers: [{ resolve, reject }]
        });
        if (batching.size > 1) return;
        setTimeout(async () => {
          const batched = batching;
          batching = /* @__PURE__ */ new Map();
          const entries = Array.from(batched.values());
          const args = entries.map((entry2) => entry2.arg);
          try {
            return await run_remote_function(
              event,
              state,
              false,
              async () => Promise.all(args.map(validate)),
              async (input) => {
                const get_result = await fn(input);
                for (let i = 0; i < entries.length; i++) {
                  try {
                    const result = get_result(input[i], i);
                    for (const resolver of entries[i].resolvers) {
                      resolver.resolve(result);
                    }
                  } catch (error2) {
                    for (const resolver of entries[i].resolvers) {
                      resolver.reject(error2);
                    }
                  }
                }
              }
            );
          } catch (error2) {
            for (const entry2 of batched.values()) {
              for (const resolver of entry2.resolvers) {
                resolver.reject(error2);
              }
            }
          }
        }, 0);
      });
    });
  };
  Object.defineProperty(wrapper, "__", { value: __ });
  return wrapper;
}
function create_query_resource(__, arg, state, fn) {
  let promise = null;
  const get_promise = () => {
    return promise ??= get_response(__, arg, state, fn);
  };
  return {
    /** @type {Promise<any>['catch']} */
    catch(onrejected) {
      return get_promise().catch(onrejected);
    },
    current: void 0,
    error: void 0,
    /** @type {Promise<any>['finally']} */
    finally(onfinally) {
      return get_promise().finally(onfinally);
    },
    loading: true,
    ready: false,
    refresh() {
      const refresh_context = get_refresh_context(__, "refresh", arg);
      const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
      const value = is_immediate_refresh ? get_promise() : fn();
      return update_refresh_value(refresh_context, value, is_immediate_refresh);
    },
    run() {
      if (!state.is_in_universal_load) {
        throw new Error(
          "On the server, .run() can only be called in universal `load` functions. Anywhere else, just await the query directly"
        );
      }
      return get_response(__, arg, state, fn);
    },
    /** @param {any} value */
    set(value) {
      return update_refresh_value(get_refresh_context(__, "set", arg), value);
    },
    /** @type {Promise<any>['then']} */
    then(onfulfilled, onrejected) {
      return get_promise().then(onfulfilled, onrejected);
    },
    withOverride() {
      throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
    },
    get [Symbol.toStringTag]() {
      return "QueryResource";
    }
  };
}
Object.defineProperty(query, "batch", { value: batch, enumerable: true });
function get_refresh_context(__, action, arg) {
  const { state } = get_request_store();
  const { refreshes } = state.remote;
  if (!refreshes) {
    const name = __.type === "query_batch" ? `query.batch '${__.name}'` : `query '${__.name}'`;
    throw new Error(
      `Cannot call ${action} on ${name} because it is not executed in the context of a command/form remote function`
    );
  }
  const cache = get_cache(__, state);
  const cache_key = stringify_remote_arg(arg, state.transport);
  const refreshes_key = create_remote_key(__.id, cache_key);
  return { __, state, refreshes, refreshes_key, cache, cache_key };
}
function update_refresh_value({ __, refreshes, refreshes_key, cache, cache_key }, value, is_immediate_refresh = false) {
  const promise = Promise.resolve(value);
  if (!is_immediate_refresh) {
    cache[cache_key] = { serialize: true, data: promise };
  }
  if (__.id) {
    refreshes[refreshes_key] = promise;
  }
  return promise.then(
    () => {
    },
    () => {
    }
  );
}
function requested(query2, limit = Infinity) {
  const { state } = get_request_store();
  const internals = (
    /** @type {RemoteQueryInternals | undefined} */
    /** @type {any} */
    query2.__
  );
  if (!internals || internals.type !== "query") {
    throw new Error("requested(...) expects a query function created with query(...)");
  }
  const requested2 = state.remote.requested;
  const payloads = requested2?.get(internals.id) ?? [];
  const refreshes = state.remote.refreshes ??= {};
  const [selected, skipped] = split_limit(payloads, limit);
  const record_failure = (payload, error2) => {
    const promise = Promise.reject(error2);
    promise.catch(() => {
    });
    const key = create_remote_key(internals.id, payload);
    refreshes[key] = promise;
  };
  for (const payload of skipped) {
    record_failure(
      payload,
      new Error(
        `Requested refresh was rejected because it exceeded requested(${internals.name}, ${limit}) limit`
      )
    );
  }
  return {
    *[Symbol.iterator]() {
      for (const payload of selected) {
        try {
          const parsed = parse_remote_arg(payload, state.transport);
          const validated = internals.validate(parsed);
          if (is_thenable(validated)) {
            throw new Error(
              // TODO improve
              `requested(${internals.name}, ${limit}) cannot be used with synchronous iteration because the query validator is async. Use \`for await ... of\` instead`
            );
          }
          yield mark_argument_validated(internals, state, validated);
        } catch (error2) {
          record_failure(payload, error2);
          continue;
        }
      }
    },
    async *[Symbol.asyncIterator]() {
      yield* race_all(selected, async (payload) => {
        try {
          const parsed = parse_remote_arg(payload, state.transport);
          const validated = await internals.validate(parsed);
          return mark_argument_validated(internals, state, validated);
        } catch (error2) {
          record_failure(payload, error2);
          throw new Error(`Skipping ${internals.name}(${payload})`, { cause: error2 });
        }
      });
    },
    async refreshAll() {
      for await (const arg of this) {
        void query2(arg).refresh();
      }
    }
  };
}
function split_limit(array, limit) {
  if (limit === Infinity) {
    return [array, []];
  }
  if (!Number.isInteger(limit) || limit < 0) {
    throw new Error("Limit must be a non-negative integer or Infinity");
  }
  return [array.slice(0, limit), array.slice(limit)];
}
function is_thenable(value) {
  return !!value && (typeof value === "object" || typeof value === "function") && "then" in value;
}
async function* race_all(array, fn) {
  const pending = /* @__PURE__ */ new Set();
  for (const value of array) {
    const promise = Promise.resolve(fn(value)).then((result) => ({
      promise,
      value: result
    }));
    promise.catch(() => {
    });
    pending.add(promise);
  }
  while (pending.size > 0) {
    try {
      const { promise, value } = await Promise.race(pending);
      pending.delete(promise);
      yield value;
    } catch {
    }
  }
}
export {
  command,
  form,
  prerender,
  query,
  requested
};

```

---

## .svelte-kit/types/src/routes/$types.d.ts

```ts
import type * as Kit from '@sveltejs/kit';

type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
type MatcherParam<M> = M extends (param : string) => param is (infer U extends string) ? U : string;
type RouteParams = {  };
type RouteId = '/';
type MaybeWithVoid<T> = {} extends T ? T | void : T;
export type RequiredKeys<T> = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];
type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Partial<Pick<App.PageData, keyof T & keyof App.PageData>> & Record<string, any>>
type EnsureDefined<T> = T extends null | undefined ? {} : T;
type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
export type Snapshot<T = any> = Kit.Snapshot<T>;
type PageParentData = EnsureDefined<LayoutData>;
type LayoutRouteId = RouteId | "/" | "/burrito" | "/profile" | null
type LayoutParams = RouteParams & {  }
type LayoutParentData = EnsureDefined<{}>;

export type PageServerData = null;
export type PageData = Expand<PageParentData>;
export type PageProps = { params: RouteParams; data: PageData }
export type LayoutServerData = null;
export type LayoutData = Expand<LayoutParentData>;
export type LayoutProps = { params: LayoutParams; data: LayoutData; children: import("svelte").Snippet }
```

---

## .svelte-kit/types/src/routes/api/auth/login/$types.d.ts

```ts
import type * as Kit from '@sveltejs/kit';

type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
type MatcherParam<M> = M extends (param : string) => param is (infer U extends string) ? U : string;
type RouteParams = {  };
type RouteId = '/api/auth/login';

export type RequestHandler = Kit.RequestHandler<RouteParams, RouteId>;
export type RequestEvent = Kit.RequestEvent<RouteParams, RouteId>;
```

---

## .svelte-kit/types/src/routes/burrito/$types.d.ts

```ts
import type * as Kit from '@sveltejs/kit';

type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
type MatcherParam<M> = M extends (param : string) => param is (infer U extends string) ? U : string;
type RouteParams = {  };
type RouteId = '/burrito';
type MaybeWithVoid<T> = {} extends T ? T | void : T;
export type RequiredKeys<T> = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];
type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Partial<Pick<App.PageData, keyof T & keyof App.PageData>> & Record<string, any>>
type EnsureDefined<T> = T extends null | undefined ? {} : T;
type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
export type Snapshot<T = any> = Kit.Snapshot<T>;
type PageParentData = EnsureDefined<import('../$types.js').LayoutData>;

export type PageServerData = null;
export type PageData = Expand<PageParentData>;
export type PageProps = { params: RouteParams; data: PageData }
```

---

## .svelte-kit/types/src/routes/profile/$types.d.ts

```ts
import type * as Kit from '@sveltejs/kit';

type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
type MatcherParam<M> = M extends (param : string) => param is (infer U extends string) ? U : string;
type RouteParams = {  };
type RouteId = '/profile';
type MaybeWithVoid<T> = {} extends T ? T | void : T;
export type RequiredKeys<T> = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];
type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Partial<Pick<App.PageData, keyof T & keyof App.PageData>> & Record<string, any>>
type EnsureDefined<T> = T extends null | undefined ? {} : T;
type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
export type Snapshot<T = any> = Kit.Snapshot<T>;
type PageParentData = EnsureDefined<import('../$types.js').LayoutData>;

export type PageServerData = null;
export type PageData = Expand<PageParentData>;
export type PageProps = { params: RouteParams; data: PageData }
```

---

## src/app.d.ts

```ts
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
	namespace App {
		// interface Error {}
		// interface Locals {}
		// interface PageData {}
		// interface PageState {}
		// interface Platform {}
	}
}

export {};

```

---

## src/app.html

```html
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		%sveltekit.head%
	</head>
	<body data-sveltekit-preload-data="hover">
		<div style="display: contents">%sveltekit.body%</div>
	</body>
</html>

```

---

## src/hooks.client.ts

```ts
import * as amplitude from '@amplitude/unified';
import { env } from '$env/dynamic/public';

// Initialize Amplitude when the app starts in the browser
export async function init() {
	void amplitude.initAll(env.PUBLIC_AMPLITUDE_API_KEY ?? '');
}

```

---

## src/hooks.server.ts

```ts
import type { Handle } from '@sveltejs/kit';

export const handle: Handle = async ({ event, resolve }) => {
	return resolve(event);
};

```

---

## src/lib/auth.svelte.ts

```ts
import { getContext, setContext } from 'svelte';
import * as amplitude from '@amplitude/unified';
import { Identify } from '@amplitude/unified';
import { browser } from '$app/environment';

export interface User {
	username: string;
	burritoConsiderations: number;
}

const AUTH_KEY = Symbol('auth');

// Class-based auth state using Svelte 5 $state in class fields
// This is the recommended pattern for encapsulating reactive state + behavior
export class AuthState {
	user = $state<User | null>(null);

	constructor() {
		// Restore user from localStorage on creation (browser only)
		if (browser) {
			const storedUsername = localStorage.getItem('currentUser');
			if (storedUsername) {
				this.user = { username: storedUsername, burritoConsiderations: 0 };
			}
		}
	}

	login = async (username: string, password: string): Promise<boolean> => {
		try {
			const response = await fetch('/api/auth/login', {
				method: 'POST',
				headers: { 'Content-Type': 'application/json' },
				body: JSON.stringify({ username, password })
			});

			if (response.ok) {
				const { user: userData } = await response.json();
				this.user = userData as User;

				if (browser) {
					localStorage.setItem('currentUser', username);
					amplitude.setUserId(username);
					const identifyObj = new Identify();
					identifyObj.set('username', username);
					amplitude.identify(identifyObj);
					amplitude.track('User Logged In', { username });
				}

				return true;
			}
			return false;
		} catch (error) {
			console.error('Login error:', error);
			return false;
		}
	};

	logout = (): void => {
		if (browser) {
			amplitude.track('User Logged Out');
			amplitude.reset();
			localStorage.removeItem('currentUser');
		}
		this.user = null;
	};

	incrementBurritoConsiderations = (): void => {
		if (this.user) {
			this.user = {
				...this.user,
				burritoConsiderations: this.user.burritoConsiderations + 1
			};
		}
	};
}

export function setAuthContext(auth: AuthState) {
	setContext(AUTH_KEY, auth);
}

export function getAuthContext(): AuthState {
	return getContext<AuthState>(AUTH_KEY);
}

```

---

## src/lib/components/Header.svelte

```svelte
<script lang="ts">
	import { getAuthContext } from '$lib/auth.svelte';

	const auth = getAuthContext();
</script>

<header class="header">
	<div class="header-container">
		<nav>
			<a href="/">Home</a>
			{#if auth.user}
				<a href="/burrito">Burrito</a>
				<a href="/profile">Profile</a>
			{/if}
		</nav>
		<div class="user-section">
			{#if auth.user}
				<span>Welcome, {auth.user.username}</span>
				<button class="btn-logout" onclick={() => auth.logout()}>Logout</button>
			{/if}
		</div>
	</div>
</header>

```

---

## src/lib/index.ts

```ts
// place files you want to import through the `$lib` alias in this folder.

```

---

## src/lib/server/amplitude.ts

```ts
import { createInstance } from '@amplitude/analytics-node';
import { env } from '$env/dynamic/public';

type AmplitudeNodeClient = ReturnType<typeof createInstance>;

let amplitudeClient: AmplitudeNodeClient | null = null;

export function getAmplitudeClient(): AmplitudeNodeClient {
	if (!amplitudeClient) {
		amplitudeClient = createInstance();
		amplitudeClient.init(env.PUBLIC_AMPLITUDE_API_KEY ?? '');
	}
	return amplitudeClient;
}

export async function flushAmplitude() {
	if (amplitudeClient) {
		await amplitudeClient.flush();
	}
}

```

---

## src/routes/+layout.svelte

```svelte
<script lang="ts">
	import { AuthState, setAuthContext } from '$lib/auth.svelte';
	import Header from '$lib/components/Header.svelte';
	import '../app.css';

	let { children } = $props();

	// Create and provide auth context
	const auth = new AuthState();
	setAuthContext(auth);
</script>

<svelte:head>
	<title>Burrito consideration app</title>
	<meta name="description" content="Consider the potential of burritos with Amplitude analytics" />
</svelte:head>

<Header />
<main>
	{@render children()}
</main>

```

---

## src/routes/+page.svelte

```svelte
<script lang="ts">
	import { getAuthContext } from '$lib/auth.svelte';

	const auth = getAuthContext();

	let username = $state('');
	let password = $state('');
	let error = $state('');

	async function handleSubmit(e: Event) {
		e.preventDefault();
		error = '';

		try {
			const success = await auth.login(username, password);
			if (success) {
				username = '';
				password = '';
			} else {
				error = 'Please provide both username and password';
			}
		} catch (err) {
			console.error('Login failed:', err);
			error = 'An error occurred during login';
		}
	}
</script>

<div class="container">
	{#if auth.user}
		<h1>Welcome back, {auth.user.username}!</h1>
		<p>You are now logged in. Check out the navigation to explore features.</p>
		<ul>
			<li><a href="/burrito">Consider a burrito</a></li>
			<li><a href="/profile">View your profile</a></li>
		</ul>
	{:else}
		<h1>Welcome to Burrito consideration app</h1>
		<p>Sign in to start considering burritos.</p>

		<form class="form" onsubmit={handleSubmit}>
			<div class="form-group">
				<label for="username">Username:</label>
				<input type="text" id="username" bind:value={username} required />
			</div>

			<div class="form-group">
				<label for="password">Password:</label>
				<input type="password" id="password" bind:value={password} required />
			</div>

			{#if error}
				<p class="error">{error}</p>
			{/if}

			<button type="submit" class="btn-primary">Sign In</button>
		</form>

		<p class="note">
			Enter any username and password to sign in. This is a demo app.
		</p>
	{/if}
</div>

```

---

## src/routes/api/auth/login/+server.ts

```ts
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { getAmplitudeClient } from '$lib/server/amplitude';

const users = new Map<string, { username: string; burritoConsiderations: number }>();

export const POST: RequestHandler = async ({ request }) => {
	const { username, password } = await request.json();

	if (!username || !password) {
		return json({ error: 'Username and password required' }, { status: 400 });
	}

	let user = users.get(username);
	const isNewUser = !user;

	if (!user) {
		user = { username, burritoConsiderations: 0 };
		users.set(username, user);
	}

	// Capture server-side login event with user context
	const amplitude = getAmplitudeClient();
	amplitude.track('Server Login Completed', { isNewUser, source: 'api' }, { user_id: username });

	// Flush events to ensure they're sent
	await amplitude.flush();

	return json({ success: true, user });
};

```

---

## src/routes/burrito/+page.svelte

```svelte
<script lang="ts">
	import { goto } from '$app/navigation';
	import { browser } from '$app/environment';
	import * as amplitude from '@amplitude/unified';
	import { getAuthContext } from '$lib/auth.svelte';

	const auth = getAuthContext();

	let hasConsidered = $state(false);

	// Redirect to home if not logged in
	$effect(() => {
		if (browser && !auth.user) {
			goto('/');
		}
	});

	function handleConsideration() {
		if (!auth.user) return;

		auth.incrementBurritoConsiderations();
		hasConsidered = true;
		setTimeout(() => (hasConsidered = false), 2000);

		// Capture burrito consideration event with Amplitude
		amplitude.track('Burrito Considered', {
			total_considerations: auth.user.burritoConsiderations,
			username: auth.user.username
		});
	}
</script>

<div class="container">
	{#if auth.user}
		<h1>Burrito consideration zone</h1>
		<p>This is where you consider the infinite potential of burritos.</p>
		<p>Current considerations: <strong>{auth.user.burritoConsiderations}</strong></p>

		<button class="btn-burrito" onclick={handleConsideration}>
			I have considered the burrito potential
		</button>

		{#if hasConsidered}
			<p class="success">
				Thank you for your consideration! Count: {auth.user.burritoConsiderations}
			</p>
		{/if}

		<div class="note">
			<p>Each consideration is tracked as an Amplitude event with custom properties.</p>
		</div>
	{:else}
		<p>Please log in to consider burritos.</p>
	{/if}
</div>

```

---

## src/routes/profile/+page.svelte

```svelte
<script lang="ts">
	import { goto } from '$app/navigation';
	import { browser } from '$app/environment';
	import { getAuthContext } from '$lib/auth.svelte';

	const auth = getAuthContext();

	// Redirect to home if not logged in
	$effect(() => {
		if (browser && !auth.user) {
			goto('/');
		}
	});
</script>

<div class="container">
	{#if auth.user}
		<h1>User profile</h1>

		<div class="stats">
			<h2>Your information</h2>
			<p><strong>Username:</strong> {auth.user.username}</p>
			<p><strong>Burrito considerations:</strong> {auth.user.burritoConsiderations}</p>
		</div>
	{:else}
		<p>Please log in to view your profile.</p>
	{/if}
</div>

```

---

## static/robots.txt

```txt
# allow crawling everything by default
User-agent: *
Disallow:

```

---

## svelte.config.js

```js
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://svelte.dev/docs/kit/integrations
	// for more information about preprocessors
	preprocess: vitePreprocess(),

	kit: {
		// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
		// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
		// See https://svelte.dev/docs/kit/adapters for more information about adapters.
		adapter: adapter(),
		// Required for Amplitude Browser SDK (e.g. Session Replay) to work correctly with SSR
		paths: {
			relative: false
		}
	}
};

export default config;

```

---

## vite.config.ts

```ts
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
	plugins: [sveltekit()]
});

```

---

